aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmlecmascript')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/componentCreationForType.qml48
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp4
2 files changed, 50 insertions, 2 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/componentCreationForType.qml b/tests/auto/qml/qqmlecmascript/data/componentCreationForType.qml
new file mode 100644
index 0000000000..66b06d4f5c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/componentCreationForType.qml
@@ -0,0 +1,48 @@
+import QtQml
+
+QtObject {
+ id: root
+ property int status: -1
+ Component.onCompleted: {
+ let comp
+ comp = Qt.createComponent("QtQml", "QtObject")
+ if (comp.status !== Component.Ready) {
+ root.status = 1
+ return
+ }
+
+ comp = Qt.createComponent("QtQml", "QtObject", root)
+ if (comp.status !== Component.Ready) {
+ root.status = 2
+ return
+ }
+
+ comp = Qt.createComponent("QtQml", "QtObject", Component.PreferSynchronous, root)
+ if (comp.status !== Component.Ready) {
+ root.status = 3
+ return
+ }
+
+
+ comp = Qt.createComponent("QtQml", "QtObject", Component.Asynchronous)
+ // C++ component will _always_ be ready, even if we request async loading
+ if (comp.status !== Component.Ready) {
+ root.status = 4
+ return
+ }
+
+ comp = Qt.createComponent("QtQml", "DoesNotExist")
+ if (comp.status !== Component.Error) {
+ root.status = 5
+ return
+ }
+
+ comp = Qt.createComponent("NoSuchModule", "QtObject")
+ if (comp.status !== Component.Error) {
+ root.status = 6
+ return
+ }
+
+ root.status = 0
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 2922b02643..f591a87dcb 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -1964,11 +1964,11 @@ void tst_qqmlecmascript::componentCreation_data()
<< "null";
QTest::newRow("invalidSecondArg")
<< "invalidSecondArg"
- << "" // We cannot catch this case as coercing a string to a number is valid in JavaScript
+ << ":40: TypeError: Invalid arguments; did you swap mode and parent"
<< "";
QTest::newRow("invalidThirdArg")
<< "invalidThirdArg"
- << ":45: TypeError: Passing incompatible arguments to C++ functions from JavaScript is not allowed."
+ << ":45: TypeError: Invalid arguments; did you swap mode and parent"
<< "";
QTest::newRow("invalidMode")
<< "invalidMode"