aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeworkerscript
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/qdeclarativeworkerscript')
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/data/stressDispose.js6
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/data/stressDispose.qml13
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp13
3 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/stressDispose.js b/tests/auto/declarative/qdeclarativeworkerscript/data/stressDispose.js
new file mode 100644
index 0000000000..5c4c5ec906
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeworkerscript/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/declarative/qdeclarativeworkerscript/data/stressDispose.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/stressDispose.qml
new file mode 100644
index 0000000000..d05918a074
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeworkerscript/data/stressDispose.qml
@@ -0,0 +1,13 @@
+import QtQuick 1.0
+
+Item {
+ WorkerScript {
+ id: worker
+ source: "stressDispose.js"
+ }
+
+ Component.onCompleted: {
+ worker.sendMessage(10);
+ }
+}
+
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
index dd99a18ce3..2c85040f5f 100644
--- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
+++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
@@ -80,6 +80,7 @@ private slots:
void script_included();
void scriptError_onLoad();
void scriptError_onCall();
+ void stressDispose();
private:
void waitForEchoMessage(QDeclarativeWorkerScript *worker) {
@@ -283,6 +284,18 @@ void tst_QDeclarativeWorkerScript::scriptError_onCall()
delete worker;
}
+// Rapidly create and destroy worker scripts to test resources are being disposed
+// in the correct isolate
+void tst_QDeclarativeWorkerScript::stressDispose()
+{
+ for (int ii = 0; ii < 100; ++ii) {
+ QDeclarativeEngine engine;
+ QDeclarativeComponent component(&engine, SRCDIR "/data/stressDispose.qml");
+ QObject *o = component.create();
+ QVERIFY(o);
+ delete o;
+ }
+}
QTEST_MAIN(tst_QDeclarativeWorkerScript)