aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/auto/declarative/qsglistview/data/qtbug-21742.qml36
-rw-r--r--tests/auto/declarative/qsglistview/tst_qsglistview.cpp18
2 files changed, 52 insertions, 2 deletions
diff --git a/tests/auto/declarative/qsglistview/data/qtbug-21742.qml b/tests/auto/declarative/qsglistview/data/qtbug-21742.qml
new file mode 100644
index 0000000000..774f9041fb
--- /dev/null
+++ b/tests/auto/declarative/qsglistview/data/qtbug-21742.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+
+Rectangle {
+ height: 200
+ width: 200
+ property int count: menuView.count
+
+ Component.onCompleted: { setModel(); }
+
+ function setModel()
+ {
+ menuModel.append({"enabledItem" : true});
+ menuView.currentIndex = 0;
+ }
+
+ ListModel {
+ id: menuModel
+ }
+
+ ListView {
+ id: menuView
+ anchors.fill: parent
+ model: menuModel
+ delegate: mything
+ }
+
+ Component {
+ id: mything
+ Rectangle {
+ height: 50
+ width: 200
+ color: index == menuView.currentIndex ? "green" : "blue"
+ }
+ }
+
+} \ No newline at end of file
diff --git a/tests/auto/declarative/qsglistview/tst_qsglistview.cpp b/tests/auto/declarative/qsglistview/tst_qsglistview.cpp
index a23d3b592c..8e2375d6b5 100644
--- a/tests/auto/declarative/qsglistview/tst_qsglistview.cpp
+++ b/tests/auto/declarative/qsglistview/tst_qsglistview.cpp
@@ -114,9 +114,7 @@ private slots:
void propertyChanges();
void componentChanges();
void modelChanges();
- void QTBUG_9791();
void manualHighlight();
- void QTBUG_11105();
void header();
void header_data();
void header_delayItemCreation();
@@ -143,6 +141,10 @@ private slots:
void snapToItem_data();
void snapToItem();
+ void QTBUG_9791();
+ void QTBUG_11105();
+ void QTBUG_21742();
+
private:
template <class T> void items();
template <class T> void changed();
@@ -4045,6 +4047,18 @@ void tst_QSGListView::creationContext()
QCOMPARE(item->property("text").toString(), QString("Hello!"));
}
+void tst_QSGListView::QTBUG_21742()
+{
+ QSGView canvas;
+ canvas.setGeometry(0,0,200,200);
+ canvas.setSource(QUrl::fromLocalFile(TESTDATA("qtbug-21742.qml")));
+ qApp->processEvents();
+
+ QSGItem *rootItem = qobject_cast<QSGItem *>(canvas.rootObject());
+ QVERIFY(rootItem);
+ QCOMPARE(rootItem->property("count").toInt(), 1);
+}
+
QSGView *tst_QSGListView::createView()
{
QSGView *canvas = new QSGView(0);