aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qquickworkerscript
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-08-20 11:23:01 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-08-21 06:33:11 +0000
commit26e9c07650474a23817487e768bbebbb87bd78e4 (patch)
treea287f36b018be08ad1c75d0d41cfef0a305c0d52 /tests/auto/qml/qquickworkerscript
parent3a7bd721edad972dd0691ff814b3417b4b5228a0 (diff)
Clean up QML worker scripts part 2
Now that we have one JS engine per worker script, we can get rid of the per-script QML context and let the script simply run in the global object, which is now also mutable. Change-Id: I36d8616b85b2c0ff3a356ee7be9d242c3da624cf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/qml/qquickworkerscript')
-rw-r--r--tests/auto/qml/qquickworkerscript/data/script_global.js5
-rw-r--r--tests/auto/qml/qquickworkerscript/data/script_global2.js6
-rw-r--r--tests/auto/qml/qquickworkerscript/data/worker_global.qml5
-rw-r--r--tests/auto/qml/qquickworkerscript/data/worker_global2.qml5
-rw-r--r--tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp42
5 files changed, 0 insertions, 63 deletions
diff --git a/tests/auto/qml/qquickworkerscript/data/script_global.js b/tests/auto/qml/qquickworkerscript/data/script_global.js
deleted file mode 100644
index cce4f2ceca..0000000000
--- a/tests/auto/qml/qquickworkerscript/data/script_global.js
+++ /dev/null
@@ -1,5 +0,0 @@
-WorkerScript.onMessage = function(msg) {
- world = "World"
- WorkerScript.sendMessage(msg + " " + world)
-}
-
diff --git a/tests/auto/qml/qquickworkerscript/data/script_global2.js b/tests/auto/qml/qquickworkerscript/data/script_global2.js
deleted file mode 100644
index 0867f7ee76..0000000000
--- a/tests/auto/qml/qquickworkerscript/data/script_global2.js
+++ /dev/null
@@ -1,6 +0,0 @@
-world = "World"
-
-WorkerScript.onMessage = function(msg) {
- WorkerScript.sendMessage(msg + " " + world)
-}
-
diff --git a/tests/auto/qml/qquickworkerscript/data/worker_global.qml b/tests/auto/qml/qquickworkerscript/data/worker_global.qml
deleted file mode 100644
index 546afd2f39..0000000000
--- a/tests/auto/qml/qquickworkerscript/data/worker_global.qml
+++ /dev/null
@@ -1,5 +0,0 @@
-import QtQuick 2.0
-
-BaseWorker {
- source: "script_global.js"
-}
diff --git a/tests/auto/qml/qquickworkerscript/data/worker_global2.qml b/tests/auto/qml/qquickworkerscript/data/worker_global2.qml
deleted file mode 100644
index 42cad3852b..0000000000
--- a/tests/auto/qml/qquickworkerscript/data/worker_global2.qml
+++ /dev/null
@@ -1,5 +0,0 @@
-import QtQuick 2.0
-
-BaseWorker {
- source: "script_global2.js"
-}
diff --git a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
index e8a4be6faf..e21a53b4f3 100644
--- a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
+++ b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
@@ -57,7 +57,6 @@ private slots:
void scriptError_onCall();
void script_function();
void script_var();
- void script_global();
void stressDispose();
private:
@@ -311,47 +310,6 @@ void tst_QQuickWorkerScript::script_var()
delete worker;
}
-void tst_QQuickWorkerScript::script_global()
-{
- {
- QQmlComponent component(&m_engine, testFileUrl("worker_global.qml"));
- QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create());
- QVERIFY(worker != nullptr);
-
- QString value("Hello");
-
- QtMessageHandler previousMsgHandler = qInstallMessageHandler(qquickworkerscript_warningsHandler);
-
- QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
-
- QTRY_COMPARE(qquickworkerscript_lastWarning,
- testFileUrl("script_global.js").toString() + QLatin1String(":2: Invalid write to global property \"world\""));
-
- qInstallMessageHandler(previousMsgHandler);
-
- qApp->processEvents();
- delete worker;
- }
-
- qquickworkerscript_lastWarning = QString();
-
- {
- QtMessageHandler previousMsgHandler = qInstallMessageHandler(qquickworkerscript_warningsHandler);
-
- QQmlComponent component(&m_engine, testFileUrl("worker_global2.qml"));
- QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create());
- QVERIFY(worker != nullptr);
-
- QTRY_COMPARE(qquickworkerscript_lastWarning,
- testFileUrl("script_global2.js").toString() + QLatin1String(":1: Invalid write to global property \"world\""));
-
- qInstallMessageHandler(previousMsgHandler);
-
- qApp->processEvents();
- delete worker;
- }
-}
-
// Rapidly create and destroy worker scripts to test resources are being disposed
// in the correct isolate
void tst_QQuickWorkerScript::stressDispose()