summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-08-31 07:56:11 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-08-31 07:56:11 (GMT)
commit07095fe95200112ba14bf728148d03f579940c28 (patch)
tree47f320950ed6b9cf6a50450a847beb16b0d97ae7 /tests/auto
parent868ec6b758ad37ac7c977264561ce3052e39685d (diff)
downloadQt-07095fe95200112ba14bf728148d03f579940c28.zip
Qt-07095fe95200112ba14bf728148d03f579940c28.tar.gz
Qt-07095fe95200112ba14bf728148d03f579940c28.tar.bz2
Prevent calling deleteLater() from QML
QTBUG-13045
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/deleteLater.qml14
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp10
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/deleteLater.qml b/tests/auto/declarative/qdeclarativeecmascript/data/deleteLater.qml
new file mode 100644
index 0000000..6d23e5f7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/deleteLater.qml
@@ -0,0 +1,14 @@
+import Qt 4.7
+
+QtObject {
+ id: root
+ property bool test: false
+
+ Component.onCompleted: {
+ try {
+ root.deleteLater()
+ } catch(e) {
+ test = true;
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index c01d756..496cc05 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -158,6 +158,7 @@ private slots:
void qtbug_11606();
void qtbug_11600();
void nonscriptable();
+ void deleteLater();
void include();
@@ -2542,6 +2543,15 @@ void tst_qdeclarativeecmascript::nonscriptable()
delete o;
}
+// deleteLater() should not be callable from QML
+void tst_qdeclarativeecmascript::deleteLater()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("deleteLater.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test").toBool(), true);
+ delete o;
+}
QTEST_MAIN(tst_qdeclarativeecmascript)