aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/tst_swipedelegate.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/controls/data/tst_swipedelegate.qml')
-rw-r--r--tests/auto/controls/data/tst_swipedelegate.qml75
1 files changed, 70 insertions, 5 deletions
diff --git a/tests/auto/controls/data/tst_swipedelegate.qml b/tests/auto/controls/data/tst_swipedelegate.qml
index d37ea42b..255dd881 100644
--- a/tests/auto/controls/data/tst_swipedelegate.qml
+++ b/tests/auto/controls/data/tst_swipedelegate.qml
@@ -702,7 +702,9 @@ TestCase {
property alias removeAnimation: onRemoveAnimation
- ListView.onRemove: SequentialAnimation {
+ ListView.onRemove: onRemoveAnimation.start()
+
+ SequentialAnimation {
id: onRemoveAnimation
PropertyAction {
@@ -1273,10 +1275,10 @@ TestCase {
// When this happens, it will grab the mouse and hence we must clear
// that action's pressed state so that it doesn't stay pressed after releasing.
function test_dragSideAction() {
- var listView = createTemporaryObject(removableDelegatesComponent, testCase);
+ let listView = createTemporaryObject(removableDelegatesComponent, testCase);
verify(listView);
- var control = listView.itemAt(0, 0);
+ let control = listView.itemAt(0, 0);
verify(control);
// Expose the side action.
@@ -1284,15 +1286,43 @@ TestCase {
verify(control.swipe.leftItem);
tryCompare(control.swipe, "complete", true);
- var pressedSpy = signalSpyComponent.createObject(control,
+ let pressedSpy = signalSpyComponent.createObject(control,
{ target: control.swipe.leftItem.SwipeDelegate, signalName: "pressedChanged" });
verify(pressedSpy);
verify(pressedSpy.valid);
+ let movingHorizontallySpy = createTemporaryObject(signalSpyComponent, testCase,
+ { target: listView, signalName: "movingHorizontallyChanged" })
+ verify(movingHorizontallySpy)
+ verify(movingHorizontallySpy.valid)
+
+ let movingVerticallySpy = createTemporaryObject(signalSpyComponent, testCase,
+ { target: listView, signalName: "movingVerticallyChanged" })
+ verify(movingVerticallySpy)
+ verify(movingVerticallySpy.valid)
+
+ let flickingHorizontallySpy = createTemporaryObject(signalSpyComponent, testCase,
+ { target: listView, signalName: "flickingHorizontallyChanged" })
+ verify(flickingHorizontallySpy)
+ verify(flickingHorizontallySpy.valid)
+
+ let flickingVerticallySpy = createTemporaryObject(signalSpyComponent, testCase,
+ { target: listView, signalName: "flickingVerticallyChanged" })
+ verify(flickingVerticallySpy)
+ verify(flickingVerticallySpy.valid)
+
+ // Drag the ListView vertically; its contentY should change.
mouseDrag(listView, 20, 20, 0, listView.height);
compare(pressedSpy.count, 2);
- verify(listView.contentY !== 0);
+ // Wait for it to stop moving.
+ tryCompare(listView, "flickingVertically", false)
+
+ // 2 because it should change to true then false.
+ compare(movingHorizontallySpy.count, 0)
+ compare(movingVerticallySpy.count, 2)
+ compare(flickingHorizontallySpy.count, 0)
+ compare(flickingVerticallySpy.count, 2)
compare(control.swipe.leftItem.SwipeDelegate.pressed, false);
}
@@ -1713,4 +1743,39 @@ TestCase {
break;
}
}
+
+ function test_resizeParent() {
+ let container = createTemporaryObject(itemComponent, testCase, { objectName: "container", width: 100, height: 200 })
+ verify(container)
+
+ let control = swipeDelegateComponent.createObject(container, { width: Qt.binding(function() { return container.width }) })
+ verify(control)
+
+ // Resize while closed.
+ container.width = 200
+ compare(container.width, 200)
+ compare(control.width, 200)
+ compare(control.background.width, 200)
+ compare(control.contentItem.width, 200 - control.leftPadding - control.rightPadding)
+
+ // Return to original size.
+ container.width = 100
+ compare(control.width, 100)
+ compare(control.background.width, 100)
+ compare(control.contentItem.width, 100 - control.leftPadding - control.rightPadding)
+
+ // Swipe to the left to open.
+ swipe(control, 0, -1.0)
+ // Nothing should have changed except positions.
+ compare(control.width, 100)
+ compare(control.background.width, 100)
+ compare(control.contentItem.width, 100 - control.leftPadding - control.rightPadding)
+
+ // Resize while open.
+ container.width = 200
+ // The items should fill the width as usual.
+ compare(control.width, 200)
+ compare(control.background.width, 200)
+ compare(control.contentItem.width, 200 - control.leftPadding - control.rightPadding)
+ }
}