summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativelistmodel
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/qdeclarativelistmodel')
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml25
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp16
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml b/tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml
new file mode 100644
index 0000000..b8f2f32
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml
@@ -0,0 +1,25 @@
+import Qt 4.7
+ListView {
+ width: 100
+ height: 250
+ delegate: Rectangle {
+ width: 100
+ height: 50
+ color: black ? "black": "white"
+ }
+ model: ListModel {
+ objectName: "listModel"
+ ListElement {
+ black: false
+ rounded: false
+ }
+ ListElement {
+ black: true
+ rounded: false
+ }
+ ListElement {
+ black: true
+ rounded: false
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index f456778..31cb545 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -98,6 +98,7 @@ private slots:
void get_worker_data();
void get_nested();
void get_nested_data();
+ void crash_model_with_multiple_roles();
};
int tst_qdeclarativelistmodel::roleFromName(const QDeclarativeListModel *model, const QString &roleName)
{
@@ -886,6 +887,21 @@ void tst_qdeclarativelistmodel::get_nested_data()
get_data();
}
+//QTBUG-13754
+void tst_qdeclarativelistmodel::crash_model_with_multiple_roles()
+{
+ QDeclarativeEngine eng;
+ QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/multipleroles.qml"));
+ QObject *rootItem = component.create();
+ QVERIFY(component.errorString().isEmpty());
+ QVERIFY(rootItem != 0);
+ QDeclarativeListModel *model = rootItem->findChild<QDeclarativeListModel*>("listModel");
+ QVERIFY(model != 0);
+
+ // used to cause a crash in QDeclarativeVisualDataModel
+ model->setProperty(0, "black", true);
+}
+
QTEST_MAIN(tst_qdeclarativelistmodel)
#include "tst_qdeclarativelistmodel.moc"