diff options
Diffstat (limited to 'tests/auto/quick/qquicklistview')
-rw-r--r-- | tests/auto/quick/qquicklistview/data/strictlyenforcerange-resize.qml | 31 | ||||
-rw-r--r-- | tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | 24 |
2 files changed, 55 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/data/strictlyenforcerange-resize.qml b/tests/auto/quick/qquicklistview/data/strictlyenforcerange-resize.qml new file mode 100644 index 0000000000..338af38475 --- /dev/null +++ b/tests/auto/quick/qquicklistview/data/strictlyenforcerange-resize.qml @@ -0,0 +1,31 @@ +import QtQuick 2.0 + +ListView { + width: 400 + height: 400 + focus: true + + highlightRangeMode: ListView.StrictlyEnforceRange + highlightMoveVelocity: 200 + preferredHighlightBegin: 150 + preferredHighlightEnd: 150 + + property bool completed + Component.onCompleted: completed = true + + model: 10 + delegate: Item { + width: parent.width + height: ListView.isCurrentItem ? 100 : 50 + + Text { + anchors.centerIn: parent + text: index + } + + Behavior on height { + enabled: completed + SmoothedAnimation { velocity: 200 } + } + } +} diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 98c628068d..2eb87b9431 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -182,6 +182,7 @@ private slots: void snapOneItemCurrentIndexRemoveAnimation(); void QTBUG_9791(); + void QTBUG_33568(); void QTBUG_11105(); void QTBUG_21742(); @@ -3470,6 +3471,29 @@ void tst_QQuickListView::QTBUG_9791() QTRY_COMPARE(listview->contentX(), 590.0); } +void tst_QQuickListView::QTBUG_33568() +{ + QScopedPointer<QQuickView> window(createView()); + window->setSource(testFileUrl("strictlyenforcerange-resize.qml")); + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); + + QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); + QVERIFY(listview != 0); + + // we want to verify that the change animates smoothly, rather than jumping into place + QSignalSpy spy(listview, SIGNAL(contentYChanged())); + + listview->incrementCurrentIndex(); + QTRY_COMPARE(listview->contentY(), -100.0); + QVERIFY(spy.count() > 1); + + spy.clear(); + listview->incrementCurrentIndex(); + QTRY_COMPARE(listview->contentY(), -50.0); + QVERIFY(spy.count() > 1); +} + void tst_QQuickListView::manualHighlight() { QQuickView *window = new QQuickView(0); |