diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2016-07-11 10:54:31 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-07-13 20:12:02 +0000 |
commit | 546544b347be496a484101b1b7c05e3c6bdbc9e9 (patch) | |
tree | 7bd807eeaa235ba14b64d164702326aba0549b9d /tests/auto/controls/data/tst_swipedelegate.qml | |
parent | aa823b2961f90a3fa459a220b3eab51c227b110a (diff) |
SwipeDelegate: add swipe.close()
This allows users to close the swipe after an action has been
triggered, for example.
[ChangeLog][SwipeDelegate] Added swipe.close() for setting
swipe.position to 0.
Change-Id: Ib12a6592ac1ba46baafd88a41ea8f297599c7bbc
Task-number: QTBUG-54651
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 | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_swipedelegate.qml b/tests/auto/controls/data/tst_swipedelegate.qml index ead697d6..29dc9397 100644 --- a/tests/auto/controls/data/tst_swipedelegate.qml +++ b/tests/auto/controls/data/tst_swipedelegate.qml @@ -910,4 +910,33 @@ TestCase { control.destroy(); } + + Component { + id: closeSwipeDelegateComponent + + SwipeDelegate { + text: "SwipeDelegate" + width: 150 + + onClicked: close() + + swipe.right: Item { + width: parent.width + height: parent.height + } + } + } + + function test_close() { + var control = swipeDelegateComponent.createObject(testCase); + verify(control); + + swipe(control, 0.0, -1.0); + compare(control.swipe.rightItem.visible, true); + // Should animate, so it shouldn't change right away. + compare(control.swipe.rightItem.x, 0); + tryCompare(control.swipe.rightItem, "x", control.background.x + control.background.width); + + control.destroy(); + } } |