summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeecmascript
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-04-08 08:09:09 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-04-08 08:10:57 (GMT)
commit3e299066d0270100331973ff202209c94cf362de (patch)
treed00f7df9438d5c67058c85020b87b52e69678136 /tests/auto/declarative/qdeclarativeecmascript
parent5d31f4a2175e69a7a56dea1d682c163dc8a1512c (diff)
downloadQt-3e299066d0270100331973ff202209c94cf362de.zip
Qt-3e299066d0270100331973ff202209c94cf362de.tar.gz
Qt-3e299066d0270100331973ff202209c94cf362de.tar.bz2
Fix crash on null object assignment
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript')
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/nullObjectBinding.qml8
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp15
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/nullObjectBinding.qml b/tests/auto/declarative/qdeclarativeecmascript/data/nullObjectBinding.qml
new file mode 100644
index 0000000..1bf0b81
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/nullObjectBinding.qml
@@ -0,0 +1,8 @@
+import Qt 4.6
+
+QtObject {
+ property QtObject test
+ test: if (1) model
+ property ListModel model
+}
+
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 0e2b497..f675801 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -137,6 +137,7 @@ private slots:
void bug1();
void dynamicCreationCrash();
void regExpBug();
+ void nullObjectBinding();
void callQtInvokables();
private:
@@ -2143,6 +2144,20 @@ void tst_qdeclarativeecmascript::numberAssignment()
delete object;
}
+// Test that assigning a null object works
+// Regressed with: df1788b4dbbb2826ae63f26bdf166342595343f4
+void tst_qdeclarativeecmascript::nullObjectBinding()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("nullObjectBinding.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QVERIFY(object->property("test") == QVariant::fromValue((QObject *)0));
+
+ delete object;
+}
+
QTEST_MAIN(tst_qdeclarativeecmascript)
#include "tst_qdeclarativeecmascript.moc"