aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2012-06-06 14:12:01 +0100
committerQt by Nokia <qt-info@nokia.com>2012-06-07 12:20:32 +0200
commite58931462e3c32434d070058b87e5d9152ed004e (patch)
tree7ca61717769ba0b2a7c92a4f26136a8613054b70 /tests
parentc7ad506a4e46d3b3a2d3f6235e5c7df69b027311 (diff)
Don't double emit threaded signals
As the metacall event was posted to the object emitting the signal, it caused the signal to be *reemitted* on the object thread. If both QML and Qt connections were present, the Qt ones were run twice. Change-Id: I4bc1402ab0a43762ff6fef173ecc77fc20508bad Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/threadSignal.2.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp12
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/threadSignal.2.qml b/tests/auto/qml/qqmlecmascript/data/threadSignal.2.qml
new file mode 100644
index 0000000000..99bdbf6015
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/threadSignal.2.qml
@@ -0,0 +1,7 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyWorkerObject {
+ property bool passed: false
+ onDone: passed = (result == 'good')
+}
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index d34a8402c3..2db8967084 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -6896,11 +6896,23 @@ void tst_qqmlecmascript::signalEmitted()
// QTBUG-25647
void tst_qqmlecmascript::threadSignal()
{
+ {
QQmlComponent c(&engine, testFileUrl("threadSignal.qml"));
QObject *object = c.create();
QVERIFY(object != 0);
QTRY_VERIFY(object->property("passed").toBool());
delete object;
+ }
+ {
+ QQmlComponent c(&engine, testFileUrl("threadSignal.2.qml"));
+ QObject *object = c.create();
+ QVERIFY(object != 0);
+ QSignalSpy doneSpy(object, SIGNAL(done(const QString &)));
+ QMetaObject::invokeMethod(object, "doIt");
+ QTRY_VERIFY(object->property("passed").toBool());
+ QCOMPARE(doneSpy.count(), 1);
+ delete object;
+ }
}
// ensure that the qqmldata::destroyed() handler doesn't cause problems