From ffad3845615cf4c7a8343d47d55c88e10c4db405 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Wed, 16 Jul 2014 13:51:07 +0200 Subject: Explicitly distinguish between JavaScript Client and QML Client. It worked before, but this patch makes the code more explicit. Change-Id: Id7cf90cb3e2488106e08077e9a8165112734dd88 Reviewed-by: Michael Bruning --- tests/auto/qml/Client.qml | 10 +++++----- tests/auto/qml/tst_metaobjectpublisher.qml | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 17 deletions(-) (limited to 'tests') diff --git a/tests/auto/qml/Client.qml b/tests/auto/qml/Client.qml index 3a60235..9904fe8 100644 --- a/tests/auto/qml/Client.qml +++ b/tests/auto/qml/Client.qml @@ -44,7 +44,7 @@ import QtTest 1.0 import QtWebChannel 1.0 import QtWebChannel.Tests 1.0 -import "qrc:///qtwebchannel/qwebchannel.js" as Client +import "qrc:///qtwebchannel/qwebchannel.js" as JSClient Item { TestTransport { @@ -108,7 +108,7 @@ Item { function createChannel(callback, raw) { - return new Client.QWebChannel(clientTransport, callback, raw); + return new JSClient.QWebChannel(clientTransport, callback, raw); } function cleanup() @@ -140,7 +140,7 @@ Item { verify(msg); verify(msg.data); verify(msg.data.type); - compare(msg.data.type, Client.QWebChannelMessageTypes.init); + compare(msg.data.type, JSClient.QWebChannelMessageTypes.init); } function awaitIdle() @@ -148,7 +148,7 @@ Item { var msg = awaitMessage(); verify(msg); verify(msg.data); - compare(msg.data.type, Client.QWebChannelMessageTypes.idle); + compare(msg.data.type, JSClient.QWebChannelMessageTypes.idle); verify(webChannel.clientIsIdle()) } @@ -159,7 +159,7 @@ Item { msg = awaitMessage(); verify(msg); verify(msg.data); - } while (msg.data.type === Client.QWebChannelMessageTypes.idle); + } while (msg.data.type === JSClient.QWebChannelMessageTypes.idle); return msg; } diff --git a/tests/auto/qml/tst_metaobjectpublisher.qml b/tests/auto/qml/tst_metaobjectpublisher.qml index 52e1f09..9b2088c 100644 --- a/tests/auto/qml/tst_metaobjectpublisher.qml +++ b/tests/auto/qml/tst_metaobjectpublisher.qml @@ -44,7 +44,7 @@ import QtTest 1.0 import QtWebChannel 1.0 import QtWebChannel.Tests 1.0 -import "qrc:///qtwebchannel/qwebchannel.js" as Client +import "qrc:///qtwebchannel/qwebchannel.js" as JSClient TestCase { name: "MetaObjectPublisher" @@ -160,7 +160,7 @@ TestCase { webChannel.sendMessage("invokeMethod", "test"); var msg = client.awaitMessage(); - compare(msg.data.type, Client.QWebChannelMessageTypes.invokeMethod); + compare(msg.data.type, JSClient.QWebChannelMessageTypes.invokeMethod); compare(msg.data.object, "myObj"); compare(msg.data.args, ["test"]); @@ -177,7 +177,7 @@ TestCase { client.awaitInit(); var msg = client.awaitMessage(); - compare(msg.data.type, Client.QWebChannelMessageTypes.connectToSignal); + compare(msg.data.type, JSClient.QWebChannelMessageTypes.connectToSignal); compare(msg.data.object, "myObj"); client.awaitIdle(); @@ -192,7 +192,7 @@ TestCase { function test_grouping() { var channel = client.createChannel(function(channel) { - channel.subscribe(Client.QWebChannelMessageTypes.propertyUpdate, function() { + channel.subscribe(JSClient.QWebChannelMessageTypes.propertyUpdate, function() { channel.exec({label: "gotPropertyUpdate", values: [channel.objects.myObj.myProperty, channel.objects.myOtherObj.foo, channel.objects.myOtherObj.bar]}); }); }); @@ -235,27 +235,27 @@ TestCase { client.awaitInit(); var msg = client.awaitMessageSkipIdle(); - compare(msg.data.type, Client.QWebChannelMessageTypes.invokeMethod); + compare(msg.data.type, JSClient.QWebChannelMessageTypes.invokeMethod); compare(msg.data.object, "myFactory"); verify(myFactory.lastObj); compare(myFactory.lastObj.objectName, "testObj"); msg = client.awaitMessageSkipIdle(); - compare(msg.data.type, Client.QWebChannelMessageTypes.connectToSignal); + compare(msg.data.type, JSClient.QWebChannelMessageTypes.connectToSignal); verify(msg.data.object); var objId = msg.data.object; msg = client.awaitMessageSkipIdle(); - compare(msg.data.type, Client.QWebChannelMessageTypes.connectToSignal); + compare(msg.data.type, JSClient.QWebChannelMessageTypes.connectToSignal); compare(msg.data.object, objId); msg = client.awaitMessageSkipIdle(); - compare(msg.data.type, Client.QWebChannelMessageTypes.setProperty); + compare(msg.data.type, JSClient.QWebChannelMessageTypes.setProperty); compare(msg.data.object, objId); compare(myFactory.lastObj.myProperty, 42); msg = client.awaitMessageSkipIdle(); - compare(msg.data.type, Client.QWebChannelMessageTypes.invokeMethod); + compare(msg.data.type, JSClient.QWebChannelMessageTypes.invokeMethod); compare(msg.data.object, objId); compare(msg.data.args, ["foobar"]); @@ -267,7 +267,7 @@ TestCase { webChannel.sendMessage("triggerDelete"); msg = client.awaitMessageSkipIdle(); - compare(msg.data.type, Client.QWebChannelMessageTypes.invokeMethod); + compare(msg.data.type, JSClient.QWebChannelMessageTypes.invokeMethod); compare(msg.data.object, objId); client.awaitIdle(); @@ -293,7 +293,7 @@ TestCase { client.awaitInit(); var msg = client.awaitMessage(); - compare(msg.data.type, Client.QWebChannelMessageTypes.connectToSignal); + compare(msg.data.type, JSClient.QWebChannelMessageTypes.connectToSignal); compare(msg.data.object, "myObj"); client.awaitIdle(); @@ -305,7 +305,7 @@ TestCase { compare(msg.data.args, [42]); msg = client.awaitMessage(); - compare(msg.data.type, Client.QWebChannelMessageTypes.disconnectFromSignal); + compare(msg.data.type, JSClient.QWebChannelMessageTypes.disconnectFromSignal); compare(msg.data.object, "myObj"); myObj.mySignal(0); -- cgit v1.2.1