aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qmltest/listview
diff options
context:
space:
mode:
authorAlbert Astals Cid <albert.astals@canonical.com>2014-04-15 15:27:29 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-18 07:39:32 +0200
commit5772da7e911832e71634322345948b0c98d397bf (patch)
tree8526b8b4a782d3f1ff09b2aca783bd11d8bf1682 /tests/auto/qmltest/listview
parentdc051f28b865e54d3834824ffea6f2562f0836c1 (diff)
QQuickItemView/QQuickPathView: Fix creation of delegates
When the delegate is set before the model and after the ItemView/PathView has been created Task-number: QTBUG-38368 Change-Id: I6963abe28087699cf4e8921153dc7641bae3b220 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'tests/auto/qmltest/listview')
-rw-r--r--tests/auto/qmltest/listview/tst_listview.qml23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qmltest/listview/tst_listview.qml b/tests/auto/qmltest/listview/tst_listview.qml
index 0589e7c46b..03be57909f 100644
--- a/tests/auto/qmltest/listview/tst_listview.qml
+++ b/tests/auto/qmltest/listview/tst_listview.qml
@@ -102,6 +102,23 @@ Item {
}
}
+ ListView {
+ id: listViewDelegateModelAfterCreate
+ anchors.fill: parent
+ property int createdDelegates: 0
+ }
+
+ Component {
+ id: delegateModelAfterCreateComponent
+ Rectangle {
+ width: 140
+ height: 140
+ border.color: "black"
+ color: "red"
+ Component.onCompleted: listViewDelegateModelAfterCreate.createdDelegates++;
+ }
+ }
+
ListModel { id: emptymodel }
ListModel { id: manyitems }
ListModel { id: firstmodel; ListElement { name: "FirstModelElement0" } }
@@ -249,5 +266,11 @@ Item {
asyncListViewLoaderView.currentIndex = 4;
}
}
+
+ function test_set_delegate_model_after_list_creation() {
+ listViewDelegateModelAfterCreate.delegate = delegateModelAfterCreateComponent;
+ listViewDelegateModelAfterCreate.model = 40;
+ verify(listViewDelegateModelAfterCreate.createdDelegates > 0);
+ }
}
}