aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2019-03-22 10:47:29 +0100
committerFrederik Gladhorn <frederik.gladhorn@qt.io>2019-03-25 12:28:51 +0000
commit857cfc1adecd72750cea26d4c91371f4aaf9a68f (patch)
treea0c9e9b0822efbd390a4db83957ad02ccfbb6307 /tests
parent8b701450aeceb878784879eaf65dc42d5befd3a5 (diff)
Only connect to signal once per client object
We only disconnect once when all signals are disconnected, so we should also only connect at most once per signal. Change-Id: Ib3a866c3942bec5e06e3b301315bc83cdb972fab Reviewed-by: Arno Rehn <a.rehn@menlosystems.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/tst_webchannel.qml25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qml/tst_webchannel.qml b/tests/auto/qml/tst_webchannel.qml
index 298376f..0069261 100644
--- a/tests/auto/qml/tst_webchannel.qml
+++ b/tests/auto/qml/tst_webchannel.qml
@@ -451,4 +451,29 @@ TestCase {
0
]);
}
+
+ function test_multiConnect()
+ {
+ var signalArgs = [];
+ function logSignalArgs(arg) {
+ signalArgs.push(arg);
+ }
+ var channel = client.createChannel(function(channel) {
+ var testObject = channel.objects.testObject;
+ testObject.testSignalInt.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.invokeMethod);
+ client.awaitIdle();
+
+ compare(signalArgs, [42, 42, 1, 1, 0, 0]);
+ }
}