summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-04-08 08:24:48 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-04-08 08:24:48 (GMT)
commit978c56d47a6436fab9ab239bc81cdbf245b9ab10 (patch)
tree9f53ad0dc50407baa554644db60f19e9a9e6f011 /tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
parent3e299066d0270100331973ff202209c94cf362de (diff)
downloadQt-978c56d47a6436fab9ab239bc81cdbf245b9ab10.zip
Qt-978c56d47a6436fab9ab239bc81cdbf245b9ab10.tar.gz
Qt-978c56d47a6436fab9ab239bc81cdbf245b9ab10.tar.bz2
Don't crash when QML engine is deleted
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp')
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index f675801..72f14f9 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -138,6 +138,7 @@ private slots:
void dynamicCreationCrash();
void regExpBug();
void nullObjectBinding();
+ void deletedEngine();
void callQtInvokables();
private:
@@ -2158,6 +2159,28 @@ void tst_qdeclarativeecmascript::nullObjectBinding()
delete object;
}
+// Test that bindings don't evaluate once the engine has been destroyed
+void tst_qdeclarativeecmascript::deletedEngine()
+{
+ QDeclarativeEngine *engine = new QDeclarativeEngine;
+ QDeclarativeComponent component(engine, TEST_FILE("deletedEngine.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("a").toInt(), 39);
+ object->setProperty("b", QVariant(9));
+ QCOMPARE(object->property("a").toInt(), 117);
+
+ delete engine;
+
+ QCOMPARE(object->property("a").toInt(), 117);
+ object->setProperty("b", QVariant(10));
+ QCOMPARE(object->property("a").toInt(), 117);
+
+ delete object;
+}
+
QTEST_MAIN(tst_qdeclarativeecmascript)
#include "tst_qdeclarativeecmascript.moc"