diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qml/WebChannelTest.qml | 16 | ||||
-rw-r--r-- | tests/qml/data/grouping.html | 2 | ||||
-rw-r--r-- | tests/qml/tst_metaobjectpublisher.qml | 22 |
3 files changed, 26 insertions, 14 deletions
diff --git a/tests/qml/WebChannelTest.qml b/tests/qml/WebChannelTest.qml index 59a0cab..9a0baa9 100644 --- a/tests/qml/WebChannelTest.qml +++ b/tests/qml/WebChannelTest.qml @@ -131,7 +131,7 @@ TestCase { verify(msg); verify(msg.data); verify(msg.data.type); - compare(msg.data.type, "Qt.init"); + compare(msg.data.type, qWebChannelMessageTypes.init); } function awaitIdle() @@ -139,7 +139,19 @@ TestCase { var msg = awaitMessage(); verify(msg); verify(msg.data); - compare(msg.data.type, "Qt.idle"); + compare(msg.data.type, qWebChannelMessageTypes.idle); verify(webChannel.test_clientIsIdle()) } + + property var qWebChannelMessageTypes: ({ + signal: 1, + propertyUpdate: 2, + init: 3, + idle: 4, + debug: 5, + invokeMethod: 6, + connectToSignal: 7, + disconnectFromSignal: 8, + setProperty: 9, + }); } diff --git a/tests/qml/data/grouping.html b/tests/qml/data/grouping.html index 60fa0f8..f2d7aec 100644 --- a/tests/qml/data/grouping.html +++ b/tests/qml/data/grouping.html @@ -5,7 +5,7 @@ <script type="text/javascript"> //BEGIN SETUP window.channel = createWebChannel(function(channel) { - channel.subscribe("Qt.propertyUpdate", function() { + channel.subscribe(QWebChannelMessageTypes.propertyUpdate, function() { channel.exec({label: "gotPropertyUpdate", values: [myObj.myProperty(), myOtherObj.foo(), myOtherObj.bar()]}); }); }); diff --git a/tests/qml/tst_metaobjectpublisher.qml b/tests/qml/tst_metaobjectpublisher.qml index fed52d8..e07f105 100644 --- a/tests/qml/tst_metaobjectpublisher.qml +++ b/tests/qml/tst_metaobjectpublisher.qml @@ -102,7 +102,7 @@ WebChannelTest { msg = awaitMessage(); verify(msg); verify(msg.data); - } while (msg.data.type === "Qt.idle"); + } while (msg.data.type === qWebChannelMessageTypes.idle); return msg; } @@ -145,7 +145,7 @@ WebChannelTest { webChannel.sendMessage("invokeMethod", "test"); var msg = awaitMessage(); - compare(msg.data.type, "Qt.invokeMethod"); + compare(msg.data.type, qWebChannelMessageTypes.invokeMethod); compare(msg.data.object, "myObj"); compare(msg.data.args, ["test"]); @@ -158,7 +158,7 @@ WebChannelTest { awaitInit(); var msg = awaitMessage(); - compare(msg.data.type, "Qt.connectToSignal"); + compare(msg.data.type, qWebChannelMessageTypes.connectToSignal); compare(msg.data.object, "myObj"); awaitIdle(); @@ -197,27 +197,27 @@ WebChannelTest { awaitInit(); var msg = awaitMessageSkipIdle(); - compare(msg.data.type, "Qt.invokeMethod"); + compare(msg.data.type, qWebChannelMessageTypes.invokeMethod); compare(msg.data.object, "myFactory"); verify(myFactory.lastObj); compare(myFactory.lastObj.objectName, "testObj"); msg = awaitMessageSkipIdle(); - compare(msg.data.type, "Qt.connectToSignal"); + compare(msg.data.type, qWebChannelMessageTypes.connectToSignal); verify(msg.data.object); var objId = msg.data.object; msg = awaitMessageSkipIdle(); - compare(msg.data.type, "Qt.connectToSignal"); + compare(msg.data.type, qWebChannelMessageTypes.connectToSignal); compare(msg.data.object, objId); msg = awaitMessageSkipIdle(); - compare(msg.data.type, "Qt.setProperty"); + compare(msg.data.type, qWebChannelMessageTypes.setProperty); compare(msg.data.object, objId); compare(myFactory.lastObj.myProperty, 42); msg = awaitMessageSkipIdle(); - compare(msg.data.type, "Qt.invokeMethod"); + compare(msg.data.type, qWebChannelMessageTypes.invokeMethod); compare(msg.data.object, objId); compare(msg.data.args, ["foobar"]); @@ -229,7 +229,7 @@ WebChannelTest { webChannel.sendMessage("triggerDelete"); msg = awaitMessageSkipIdle(); - compare(msg.data.type, "Qt.invokeMethod"); + compare(msg.data.type, qWebChannelMessageTypes.invokeMethod); compare(msg.data.object, objId); webChannel.sendMessage("report"); @@ -245,7 +245,7 @@ WebChannelTest { awaitInit(); var msg = awaitMessage(); - compare(msg.data.type, "Qt.connectToSignal"); + compare(msg.data.type, qWebChannelMessageTypes.connectToSignal); compare(msg.data.object, "myObj"); awaitIdle(); @@ -257,7 +257,7 @@ WebChannelTest { compare(msg.data.args, [42]); msg = awaitMessage(); - compare(msg.data.type, "Qt.disconnectFromSignal"); + compare(msg.data.type, qWebChannelMessageTypes.disconnectFromSignal); compare(msg.data.object, "myObj"); myObj.mySignal(0); |