diff options
Diffstat (limited to 'tests/auto/quick/qquicklistview')
-rw-r--r-- | tests/auto/quick/qquicklistview/data/programmaticFlickAtBounds3.qml | 19 | ||||
-rw-r--r-- | tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | 30 |
2 files changed, 49 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/data/programmaticFlickAtBounds3.qml b/tests/auto/quick/qquicklistview/data/programmaticFlickAtBounds3.qml new file mode 100644 index 0000000000..bd913b2ce1 --- /dev/null +++ b/tests/auto/quick/qquicklistview/data/programmaticFlickAtBounds3.qml @@ -0,0 +1,19 @@ +import QtQuick 2.9 + +ListView { + id: view + width: 200; height: 400 + + property real minOvershoot + onVerticalOvershootChanged: if (verticalOvershoot < minOvershoot) minOvershoot = verticalOvershoot + + highlightRangeMode: ListView.StrictlyEnforceRange + preferredHighlightBegin: 0 + preferredHighlightEnd: 0 + + model: 10 + delegate: Rectangle { + width: 200; height: 50 + color: index % 2 ? "red" : "green" + } +} diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 2eb87b9431..0d0f234d33 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -236,6 +236,7 @@ private slots: void QTBUG_38209(); void programmaticFlickAtBounds(); void programmaticFlickAtBounds2(); + void programmaticFlickAtBounds3(); void layoutChange(); @@ -8069,6 +8070,35 @@ void tst_QQuickListView::programmaticFlickAtBounds2() QTRY_COMPARE(listview->contentY(), qreal(100.0)); } +void tst_QQuickListView::programmaticFlickAtBounds3() +{ + QScopedPointer<QQuickView> window(createView()); + window->setSource(testFileUrl("programmaticFlickAtBounds3.qml")); + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); + + QQuickListView *listview = qobject_cast<QQuickListView *>(window->rootObject()); + QVERIFY(listview); + + // flick down + listview->flick(0, 2000); + + // verify scope of the movement + QTRY_VERIFY(listview->property("minOvershoot").toReal() < qreal(-50.0)); + + // reset, and test a second time + listview->cancelFlick(); + listview->returnToBounds(); + QTRY_COMPARE(listview->contentY(), qreal(0.0)); + listview->setProperty("minOvershoot", qreal(0.0)); + + // flick down + listview->flick(0, 2000); + + // verify scope of the movement is the same + QTRY_VERIFY(listview->property("minOvershoot").toReal() < qreal(-50.0)); +} + void tst_QQuickListView::layoutChange() { RandomSortModel *model = new RandomSortModel; |