aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-06-10 13:42:46 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-06-10 18:55:37 +0200
commit880ce0210406ff51d9c3a164ae95bcc43e020e8b (patch)
tree213fd12b55f77f9c842ac676637b9e346a252e69 /tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
parent2449999ba17c216466ccbefe77b33c790816b771 (diff)
Modernize tst_QQuickListView::QTBUG_39492
- Don't use context properties: a singleton is better - Use required properties to declare dependendencies - Rename to treeDelegateModelLayoutChange() to describe what it's testing rather than just a bug number, and because it's somewhat analogous to tst_QQuickPathView::treeModel() Task-number: QTBUG-39492 Change-Id: I753bbdf625b8d8c82774b6a2b1754fe3c8895823 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/quick/qquicklistview/tst_qquicklistview.cpp')
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 349d070a07..46e59d229e 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2018 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -255,8 +255,8 @@ private slots:
void layoutChange();
- void QTBUG_39492_data();
- void QTBUG_39492();
+ void treeDelegateModelLayoutChange_data();
+ void treeDelegateModelLayoutChange();
void jsArrayChange();
void objectModel();
@@ -8945,7 +8945,7 @@ void tst_QQuickListView::layoutChange()
}
}
-void tst_QQuickListView::QTBUG_39492_data()
+void tst_QQuickListView::treeDelegateModelLayoutChange_data()
{
QStandardItemModel *sourceModel = new QStandardItemModel(this);
for (int i = 0; i < 5; ++i) {
@@ -8981,14 +8981,15 @@ void tst_QQuickListView::QTBUG_39492_data()
<< QPersistentModelIndex(sortModel->index(1, 0, rootIndex2));
}
-void tst_QQuickListView::QTBUG_39492()
+void tst_QQuickListView::treeDelegateModelLayoutChange() // QTBUG-39492
{
QFETCH(QSortFilterProxyModel*, model);
QFETCH(QPersistentModelIndex, rootIndex);
+ qmlRegisterSingletonInstance("Qt.treemodel", 1, 0, "TreeModelCpp", model);
+
QQuickView *window = getView();
- window->rootContext()->setContextProperty("testModel", QVariant::fromValue(model));
- window->setSource(testFileUrl("qtbug39492.qml"));
+ window->setSource(testFileUrl("treeDelegateModel.qml"));
QQuickListView *listview = window->rootObject()->findChild<QQuickListView *>("listView");
QVERIFY(listview);