aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlengine
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-05-04 08:32:45 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-17 08:58:45 +0200
commit43a6cc75886c662e63db440dd191cefa1fe956f3 (patch)
treecd3247453a0c2a59e0c5d3af11434d18761c2de4 /tests/auto/qml/qqmlengine
parent9af1a7d0aee4f9ed48b2519779388830a8dd03e9 (diff)
Add QQmlEngine::trimComponentCache()
Allow unused data in the engine's component cache to be safely discarded so that the memory can be freed for other purposes. Unloading of scripts that are no longer required after trimming unused components is not yet supported. Task-number: QTBUG-25653 Change-Id: I37bc9d5592eeb5edceeb34d010a555dcffd11cea Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'tests/auto/qml/qqmlengine')
-rw-r--r--tests/auto/qml/qqmlengine/data/EmptyAggregateEmptyComponent.qml6
-rw-r--r--tests/auto/qml/qqmlengine/data/EmptyAggregateVMEComponent.qml6
-rw-r--r--tests/auto/qml/qqmlengine/data/EmptyComponent.qml4
-rw-r--r--tests/auto/qml/qqmlengine/data/EmptyExtendEmptyComponent.qml4
-rw-r--r--tests/auto/qml/qqmlengine/data/EmptyExtendVMEComponent.qml4
-rw-r--r--tests/auto/qml/qqmlengine/data/EmptyPropertyEmptyComponent.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/EmptyPropertyVMEComponent.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/NestedEmptyComponent.qml4
-rw-r--r--tests/auto/qml/qqmlengine/data/NestedVMEComponent.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/ScriptComponent.qml6
-rw-r--r--tests/auto/qml/qqmlengine/data/TopLevelComponent.qml6
-rw-r--r--tests/auto/qml/qqmlengine/data/VMEAggregateEmptyComponent.qml8
-rw-r--r--tests/auto/qml/qqmlengine/data/VMEAggregateVMEComponent.qml8
-rw-r--r--tests/auto/qml/qqmlengine/data/VMEComponent.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/VMEExtendEmptyComponent.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/VMEExtendVMEComponent.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/VMEPropertyEmptyComponent.qml7
-rw-r--r--tests/auto/qml/qqmlengine/data/VMEPropertyVMEComponent.qml7
-rw-r--r--tests/auto/qml/qqmlengine/data/VMETransientEmptyComponent.qml15
-rw-r--r--tests/auto/qml/qqmlengine/data/VMETransientVMEComponent.qml15
-rw-r--r--tests/auto/qml/qqmlengine/data/script.js1
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.1.qml38
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.2.qml40
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.1.qml39
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.2.qml42
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyComponent.1.qml34
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyComponent.2.qml36
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.1.qml38
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.2.qml40
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.1.qml39
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.2.qml42
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.1.qml40
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.2.qml44
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.1.qml40
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.2.qml44
-rw-r--r--tests/auto/qml/qqmlengine/data/testIncubatedComponent.qml51
-rw-r--r--tests/auto/qml/qqmlengine/data/testLoaderComponent.qml62
-rw-r--r--tests/auto/qml/qqmlengine/data/testReloadComponent.qml52
-rw-r--r--tests/auto/qml/qqmlengine/data/testScriptComponent.qml43
-rw-r--r--tests/auto/qml/qqmlengine/data/testTopLevelComponent.qml50
-rw-r--r--tests/auto/qml/qqmlengine/data/testTransientComponent.1.qml34
-rw-r--r--tests/auto/qml/qqmlengine/data/testTransientComponent.2.qml36
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.1.qml39
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.2.qml42
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.1.qml39
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.2.qml42
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEComponent.1.qml34
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEComponent.2.qml36
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.1.qml39
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.2.qml42
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.1.qml39
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.2.qml42
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.1.qml40
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.2.qml44
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.1.qml40
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.2.qml44
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.1.qml41
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.2.qml45
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.1.qml41
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.2.qml45
-rw-r--r--tests/auto/qml/qqmlengine/qqmlengine.pro4
-rw-r--r--tests/auto/qml/qqmlengine/tst_qqmlengine.cpp124
62 files changed, 1874 insertions, 3 deletions
diff --git a/tests/auto/qml/qqmlengine/data/EmptyAggregateEmptyComponent.qml b/tests/auto/qml/qqmlengine/data/EmptyAggregateEmptyComponent.qml
new file mode 100644
index 0000000000..76a0e32335
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/EmptyAggregateEmptyComponent.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Item {
+ EmptyComponent {
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/EmptyAggregateVMEComponent.qml b/tests/auto/qml/qqmlengine/data/EmptyAggregateVMEComponent.qml
new file mode 100644
index 0000000000..7e6821ee48
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/EmptyAggregateVMEComponent.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Item {
+ VMEComponent {
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/EmptyComponent.qml b/tests/auto/qml/qqmlengine/data/EmptyComponent.qml
new file mode 100644
index 0000000000..459c82afbb
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/EmptyComponent.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+Item {
+}
diff --git a/tests/auto/qml/qqmlengine/data/EmptyExtendEmptyComponent.qml b/tests/auto/qml/qqmlengine/data/EmptyExtendEmptyComponent.qml
new file mode 100644
index 0000000000..728b8e7798
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/EmptyExtendEmptyComponent.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+EmptyComponent {
+}
diff --git a/tests/auto/qml/qqmlengine/data/EmptyExtendVMEComponent.qml b/tests/auto/qml/qqmlengine/data/EmptyExtendVMEComponent.qml
new file mode 100644
index 0000000000..88efc731a0
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/EmptyExtendVMEComponent.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+VMEComponent {
+}
diff --git a/tests/auto/qml/qqmlengine/data/EmptyPropertyEmptyComponent.qml b/tests/auto/qml/qqmlengine/data/EmptyPropertyEmptyComponent.qml
new file mode 100644
index 0000000000..293a8e713e
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/EmptyPropertyEmptyComponent.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property EmptyComponent p: EmptyComponent {}
+}
diff --git a/tests/auto/qml/qqmlengine/data/EmptyPropertyVMEComponent.qml b/tests/auto/qml/qqmlengine/data/EmptyPropertyVMEComponent.qml
new file mode 100644
index 0000000000..8444edc829
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/EmptyPropertyVMEComponent.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property VMEComponent p: VMEComponent {}
+}
diff --git a/tests/auto/qml/qqmlengine/data/NestedEmptyComponent.qml b/tests/auto/qml/qqmlengine/data/NestedEmptyComponent.qml
new file mode 100644
index 0000000000..728b8e7798
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/NestedEmptyComponent.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+EmptyComponent {
+}
diff --git a/tests/auto/qml/qqmlengine/data/NestedVMEComponent.qml b/tests/auto/qml/qqmlengine/data/NestedVMEComponent.qml
new file mode 100644
index 0000000000..fd4f15482c
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/NestedVMEComponent.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+VMEComponent {
+ property real pi: 3.1415927
+}
diff --git a/tests/auto/qml/qqmlengine/data/ScriptComponent.qml b/tests/auto/qml/qqmlengine/data/ScriptComponent.qml
new file mode 100644
index 0000000000..3fb9a10e85
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/ScriptComponent.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+import "script.js" as JS
+
+VMEExtendVMEComponent {
+ function getSomething() { return JS.getSomething() }
+}
diff --git a/tests/auto/qml/qqmlengine/data/TopLevelComponent.qml b/tests/auto/qml/qqmlengine/data/TopLevelComponent.qml
new file mode 100644
index 0000000000..dea8a9ce2e
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/TopLevelComponent.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Component {
+ VMEExtendVMEComponent {
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/VMEAggregateEmptyComponent.qml b/tests/auto/qml/qqmlengine/data/VMEAggregateEmptyComponent.qml
new file mode 100644
index 0000000000..a34a036471
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/VMEAggregateEmptyComponent.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+Item {
+ property string bar: 'baz'
+
+ EmptyComponent {
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/VMEAggregateVMEComponent.qml b/tests/auto/qml/qqmlengine/data/VMEAggregateVMEComponent.qml
new file mode 100644
index 0000000000..4bacdf8042
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/VMEAggregateVMEComponent.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+Item {
+ property string foo: 'bar'
+
+ VMEComponent {
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/VMEComponent.qml b/tests/auto/qml/qqmlengine/data/VMEComponent.qml
new file mode 100644
index 0000000000..0a43a08711
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/VMEComponent.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property string foo: 'bar'
+}
diff --git a/tests/auto/qml/qqmlengine/data/VMEExtendEmptyComponent.qml b/tests/auto/qml/qqmlengine/data/VMEExtendEmptyComponent.qml
new file mode 100644
index 0000000000..df81f6bb88
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/VMEExtendEmptyComponent.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+EmptyComponent {
+ property string bar: 'baz'
+}
diff --git a/tests/auto/qml/qqmlengine/data/VMEExtendVMEComponent.qml b/tests/auto/qml/qqmlengine/data/VMEExtendVMEComponent.qml
new file mode 100644
index 0000000000..bf7a2ecdc2
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/VMEExtendVMEComponent.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+VMEComponent {
+ property string bar: 'baz'
+}
diff --git a/tests/auto/qml/qqmlengine/data/VMEPropertyEmptyComponent.qml b/tests/auto/qml/qqmlengine/data/VMEPropertyEmptyComponent.qml
new file mode 100644
index 0000000000..4ead1e0088
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/VMEPropertyEmptyComponent.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Item {
+ property string foo: 'bar'
+
+ property EmptyComponent p: EmptyComponent {}
+}
diff --git a/tests/auto/qml/qqmlengine/data/VMEPropertyVMEComponent.qml b/tests/auto/qml/qqmlengine/data/VMEPropertyVMEComponent.qml
new file mode 100644
index 0000000000..88867f29fc
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/VMEPropertyVMEComponent.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Item {
+ property string foo: 'bar'
+
+ property VMEComponent p: VMEComponent {}
+}
diff --git a/tests/auto/qml/qqmlengine/data/VMETransientEmptyComponent.qml b/tests/auto/qml/qqmlengine/data/VMETransientEmptyComponent.qml
new file mode 100644
index 0000000000..487025f67f
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/VMETransientEmptyComponent.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ property var p: null
+
+ Component.onCompleted: {
+ var c = Qt.createComponent('EmptyComponent.qml')
+ p = c.createObject()
+ c.destroy()
+ }
+
+ Component.onDestruction: {
+ p.destroy()
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/VMETransientVMEComponent.qml b/tests/auto/qml/qqmlengine/data/VMETransientVMEComponent.qml
new file mode 100644
index 0000000000..8f29b53ca5
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/VMETransientVMEComponent.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ property var p: null
+
+ Component.onCompleted: {
+ var c = Qt.createComponent('VMEComponent.qml')
+ p = c.createObject()
+ c.destroy()
+ }
+
+ Component.onDestruction: {
+ p.destroy()
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/script.js b/tests/auto/qml/qqmlengine/data/script.js
new file mode 100644
index 0000000000..616de3ddd7
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/script.js
@@ -0,0 +1 @@
+function getSomething() { return 'https://example.org/' }
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.1.qml
new file mode 100644
index 0000000000..812242f146
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.1.qml
@@ -0,0 +1,38 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateEmptyComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyAggregateEmptyComponent.qml')) return reportError('Aggregate component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('EmptyAggregateEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateEmptyComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyAggregateEmptyComponent.qml')) return reportError('Aggregate component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateEmptyComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyAggregateEmptyComponent.qml')) return reportError('Aggregate component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateEmptyComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyAggregateEmptyComponent.qml')) return reportError('Aggregate component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.2.qml
new file mode 100644
index 0000000000..a171ee6b28
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.2.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateEmptyComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyAggregateEmptyComponent.qml')) return reportError('Aggregate component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('EmptyAggregateEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateEmptyComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyAggregateEmptyComponent.qml')) return reportError('Aggregate component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateEmptyComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyAggregateEmptyComponent.qml')) return reportError('Aggregate component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+ if (!obj) return reportError('Invalid object 3')
+ if (obj.x == undefined) return reportError('Invalid object 4')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateEmptyComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyAggregateEmptyComponent.qml')) return reportError('Aggregate component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.1.qml
new file mode 100644
index 0000000000..de40284452
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.1.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateVMEComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Aggregate component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('EmptyAggregateVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateVMEComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyAggregateVMEComponent.qml')) return reportError('Aggregate component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.children[0].foo != 'bar') return reportError('Invalid object 3')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateVMEComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyAggregateVMEComponent.qml')) return reportError('Aggregate component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateVMEComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyAggregateVMEComponent.qml')) return reportError('Aggregate component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.2.qml
new file mode 100644
index 0000000000..4939087b31
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.2.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateVMEComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Aggregate component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('EmptyAggregateVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateVMEComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyAggregateVMEComponent.qml')) return reportError('Aggregate component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.children[0].foo != 'bar') return reportError('Invalid object 3')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateVMEComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyAggregateVMEComponent.qml')) return reportError('Aggregate component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+ if (!obj) return reportError('Invalid object 4')
+ if (obj.x == undefined) return reportError('Invalid object 5')
+ if (obj.children[0].foo != 'bar') return reportError('Invalid object 6')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateVMEComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyAggregateVMEComponent.qml')) return reportError('Aggregate component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyComponent.1.qml
new file mode 100644
index 0000000000..5cee0341fe
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyComponent.1.qml
@@ -0,0 +1,34 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('EmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyComponent.2.qml
new file mode 100644
index 0000000000..2a13822fab
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyComponent.2.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('EmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+ if (!obj) return reportError('Invalid object 3')
+ if (obj.x == undefined) return reportError('Invalid object 4')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.1.qml
new file mode 100644
index 0000000000..2f238175fa
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.1.qml
@@ -0,0 +1,38 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendEmptyComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyExtendEmptyComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('EmptyExtendEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendEmptyComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyExtendEmptyComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendEmptyComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyExtendEmptyComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendEmptyComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyExtendEmptyComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.2.qml
new file mode 100644
index 0000000000..d36e95fec3
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.2.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendEmptyComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyExtendEmptyComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('EmptyExtendEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendEmptyComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyExtendEmptyComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendEmptyComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyExtendEmptyComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+ if (!obj) return reportError('Invalid object 3')
+ if (obj.x == undefined) return reportError('Invalid object 4')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendEmptyComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyExtendEmptyComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.1.qml
new file mode 100644
index 0000000000..53dd5a17e9
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.1.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendVMEComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('EmptyExtendVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendVMEComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.foo != 'bar') return reportError('Invalid object 3')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendVMEComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendVMEComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.2.qml
new file mode 100644
index 0000000000..e5cd7d60de
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.2.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendVMEComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('EmptyExtendVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendVMEComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.foo != 'bar') return reportError('Invalid object 3')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendVMEComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+ if (!obj) return reportError('Invalid object 4')
+ if (obj.x == undefined) return reportError('Invalid object 5')
+ if (obj.foo != 'bar') return reportError('Invalid object 6')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendVMEComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.1.qml
new file mode 100644
index 0000000000..d98aef2932
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.1.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyEmptyComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyPropertyEmptyComponent.qml')) return reportError('Property component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('EmptyPropertyEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyEmptyComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyPropertyEmptyComponent.qml')) return reportError('Property component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.p == undefined) return reportError('Invalid object 3')
+ if (obj.p.x == undefined) return reportError('Invalid object 4')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyEmptyComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyPropertyEmptyComponent.qml')) return reportError('Property component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyEmptyComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyPropertyEmptyComponent.qml')) return reportError('Property component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.2.qml
new file mode 100644
index 0000000000..7f438aa995
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.2.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyEmptyComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyPropertyEmptyComponent.qml')) return reportError('Property component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('EmptyPropertyEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyEmptyComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyPropertyEmptyComponent.qml')) return reportError('Property component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.p == undefined) return reportError('Invalid object 3')
+ if (obj.p.x == undefined) return reportError('Invalid object 4')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyEmptyComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyPropertyEmptyComponent.qml')) return reportError('Property component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+ if (!obj) return reportError('Invalid object 5')
+ if (obj.x == undefined) return reportError('Invalid object 6')
+ if (obj.p == undefined) return reportError('Invalid object 7')
+ if (obj.p.x == undefined) return reportError('Invalid object 8')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyEmptyComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyPropertyEmptyComponent.qml')) return reportError('Property component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.1.qml
new file mode 100644
index 0000000000..83d6226e83
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.1.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyVMEComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyPropertyVMEComponent.qml')) return reportError('Property component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('EmptyPropertyVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyVMEComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyPropertyVMEComponent.qml')) return reportError('Property component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.p == undefined) return reportError('Invalid object 3')
+ if (obj.p.foo != 'bar') return reportError('Invalid object 4')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyVMEComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyPropertyVMEComponent.qml')) return reportError('Property component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyVMEComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyPropertyVMEComponent.qml')) return reportError('Property component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.2.qml
new file mode 100644
index 0000000000..98dfb7241b
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.2.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyVMEComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyPropertyVMEComponent.qml')) return reportError('Property component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('EmptyPropertyVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyVMEComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyPropertyVMEComponent.qml')) return reportError('Property component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.p == undefined) return reportError('Invalid object 3')
+ if (obj.p.foo != 'bar') return reportError('Invalid object 4')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyVMEComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyPropertyVMEComponent.qml')) return reportError('Property component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+ if (!obj) return reportError('Invalid object 5')
+ if (obj.x == undefined) return reportError('Invalid object 6')
+ if (obj.p == undefined) return reportError('Invalid object 7')
+ if (obj.p.foo != 'bar') return reportError('Invalid object 8')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyVMEComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyPropertyVMEComponent.qml')) return reportError('Property component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testIncubatedComponent.qml b/tests/auto/qml/qqmlengine/data/testIncubatedComponent.qml
new file mode 100644
index 0000000000..50af9c4f16
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testIncubatedComponent.qml
@@ -0,0 +1,51 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testIncubatedComponent.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var c = Qt.createComponent('VMEExtendVMEComponent.qml')
+ var i = c.incubateObject(null, {}, Qt.Asynchronous)
+
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testIncubatedComponent.qml')) return reportError('Test component unloaded 1')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ c.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testIncubatedComponent.qml')) return reportError('Test component unloaded 2')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+
+ i.onStatusChanged = function(status) {
+ if (status != Component.Ready) return;
+ if (i.object == null) return reportError('Extend component not created')
+ if (i.object.foo != 'bar') return reportError('Invalid object')
+ if (i.object.bar != 'baz') return reportError('Invalid object 2')
+
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testIncubatedComponent.qml')) return reportError('Test component unloaded 3')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already unloaded 2')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded 2')
+
+ i.object.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testIncubatedComponent.qml')) return reportError('Test component unloaded 4')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+
+ componentCache.beginIncubation()
+ componentCache.waitForIncubation();
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testLoaderComponent.qml b/tests/auto/qml/qqmlengine/data/testLoaderComponent.qml
new file mode 100644
index 0000000000..a04ca41c26
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testLoaderComponent.qml
@@ -0,0 +1,62 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testLoaderComponent.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ loader.source = 'VMEExtendVMEComponent.qml'
+ }
+
+ Loader {
+ id: loader
+
+ property bool previouslyLoaded: false
+ onLoaded: {
+ if (!previouslyLoaded) {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testLoaderComponent.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+
+ if (!item) return reportError('Invalid item')
+ if (item.foo != 'bar') return reportError('Invalid item 2')
+ if (item.bar != 'baz') return reportError('Invalid item 3')
+
+ loader.source = ''
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testLoaderComponent.qml')) return reportError('Test component not loaded 3')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+ if (item) return reportError('Item not invalidated')
+
+ previouslyLoaded = true
+ loader.source = 'VMEExtendVMEComponent.qml'
+ } else {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testLoaderComponent.qml')) return reportError('Test component not loaded 4')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not reloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not reloaded')
+
+ if (!item) return reportError('Invalid item 4')
+ if (item.foo != 'bar') return reportError('Invalid item 5')
+ if (item.bar != 'baz') return reportError('Invalid item 6')
+
+ loader.source = ''
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testLoaderComponent.qml')) return reportError('Test component not loaded 5')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not unloaded 2')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded 2')
+ if (item) return reportError('Item not invalidated 2')
+
+ success = true
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testReloadComponent.qml b/tests/auto/qml/qqmlengine/data/testReloadComponent.qml
new file mode 100644
index 0000000000..74442108cd
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testReloadComponent.qml
@@ -0,0 +1,52 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testReloadComponent.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMEExtendVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testReloadComponent.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.bar != 'baz') return reportError('Invalid object 3')
+
+ obj.destroy()
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testReloadComponent.qml')) return reportError('Test component not loaded 3')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ comp = Qt.createComponent('VMEExtendVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testReloadComponent.qml')) return reportError('Test component not loaded 4')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not reloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not reloaded')
+
+ obj = comp.createObject()
+ if (!obj) return reportError('Invalid object 4')
+ if (obj.foo != 'bar') return reportError('Invalid object 5')
+ if (obj.bar != 'baz') return reportError('Invalid object 6')
+
+ obj.destroy()
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testReloadComponent.qml')) return reportError('Test component not loaded 5')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not unloaded 2')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded 2')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testScriptComponent.qml b/tests/auto/qml/qqmlengine/data/testScriptComponent.qml
new file mode 100644
index 0000000000..b33eb48461
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testScriptComponent.qml
@@ -0,0 +1,43 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testScriptComponent.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('ScriptComponent.qml')) return reportError('Script component already loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+ if (componentCache.isScriptLoaded('script.js')) return reportError('Script file already loaded')
+
+ var comp = Qt.createComponent('ScriptComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testScriptComponent.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('ScriptComponent.qml')) return reportError('Script component not loaded')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+ if (!componentCache.isScriptLoaded('script.js')) return reportError('Script file not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.bar != 'baz') return reportError('Invalid object 3')
+ if (obj.getSomething() != 'https://example.org/') return reportError('Invalid object 4')
+
+ obj.destroy()
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testScriptComponent.qml')) return reportError('Test component not loaded 3')
+ if (componentCache.isTypeLoaded('ScriptComponent.qml')) return reportError('Script component not unloaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ // Script unloading is not currently implemented
+ //if (componentCache.isScriptLoaded('script.js')) return reportError('Script file already loaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testTopLevelComponent.qml b/tests/auto/qml/qqmlengine/data/testTopLevelComponent.qml
new file mode 100644
index 0000000000..6cf8ec4203
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testTopLevelComponent.qml
@@ -0,0 +1,50 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTopLevelComponent.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('TopLevelComponent.qml')) return reportError('Top-level component already loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('TopLevelComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTopLevelComponent.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('TopLevelComponent.qml')) return reportError('Top-level component not loaded')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var internalComp = comp.createObject()
+ if (!internalComp) return reportError('Invalid component')
+
+ var obj = internalComp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.bar != 'baz') return reportError('Invalid object 3')
+
+ internalComp.destroy()
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTopLevelComponent.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('TopLevelComponent.qml')) return reportError('Top-level component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+ if (!obj) return reportError('Invalid object 4')
+ if (obj.foo != 'bar') return reportError('Invalid object 5')
+ if (obj.bar != 'baz') return reportError('Invalid object 6')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTopLevelComponent.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('TopLevelComponent.qml')) return reportError('Top-level component not unloaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testTransientComponent.1.qml b/tests/auto/qml/qqmlengine/data/testTransientComponent.1.qml
new file mode 100644
index 0000000000..d3e6ffd7cf
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testTransientComponent.1.qml
@@ -0,0 +1,34 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTransientComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Transient component already loaded')
+
+ var comp = Qt.createComponent('VMEExtendVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTransientComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Transient component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return
+ if (obj.foo != 'bar') return reportError('Invalid object')
+ if (obj.bar != 'baz') return reportError('Invalid object 2')
+
+ obj.destroy()
+ if (!componentCache.isTypeLoaded('testTransientComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Transient component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTransientComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Transient component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testTransientComponent.2.qml b/tests/auto/qml/qqmlengine/data/testTransientComponent.2.qml
new file mode 100644
index 0000000000..acb0113e61
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testTransientComponent.2.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTransientComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Transient component already loaded')
+
+ var comp = Qt.createComponent('VMEExtendVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTransientComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Transient component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return
+ if (obj.foo != 'bar') return reportError('Invalid object')
+ if (obj.bar != 'baz') return reportError('Invalid object 2')
+
+ comp.destroy()
+ if (!componentCache.isTypeLoaded('testTransientComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Transient component already unloaded')
+ if (obj.foo != 'bar') return reportError('Invalid object 3')
+ if (obj.bar != 'baz') return reportError('Invalid object 4')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTransientComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Transient component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.1.qml
new file mode 100644
index 0000000000..a5beede469
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.1.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateEmptyComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEAggregateEmptyComponent.qml')) return reportError('Aggregate component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('VMEAggregateEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateEmptyComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEAggregateEmptyComponent.qml')) return reportError('Aggregate component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.children[0].x == undefined) return reportError('Invalid object 2')
+ if (obj.bar != 'baz') return reportError('Invalid object 3')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateEmptyComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEAggregateEmptyComponent.qml')) return reportError('Aggregate component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateEmptyComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEAggregateEmptyComponent.qml')) return reportError('Aggregate component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.2.qml
new file mode 100644
index 0000000000..4c8e52f251
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.2.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateEmptyComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEAggregateEmptyComponent.qml')) return reportError('Aggregate component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('VMEAggregateEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateEmptyComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEAggregateEmptyComponent.qml')) return reportError('Aggregate component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.children[0].x == undefined) return reportError('Invalid object 2')
+ if (obj.bar != 'baz') return reportError('Invalid object 3')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateEmptyComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEAggregateEmptyComponent.qml')) return reportError('Aggregate component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+ if (!obj) return reportError('Invalid object 4')
+ if (obj.children[0].x == undefined) return reportError('Invalid object 5')
+ if (obj.bar != 'baz') return reportError('Invalid object 6')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateEmptyComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEAggregateEmptyComponent.qml')) return reportError('Aggregate component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.1.qml
new file mode 100644
index 0000000000..983d6e824c
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.1.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateVMEComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Aggregate component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMEAggregateVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateVMEComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEAggregateVMEComponent.qml')) return reportError('Aggregate component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.children[0].foo != 'bar') return reportError('Invalid object 3')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateVMEComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEAggregateVMEComponent.qml')) return reportError('Aggregate component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateVMEComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEAggregateVMEComponent.qml')) return reportError('Aggregate component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.2.qml
new file mode 100644
index 0000000000..fc8e5a0cd4
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.2.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateVMEComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Aggregate component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMEAggregateVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateVMEComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEAggregateVMEComponent.qml')) return reportError('Aggregate component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.children[0].foo != 'bar') return reportError('Invalid object 3')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateVMEComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEAggregateVMEComponent.qml')) return reportError('Aggregate component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+ if (!obj) return reportError('Invalid object r4')
+ if (obj.foo != 'bar') return reportError('Invalid object 5')
+ if (obj.children[0].foo != 'bar') return reportError('Invalid object 6')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateVMEComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEAggregateVMEComponent.qml')) return reportError('Aggregate component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEComponent.1.qml
new file mode 100644
index 0000000000..fcfd05c51f
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEComponent.1.qml
@@ -0,0 +1,34 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEComponent.2.qml
new file mode 100644
index 0000000000..f434406eec
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEComponent.2.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+ if (!obj) return reportError('Invalid object 3')
+ if (obj.foo != 'bar') return reportError('Invalid object 4')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.1.qml
new file mode 100644
index 0000000000..1dcaec90e6
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.1.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendEmptyComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendEmptyComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('VMEExtendEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendEmptyComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEExtendEmptyComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.bar != 'baz') return reportError('Invalid object 3')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendEmptyComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEExtendEmptyComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendEmptyComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEExtendEmptyComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.2.qml
new file mode 100644
index 0000000000..fd7d7e454c
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.2.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendEmptyComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendEmptyComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('VMEExtendEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendEmptyComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEExtendEmptyComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.bar != 'baz') return reportError('Invalid object 3')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendEmptyComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEExtendEmptyComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+ if (!obj) return reportError('Invalid object 4')
+ if (obj.x == undefined) return reportError('Invalid object 5')
+ if (obj.bar != 'baz') return reportError('Invalid object 6')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendEmptyComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEExtendEmptyComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.1.qml
new file mode 100644
index 0000000000..d2dab32fc9
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.1.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendVMEComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMEExtendVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendVMEComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.bar != 'baz') return reportError('Invalid object 3')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendVMEComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendVMEComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.2.qml
new file mode 100644
index 0000000000..813e43896c
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.2.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendVMEComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMEExtendVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendVMEComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.bar != 'baz') return reportError('Invalid object 3')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendVMEComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+ if (!obj) return reportError('Invalid object 4')
+ if (obj.foo != 'bar') return reportError('Invalid object 5')
+ if (obj.bar != 'baz') return reportError('Invalid object 6')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendVMEComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.1.qml
new file mode 100644
index 0000000000..c6f0b7928b
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.1.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyEmptyComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEPropertyEmptyComponent.qml')) return reportError('Property component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('VMEPropertyEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyEmptyComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEPropertyEmptyComponent.qml')) return reportError('Property component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.p == undefined) return reportError('Invalid object 3')
+ if (obj.p.x == undefined) return reportError('Invalid object 4')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyEmptyComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEPropertyEmptyComponent.qml')) return reportError('Property component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyEmptyComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEPropertyEmptyComponent.qml')) return reportError('Property component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.2.qml
new file mode 100644
index 0000000000..255138520c
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.2.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyEmptyComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEPropertyEmptyComponent.qml')) return reportError('Property component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('VMEPropertyEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyEmptyComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEPropertyEmptyComponent.qml')) return reportError('Property component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.p == undefined) return reportError('Invalid object 3')
+ if (obj.p.x == undefined) return reportError('Invalid object 4')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyEmptyComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEPropertyEmptyComponent.qml')) return reportError('Property component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+ if (!obj) return reportError('Invalid object 5')
+ if (obj.foo != 'bar') return reportError('Invalid object 6')
+ if (obj.p == undefined) return reportError('Invalid object 7')
+ if (obj.p.x == undefined) return reportError('Invalid object 8')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyEmptyComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEPropertyEmptyComponent.qml')) return reportError('Property component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.1.qml
new file mode 100644
index 0000000000..0ad59b32d3
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.1.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMEPropertyVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.p == undefined) return reportError('Invalid object 3')
+ if (obj.p.foo != 'bar') return reportError('Invalid object 4')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.2.qml
new file mode 100644
index 0000000000..60f72a92fe
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.2.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMEPropertyVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.p == undefined) return reportError('Invalid object 3')
+ if (obj.p.foo != 'bar') return reportError('Invalid object 4')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+ if (!obj) return reportError('Invalid object 5')
+ if (obj.foo != 'bar') return reportError('Invalid object 6')
+ if (obj.p == undefined) return reportError('Invalid object 7')
+ if (obj.p.foo != 'bar') return reportError('Invalid object 8')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.1.qml
new file mode 100644
index 0000000000..6c7f959f49
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.1.qml
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientEmptyComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMETransientEmptyComponent.qml')) return reportError('Transient component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('VMETransientEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientEmptyComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMETransientEmptyComponent.qml')) return reportError('Transient component not loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (!obj.p) return reportError('Invalid object 3')
+ if (obj.p.x == undefined) return reportError('Invalid object 4')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientEmptyComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMETransientEmptyComponent.qml')) return reportError('Transient component already unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientEmptyComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMETransientEmptyComponent.qml')) return reportError('Transient component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded 2')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.2.qml
new file mode 100644
index 0000000000..86060c3998
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.2.qml
@@ -0,0 +1,45 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientEmptyComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMETransientEmptyComponent.qml')) return reportError('Transient component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('VMETransientEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientEmptyComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMETransientEmptyComponent.qml')) return reportError('Transient component not loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (!obj.p) return reportError('Invalid object 3')
+ if (obj.p.x == undefined) return reportError('Invalid object 4')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientEmptyComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMETransientEmptyComponent.qml')) return reportError('Transient component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+ if (!obj) return reportError('Invalid object 5')
+ if (obj.x == undefined) return reportError('Invalid object 6')
+ if (!obj.p) return reportError('Invalid object 7')
+ if (obj.p.x == undefined) return reportError('Invalid object 8')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientEmptyComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMETransientEmptyComponent.qml')) return reportError('Transient component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.1.qml
new file mode 100644
index 0000000000..c50fd70dec
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.1.qml
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientVMEComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMETransientVMEComponent.qml')) return reportError('Transient component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMETransientVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientVMEComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMETransientVMEComponent.qml')) return reportError('Transient component not loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (!obj.p) return reportError('Invalid object 3')
+ if (obj.p.foo != 'bar') return reportError('Invalid object 4')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientVMEComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMETransientVMEComponent.qml')) return reportError('Transient component already unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientVMEComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMETransientVMEComponent.qml')) return reportError('Transient component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded 2')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.2.qml
new file mode 100644
index 0000000000..120d249bc0
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.2.qml
@@ -0,0 +1,45 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientVMEComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMETransientVMEComponent.qml')) return reportError('Transient component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMETransientVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientVMEComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMETransientVMEComponent.qml')) return reportError('Transient component not loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (!obj.p) return reportError('Invalid object 3')
+ if (obj.p.foo != 'bar') return reportError('Invalid object 4')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientVMEComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMETransientVMEComponent.qml')) return reportError('Transient component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+ if (!obj) return reportError('Invalid object 5')
+ if (obj.x == undefined) return reportError('Invalid object 6')
+ if (!obj.p) return reportError('Invalid object 7')
+ if (obj.p.foo != 'bar') return reportError('Invalid object 8')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientVMEComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMETransientVMEComponent.qml')) return reportError('Transient component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/qqmlengine.pro b/tests/auto/qml/qqmlengine/qqmlengine.pro
index e87b4e30aa..87e2814555 100644
--- a/tests/auto/qml/qqmlengine/qqmlengine.pro
+++ b/tests/auto/qml/qqmlengine/qqmlengine.pro
@@ -2,8 +2,10 @@ CONFIG += testcase
TARGET = tst_qqmlengine
macx:CONFIG -= app_bundle
+include (../../shared/util.pri)
+
SOURCES += tst_qqmlengine.cpp
CONFIG += parallel_test
-QT += core-private gui-private qml-private network testlib
+QT += core-private gui-private qml-private v8-private network testlib
diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
index ab18cdd050..727635ee2c 100644
--- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
+++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include <qtest.h>
+#include "../../shared/util.h"
#include <QQmlEngine>
#include <QQmlContext>
#include <QNetworkAccessManager>
@@ -51,8 +51,10 @@
#include <QQmlComponent>
#include <QQmlNetworkAccessManagerFactory>
#include <QQmlExpression>
+#include <QQmlIncubationController>
+#include <private/qqmlengine_p.h>
-class tst_qqmlengine : public QObject
+class tst_qqmlengine : public QQmlDataTest
{
Q_OBJECT
public:
@@ -65,6 +67,8 @@ private slots:
void contextForObject();
void offlineStoragePath();
void clearComponentCache();
+ void trimComponentCache();
+ void trimComponentCache_data();
void outputWarningsToStandardError();
void objectOwnership();
void multipleEngines();
@@ -252,6 +256,122 @@ void tst_qqmlengine::clearComponentCache()
}
}
+struct ComponentCacheFunctions : public QObject, public QQmlIncubationController
+{
+ Q_OBJECT
+public:
+ QQmlEngine *engine;
+
+ ComponentCacheFunctions(QQmlEngine &e) : engine(&e) {}
+
+ Q_INVOKABLE void trim()
+ {
+ // Wait for any pending deletions to occur
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+
+ engine->trimComponentCache();
+ }
+
+ Q_INVOKABLE bool isTypeLoaded(QString file)
+ {
+ return QQmlEnginePrivate::get(engine)->isTypeLoaded(tst_qqmlengine::instance()->testFileUrl(file));
+ }
+
+ Q_INVOKABLE bool isScriptLoaded(QString file)
+ {
+ return QQmlEnginePrivate::get(engine)->isScriptLoaded(tst_qqmlengine::instance()->testFileUrl(file));
+ }
+
+ Q_INVOKABLE void beginIncubation()
+ {
+ startTimer(0);
+ }
+
+ Q_INVOKABLE void waitForIncubation()
+ {
+ while (incubatingObjectCount() > 0) {
+ QCoreApplication::processEvents();
+ }
+ }
+
+private:
+ virtual void timerEvent(QTimerEvent *)
+ {
+ incubateFor(1000);
+ }
+};
+
+void tst_qqmlengine::trimComponentCache()
+{
+ QFETCH(QString, file);
+
+ QQmlEngine engine;
+ ComponentCacheFunctions componentCache(engine);
+ engine.rootContext()->setContextProperty("componentCache", &componentCache);
+ engine.setIncubationController(&componentCache);
+
+ QQmlComponent component(&engine, testFileUrl(file));
+ QVERIFY(component.isReady());
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("success").toBool(), true);
+}
+
+void tst_qqmlengine::trimComponentCache_data()
+{
+ QTest::addColumn<QString>("file");
+
+ // The various tests here are for two types of components: those that are
+ // empty apart from their inherited elements, and those that define new properties.
+ // For each there are five types of composition: extension, aggregation,
+ // aggregation via component, property and object-created-via-transient-component.
+ foreach (const QString &test, (QStringList() << "EmptyComponent"
+ << "VMEComponent"
+ << "EmptyExtendEmptyComponent"
+ << "VMEExtendEmptyComponent"
+ << "EmptyExtendVMEComponent"
+ << "VMEExtendVMEComponent"
+ << "EmptyAggregateEmptyComponent"
+ << "VMEAggregateEmptyComponent"
+ << "EmptyAggregateVMEComponent"
+ << "VMEAggregateVMEComponent"
+ << "EmptyPropertyEmptyComponent"
+ << "VMEPropertyEmptyComponent"
+ << "EmptyPropertyVMEComponent"
+ << "VMEPropertyVMEComponent"
+ << "VMETransientEmptyComponent"
+ << "VMETransientVMEComponent")) {
+ // For these cases, we first test that the component instance keeps the components
+ // referenced, and then that the instantiated object keeps the components referenced
+ for (int i = 1; i <= 2; ++i) {
+ QString name(QString("%1-%2").arg(test).arg(i));
+ QString file(QString("test%1.%2.qml").arg(test).arg(i));
+ QTest::newRow(name.toLatin1().constData()) << file;
+ }
+ }
+
+ // Test that a transient component is correctly referenced
+ QTest::newRow("TransientComponent-1") << "testTransientComponent.1.qml";
+ QTest::newRow("TransientComponent-2") << "testTransientComponent.2.qml";
+
+ // Test that components can be reloaded after unloading
+ QTest::newRow("ReloadComponent") << "testReloadComponent.qml";
+
+ // Test that components are correctly referenced when dynamically loaded
+ QTest::newRow("LoaderComponent") << "testLoaderComponent.qml";
+
+ // Test that components are correctly referenced when incubated
+ QTest::newRow("IncubatedComponent") << "testIncubatedComponent.qml";
+
+ // Test that a top-level omponents is correctly referenced
+ QTest::newRow("TopLevelComponent") << "testTopLevelComponent.qml";
+
+ // TODO:
+ // Test that scripts are unloaded when no longer referenced
+ QTest::newRow("ScriptComponent") << "testScriptComponent.qml";
+}
+
static QStringList warnings;
static void msgHandler(QtMsgType, const char *warning)
{