diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-09-20 10:02:44 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-09-20 11:50:39 +0000 |
commit | 7b9c4db132d03a24b63d1fb9f3d85c82b63089db (patch) | |
tree | c4cf2a7b35cc328eb8990b8676e0612059b880ff /tests/auto/controls/data/tst_switch.qml | |
parent | b3983692680a91023dc5f22608b4e84b46fae883 (diff) |
Switch/Delegate: improve dragging behavior
Don't start dragging the handle unless the initial press was at the
indicator, or the drag has reached the indicator area. This prevents
unnatural jumps when dragging far outside the indicator.
Change-Id: I2b31b319a347ab489f2de5c044e42d908827b425
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/controls/data/tst_switch.qml')
-rw-r--r-- | tests/auto/controls/data/tst_switch.qml | 34 |
1 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 f854526c..93773e0d 100644 --- a/tests/auto/controls/data/tst_switch.qml +++ b/tests/auto/controls/data/tst_switch.qml @@ -267,6 +267,40 @@ TestCase { compare(control.pressed, false) verify(spy.success) + // press-drag-release from and to outside the indicator + spy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": false }], + "pressed"] + mousePress(control, control.width) + compare(control.position, 0.0) + compare(control.checked, false) + compare(control.pressed, true) + verify(spy.success) + + mouseMove(control, control.width - control.rightPadding) + compare(control.position, 0.0) + compare(control.checked, false) + compare(control.pressed, true) + + mouseMove(control, control.width / 2) + compare(control.position, 0.5) + compare(control.checked, false) + compare(control.pressed, true) + + mouseMove(control, control.width - control.rightPadding) + compare(control.position, 1.0) + compare(control.checked, false) + compare(control.pressed, true) + + spy.expectedSequence = [["pressedChanged", { "pressed": false, "checked": false }], + ["checkedChanged", { "pressed": false, "checked": true }], + "released", + "clicked"] + mouseRelease(control, control.width) + compare(control.position, 1.0) + compare(control.checked, true) + compare(control.pressed, false) + verify(spy.success) + control.destroy() } |