diff options
author | Liang Qi <liang.qi@qt.io> | 2018-01-09 14:32:32 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-01-09 14:32:32 +0100 |
commit | e3f7da72ac5b4540f88bb5cbd91a4917ba84334a (patch) | |
tree | 3f05c1cf965fe291685c383f04b0bec87b05095b /tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | |
parent | 4cc883452b37dbe3148064150dc2f6b282b6b816 (diff) | |
parent | 2e8a45d99f94cbd2c805dd3de56d60d9baa9bd4e (diff) |
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
.qmake.conf
src/qml/memory/qv4mm.cpp
src/qml/qml/qqmlbinding.cpp
Change-Id: I98e51ef5af12691196da5772a07d3d53d213efcc
Diffstat (limited to 'tests/auto/quick/qquicklistview/tst_qquicklistview.cpp')
-rw-r--r-- | tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 32f61884f5..8827ad0f3a 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -261,6 +261,7 @@ private slots: void releaseItems(); void QTBUG_34576_velocityZero(); + void QTBUG_61537_modelChangesAsync(); private: template <class T> void items(const QUrl &source); @@ -8694,6 +8695,33 @@ void tst_QQuickListView::QTBUG_34576_velocityZero() delete window; } +void tst_QQuickListView::QTBUG_61537_modelChangesAsync() +{ + // The purpose of this test if to check that any model changes that happens + // during start-up, while a loader higher up in the chain is still incubating + // async, will not fail. + QQuickView window; + window.setGeometry(0,0,640,480); + + QString filename(testFile("qtbug61537_modelChangesAsync.qml")); + window.setSource(QUrl::fromLocalFile(filename)); + window.show(); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + + // The qml file will assign the listview to the 'listView' property once the + // loader is ready with async incubation. So we need to wait for it. + QObject *root = window.rootObject(); + QTRY_VERIFY(root->property("listView").value<QQuickListView *>()); + QQuickListView *listView = root->property("listView").value<QQuickListView *>(); + QVERIFY(listView); + + // Check that the number of delegates we expect to be visible in + // the listview matches the number of items we find if we count. + int reportedCount = listView->count(); + int actualCount = findItems<QQuickItem>(listView, "delegate").count(); + QCOMPARE(reportedCount, actualCount); +} + QTEST_MAIN(tst_QQuickListView) #include "tst_qquicklistview.moc" |