diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-11-23 12:49:51 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-11-23 15:03:01 +0100 |
commit | d0733d14063bbe62082b581599e78e312d3008be (patch) | |
tree | 22d633e5d9809bde36ede3029aa463c8dce3e5fc /tests/auto/quick/pointerhandlers | |
parent | e94eeb48b5a7f6a53ff9e48ffc216113852bccf4 (diff) |
Fix multipointtoucharea_interop tests
In several places these were doing stuff like
touch.press(1, p1).commit();
QTRY_VERIFY(devPriv->pointById(0)->passiveGrabbers.contains(drag));
The point ID is really the key in activePoints, it doesn't necessarily
start from 0; so pointById() has to be given the same point ID that was
used in the event, otherwise it will construct a new point(0).
But now tst_MptaInterop::touchesThenPinch fails further down: after the
complicated series of events, when only one point is still being dragged,
DragHandler fails to grab it and start dragging for some reason.
dragHandlerInParentStealingGrabFromItem() uses mouse not touch.
Pick-to: 6.0
Task-number: QTBUG-86729
Change-Id: I7ad0d3f30cb5fee15fe83183d62ee10a020c14df
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/auto/quick/pointerhandlers')
-rw-r--r-- | tests/auto/quick/pointerhandlers/multipointtoucharea_interop/BLACKLIST | 4 | ||||
-rw-r--r-- | tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp | 30 |
2 files changed, 15 insertions, 19 deletions
diff --git a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/BLACKLIST b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/BLACKLIST index 513f37976b..3f01d3a7d4 100644 --- a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/BLACKLIST +++ b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/BLACKLIST @@ -1,6 +1,2 @@ -[dragHandlerInParentStealingGrabFromItem] -* # QTBUG-86729 [touchesThenPinch] * # QTBUG-86729 -[touchDrag] -* # QTBUG-86729 diff --git a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp index 9a278cd570..e5c2d5b979 100644 --- a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp +++ b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp @@ -111,7 +111,7 @@ void tst_MptaInterop::touchDrag() QQuickTouchUtils::flush(window); auto devPriv = QPointingDevicePrivate::get(touchDevice); QCOMPARE(tp.at(0)->property("pressed").toBool(), true); - QTRY_VERIFY(devPriv->pointById(0)->passiveGrabbers.contains(drag)); + QTRY_VERIFY(devPriv->pointById(1)->passiveGrabbers.contains(drag)); // Start moving // DragHandler keeps monitoring, due to its passive grab, @@ -121,7 +121,7 @@ void tst_MptaInterop::touchDrag() p1 += QPoint(dragThreshold / 2, 0); touch.move(1, p1).commit(); QQuickTouchUtils::flush(window); - if (!dragStoleGrab && devPriv->pointById(0)->exclusiveGrabber == drag) + if (!dragStoleGrab && devPriv->pointById(1)->exclusiveGrabber == drag) dragStoleGrab = i; } if (dragStoleGrab) @@ -160,8 +160,8 @@ void tst_MptaInterop::touchesThenPinch() QPoint p1 = mpta->mapToScene(QPointF(20, 20)).toPoint(); touch.press(1, p1).commit(); QQuickTouchUtils::flush(window); - QTRY_COMPARE(devPriv->pointById(0)->exclusiveGrabber, mpta); - QTRY_COMPARE(devPriv->pointById(0)->passiveGrabbers.first(), drag); + QTRY_COMPARE(devPriv->pointById(1)->exclusiveGrabber, mpta); + QTRY_COMPARE(devPriv->pointById(1)->passiveGrabbers.first(), drag); // Press a second touchpoint: MPTA grabs it QPoint p2 = mpta->mapToScene(QPointF(200, 30)).toPoint(); @@ -180,9 +180,9 @@ void tst_MptaInterop::touchesThenPinch() QCOMPARE(tp.at(2)->property("pressed").toBool(), true); QCOMPARE(mptaPressedSpy.count(), 3); QCOMPARE(mptaCanceledSpy.count(), 0); - QCOMPARE(devPriv->pointById(0)->exclusiveGrabber, mpta); QCOMPARE(devPriv->pointById(1)->exclusiveGrabber, mpta); QCOMPARE(devPriv->pointById(2)->exclusiveGrabber, mpta); + QCOMPARE(devPriv->pointById(3)->exclusiveGrabber, mpta); QVERIFY(!pinch->active()); // Start moving: PinchHandler steals the exclusive grab from MPTA as soon as dragThreshold is exceeded @@ -213,10 +213,10 @@ void tst_MptaInterop::touchesThenPinch() QPoint p4 = mpta->mapToScene(QPointF(300, 200)).toPoint(); touch.move(1, p1).move(2, p2).move(3, p3).press(4, p4).commit(); // PinchHandler deactivates, which lets MPTA grab all the points - QTRY_COMPARE(devPriv->pointById(0)->exclusiveGrabber, mpta); - QCOMPARE(devPriv->pointById(1)->exclusiveGrabber, mpta); + QTRY_COMPARE(devPriv->pointById(1)->exclusiveGrabber, mpta); QCOMPARE(devPriv->pointById(2)->exclusiveGrabber, mpta); QCOMPARE(devPriv->pointById(3)->exclusiveGrabber, mpta); + QCOMPARE(devPriv->pointById(4)->exclusiveGrabber, mpta); // Move some more... MPTA keeps reacting for (int i = 0; i < 8; ++i) { p1 += QPoint(4, 4); @@ -224,10 +224,10 @@ void tst_MptaInterop::touchesThenPinch() p3 += QPoint(-4, 4); p4 += QPoint(-4, -4); touch.move(1, p1).move(2, p2).move(3, p3).move(4, p4).commit(); - QCOMPARE(devPriv->pointById(0)->exclusiveGrabber, mpta); QCOMPARE(devPriv->pointById(1)->exclusiveGrabber, mpta); QCOMPARE(devPriv->pointById(2)->exclusiveGrabber, mpta); QCOMPARE(devPriv->pointById(3)->exclusiveGrabber, mpta); + QCOMPARE(devPriv->pointById(4)->exclusiveGrabber, mpta); QCOMPARE(tp.at(0)->property("pressed").toBool(), true); QCOMPARE(tp.at(1)->property("pressed").toBool(), true); QCOMPARE(tp.at(2)->property("pressed").toBool(), true); @@ -242,9 +242,9 @@ void tst_MptaInterop::touchesThenPinch() p2 += QPoint(4, 4); p3 -= QPoint(-4, 4); touch.move(1, p1).move(2, p2).move(3, p3).commit(); - QTRY_COMPARE(devPriv->pointById(0)->exclusiveGrabber, pinch); - QCOMPARE(devPriv->pointById(1)->exclusiveGrabber, pinch); + QTRY_COMPARE(devPriv->pointById(1)->exclusiveGrabber, pinch); QCOMPARE(devPriv->pointById(2)->exclusiveGrabber, pinch); + QCOMPARE(devPriv->pointById(3)->exclusiveGrabber, pinch); } // Release the first finger @@ -268,12 +268,12 @@ void tst_MptaInterop::touchesThenPinch() p2 += QPoint(8, -8); touch.move(2, p2).commit(); QQuickTouchUtils::flush(window); - QVERIFY(devPriv->pointById(0)->passiveGrabbers.contains(drag)); - if (!dragTookGrab && devPriv->pointById(0)->exclusiveGrabber == drag) + QVERIFY(devPriv->pointById(2)->passiveGrabbers.contains(drag)); + if (!dragTookGrab && devPriv->pointById(2)->exclusiveGrabber == drag) dragTookGrab = i; } qCDebug(lcPointerTests) << "drag started after" << dragTookGrab << "moves; ended with translation" << drag->translation(); - QCOMPARE(devPriv->pointById(0)->exclusiveGrabber, drag); + QCOMPARE(devPriv->pointById(1)->exclusiveGrabber, drag); QTRY_VERIFY(drag->translation().x() > 0); touch.release(2, p2).commit(); @@ -305,7 +305,7 @@ void tst_MptaInterop::dragHandlerInParentStealingGrabFromItem() // QTBUG-75025 QScopedPointer<QQuickView> windowPtr; createView(windowPtr, "dragParentOfMPTA.qml"); QQuickView * window = windowPtr.data(); - auto devPriv = QPointingDevicePrivate::get(touchDevice); + auto devPriv = QPointingDevicePrivate::get(QPointingDevice::primaryPointingDevice()); QPointer<QQuickPointerHandler> handler = window->rootObject()->findChild<QQuickPointerHandler*>(); QVERIFY(handler); @@ -327,7 +327,7 @@ void tst_MptaInterop::dragHandlerInParentStealingGrabFromItem() // QTBUG-75025 for (int i = 0; i < 4; ++i) { point += QPoint(dragThreshold / 2, 0); QTest::mouseMove(window, point); - if (!dragStoleGrab && devPriv->pointById(0)->exclusiveGrabber == handler) + if (!dragStoleGrab && devPriv->firstPointExclusiveGrabber() == handler) dragStoleGrab = i; } if (dragStoleGrab) |