summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2014-10-16 17:05:13 +0200
committerMilian Wolff <milian.wolff@kdab.com>2014-10-17 13:02:10 +0200
commitefbc8e0066f82ee530b4770e4484d6372e5e7cc1 (patch)
treefc20445402839240d1944821f594892ed3ecd4a6 /tests
parent973b33e05c611b201660fc3e1581c44f81f82e43 (diff)
downloadqtwebchannel-efbc8e0066f82ee530b4770e4484d6372e5e7cc1.tar.gz
Never manually connect to the destroyed signal of any object.
The web channel always connects to that signal automatically for internal book-keeping purposes. Thus we do not have to connect to the signal for wrapped objects. This simplifies the tests and reduces the IPC traffic for wrapped objects. Change-Id: Iaf8d9ce0b87874917cdcdf9013e21a53ee36b53a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/tst_webchannel.qml32
1 files changed, 10 insertions, 22 deletions
diff --git a/tests/auto/qml/tst_webchannel.qml b/tests/auto/qml/tst_webchannel.qml
index 3e76d12..f304197 100644
--- a/tests/auto/qml/tst_webchannel.qml
+++ b/tests/auto/qml/tst_webchannel.qml
@@ -244,11 +244,6 @@ TestCase {
compare(myFactory.lastObj.objectName, "testObj");
compare(channel.objects[testObjId].objectName, "testObj");
- // deleteLater signal connection
- msg = client.awaitMessage();
- compare(msg.type, JSClient.QWebChannelMessageTypes.connectToSignal);
- compare(msg.object, testObjId);
-
// mySignal connection
msg = client.awaitMessage();
compare(msg.type, JSClient.QWebChannelMessageTypes.connectToSignal);
@@ -287,26 +282,23 @@ TestCase {
// objects even if no callback function is set
function test_wrapper_wrapEveryQObject()
{
+ var testObj;
var channel = client.createChannel(function(channel) {
- channel.objects.myFactory.create("testObj");
+ channel.objects.myFactory.create("testObj", function(obj) {
+ testObj = obj;
+ });
});
client.awaitInit();
// ignore first message (call to myFactory.create())
client.awaitMessage();
-
- // second message connects to destroyed signal and contains the new objects ID
- var msg = client.awaitMessage();
- verify(msg.object);
-
- var testObjId = msg.object;
- compare(msg.type, JSClient.QWebChannelMessageTypes.connectToSignal);
- compare(typeof channel.objects[testObjId], "object");
-
client.awaitIdle();
- channel.objects[testObjId].deleteLater();
- msg = client.awaitMessage();
+ verify(testObj);
+ var testObjId = testObj.__id__;
+
+ testObj.deleteLater();
+ var msg = client.awaitMessage();
compare(msg.type, JSClient.QWebChannelMessageTypes.invokeMethod);
compare(msg.object, testObjId);
@@ -329,14 +321,10 @@ TestCase {
});
client.awaitInit();
- // first message (call to myFactory.create())
+ // call to myFactory.create()
var msg = client.awaitMessage();
compare(msg.type, JSClient.QWebChannelMessageTypes.invokeMethod);
- // second message connects to destroyed signal
- msg = client.awaitMessage();
- compare(msg.type, JSClient.QWebChannelMessageTypes.connectToSignal);
-
client.awaitIdle();
testObj.myProperty = 42;