diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-07-26 09:14:44 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-07-26 13:21:16 +0200 |
commit | 75d8ebb3e6925f500ddeefe2ab491be2ae83264c (patch) | |
tree | 6874c91386434f4a1934a9555a3f1d5daf69434c /tests/auto/quick/qquicklistview | |
parent | fcb40ff6d71f4561401e6b2bd4d7fc706fff8eee (diff) | |
parent | ba8416b80f42c81387170620472194e7a76429b8 (diff) |
Merge remote-tracking branch 'origin/5.3' into dev
Conflicts:
src/qml/compiler/qv4ssa.cpp
src/qml/jsruntime/qv4arrayobject.cpp
src/qml/jsruntime/qv4engine.cpp
Change-Id: Ie3ef6202b6a3a8521971e1be10c40c6a2db6989c
Diffstat (limited to 'tests/auto/quick/qquicklistview')
-rw-r--r-- | tests/auto/quick/qquicklistview/data/simplelistview.qml | 11 | ||||
-rw-r--r-- | tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | 64 |
2 files changed, 71 insertions, 4 deletions
diff --git a/tests/auto/quick/qquicklistview/data/simplelistview.qml b/tests/auto/quick/qquicklistview/data/simplelistview.qml new file mode 100644 index 0000000000..56a96150c5 --- /dev/null +++ b/tests/auto/quick/qquicklistview/data/simplelistview.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 + +ListView { + width: 400 + height: 400 + model: 100 + delegate: Rectangle { + height: 40; width: 400 + color: index % 2 ? "lightsteelblue" : "lightgray" + } +} diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index b909d14301..c8ab62cbbc 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -231,6 +231,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); @@ -4081,12 +4084,13 @@ void tst_QQuickListView::resetModel_headerFooter() model.reset(); - header = findItem<QQuickItem>(contentItem, "header"); - QVERIFY(header); + // A reset should not force a new header or footer to be created. + QQuickItem *newHeader = findItem<QQuickItem>(contentItem, "header"); + QVERIFY(newHeader == header); QCOMPARE(header->y(), -header->height()); - footer = findItem<QQuickItem>(contentItem, "footer"); - QVERIFY(footer); + QQuickItem *newFooter = findItem<QQuickItem>(contentItem, "footer"); + QVERIFY(newFooter == footer); QCOMPARE(footer->y(), 30.*4); delete window; @@ -7362,6 +7366,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" |