2 import Qt.test.qobjectApi 1.0 as QObjectApi
5 property bool success: true
6 property variant testProp: null
8 // first we create an object and reference it via a dynamic variant property
9 function createReference() {
10 var c = Qt.createComponent("HRMDPComponent.qml");
11 testProp = c.createObject(null); // QML ownership.
14 // after a gc, it should not have been collected.
15 function ensureReference() {
16 if (testProp == null) success = false; // should not have triggered delete notify / zeroed testProp value
17 if (testProp.variantCanary != 5) success = false; // should not have deleted vmemo of object referenced by testProp
18 if (testProp.varCanary != 12) success = false; // should not have collected vmemo vmeProperties
19 if (QObjectApi.qobjectTestWritableProperty != 42) success = false; // should not have been set to 43.
22 // then we remove the reference.
23 function removeReference() {
24 testProp = null; // allow original object to be released.
27 // after a gc (and deferred deletion process) the object should be gone
28 function ensureDeletion() {
29 if (QObjectApi.qobjectTestWritableProperty != 43) success = false; // should have been set to 43.