diff options
Diffstat (limited to 'tests/auto/qml/qquickworkerscript/data')
16 files changed, 117 insertions, 0 deletions
diff --git a/tests/auto/qml/qquickworkerscript/data/BaseWorker.qml b/tests/auto/qml/qquickworkerscript/data/BaseWorker.qml new file mode 100644 index 0000000000..0ac56d9b66 --- /dev/null +++ b/tests/auto/qml/qquickworkerscript/data/BaseWorker.qml @@ -0,0 +1,24 @@ +import QtQuick 2.0 + +WorkerScript { + id: worker + + property variant response + + signal done() + + function testSend(value) { + worker.sendMessage(value) + } + + function compareLiteralResponse(expected) { + var e = eval('(' + expected + ')') + return JSON.stringify(worker.response) == JSON.stringify(e) + } + + onMessage: { + worker.response = messageObject + worker.done() + } +} + diff --git a/tests/auto/qml/qquickworkerscript/data/Global.js b/tests/auto/qml/qquickworkerscript/data/Global.js new file mode 100644 index 0000000000..6bdb4a56b9 --- /dev/null +++ b/tests/auto/qml/qquickworkerscript/data/Global.js @@ -0,0 +1 @@ +var data = "World" diff --git a/tests/auto/qml/qquickworkerscript/data/externalObjectWorker.qml b/tests/auto/qml/qquickworkerscript/data/externalObjectWorker.qml new file mode 100644 index 0000000000..1dae608b50 --- /dev/null +++ b/tests/auto/qml/qquickworkerscript/data/externalObjectWorker.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 + +Item { + id: root + + function testExternalObject() { + worker.sendMessage(Qt.vector3d(1,2,3)); + } + + WorkerScript { + id: worker + source: "script.js" + } +} diff --git a/tests/auto/qml/qquickworkerscript/data/script.js b/tests/auto/qml/qquickworkerscript/data/script.js new file mode 100644 index 0000000000..90aae263a1 --- /dev/null +++ b/tests/auto/qml/qquickworkerscript/data/script.js @@ -0,0 +1,4 @@ +WorkerScript.onMessage = function(msg) { + WorkerScript.sendMessage(msg) +} + diff --git a/tests/auto/qml/qquickworkerscript/data/script_error_onCall.js b/tests/auto/qml/qquickworkerscript/data/script_error_onCall.js new file mode 100644 index 0000000000..f589b0ef40 --- /dev/null +++ b/tests/auto/qml/qquickworkerscript/data/script_error_onCall.js @@ -0,0 +1,6 @@ +WorkerScript.onMessage = function(msg) { + var a = 123 + var b = 345 + var f = getData() +} + diff --git a/tests/auto/qml/qquickworkerscript/data/script_error_onLoad.js b/tests/auto/qml/qquickworkerscript/data/script_error_onLoad.js new file mode 100644 index 0000000000..1d6eab2285 --- /dev/null +++ b/tests/auto/qml/qquickworkerscript/data/script_error_onLoad.js @@ -0,0 +1,5 @@ +WorkerScript.onMessage = function(msg) { + var a = 123 + aoij awef aljfaow eij +} + diff --git a/tests/auto/qml/qquickworkerscript/data/script_fixed_return.js b/tests/auto/qml/qquickworkerscript/data/script_fixed_return.js new file mode 100644 index 0000000000..14f6f178ae --- /dev/null +++ b/tests/auto/qml/qquickworkerscript/data/script_fixed_return.js @@ -0,0 +1,4 @@ +WorkerScript.onMessage = function(msg) { + WorkerScript.sendMessage('Hello_World') +} + diff --git a/tests/auto/qml/qquickworkerscript/data/script_include.js b/tests/auto/qml/qquickworkerscript/data/script_include.js new file mode 100644 index 0000000000..0385d91170 --- /dev/null +++ b/tests/auto/qml/qquickworkerscript/data/script_include.js @@ -0,0 +1,5 @@ +WorkerScript.onMessage = function(msg) { + var res = Qt.include("Global.js"); + WorkerScript.sendMessage(msg + " " + data) +} + diff --git a/tests/auto/qml/qquickworkerscript/data/script_pragma.js b/tests/auto/qml/qquickworkerscript/data/script_pragma.js new file mode 100644 index 0000000000..cb3b6d3398 --- /dev/null +++ b/tests/auto/qml/qquickworkerscript/data/script_pragma.js @@ -0,0 +1,6 @@ +.pragma library + +WorkerScript.onMessage = function(msg) { + WorkerScript.sendMessage(msg) +} + diff --git a/tests/auto/qml/qquickworkerscript/data/stressDispose.js b/tests/auto/qml/qquickworkerscript/data/stressDispose.js new file mode 100644 index 0000000000..5c4c5ec906 --- /dev/null +++ b/tests/auto/qml/qquickworkerscript/data/stressDispose.js @@ -0,0 +1,6 @@ +WorkerScript.onMessage = function() { +} +for (var ii = 0; ii < 100; ++ii) { + var a = "HELLO WORLD"; +} + diff --git a/tests/auto/qml/qquickworkerscript/data/stressDispose.qml b/tests/auto/qml/qquickworkerscript/data/stressDispose.qml new file mode 100644 index 0000000000..3e8465d6fe --- /dev/null +++ b/tests/auto/qml/qquickworkerscript/data/stressDispose.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 + +Item { + WorkerScript { + id: worker + source: "stressDispose.js" + } + + Component.onCompleted: { + worker.sendMessage(10); + } +} + diff --git a/tests/auto/qml/qquickworkerscript/data/worker.qml b/tests/auto/qml/qquickworkerscript/data/worker.qml new file mode 100644 index 0000000000..b5a92bf1f5 --- /dev/null +++ b/tests/auto/qml/qquickworkerscript/data/worker.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +BaseWorker { + source: "script.js" +} diff --git a/tests/auto/qml/qquickworkerscript/data/worker_error_onCall.qml b/tests/auto/qml/qquickworkerscript/data/worker_error_onCall.qml new file mode 100644 index 0000000000..aa20783e76 --- /dev/null +++ b/tests/auto/qml/qquickworkerscript/data/worker_error_onCall.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +BaseWorker { + source: "script_error_onCall.js" +} + diff --git a/tests/auto/qml/qquickworkerscript/data/worker_error_onLoad.qml b/tests/auto/qml/qquickworkerscript/data/worker_error_onLoad.qml new file mode 100644 index 0000000000..8a33aeb44c --- /dev/null +++ b/tests/auto/qml/qquickworkerscript/data/worker_error_onLoad.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +BaseWorker { + source: "script_error_onLoad.js" +} + + diff --git a/tests/auto/qml/qquickworkerscript/data/worker_include.qml b/tests/auto/qml/qquickworkerscript/data/worker_include.qml new file mode 100644 index 0000000000..100b8d4551 --- /dev/null +++ b/tests/auto/qml/qquickworkerscript/data/worker_include.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +BaseWorker { + source: "script_include.js" +} diff --git a/tests/auto/qml/qquickworkerscript/data/worker_pragma.qml b/tests/auto/qml/qquickworkerscript/data/worker_pragma.qml new file mode 100644 index 0000000000..7e313b3c42 --- /dev/null +++ b/tests/auto/qml/qquickworkerscript/data/worker_pragma.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + +BaseWorker { + source: "script_pragma.js" +} + |