aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2019-10-30 16:21:16 +0100
committerMitch Curtis <mitch.curtis@qt.io>2021-06-16 18:41:11 +0200
commit887af04857f366c393512573cafebccde2678d6d (patch)
treec39bfb98ce81e2392fc486c76a3aacee188ea238 /tests
parent6dc95399797de4ec27984956df1fa587f4eb18ba (diff)
Fix SwipeDelegate losing swipes to parent flickables
Use a smaller threshold than Flickable so that it doesn't steal our events. Fixes: QTBUG-55705 Pick-to: 5.15 6.1 6.2 Change-Id: I7e985c27788818226a3158078d485ea12ddd7006 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_swipedelegate.qml40
1 files changed, 35 insertions, 5 deletions
diff --git a/tests/auto/controls/data/tst_swipedelegate.qml b/tests/auto/controls/data/tst_swipedelegate.qml
index 17440042..d0d4e318 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 {
@@ -1274,10 +1276,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.
@@ -1285,15 +1287,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);
}