diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-07-09 08:25:38 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-07-09 08:26:10 +0200 |
commit | 1db5df5a73d9cc7dfe24c07ea4f4d30ed377861b (patch) | |
tree | ff1d62ff1043a43484d6b069a7bbadfe26a5719f /tests/auto/controls/data/tst_swipedelegate.qml | |
parent | cbfa64fd84cab95d909371a5e44146928e403c05 (diff) | |
parent | 38f7d855f2485cfb6a3a4328c1d31bac44ee0ae0 (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Change-Id: Ifff470774347041d1638fb1da277a8cc11a00db6
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 7230406d..ead697d6 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. |