From e3e4d6a18d63537459f0e616360e53e816927f76 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Wed, 5 Feb 2014 16:03:20 +0100 Subject: Use an enum for message types instead of strings. This further reduces the network traffic and thus leads to a small performance boost. Personally, I also think this code is a bit nicer to read and grasp. Change-Id: I943c621142e9982f0e52d24e3a0976428856541b Reviewed-by: Simon Hausmann Reviewed-by: Frederik Gladhorn --- tests/qml/WebChannelTest.qml | 16 ++++++++++++++-- tests/qml/data/grouping.html | 2 +- tests/qml/tst_metaobjectpublisher.qml | 22 +++++++++++----------- 3 files changed, 26 insertions(+), 14 deletions(-) (limited to 'tests') 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 @@