diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2016-07-08 15:53:50 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2016-07-08 14:35:07 +0000 |
commit | 38f7d855f2485cfb6a3a4328c1d31bac44ee0ae0 (patch) | |
tree | ebffd16a478d9f79983d16d97466208ee925151a /tests/auto/controls/data/tst_swipedelegate.qml | |
parent | 780200919d4e5d68aad3d91845877515e10cbc03 (diff) |
SwipeDelegate: only consume child events if we grabbed the mouse
Change-Id: Ie808d06824e3bbdb36111625fbb5c59ee9d4e2a4
Task-number: QTBUG-54648
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'tests/auto/controls/data/tst_swipedelegate.qml')
-rw-r--r-- | tests/auto/controls/data/tst_swipedelegate.qml | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_swipedelegate.qml b/tests/auto/controls/data/tst_swipedelegate.qml index 6666589f..f89893c3 100644 --- a/tests/auto/controls/data/tst_swipedelegate.qml +++ b/tests/auto/controls/data/tst_swipedelegate.qml @@ -426,25 +426,49 @@ TestCase { } } + Component { + id: signalSpyComponent + + SignalSpy {} + } + function test_eventsToLeftAndRight() { var control = swipeDelegateWithButtonComponent.createObject(testCase); verify(control); // The button should be pressed instead of the SwipeDelegate. mouseDrag(control, control.width / 2, control.height / 2, -control.width, 0); + // Mouse has been released by this stage. verify(!control.pressed); compare(control.swipe.position, -1.0); verify(control.swipe.rightItem); verify(control.swipe.rightItem.visible); compare(control.swipe.rightItem.parent, control); + var buttonPressedSpy = signalSpyComponent.createObject(control, { target: control.swipe.rightItem, signalName: "pressed" }); + verify(buttonPressedSpy); + verify(buttonPressedSpy.valid); + var buttonReleasedSpy = signalSpyComponent.createObject(control, { target: control.swipe.rightItem, signalName: "released" }); + verify(buttonReleasedSpy); + verify(buttonReleasedSpy.valid); + var buttonClickedSpy = signalSpyComponent.createObject(control, { target: control.swipe.rightItem, signalName: "clicked" }); + verify(buttonClickedSpy); + verify(buttonClickedSpy.valid); + + // Now press the button. mousePress(control, control.width / 2, control.height / 2); verify(!control.pressed); var button = control.swipe.rightItem; verify(button.pressed); + compare(buttonPressedSpy.count, 1); + compare(buttonReleasedSpy.count, 0); + compare(buttonClickedSpy.count, 0); mouseRelease(control, control.width / 2, control.height / 2); verify(!button.pressed); + compare(buttonPressedSpy.count, 1); + compare(buttonReleasedSpy.count, 1); + compare(buttonClickedSpy.count, 1); // Returning back to a position of 0 and pressing on the control should // result in the control being pressed. |