diff options
author | Liang Qi <liang.qi@qt.io> | 2018-10-01 11:59:36 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-10-01 11:59:36 +0200 |
commit | 87662fd1b71db11f0759e0be03d8a288ee11b775 (patch) | |
tree | 7e9659b6e581205c798844388cffcec88ecaa112 /tests/auto/quick/qquickpathview | |
parent | e8b01250fdbef269379df8c2481c9482317e8220 (diff) | |
parent | 777cd6e9b10c83f5826fde67ad00a85c978218c0 (diff) |
Merge remote-tracking branch 'origin/5.11' into 5.12
Conflicts:
src/quick/items/qquickevents_p_p.h
Change-Id: I8c699aeb46903e2ea80a97a346cb5af460859a98
Diffstat (limited to 'tests/auto/quick/qquickpathview')
-rw-r--r-- | tests/auto/quick/qquickpathview/tst_qquickpathview.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp index 7d297d3fa2..aceb61bde4 100644 --- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp +++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp @@ -50,6 +50,8 @@ #include <math.h> +Q_LOGGING_CATEGORY(lcTests, "qt.quick.tests") + using namespace QQuickViewTestUtil; using namespace QQuickVisualTestUtil; @@ -2263,6 +2265,59 @@ void tst_QQuickPathView::nestedinFlickable() QCOMPARE(fflickingSpy.count(), 0); QCOMPARE(fflickStartedSpy.count(), 0); QCOMPARE(fflickEndedSpy.count(), 0); + + // now test that two quick flicks are both handled by the pathview + movingSpy.clear(); + moveStartedSpy.clear(); + moveEndedSpy.clear(); + fflickingSpy.clear(); + fflickStartedSpy.clear(); + fflickEndedSpy.clear(); + int shortInterval = 2; + QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(23,216)); + QTest::mouseMove(window.data(), QPoint(48,216), shortInterval); + QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(73,217)); + QVERIFY(pathview->isMoving()); + QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(21,216)); + QTest::mouseMove(window.data(), QPoint(46,216), shortInterval); + QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(71,217)); + QVERIFY(pathview->isMoving()); + // moveEndedSpy.count() and moveStartedSpy.count() should be exactly 1 + // but in CI we sometimes see a scheduling issue being hit which + // causes the main thread to be stalled while the animation thread + // continues, allowing the animation timer to finish after the first + // call to QVERIFY(pathview->isMoving()) in the code above, prior to + // the detected beginning of the second flick, which can cause both of + // those signal counts to be 2 rather than 1. + // Note that this is not a true problem (this scheduling quirk just + // means that the unit test is not testing the enforced behavior + // as strictly as it would otherwise); it is only a bug if it results + // in the Flickable handling one or more of the flicks, and that + // is unconditionally tested below. + // To avoid false positive test failure in the scheduling quirk case + // we allow the multiple signal count case, rather than simply: + // QTRY_COMPARE(moveEndedSpy.count(), 1); + // QCOMPARE(moveStartedSpy.count(), 1); + QTRY_VERIFY(moveEndedSpy.count() > 0); + qCDebug(lcTests) << "After receiving moveEnded signal:" + << "moveEndedSpy.count():" << moveEndedSpy.count() + << "moveStartedSpy.count():" << moveStartedSpy.count() + << "fflickingSpy.count():" << fflickingSpy.count() + << "fflickStartedSpy.count():" << fflickStartedSpy.count() + << "fflickEndedSpy.count():" << fflickEndedSpy.count(); + QTRY_COMPARE(moveStartedSpy.count(), moveEndedSpy.count()); + qCDebug(lcTests) << "After receiving matched moveEnded signal(s):" + << "moveEndedSpy.count():" << moveEndedSpy.count() + << "moveStartedSpy.count():" << moveStartedSpy.count() + << "fflickingSpy.count():" << fflickingSpy.count() + << "fflickStartedSpy.count():" << fflickStartedSpy.count() + << "fflickEndedSpy.count():" << fflickEndedSpy.count(); + QVERIFY(moveStartedSpy.count() <= 2); + // Flickable should not handle this + QCOMPARE(fflickingSpy.count(), 0); + QCOMPARE(fflickStartedSpy.count(), 0); + QCOMPARE(fflickEndedSpy.count(), 0); + } void tst_QQuickPathView::flickableDelegate() |