diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-11-16 13:01:14 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-11-16 16:22:48 +0100 |
commit | 526d1e7cc75c5c5e31358fdd5027583330f49422 (patch) | |
tree | 1de1767a4b1ff4c85c09a9576d334415a392937f /tests | |
parent | 3c69fd6bf0a5f40efec7888bd2ae161b7315e885 (diff) |
Stabilize tst_QQuickMultiPointTouchArea::inFlickableWithPressDelay
Flickable moves after taking over the grab, but this test was failing
anyway. Might as well check for everything in one loop of move events.
Change-Id: Iafa21cdfb88df36337e4350934d3bf569418bdca
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp index bfe09acca9..d70a23061b 100644 --- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp +++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp @@ -809,23 +809,31 @@ void tst_QQuickMultiPointTouchArea::inFlickableWithPressDelay() // QTBUG-78818 QTRY_COMPARE(point11->pressed(), true); // wait until pressDelay exceeded QCOMPARE(devPriv->pointById(0)->exclusiveGrabber, mpta); - // drag past the threshold: Flickable takes over the grab, MPTA gets touchUngrab and is no longer pressed + // drag past the threshold: Flickable takes over the grab, + // MPTA gets touchUngrab and is no longer pressed, + // and Flickable starts moving int i = 0; - for (; i < 10 && devPriv->firstPointExclusiveGrabber() != flickable; ++i) { + int grabbedAfter = -1; + int movedAfter = -1; + int contentYChangedAfter = -1; + for (; i < 10 && contentYChangedAfter < 0; ++i) { p1 += QPoint(0,dragThreshold); QTest::touchEvent(window.data(), device).move(0, p1); QQuickTouchUtils::flush(window.data()); + if (devPriv->firstPointExclusiveGrabber() == flickable) + grabbedAfter = i; + if (flickable->isMoving()) + movedAfter = i; + if (!qFuzzyIsNull(flickable->contentY())) + contentYChangedAfter = i; } QCOMPARE(devPriv->firstPointExclusiveGrabber(), flickable); - qCDebug(lcTests, "Flickable stole grab from MPTA after %d moves", i); + int cancelCount = window->rootObject()->property("cancelCount").toInt(); + qCDebug(lcTests, "Flickable stole grab from MPTA after %d moves, started moving after %d, and moved to contentY %lf after %d moves; got %d cancel(s)", + grabbedAfter, movedAfter, flickable->contentY(), contentYChangedAfter, cancelCount); QCOMPARE(devPriv->pointById(0)->exclusiveGrabber, flickable); QCOMPARE(point11->pressed(), false); - QVERIFY(window->rootObject()->property("cancelCount").toInt() > 0); // actually 2 because 2 touchPoints are declared... but only one was really cancelled - - // drag a little more and the Flickable moves - p1 += QPoint(0,1); - QTest::touchEvent(window.data(), device).move(0, p1); - QQuickTouchUtils::flush(window.data()); + QVERIFY(cancelCount > 0); // 2 touchPoints are declared but only one was really cancelled QVERIFY(flickable->contentY() < 0); QVERIFY(flickable->isMoving()); |