summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2013-12-28 16:59:02 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-08 15:04:48 +0100
commit4d3167b97b8e48a9fcdb1c2b86467d75e7d669eb (patch)
tree0e335790074632bf05d62f276e9334ba54a41926 /tests
parenta5d8d21e5ff33b88c15f4767b3a0d04ad4dbed7a (diff)
downloadqtwebchannel-4d3167b97b8e48a9fcdb1c2b86467d75e7d669eb.tar.gz
Simplify QWebChannel usage by merging webchannel.js and qobject.js.
The code now resides in a single qwebchannel.js file and there is only a single callback-nesting required to setup a MetaObjectPublisher connection. The server-side will be simplified in the next step. Change-Id: Ib5fc77a03c2b281c61af91713411eed571ec6108 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/qml/data/bench_init.html7
-rw-r--r--tests/qml/data/disconnect.html17
-rw-r--r--tests/qml/data/grouping.html9
-rw-r--r--tests/qml/data/method.html9
-rw-r--r--tests/qml/data/property.html17
-rw-r--r--tests/qml/data/receiveRaw.html4
-rw-r--r--tests/qml/data/respond.html4
-rw-r--r--tests/qml/data/send.html4
-rw-r--r--tests/qml/data/signal.html9
-rw-r--r--tests/qml/data/wrapper.html29
10 files changed, 44 insertions, 65 deletions
diff --git a/tests/qml/data/bench_init.html b/tests/qml/data/bench_init.html
index ef18650..cb1b488 100644
--- a/tests/qml/data/bench_init.html
+++ b/tests/qml/data/bench_init.html
@@ -1,13 +1,10 @@
<html>
<head>
- <script type="text/javascript" src="qrc:///qwebchannel/webchannel.js"></script>
- <script type="text/javascript" src="qrc:///qwebchannel/qobject.js"></script>
+ <script type="text/javascript" src="qrc:///qwebchannel/qwebchannel.js"></script>
<script type="text/javascript">
//BEGIN SETUP
var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]);
- new QWebChannel(baseUrl, function(channel) {
- setupQObjectWebChannel(channel, function() {});
- });
+ new QWebChannel(baseUrl, function(channel) {});
//END SETUP
</script>
</head>
diff --git a/tests/qml/data/disconnect.html b/tests/qml/data/disconnect.html
index f4cbb0a..dc771b9 100644
--- a/tests/qml/data/disconnect.html
+++ b/tests/qml/data/disconnect.html
@@ -1,19 +1,16 @@
<html>
<head>
- <script type="text/javascript" src="qrc:///qwebchannel/webchannel.js"></script>
- <script type="text/javascript" src="qrc:///qwebchannel/qobject.js"></script>
+ <script type="text/javascript" src="qrc:///qwebchannel/qwebchannel.js"></script>
<script type="text/javascript">
//BEGIN SETUP
var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]);
new QWebChannel(baseUrl, function(channel) {
- setupQObjectWebChannel(channel, function() {
- myObj.mySignal.connect(function(arg) {
- channel.exec({label: "mySignalReceived", args: [arg]});
- myObj.mySignal.disconnect(this);
- });
- channel.subscribe("report", function() {
- channel.exec({label: "report"});
- });
+ myObj.mySignal.connect(function(arg) {
+ channel.exec({label: "mySignalReceived", args: [arg]});
+ myObj.mySignal.disconnect(this);
+ });
+ channel.subscribe("report", function() {
+ channel.exec({label: "report"});
});
});
//END SETUP
diff --git a/tests/qml/data/grouping.html b/tests/qml/data/grouping.html
index bb804f4..2a6c158 100644
--- a/tests/qml/data/grouping.html
+++ b/tests/qml/data/grouping.html
@@ -1,15 +1,12 @@
<html>
<head>
- <script type="text/javascript" src="qrc:///qwebchannel/webchannel.js"></script>
- <script type="text/javascript" src="qrc:///qwebchannel/qobject.js"></script>
+ <script type="text/javascript" src="qrc:///qwebchannel/qwebchannel.js"></script>
<script type="text/javascript">
//BEGIN SETUP
var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]);
window.channel = new QWebChannel(baseUrl, function(channel) {
- setupQObjectWebChannel(channel, function() {
- channel.subscribe("Qt.propertyUpdate", function() {
- channel.exec({label: "gotPropertyUpdate", values: [myObj.myProperty(), myOtherObj.foo(), myOtherObj.bar()]});
- });
+ channel.subscribe("Qt.propertyUpdate", function() {
+ channel.exec({label: "gotPropertyUpdate", values: [myObj.myProperty(), myOtherObj.foo(), myOtherObj.bar()]});
});
});
//END SETUP
diff --git a/tests/qml/data/method.html b/tests/qml/data/method.html
index 618550f..04048a6 100644
--- a/tests/qml/data/method.html
+++ b/tests/qml/data/method.html
@@ -1,15 +1,12 @@
<html>
<head>
- <script type="text/javascript" src="qrc:///qwebchannel/webchannel.js"></script>
- <script type="text/javascript" src="qrc:///qwebchannel/qobject.js"></script>
+ <script type="text/javascript" src="qrc:///qwebchannel/qwebchannel.js"></script>
<script type="text/javascript">
//BEGIN SETUP
var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]);
new QWebChannel(baseUrl, function(channel) {
- setupQObjectWebChannel(channel, function() {
- channel.subscribe("invokeMethod", function(arg) {
- myObj.myMethod(arg);
- });
+ channel.subscribe("invokeMethod", function(arg) {
+ myObj.myMethod(arg);
});
});
//END SETUP
diff --git a/tests/qml/data/property.html b/tests/qml/data/property.html
index 1a8360a..5d03118 100644
--- a/tests/qml/data/property.html
+++ b/tests/qml/data/property.html
@@ -1,19 +1,16 @@
<html>
<head>
- <script type="text/javascript" src="qrc:///qwebchannel/webchannel.js"></script>
- <script type="text/javascript" src="qrc:///qwebchannel/qobject.js"></script>
+ <script type="text/javascript" src="qrc:///qwebchannel/qwebchannel.js"></script>
<script type="text/javascript">
//BEGIN SETUP
var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]);
new QWebChannel(baseUrl, function(channel) {
- setupQObjectWebChannel(channel, function() {
- channel.exec({label: "init", value: myObj.myProperty()});
- myObj.myPropertyChanged.connect(function() {
- channel.exec({label: "changed", value: myObj.myProperty()});
- });
- channel.subscribe("setProperty", function(newValue) {
- myObj.myProperty = newValue;
- });
+ channel.exec({label: "init", value: myObj.myProperty()});
+ myObj.myPropertyChanged.connect(function() {
+ channel.exec({label: "changed", value: myObj.myProperty()});
+ });
+ channel.subscribe("setProperty", function(newValue) {
+ myObj.myProperty = newValue;
});
});
//END SETUP
diff --git a/tests/qml/data/receiveRaw.html b/tests/qml/data/receiveRaw.html
index cfe685e..7c98bab 100644
--- a/tests/qml/data/receiveRaw.html
+++ b/tests/qml/data/receiveRaw.html
@@ -1,12 +1,12 @@
<html>
<head>
- <script type="text/javascript" src="qrc:///qwebchannel/webchannel.js"></script>
+ <script type="text/javascript" src="qrc:///qwebchannel/qwebchannel.js"></script>
<script type="text/javascript">
//BEGIN SETUP
var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]);
new QWebChannel(baseUrl, function(channel) {
channel.send("foobar");
- });
+ }, true);
//END SETUP
</script>
</head>
diff --git a/tests/qml/data/respond.html b/tests/qml/data/respond.html
index 29e47b8..6c8db0d 100644
--- a/tests/qml/data/respond.html
+++ b/tests/qml/data/respond.html
@@ -1,6 +1,6 @@
<html>
<head>
- <script type="text/javascript" src="qrc:///qwebchannel/webchannel.js"></script>
+ <script type="text/javascript" src="qrc:///qwebchannel/qwebchannel.js"></script>
<script type="text/javascript">
//BEGIN SETUP
var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]);
@@ -8,7 +8,7 @@
channel.exec("foobar", function(response) {
channel.send("received:"+response);
});
- });
+ }, true);
//END SETUP
</script>
</head>
diff --git a/tests/qml/data/send.html b/tests/qml/data/send.html
index f30e9c8..7d601a8 100644
--- a/tests/qml/data/send.html
+++ b/tests/qml/data/send.html
@@ -1,6 +1,6 @@
<html>
<head>
- <script type="text/javascript" src="qrc:///qwebchannel/webchannel.js"></script>
+ <script type="text/javascript" src="qrc:///qwebchannel/qwebchannel.js"></script>
<script type="text/javascript">
//BEGIN SETUP
var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]);
@@ -8,7 +8,7 @@
channel.subscribe("myMessage", function(payload) {
channel.send("myMessagePong:" + payload);
});
- });
+ }, true);
//END SETUP
</script>
</head>
diff --git a/tests/qml/data/signal.html b/tests/qml/data/signal.html
index e3815cb..92b0ed5 100644
--- a/tests/qml/data/signal.html
+++ b/tests/qml/data/signal.html
@@ -1,15 +1,12 @@
<html>
<head>
- <script type="text/javascript" src="qrc:///qwebchannel/webchannel.js"></script>
- <script type="text/javascript" src="qrc:///qwebchannel/qobject.js"></script>
+ <script type="text/javascript" src="qrc:///qwebchannel/qwebchannel.js"></script>
<script type="text/javascript">
//BEGIN SETUP
var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]);
new QWebChannel(baseUrl, function(channel) {
- setupQObjectWebChannel(channel, function() {
- myObj.mySignal.connect(function(arg) {
- channel.exec({label: "signalReceived", value: arg});
- });
+ myObj.mySignal.connect(function(arg) {
+ channel.exec({label: "signalReceived", value: arg});
});
});
//END SETUP
diff --git a/tests/qml/data/wrapper.html b/tests/qml/data/wrapper.html
index 54f456b..9c4386c 100644
--- a/tests/qml/data/wrapper.html
+++ b/tests/qml/data/wrapper.html
@@ -1,26 +1,23 @@
<html>
<head>
- <script type="text/javascript" src="qrc:///qwebchannel/webchannel.js"></script>
- <script type="text/javascript" src="qrc:///qwebchannel/qobject.js"></script>
+ <script type="text/javascript" src="qrc:///qwebchannel/qwebchannel.js"></script>
<script type="text/javascript">
//BEGIN SETUP
var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]);
new QWebChannel(baseUrl, function(channel) {
- setupQObjectWebChannel(channel, function() {
- myFactory.create("testObj", function(obj) {
- window[obj.objectName()] = obj;
- obj.mySignal.connect(function(arg1, arg2) {
- channel.exec({label: "signalReceived", args: [arg1, arg2]});
- });
- obj.myProperty = 42;
- obj.myMethod("foobar");
- });
- channel.subscribe("triggerDelete", function() {
- testObj.deleteLater();
- });
- channel.subscribe("report", function() {
- channel.exec({label:"report", obj: testObj})
+ myFactory.create("testObj", function(obj) {
+ window[obj.objectName()] = obj;
+ obj.mySignal.connect(function(arg1, arg2) {
+ channel.exec({label: "signalReceived", args: [arg1, arg2]});
});
+ obj.myProperty = 42;
+ obj.myMethod("foobar");
+ });
+ channel.subscribe("triggerDelete", function() {
+ testObj.deleteLater();
+ });
+ channel.subscribe("report", function() {
+ channel.exec({label:"report", obj: testObj})
});
});
//END SETUP