aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qquickworkerscript
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-01-09 01:00:43 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2020-01-09 07:24:26 +0000
commitba10b0b9ed93be007fcb156710ef6081000e3ae3 (patch)
treeea17c625900b83d5955cb4a2db1587a5f07e2fb4 /tests/auto/qml/qquickworkerscript
parent653c25d48298fb747cf6f3b012816855c51d4260 (diff)
parent1798d20ded699837f7b3afe0bb340617af266518 (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts: src/particles/qquickitemparticle.cpp src/qmlmodels/qqmladaptormodel.cpp tests/auto/particles/qquickitemparticle/tst_qquickitemparticle.cpp Change-Id: Ibd8fbb91da6893a09f4ffe61ad0b95d8149bbc87
Diffstat (limited to 'tests/auto/qml/qquickworkerscript')
-rw-r--r--tests/auto/qml/qquickworkerscript/data/doRequest.mjs6
-rw-r--r--tests/auto/qml/qquickworkerscript/data/xmlHttpRequest.qml16
-rw-r--r--tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp8
3 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/qml/qquickworkerscript/data/doRequest.mjs b/tests/auto/qml/qquickworkerscript/data/doRequest.mjs
new file mode 100644
index 0000000000..d607c3400d
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/data/doRequest.mjs
@@ -0,0 +1,6 @@
+WorkerScript.onMessage = function(message)
+{
+ var req = new XMLHttpRequest();
+ req.open("GET", message.url, true);
+ req.send();
+};
diff --git a/tests/auto/qml/qquickworkerscript/data/xmlHttpRequest.qml b/tests/auto/qml/qquickworkerscript/data/xmlHttpRequest.qml
new file mode 100644
index 0000000000..42136d78f0
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/data/xmlHttpRequest.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.14
+
+Rectangle
+{
+ width: 100
+ height: 100
+
+ WorkerScript
+ {
+ source: "doRequest.mjs"
+ Component.onCompleted:
+ {
+ sendMessage({"url": "https://example.com"});
+ }
+ }
+}
diff --git a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
index bb4c9a7c1e..2f79f7157f 100644
--- a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
+++ b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
@@ -60,6 +60,7 @@ private slots:
void script_function();
void script_var();
void stressDispose();
+ void xmlHttpRequest();
private:
void waitForEchoMessage(QQuickWorkerScript *worker) {
@@ -359,6 +360,13 @@ void tst_QQuickWorkerScript::stressDispose()
}
}
+void tst_QQuickWorkerScript::xmlHttpRequest()
+{
+ QQmlComponent component(&m_engine, testFileUrl("xmlHttpRequest.qml"));
+ QScopedPointer<QObject> root{component.create()}; // should not crash
+ QVERIFY(root);
+}
+
QTEST_MAIN(tst_QQuickWorkerScript)
#include "tst_qquickworkerscript.moc"