summaryrefslogtreecommitdiff
path: root/tests/auto/qml/tst_webchannel.qml
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2016-06-16 22:55:43 +0200
committerMilian Wolff <milian.wolff@kdab.com>2016-07-21 09:04:37 +0000
commit3b28a6956cb3cab087481312dc82a907b118e0de (patch)
tree7922cc3a23a6b573247a3ff46fc54b577ea2836a /tests/auto/qml/tst_webchannel.qml
parent43ff11f564d90f7818d741ae4304462938c38438 (diff)
downloadqtwebchannel-3b28a6956cb3cab087481312dc82a907b118e0de.tar.gz
Add a test that emits signals from C++ and checks them in QMLv5.6.25.6.2
This is again trying to reproduce the issue described in the bug report, but it also passes for me. Still, it's good to have this tested in more depth. Change-Id: Ibaaefd7359d558c3b59af3d86a1260ab06caa598 Task-number: QTBUG-54074 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'tests/auto/qml/tst_webchannel.qml')
-rw-r--r--tests/auto/qml/tst_webchannel.qml43
1 files changed, 42 insertions, 1 deletions
diff --git a/tests/auto/qml/tst_webchannel.qml b/tests/auto/qml/tst_webchannel.qml
index 6cb24b0..dc4cf93 100644
--- a/tests/auto/qml/tst_webchannel.qml
+++ b/tests/auto/qml/tst_webchannel.qml
@@ -94,10 +94,15 @@ TestCase {
}
}
+ TestObject {
+ id: testObject
+ WebChannel.id: "testObject"
+ }
+
TestWebChannel {
id: webChannel
transports: [client.serverTransport]
- registeredObjects: [myObj, myOtherObj, myFactory]
+ registeredObjects: [myObj, myOtherObj, myFactory, testObject]
}
function initChannel() {
@@ -412,4 +417,40 @@ TestCase {
myObj.mySignal(0, myObj);
compare(signalArg, 42);
}
+
+ // see also: https://bugreports.qt.io/browse/QTBUG-54074
+ function test_signalArgumentTypeConversion()
+ {
+ var signalArgs = [];
+ function logSignalArgs(arg) {
+ signalArgs.push(arg);
+ }
+ var channel = client.createChannel(function(channel) {
+ var testObject = channel.objects.testObject;
+ testObject.testSignalBool.connect(logSignalArgs);
+ testObject.testSignalInt.connect(logSignalArgs);
+ testObject.triggerSignals();
+ });
+ client.awaitInit();
+
+ var msg = client.awaitMessage();
+ compare(msg.type, JSClient.QWebChannelMessageTypes.connectToSignal);
+ compare(msg.object, "testObject");
+
+ msg = client.awaitMessage();
+ compare(msg.type, JSClient.QWebChannelMessageTypes.connectToSignal);
+ compare(msg.object, "testObject");
+
+ msg = client.awaitMessage();
+ compare(msg.type, JSClient.QWebChannelMessageTypes.invokeMethod);
+ client.awaitIdle();
+
+ compare(signalArgs, [
+ true,
+ false,
+ 42,
+ 1,
+ 0
+ ]);
+ }
}