diff options
Diffstat (limited to 'tests/auto/qml/qqmlengine/data')
60 files changed, 1749 insertions, 0 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 + } +} |