summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-09-23 05:08:36 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-09-23 05:08:36 (GMT)
commit718c4ff7e9a9cbf0150c937c1036a03935dda3e1 (patch)
tree4f81e1b337975de012653152f7c2f59dc609b7cd /tests
parentd5c1df72cecda0344717224fede54d83b6d5f15b (diff)
downloadQt-718c4ff7e9a9cbf0150c937c1036a03935dda3e1.zip
Qt-718c4ff7e9a9cbf0150c937c1036a03935dda3e1.tar.gz
Qt-718c4ff7e9a9cbf0150c937c1036a03935dda3e1.tar.bz2
Fix crash
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qmlecmascript/data/enums.2.qml8
-rw-r--r--tests/auto/declarative/qmlecmascript/data/nonExistantAttachedObject.qml5
-rw-r--r--tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp24
3 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlecmascript/data/enums.2.qml b/tests/auto/declarative/qmlecmascript/data/enums.2.qml
new file mode 100644
index 0000000..bdc672f
--- /dev/null
+++ b/tests/auto/declarative/qmlecmascript/data/enums.2.qml
@@ -0,0 +1,8 @@
+import Qt.test 1.0
+import Qt.test 1.0 as Namespace
+
+MyQmlObject {
+ property int a: MyQmlObject.EnumValue10
+ property int b: Namespace.MyQmlObject.EnumValue10
+}
+
diff --git a/tests/auto/declarative/qmlecmascript/data/nonExistantAttachedObject.qml b/tests/auto/declarative/qmlecmascript/data/nonExistantAttachedObject.qml
new file mode 100644
index 0000000..f9585db
--- /dev/null
+++ b/tests/auto/declarative/qmlecmascript/data/nonExistantAttachedObject.qml
@@ -0,0 +1,5 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ stringProperty: MyQmlContainer.prop
+}
diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
index f01e9d4..7e6d83b 100644
--- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
+++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
@@ -48,6 +48,7 @@ private slots:
void valueTypeFunctions();
void constantsOverrideBindings();
void outerBindingOverridesInnerBinding();
+ void nonExistantAttachedObject();
private:
QmlEngine engine;
@@ -378,6 +379,8 @@ void tst_qmlecmascript::extensionObjects()
void tst_qmlecmascript::enums()
{
+ // Existant enums
+ {
QmlComponent component(&engine, TEST_FILE("enums.1.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -392,6 +395,15 @@ void tst_qmlecmascript::enums()
QCOMPARE(object->property("h").toInt(), 3);
QCOMPARE(object->property("i").toInt(), 19);
QCOMPARE(object->property("j").toInt(), 19);
+ }
+ // Non-existant enums
+ {
+ QmlComponent component(&engine, TEST_FILE("enums.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("a").toInt(), 0);
+ QCOMPARE(object->property("b").toInt(), 0);
+ }
}
void tst_qmlecmascript::valueTypeFunctions()
@@ -482,6 +494,18 @@ void tst_qmlecmascript::outerBindingOverridesInnerBinding()
QCOMPARE(object->property("c3").toInt(), 8);
}
+/*
+Access a non-existant attached object.
+
+Tests for a regression where this used to crash.
+*/
+void tst_qmlecmascript::nonExistantAttachedObject()
+{
+ QmlComponent component(&engine, TEST_FILE("nonExistantAttachedObject.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
QTEST_MAIN(tst_qmlecmascript)
#include "tst_qmlecmascript.moc"