diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-11-21 14:38:39 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-11-22 08:05:40 +0000 |
commit | 994319a35eac6c9574068f1d37a993f587c771da (patch) | |
tree | c11218e9cca17876a40a2cd49ae2f72fffc18698 /tests | |
parent | de4ff95cd166b13fb4818ada5493d913345ef0ef (diff) |
AbstractButton: fix press-and-hold for checkable buttons
Don't toggle the checked state on release after press-and-hold.
Change-Id: I06b6a0e86dc02c171eef10f3c0d564ff605796f0
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/controls/data/tst_abstractbutton.qml | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_abstractbutton.qml b/tests/auto/controls/data/tst_abstractbutton.qml index 27fc4525..83ca7980 100644 --- a/tests/auto/controls/data/tst_abstractbutton.qml +++ b/tests/auto/controls/data/tst_abstractbutton.qml @@ -60,6 +60,11 @@ TestCase { Item { } } + Component { + id: signalSpy + SignalSpy { } + } + function test_text() { var control = button.createObject(testCase); verify(control); @@ -103,4 +108,21 @@ TestCase { control.destroy() } + + function test_pressAndHold() { + var control = button.createObject(testCase, {checkable: true}) + verify(control) + + var pressAndHoldSpy = signalSpy.createObject(control, {target: control, signalName: "pressAndHold"}) + verify(pressAndHoldSpy.valid) + + mousePress(control) + pressAndHoldSpy.wait() + compare(control.checked, false) + + mouseRelease(control) + compare(control.checked, false) + + control.destroy() + } } |