aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick')
-rw-r--r--tests/auto/quick/qquickflickable/data/wheel.qml5
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp20
2 files changed, 24 insertions, 1 deletions
diff --git a/tests/auto/quick/qquickflickable/data/wheel.qml b/tests/auto/quick/qquickflickable/data/wheel.qml
index 2928bbcd72..2be543cdde 100644
--- a/tests/auto/quick/qquickflickable/data/wheel.qml
+++ b/tests/auto/quick/qquickflickable/data/wheel.qml
@@ -8,9 +8,14 @@ Rectangle {
Flickable {
id: flick
objectName: "flick"
+ property bool ended: false
+ property int movementsAfterEnd: 0
anchors.fill: parent
contentWidth: 800
contentHeight: 800
+ onContentXChanged: if (ended) ++movementsAfterEnd
+ onContentYChanged: if (ended) ++movementsAfterEnd
+ onMovementEnded: ended = true
Rectangle {
width: flick.contentWidth
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index 294f7069c0..7de0a0fa0e 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -724,7 +724,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);
@@ -735,9 +738,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);
@@ -748,6 +761,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()