~ubuntu-branches/ubuntu/saucy/qtdeclarative-opensource-src/saucy

« back to all changes in this revision

Viewing changes to tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.1.qml

  • Committer: Package Import Robot
  • Author(s): Timo Jyrinki
  • Date: 2013-02-05 14:17:19 UTC
  • Revision ID: package-import@ubuntu.com-20130205141719-qqeyml8wslpyez52
Tags: upstream-5.0.1
ImportĀ upstreamĀ versionĀ 5.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import QtQuick 2.0
 
2
 
 
3
Item {
 
4
    property bool success: false
 
5
 
 
6
    function reportError(s) { console.warn(s) }
 
7
 
 
8
    Component.onCompleted: {
 
9
        componentCache.trim()
 
10
        if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.1.qml')) return reportError('Test component not loaded')
 
11
        if (componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component already loaded')
 
12
        if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
 
13
 
 
14
        var comp = Qt.createComponent('VMEPropertyVMEComponent.qml')
 
15
        componentCache.trim()
 
16
        if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.1.qml')) return reportError('Test component not loaded 2')
 
17
        if (!componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component not loaded')
 
18
        if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
 
19
 
 
20
        var obj = comp.createObject()
 
21
        if (!obj) return reportError('Invalid object')
 
22
        if (obj.foo != 'bar') return reportError('Invalid object 2')
 
23
        if (obj.p == undefined) return reportError('Invalid object 3')
 
24
        if (obj.p.foo != 'bar') return reportError('Invalid object 4')
 
25
 
 
26
        obj.destroy()
 
27
        componentCache.trim()
 
28
        if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.1.qml')) return reportError('Test component not loaded 3')
 
29
        if (!componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component already unloaded')
 
30
        if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
 
31
 
 
32
        comp.destroy()
 
33
        componentCache.trim()
 
34
        if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.1.qml')) return reportError('Test component not loaded 4')
 
35
        if (componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component not unloaded')
 
36
        if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
 
37
 
 
38
        success = true
 
39
    }
 
40
}