diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2014-01-02 21:35:50 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-13 08:49:24 +0100 |
commit | b244fc002d4fb97abb8647ed07f6e927cf3de789 (patch) | |
tree | bcba8674f9b21f9900af44aed8127aa90f340346 /tests/auto/quick/qquicklistview | |
parent | 8a3e4758350dd3868353d7a1b0ba9a4b31f7ac3d (diff) |
Item views: avoid fixing up the position while moving/flicking
Task-number: QTBUG-35920
Change-Id: Id6a68400eed69d880dd1c218ec4a1beda8a8fbb9
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'tests/auto/quick/qquicklistview')
-rw-r--r-- | tests/auto/quick/qquicklistview/data/qtbug35920.qml | 12 | ||||
-rw-r--r-- | tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | 31 |
2 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/data/qtbug35920.qml b/tests/auto/quick/qquicklistview/data/qtbug35920.qml new file mode 100644 index 0000000000..14853e3b37 --- /dev/null +++ b/tests/auto/quick/qquicklistview/data/qtbug35920.qml @@ -0,0 +1,12 @@ +import QtQuick 2.1 + +ListView { + width: 200 + height: 200 + + snapMode: ListView.SnapOneItem + highlightRangeMode: ListView.StrictlyEnforceRange + + model: 100 + delegate: Text { text: modelData } +} diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 5651806a33..efd0fa8103 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -221,6 +221,7 @@ private slots: void highlightItemGeometryChanges(); void QTBUG_36481(); + void QTBUG_35920(); private: template <class T> void items(const QUrl &source); @@ -7152,6 +7153,36 @@ void tst_QQuickListView::QTBUG_36481() QScopedPointer<QObject> object(component.create()); } +void tst_QQuickListView::QTBUG_35920() +{ + QScopedPointer<QQuickView> window(createView()); + window->setSource(testFileUrl("qtbug35920.qml")); + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); + + QQuickListView *listview = qobject_cast<QQuickListView *>(window->rootObject()); + QVERIFY(listview); + + QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(10,0)); + for (int i = 0; i < 100; ++i) { + QTest::mouseMove(window.data(), QPoint(10,i)); + if (listview->isMoving()) { + // do not fixup() the position while in movement to avoid flicker + const qreal contentY = listview->contentY(); + listview->setPreferredHighlightBegin(i); + QCOMPARE(listview->contentY(), contentY); + listview->resetPreferredHighlightBegin(); + QCOMPARE(listview->contentY(), contentY); + + listview->setPreferredHighlightEnd(i+10); + QCOMPARE(listview->contentY(), contentY); + listview->resetPreferredHighlightEnd(); + QCOMPARE(listview->contentY(), contentY); + } + } + QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(10,100)); +} + QTEST_MAIN(tst_QQuickListView) #include "tst_qquicklistview.moc" |