aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-06-15 15:51:01 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-06-15 18:04:45 +0000
commit9d6cc0f7ecafde186ec729f44dd412be3c845638 (patch)
tree2cec5b4aa6cf936717fa03c85244057153bb8504 /tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
parenta54621c231317c5777dea402215c30764ae96a2e (diff)
Cull removed items from QQuickItemView
Amends a20132c326f6d2c5fec848efb98dd86afb320e2a, which fixed a crash, but also prevented the item from being culled. This is fixed by narrowing the scope of the condition to affect only the caching related part. Fixes: QTBUG-84604 Change-Id: I9b8a1a148d6538a18280475d89b87a4049ff3465 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit ab03621516630991c7cc0fea3be79879efed23a8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto/quick/qquicklistview/tst_qquicklistview.cpp')
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 4e49344bc0..f63793ca80 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -294,6 +294,7 @@ private slots:
void reuse_checkThatItemsAreReused();
void moveObjectModelItemToAnotherObjectModel();
void changeModelAndDestroyTheOldOne();
+ void objectModelCulling();
void requiredObjectListModel();
@@ -9988,6 +9989,30 @@ void tst_QQuickListView::changeModelAndDestroyTheOldOne() // QTBUG-80203
// no crash
}
+void tst_QQuickListView::objectModelCulling()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("objectModelCulling.qml"));
+ window->resize(640, 480);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+ QObject *root = window->rootObject();
+ QVERIFY(root);
+ auto listView = root->findChild<QQuickListView *>("lv");
+ QVERIFY(listView);
+ auto model1 = root->findChild<QObject *>("model1");
+ QVERIFY(model1);
+ auto model2 = root->findChild<QObject *>("model2");
+ QVERIFY(model2);
+ auto redRect = root->findChild<QQuickItem *>("redRect");
+ QVERIFY(redRect);
+ auto redRectPriv = QQuickItemPrivate::get(redRect);
+ listView->setModel(QVariant::fromValue(model1));
+ QVERIFY(!redRectPriv->culled);
+ listView->setModel(QVariant::fromValue(model2));
+ QTRY_VERIFY(redRectPriv->culled);
+}
+
class DataObject : public QObject
{
Q_OBJECT