aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2019-10-09 08:25:17 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2019-10-09 13:08:23 +0200
commit44c51303b6968a4c8c5cf80fa92618852d017fd0 (patch)
tree23a48a20e98f2e9727156e33328f0507f6a0eff4
parent26e99aeacdb2527e6b439d8244a774cd719d732a (diff)
Add signal spies to tst_QQuickPathView::flickNClick test
QTBUG-78926 is about failing to emit the movingChanged signal. The test verifies that e2df4233a77ce8a37d2c8ef26b7b42fc0d33a24b fixed it. While we're at it, might as well verify a few more signals in this test scenario where we flick the PathView at various speeds and then stop the flick by clicking. Fixes: QTBUG-78926 Change-Id: I1253dfcd88a63abdbdd280dd9097b484a93cc491 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--tests/auto/quick/qquickpathview/tst_qquickpathview.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
index ed02a4ef48..e2d3253e44 100644
--- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
+++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
@@ -1614,16 +1614,55 @@ void tst_QQuickPathView::flickNClick() // QTBUG-77173
QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
QVERIFY(pathview != nullptr);
+ QSignalSpy movingChangedSpy(pathview, SIGNAL(movingChanged()));
+ QSignalSpy draggingSpy(pathview, SIGNAL(draggingChanged()));
+ QSignalSpy dragStartedSpy(pathview, SIGNAL(dragStarted()));
+ QSignalSpy dragEndedSpy(pathview, SIGNAL(dragEnded()));
+ QSignalSpy currentIndexSpy(pathview, SIGNAL(currentIndexChanged()));
+ QSignalSpy moveStartedSpy(pathview, SIGNAL(movementStarted()));
+ QSignalSpy moveEndedSpy(pathview, SIGNAL(movementEnded()));
+ QSignalSpy flickingSpy(pathview, SIGNAL(flickingChanged()));
+ QSignalSpy flickStartedSpy(pathview, SIGNAL(flickStarted()));
+ QSignalSpy flickEndedSpy(pathview, SIGNAL(flickEnded()));
for (int duration = 100; duration > 0; duration -= 20) {
+ movingChangedSpy.clear();
+ draggingSpy.clear();
+ dragStartedSpy.clear();
+ dragEndedSpy.clear();
+ currentIndexSpy.clear();
+ moveStartedSpy.clear();
+ moveEndedSpy.clear();
+ flickingSpy.clear();
+ flickStartedSpy.clear();
+ flickEndedSpy.clear();
// Dragging the child mouse area should animate the PathView (MA has no drag target)
flick(window.data(), QPoint(200,200), QPoint(400,200), duration);
QVERIFY(pathview->isMoving());
+ QCOMPARE(movingChangedSpy.count(), 1);
+ QCOMPARE(draggingSpy.count(), 2);
+ QCOMPARE(dragStartedSpy.count(), 1);
+ QCOMPARE(dragEndedSpy.count(), 1);
+ QVERIFY(currentIndexSpy.count() > 0);
+ QCOMPARE(moveStartedSpy.count(), 1);
+ QCOMPARE(moveEndedSpy.count(), 0);
+ QCOMPARE(flickingSpy.count(), 1);
+ QCOMPARE(flickStartedSpy.count(), 1);
+ QCOMPARE(flickEndedSpy.count(), 0);
// Now while it's still moving, click it.
// The PathView should stop at a position such that offset is a whole number.
QTest::mouseClick(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(200, 200));
QTRY_VERIFY(!pathview->isMoving());
+ QCOMPARE(movingChangedSpy.count(), 2); // QTBUG-78926
+ QCOMPARE(draggingSpy.count(), 2);
+ QCOMPARE(dragStartedSpy.count(), 1);
+ QCOMPARE(dragEndedSpy.count(), 1);
+ QCOMPARE(moveStartedSpy.count(), 1);
+ QCOMPARE(moveEndedSpy.count(), 1);
+ QCOMPARE(flickingSpy.count(), 2);
+ QCOMPARE(flickStartedSpy.count(), 1);
+ QCOMPARE(flickEndedSpy.count(), 1);
QVERIFY(qFuzzyIsNull(pathview->offset() - int(pathview->offset())));
}
}