diff options
Diffstat (limited to 'tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml')
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml b/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml index 54a3e7d..ca3ff22 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml @@ -1,31 +1,31 @@ -import Qt 4.6 +import Qt 4.7 Item { id: root - property bool incorrectArgCount1: false - property bool incorrectArgCount2: false + // errors resulting in exceptions + property QtObject incorrectArgCount1: Qt.createQmlObject() + property QtObject incorrectArgCount2: Qt.createQmlObject("import Qt 4.7\nQtObject{}", root, "main.qml", 10) + property QtObject noParent: Qt.createQmlObject("import Qt 4.7\nQtObject{\nproperty int test: 13}", 0) + property QtObject notAvailable: Qt.createQmlObject("import Qt 4.7\nQtObject{Blah{}}", root) + property QtObject errors: Qt.createQmlObject("import Qt 4.7\nQtObject{\nproperty int test: 13\nproperty int test: 13\n}", root, "main.qml") + property bool emptyArg: false - property bool noParent: false - property bool notAvailable: false - property bool runtimeError: false - property bool errors: false property bool success: false Component.onCompleted: { - // errors - incorrectArgCount1 = (createQmlObject() == null); - incorrectArgCount2 = (createQmlObject("import Qt 4.6\nQtObject{}", root, "main.qml", 10) == null); - emptyArg = (createQmlObject("", root) == null); - errors = (createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13\nproperty int test: 13\n}", root, "main.qml") == null); - noParent = (createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13}", 0) == null); - notAvailable = (createQmlObject("import Qt 4.6\nQtObject{Blah{}}", root) == null); - runtimeError = (createQmlObject("import Qt 4.6\nQtObject{property int test\nonTestChanged: QtObject{}\n}", root) == null); + // errors resulting in nulls + emptyArg = (Qt.createQmlObject("", root) == null); + try { + Qt.createQmlObject("import Qt 4.7\nQtObject{property int test\nonTestChanged: QtObject{}\n}", root) + } catch (error) { + console.log("RunTimeError: ",error.message); + } - var o = createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13\n}", root); + var o = Qt.createQmlObject("import Qt 4.7\nQtObject{\nproperty int test: 13\n}", root); success = (o.test == 13); - createQmlObject("import Qt 4.6\nItem {}\n", root); + Qt.createQmlObject("import Qt 4.7\nItem {}\n", root); } } |