aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-01-06 14:35:21 +0100
committerJani Heikkinen <jani.heikkinen@qt.io>2017-01-12 20:35:59 +0000
commit6f7852a307c7ebbdb3b6efa00cbf7626b072bbc1 (patch)
treec88c82952805f9dcb3fb219a5b8a2a94b5a07f0b /tests
parentfc083796ad8b02bf9d995ee22b6d60090e1e284d (diff)
Switch(Delegate): fix handle snappingv5.8.0
When Switch is released, nextCheckState() gets called to set the appropriate check state depending on the handle position. If the check state does not change, it must force a position update to avoid that the handle is left somewhere in the middle. Task-number: QTBUG-57944 Change-Id: I872160dafaa7dbf676b026fcc6ba0d0507a91a05 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_switch.qml17
-rw-r--r--tests/auto/controls/data/tst_switchdelegate.qml17
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_switch.qml b/tests/auto/controls/data/tst_switch.qml
index f3843cf7..52d2d7fc 100644
--- a/tests/auto/controls/data/tst_switch.qml
+++ b/tests/auto/controls/data/tst_switch.qml
@@ -187,6 +187,23 @@ TestCase {
compare(control.pressed, false)
verify(spy.success)
+ // release in the middle
+ spy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": false }],
+ "pressed"]
+ mousePress(control, 0, 0, Qt.LeftButton)
+ compare(control.pressed, true)
+ verify(spy.success)
+ mouseMove(control, control.width / 4, control.height / 4, 0, Qt.LeftButton)
+ compare(control.pressed, true)
+ spy.expectedSequence = [["pressedChanged", { "pressed": false, "checked": false }],
+ "released",
+ "clicked"]
+ mouseRelease(control, control.width / 4, control.height / 4, Qt.LeftButton)
+ compare(control.checked, false)
+ compare(control.pressed, false)
+ tryCompare(control, "position", 0) // QTBUG-57944
+ verify(spy.success)
+
// right button
spy.expectedSequence = []
mousePress(control, control.width / 2, control.height / 2, Qt.RightButton)
diff --git a/tests/auto/controls/data/tst_switchdelegate.qml b/tests/auto/controls/data/tst_switchdelegate.qml
index 4a5d711f..bb4b9d6a 100644
--- a/tests/auto/controls/data/tst_switchdelegate.qml
+++ b/tests/auto/controls/data/tst_switchdelegate.qml
@@ -183,6 +183,23 @@ TestCase {
compare(control.pressed, false)
verify(spy.success)
+ // release in the middle
+ spy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": false }],
+ "pressed"]
+ mousePress(control.indicator, 0, 0, Qt.LeftButton)
+ compare(control.pressed, true)
+ verify(spy.success)
+ mouseMove(control.indicator, control.indicator.width / 2 - 1, 0)
+ compare(control.pressed, true)
+ spy.expectedSequence = [["pressedChanged", { "pressed": false, "checked": false }],
+ "released",
+ "clicked"]
+ mouseRelease(control.indicator, control.indicator.width / 2 - 1, 0, Qt.LeftButton)
+ compare(control.checked, false)
+ compare(control.pressed, false)
+ tryCompare(control, "position", 0) // QTBUG-57944
+ verify(spy.success)
+
// right button
spy.expectedSequence = []
mousePress(control, control.width / 2, control.height / 2, Qt.RightButton)