diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-08-20 11:23:01 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-08-21 06:33:11 +0000 |
commit | 26e9c07650474a23817487e768bbebbb87bd78e4 (patch) | |
tree | a287f36b018be08ad1c75d0d41cfef0a305c0d52 /tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp | |
parent | 3a7bd721edad972dd0691ff814b3417b4b5228a0 (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/tst_qquickworkerscript.cpp')
-rw-r--r-- | tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp | 42 |
1 files changed, 0 insertions, 42 deletions
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() |