aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-09 10:51:50 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-09 10:58:43 +0000
commit5c5bbfd5b8a313919da3567f003ab412eab606ec (patch)
tree51d9785f1d809b77d57c23d78f0e2f45a4f47392 /tests
parente75bbe782def5cbcc8e7f69640c7cdb107164f4a (diff)
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 <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_rangeslider.qml62
1 files changed, 47 insertions, 15 deletions
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()
}