aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@live.com>2014-07-23 19:39:26 -0500
committerMichael Brasser <michael.brasser@live.com>2014-07-24 15:40:09 +0200
commit2c80968d21ff15f574cbbfd93ce4409cda7eeebf (patch)
treee3c0ee8a353b65e4a8a796c2d310df4866f79c28 /tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
parent36a179e8faa572544b9e8a9442f8c679a9509423 (diff)
Improve programmatic flicking of ListView (and Flickable).
Fix bug when programmatically flicking ListView after a real flick in the opposite direction. Also ensure a programmatic flick can flick past bounds when situated at the bounds and DragAndOvershootBounds is set. Task-number: QTBUG-38209 Change-Id: If4a2f65d0e7cb620b9af21f8a25a8a8797976125 Reviewed-by: Martin Jones <martin.jones@jollamobile.com>
Diffstat (limited to 'tests/auto/quick/qquicklistview/tst_qquicklistview.cpp')
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 2093265163..14e26b720c 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -228,6 +228,9 @@ private slots:
void roundingErrors();
void roundingErrors_data();
+ void QTBUG_38209();
+ void programmaticFlickAtBounds();
+
private:
template <class T> void items(const QUrl &source);
template <class T> void changed(const QUrl &source);
@@ -7309,6 +7312,58 @@ void tst_QQuickListView::roundingErrors_data()
QTest::newRow("pixelAligned=false") << false;
}
+void tst_QQuickListView::QTBUG_38209()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("simplelistview.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+
+ QQuickListView *listview = qobject_cast<QQuickListView *>(window->rootObject());
+ QVERIFY(listview);
+
+ // simulate mouse flick
+ flick(window.data(), QPoint(200, 200), QPoint(200, 50), 100);
+ QTRY_VERIFY(listview->isMoving() == false);
+ qreal contentY = listview->contentY();
+
+ // flick down
+ listview->flick(0, 1000);
+
+ // ensure we move more than just a couple pixels
+ QTRY_VERIFY(contentY - listview->contentY() > qreal(100.0));
+}
+
+void tst_QQuickListView::programmaticFlickAtBounds()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("simplelistview.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+
+ QQuickListView *listview = qobject_cast<QQuickListView *>(window->rootObject());
+ QVERIFY(listview);
+ QSignalSpy spy(listview, SIGNAL(contentYChanged()));
+
+ // flick down
+ listview->flick(0, 1000);
+
+ // verify that there is movement beyond bounds
+ QVERIFY(spy.wait(100));
+
+ // reset, and test with StopAtBounds
+ listview->cancelFlick();
+ listview->returnToBounds();
+ QTRY_COMPARE(listview->contentY(), qreal(0.0));
+ listview->setBoundsBehavior(QQuickFlickable::StopAtBounds);
+
+ // flick down
+ listview->flick(0, 1000);
+
+ // verify that there is no movement beyond bounds
+ QVERIFY(!spy.wait(100));
+}
+
QTEST_MAIN(tst_QQuickListView)
#include "tst_qquicklistview.moc"