diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2011-03-17 17:05:03 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2011-03-17 17:05:03 (GMT) |
commit | 9d63852e31674eb5de2da5cb57a09aff31aabb31 (patch) | |
tree | 68ea264ebbdc1b9f63b5c2f8d28941b82fff55ad /tests/auto/declarative/qdeclarativeworkerscript | |
parent | cbf6c5b810316efba3ccfb27f05576b8dbfe3890 (diff) | |
parent | 64ad0c327c365713e320f981d99cdd255912b4d7 (diff) | |
download | Qt-9d63852e31674eb5de2da5cb57a09aff31aabb31.zip Qt-9d63852e31674eb5de2da5cb57a09aff31aabb31.tar.gz Qt-9d63852e31674eb5de2da5cb57a09aff31aabb31.tar.bz2 |
Merge remote-tracking branch 'origin/4.7' into qt-master-from-4.7
Conflicts:
tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
Diffstat (limited to 'tests/auto/declarative/qdeclarativeworkerscript')
4 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/Global.js b/tests/auto/declarative/qdeclarativeworkerscript/data/Global.js new file mode 100644 index 0000000..6bdb4a5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/Global.js @@ -0,0 +1 @@ +var data = "World" diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/script_include.js b/tests/auto/declarative/qdeclarativeworkerscript/data/script_include.js new file mode 100644 index 0000000..0385d91 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/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/declarative/qdeclarativeworkerscript/data/worker_include.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker_include.qml new file mode 100644 index 0000000..595cb2b --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker_include.qml @@ -0,0 +1,5 @@ +import QtQuick 1.0 + +BaseWorker { + source: "script_include.js" +} diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp index 4b922fb..b64e10c 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp +++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp @@ -79,6 +79,7 @@ private slots: void messaging_sendQObjectList(); void messaging_sendJsObject(); void script_with_pragma(); + void script_included(); void scriptError_onLoad(); void scriptError_onCall(); @@ -226,6 +227,24 @@ void tst_QDeclarativeWorkerScript::script_with_pragma() delete worker; } +void tst_QDeclarativeWorkerScript::script_included() +{ + QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker_include.qml"); + QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create()); + QVERIFY(worker != 0); + + QString value("Hello"); + + QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value))); + waitForEchoMessage(worker); + + const QMetaObject *mo = worker->metaObject(); + QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).toString(), value + " World"); + + qApp->processEvents(); + delete worker; +} + static QString qdeclarativeworkerscript_lastWarning; static void qdeclarativeworkerscript_warningsHandler(QtMsgType type, const char *msg) { |