aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage/data/objectDeletionNotify.1.qml
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-07-18 10:16:12 +1000
committerQt by Nokia <qt-info@nokia.com>2012-07-20 05:35:13 +0200
commitfa3dcc0efb2696612bf9db54a7ed4e26a2cf4765 (patch)
tree1a571292334edd0ea10fda559b8c84862a51b58b /tests/auto/qml/qqmllanguage/data/objectDeletionNotify.1.qml
parent9018c236c73884ea706ac1d04a306467454e6243 (diff)
Update var property to null on object deletion
When a var property contains a pointer to a QObject-derived instance, ensure that object deletion causes the property to be updated. Task-number: QTBUG-26542 Change-Id: I67a59ffd7f09063328d45dc84889add55a5428e4 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/data/objectDeletionNotify.1.qml')
-rw-r--r--tests/auto/qml/qqmllanguage/data/objectDeletionNotify.1.qml37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/objectDeletionNotify.1.qml b/tests/auto/qml/qqmllanguage/data/objectDeletionNotify.1.qml
new file mode 100644
index 0000000000..acd5463a3c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/objectDeletionNotify.1.qml
@@ -0,0 +1,37 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ Component {
+ id: internal
+
+ Item {
+ }
+ }
+
+ property bool expectNull: null
+
+ function setExpectNull(b) {
+ success = false;
+ expectNull = b;
+ }
+
+ property QtObject obj: null
+ onObjChanged: success = (expectNull ? obj == null : obj != null)
+
+ Component.onCompleted: {
+ setExpectNull(false)
+ obj = internal.createObject(null, {})
+ if (!success) return
+
+ // Replace with a different object
+ setExpectNull(false)
+ obj = internal.createObject(null, {})
+ }
+
+ function destroyObject() {
+ setExpectNull(true)
+ obj.destroy();
+ }
+}