diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-12-01 13:01:59 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-12-01 13:01:59 +0100 |
commit | d8c5dea96fb8861089e2166ae574a85d2b69c09e (patch) | |
tree | d3f01035541b10d98acbcde1321bc43de16096f6 /tests/auto/controls/data/tst_swipedelegate.qml | |
parent | 5efd4b6a61498f0668d7367d620275367894140e (diff) | |
parent | 838fd79152957f457a47cd30970961a27f086848 (diff) |
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
tests/auto/controls/data/tst_swipedelegate.qml
Change-Id: I15bd0366f1ad0ce35f1dce6d790da6dd5f0221f9
Diffstat (limited to 'tests/auto/controls/data/tst_swipedelegate.qml')
-rw-r--r-- | tests/auto/controls/data/tst_swipedelegate.qml | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_swipedelegate.qml b/tests/auto/controls/data/tst_swipedelegate.qml index 92f25e2a..7a2ad44d 100644 --- a/tests/auto/controls/data/tst_swipedelegate.qml +++ b/tests/auto/controls/data/tst_swipedelegate.qml @@ -1367,4 +1367,53 @@ TestCase { control.destroy(); } + + Component { + id: animationSwipeDelegateComponent + + SwipeDelegate { + id: control + text: "SwipeDelegate" + width: 150 + swipe.left: greenLeftComponent + swipe.right: redRightComponent + + property alias behavior: xBehavior + property alias animation: numberAnimation + + background: Rectangle { + color: control.down ? "#ccc" : "#fff" + + Behavior on x { + id: xBehavior + enabled: !control.down + + NumberAnimation { + id: numberAnimation + easing.type: Easing.InOutCubic + duration: 400 + } + } + } + } + } + + function test_animations() { + // Test that animations are run when releasing from a drag. + var control = animationSwipeDelegateComponent.createObject(testCase); + verify(control); + + mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton); + mouseMove(control, control.width - 1, control.height / 2, Qt.LeftButton); + verify(control.down); + verify(!control.behavior.enabled); + verify(!control.animation.running); + + mouseRelease(control, control.width - 1, control.height / 2, Qt.LeftButton); + verify(!control.down); + verify(control.behavior.enabled); + verify(control.animation.running); + + control.destroy(); + } } |