aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-09-30 02:59:43 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2016-09-30 03:38:12 +0000
commite4134cfd8086a78c61a46fdfb908ade27c8d9840 (patch)
tree9514153cd35f7335238b08586671445283abbef6 /tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
parent0ca693407473eb9457cdf8f9d4be32c9d4968ced (diff)
parent0bf14044178d7aa212ac7e28530f9077790a3df4 (diff)
Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7
Diffstat (limited to 'tests/auto/quick/qquickflickable/tst_qquickflickable.cpp')
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index bbaccfe534..339e8946e8 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -741,7 +741,10 @@ void tst_qquickflickable::wheel()
QQuickFlickable *flick = window->rootObject()->findChild<QQuickFlickable*>("flick");
QVERIFY(flick != 0);
+ QQuickFlickablePrivate *fp = QQuickFlickablePrivate::get(flick);
+ QSignalSpy moveEndSpy(flick, SIGNAL(movementEnded()));
+ // test a vertical flick
{
QPoint pos(200, 200);
QWheelEvent event(pos, window->mapToGlobal(pos), QPoint(), QPoint(0,-120), -120, Qt::Vertical, Qt::NoButton, Qt::NoModifier);
@@ -752,9 +755,19 @@ void tst_qquickflickable::wheel()
QTRY_VERIFY(flick->contentY() > 0);
QCOMPARE(flick->contentX(), qreal(0));
- flick->setContentY(0);
+ QTRY_COMPARE(moveEndSpy.count(), 1);
+ QCOMPARE(fp->velocityTimeline.isActive(), false);
+ QCOMPARE(fp->timeline.isActive(), false);
+ QTest::qWait(50); // make sure that onContentYChanged won't sneak in again
+ QCOMPARE(flick->property("movementsAfterEnd").value<int>(), 0); // QTBUG-55886
+
+ // get ready to test horizontal flick
+ flick->setContentY(0); // which triggers movementEnded again
+ flick->setProperty("movementsAfterEnd", 0);
+ flick->setProperty("ended", false);
QCOMPARE(flick->contentY(), qreal(0));
+ // test a horizontal flick
{
QPoint pos(200, 200);
QWheelEvent event(pos, window->mapToGlobal(pos), QPoint(), QPoint(-120,0), -120, Qt::Horizontal, Qt::NoButton, Qt::NoModifier);
@@ -765,6 +778,11 @@ void tst_qquickflickable::wheel()
QTRY_VERIFY(flick->contentX() > 0);
QCOMPARE(flick->contentY(), qreal(0));
+ QTRY_COMPARE(moveEndSpy.count(), 2);
+ QCOMPARE(fp->velocityTimeline.isActive(), false);
+ QCOMPARE(fp->timeline.isActive(), false);
+ QTest::qWait(50); // make sure that onContentXChanged won't sneak in again
+ QCOMPARE(flick->property("movementsAfterEnd").value<int>(), 0); // QTBUG-55886
}
void tst_qquickflickable::movingAndFlicking_data()