summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-10-04 03:39:47 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-10-04 03:39:47 (GMT)
commitb2e79e0b5c26e70ad586cb965808059330cc0893 (patch)
tree626fe91a5464dda83ced19d6e7d7e34b56b00c17 /tests
parentefb0d6a986b991432d37c15151df7538fba8f430 (diff)
downloadQt-b2e79e0b5c26e70ad586cb965808059330cc0893.zip
Qt-b2e79e0b5c26e70ad586cb965808059330cc0893.tar.gz
Qt-b2e79e0b5c26e70ad586cb965808059330cc0893.tar.bz2
Prevent crash in XmlListModel when appending an empty role.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativexmllistmodel/data/roleCrash.qml7
-rw-r--r--tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp11
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/data/roleCrash.qml b/tests/auto/declarative/qdeclarativexmllistmodel/data/roleCrash.qml
new file mode 100644
index 0000000..492dad9
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativexmllistmodel/data/roleCrash.qml
@@ -0,0 +1,7 @@
+import QtQuick 1.0
+
+XmlListModel {
+ id: model
+ XmlRole {}
+ Component.onCompleted: model.roles = 0
+}
diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
index bd19bd3..a14f942 100644
--- a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
@@ -96,6 +96,8 @@ private slots:
void threading_data();
void propertyChanges();
+ void roleCrash();
+
private:
QString makeItemXmlAndData(const QString &data, QDeclarativeXmlModelData *modelData = 0) const
{
@@ -825,6 +827,15 @@ void tst_qdeclarativexmllistmodel::propertyChanges()
delete model;
}
+void tst_qdeclarativexmllistmodel::roleCrash()
+{
+ // don't crash
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleCrash.qml"));
+ QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
+ QVERIFY(model != 0);
+ delete model;
+}
+
QTEST_MAIN(tst_qdeclarativexmllistmodel)
#include "tst_qdeclarativexmllistmodel.moc"