summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-03-04 03:34:37 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-03-04 03:34:37 (GMT)
commitdb2935035697e0abdb156b895ee82b3907014e78 (patch)
tree4625b55fdf07fc3abc45c5184eae6ff0638a8371
parentafbfc2907b417034a98cf17f5787e0dfe467f737 (diff)
parentfafc3f1689b43c5504e0f5c7f7a661e5ddf82290 (diff)
downloadQt-db2935035697e0abdb156b895ee82b3907014e78.zip
Qt-db2935035697e0abdb156b895ee82b3907014e78.tar.gz
Qt-db2935035697e0abdb156b895ee82b3907014e78.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml4
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp20
2 files changed, 13 insertions, 11 deletions
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml
index bb4028f..1fce155 100644
--- a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml
+++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml
@@ -12,10 +12,6 @@ WorkerScript {
worker.sendMessage(value)
}
- function testSendLiteral(value) {
- eval('worker.sendMessage(' + value +')')
- }
-
function compareLiteralResponse(expected) {
var e = eval('(' + expected + ')')
return worker.response == e
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
index 9957b50..27ecef4 100644
--- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
+++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
@@ -48,9 +48,9 @@
#include <QtDeclarative/qdeclarativeitem.h>
#include <private/qdeclarativeworkerscript_p.h>
+#include <private/qdeclarativeengine_p.h>
#include "../../../shared/util.h"
-Q_DECLARE_METATYPE(QList<QObject*>)
Q_DECLARE_METATYPE(QScriptValue)
class tst_QDeclarativeWorkerScript : public QObject
@@ -86,13 +86,14 @@ void tst_QDeclarativeWorkerScript::source()
QFETCH(QUrl, source);
QFETCH(bool, valid);
- QDeclarativeComponent component(&m_engine);
- component.setData("import Qt 4.6\nWorkerScript { source: '" + source.toString().toUtf8() + "'; }", QUrl());
-
if (!valid) {
QByteArray w = "WorkerScript: Cannot find source file \"" + source.toString().toUtf8() + "\"";
QTest::ignoreMessage(QtWarningMsg, w.constData());
}
+
+ QDeclarativeComponent component(&m_engine);
+ component.setData("import Qt 4.6\nWorkerScript { source: '" + source.toString().toUtf8() + "'; }", QUrl());
+
QDeclarativeWorkerScript *item = qobject_cast<QDeclarativeWorkerScript*>(component.create());
QVERIFY(item != 0);
@@ -169,9 +170,15 @@ void tst_QDeclarativeWorkerScript::messaging_sendJsObject()
QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
QVERIFY(worker != 0);
- QString jsObject = "{'spell power': 3101, 'haste': 1125}";
+ QString jsObject = "{'name': 'zyz', 'spell power': 3101, 'haste': 1125}";
- QVERIFY(QMetaObject::invokeMethod(worker, "testSendLiteral", Q_ARG(QVariant, jsObject)));
+ QScriptEngine *engine = QDeclarativeEnginePrivate::getScriptEngine(qmlEngine(worker));
+ QScriptValue sv = engine->newObject();
+ sv.setProperty("name", "zyz");
+ sv.setProperty("spell power", 3101);
+ sv.setProperty("haste", 1125);
+
+ QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, qVariantFromValue(sv))));
waitForEchoMessage(worker);
QVariant result = qVariantFromValue(false);
@@ -185,4 +192,3 @@ void tst_QDeclarativeWorkerScript::messaging_sendJsObject()
QTEST_MAIN(tst_QDeclarativeWorkerScript)
#include "tst_qdeclarativeworkerscript.moc"
-