summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml5
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp13
2 files changed, 11 insertions, 7 deletions
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml
index 2982010..bb4028f 100644
--- a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml
+++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml
@@ -4,9 +4,10 @@ WorkerScript {
id: worker
source: "script.js"
- property bool done : false
property var response
+ signal done()
+
function testSend(value) {
worker.sendMessage(value)
}
@@ -21,7 +22,7 @@ WorkerScript {
}
onMessage: {
- worker.done = true
worker.response = messageObject
+ worker.done()
}
}
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
index 841a0ee..b0fc212 100644
--- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
+++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include <qtest.h>
#include <QtCore/qdebug.h>
+#include <QtCore/qtimer.h>
#include <QtScript/qscriptengine.h>
#include <QtDeclarative/qdeclarativecomponent.h>
@@ -67,11 +68,13 @@ private slots:
private:
void waitForEchoMessage(QDeclarativeWorkerScript *worker) {
- const QMetaObject *mo = worker->metaObject();
- int index = mo->indexOfProperty("done");
- QVERIFY(index >= 0);
- QTRY_COMPARE(mo->property(index).read(worker).toBool(), true);
- QTRY_COMPARE(mo->property(mo->indexOfProperty("done")).read(worker).toBool(), true);
+ QEventLoop loop;
+ QVERIFY(connect(worker, SIGNAL(done()), &loop, SLOT(quit())));
+ QTimer timer;
+ connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
+ timer.start(1000);
+ loop.exec();
+ QVERIFY(timer.isActive());
}
QDeclarativeEngine m_engine;