From 5c5bbfd5b8a313919da3567f003ab412eab606ec Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 9 Feb 2016 10:51:50 +0100 Subject: RangeSlider: choose the nearest handle The handles were hard to touch. This change makes it choose the nearest handle, so that the interaction becomes similar to what Slider has. Change-Id: Ie94eeed6a8466f44e8eee0ce0ba0a45cfb3f6924 Task-number: QTBUG-50972 Reviewed-by: Mitch Curtis --- tests/auto/controls/data/tst_rangeslider.qml | 62 +++++++++++++++++++++------- 1 file changed, 47 insertions(+), 15 deletions(-) (limited to 'tests') diff --git a/tests/auto/controls/data/tst_rangeslider.qml b/tests/auto/controls/data/tst_rangeslider.qml index 09ccb3be..97104856 100644 --- a/tests/auto/controls/data/tst_rangeslider.qml +++ b/tests/auto/controls/data/tst_rangeslider.qml @@ -309,18 +309,18 @@ TestCase { secondPressedSpy.target = control.second verify(secondPressedSpy.valid) - mousePress(control, control.width * 0.5, control.height * 0.5, Qt.LeftButton) - compare(firstPressedSpy.count, 0) + mousePress(control, control.width * 0.25, control.height * 0.75, Qt.LeftButton) + compare(firstPressedSpy.count, 1) compare(secondPressedSpy.count, 0) - compare(control.first.pressed, false) + compare(control.first.pressed, true) compare(control.first.value, 0.0) compare(control.first.position, 0.0) compare(control.second.pressed, false) compare(control.second.value, 1.0) compare(control.second.position, 1.0) - mouseRelease(control, control.width * 0.5, control.height * 0.5, Qt.LeftButton) - compare(firstPressedSpy.count, 0) + mouseRelease(control, control.width * 0.25, control.height * 0.75, Qt.LeftButton) + compare(firstPressedSpy.count, 2) compare(secondPressedSpy.count, 0) compare(control.first.pressed, false) compare(control.first.value, 0.0) @@ -329,9 +329,19 @@ TestCase { compare(control.second.value, 1.0) compare(control.second.position, 1.0) - mousePress(control, 0, 0, Qt.LeftButton) - compare(firstPressedSpy.count, 0) - compare(secondPressedSpy.count, 0) + mousePress(control, control.width * 0.75, control.height * 0.25, Qt.LeftButton) + compare(firstPressedSpy.count, 2) + compare(secondPressedSpy.count, 1) + compare(control.first.pressed, false) + compare(control.first.value, 0.0) + compare(control.first.position, 0.0) + compare(control.second.pressed, true) + compare(control.second.value, 1.0) + compare(control.second.position, 1.0) + + mouseRelease(control, control.width * 0.75, control.height * 0.25, Qt.LeftButton) + compare(firstPressedSpy.count, 2) + compare(secondPressedSpy.count, 2) compare(control.first.pressed, false) compare(control.first.value, 0.0) compare(control.first.position, 0.0) @@ -339,9 +349,19 @@ TestCase { compare(control.second.value, 1.0) compare(control.second.position, 1.0) - mouseRelease(control, 0, 0, Qt.LeftButton) - compare(firstPressedSpy.count, 0) - compare(secondPressedSpy.count, 0) + mousePress(control, 0, control.height, Qt.LeftButton) + compare(firstPressedSpy.count, 3) + compare(secondPressedSpy.count, 2) + compare(control.first.pressed, true) + compare(control.first.value, 0.0) + compare(control.first.position, 0.0) + compare(control.second.pressed, false) + compare(control.second.value, 1.0) + compare(control.second.position, 1.0) + + mouseRelease(control, 0, control.height, Qt.LeftButton) + compare(firstPressedSpy.count, 4) + compare(secondPressedSpy.count, 2) compare(control.first.pressed, false) compare(control.first.value, 0.0) compare(control.first.position, 0.0) @@ -350,8 +370,8 @@ TestCase { compare(control.second.position, 1.0) mousePress(control, control.first.handle.x, control.first.handle.y, Qt.LeftButton) - compare(firstPressedSpy.count, 1) - compare(secondPressedSpy.count, 0) + compare(firstPressedSpy.count, 5) + compare(secondPressedSpy.count, 2) compare(control.first.pressed, true) compare(control.first.value, 0.0) compare(control.first.position, 0.0) @@ -363,8 +383,8 @@ TestCase { var toX = horizontal ? control.width * 0.5 : control.first.handle.x var toY = horizontal ? control.first.handle.y : control.height * 0.5 mouseMove(control, toX, toY, Qt.LeftButton) - compare(firstPressedSpy.count, 1) - compare(secondPressedSpy.count, 0) + compare(firstPressedSpy.count, 5) + compare(secondPressedSpy.count, 2) compare(control.first.pressed, true) compare(control.first.value, 0.0) compare(control.first.position, 0.5) @@ -374,6 +394,18 @@ TestCase { compare(control.second.position, 1.0) compare(control.second.visualPosition, horizontal ? 1.0 : 0.0) + mouseRelease(control, toX, toY, Qt.LeftButton) + compare(firstPressedSpy.count, 6) + compare(secondPressedSpy.count, 2) + compare(control.first.pressed, false) + compare(control.first.value, 0.5) + compare(control.first.position, 0.5) + compare(control.first.visualPosition, 0.5) + compare(control.second.pressed, false) + compare(control.second.value, 1.0) + compare(control.second.position, 1.0) + compare(control.second.visualPosition, horizontal ? 1.0 : 0.0) + control.destroy() } -- cgit v1.2.3