From 994319a35eac6c9574068f1d37a993f587c771da Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 21 Nov 2016 14:38:39 +0100 Subject: 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 --- tests/auto/controls/data/tst_abstractbutton.qml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/auto') 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() + } } -- cgit v1.2.3