summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLutz Schönemann <lutz.schoenemann@basyskom.com>2014-08-18 18:11:34 +0200
committerLutz Schönemann <lutz.schoenemann@basyskom.com>2014-08-19 09:41:56 +0200
commit6766582f7b52de38d4cae197766099ae2242ae3e (patch)
treea0a1f94c56c74f34f816448277c35ae32c216b6c /tests
parentb91b39a7e4f0156706fde4a77379719df86e6bfa (diff)
downloadqtwebchannel-6766582f7b52de38d4cae197766099ae2242ae3e.tar.gz
Fixing property update for wrapped objects
Returned QObject pointer got wrapped correctly but a wrong QJsonObject was given to initializePropertyUpdates() method. Change-Id: I157b862ba2a90e87c295beb3c02fff932aac83c6 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/tst_webchannel.qml30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/qml/tst_webchannel.qml b/tests/auto/qml/tst_webchannel.qml
index cd7d14e..46ac209 100644
--- a/tests/auto/qml/tst_webchannel.qml
+++ b/tests/auto/qml/tst_webchannel.qml
@@ -303,6 +303,36 @@ TestCase {
compare(typeof channel.objects[testObjId], "undefined");
}
+ function test_wrapper_propertyUpdateOfWrappedObjects() {
+ var testObj;
+ var testObjId;
+ var channel = client.createChannel(function(channel) {
+ channel.objects.myFactory.create("testObj", function(obj) {
+ testObj = myFactory.lastObj;
+ testObjId = obj.__id__;
+ });
+ });
+ client.awaitInit();
+
+ // first message (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;
+ client.awaitIdle();
+ compare(channel.objects[testObjId].myProperty, 42);
+
+ channel.objects[testObjId].deleteLater();
+ msg = client.awaitMessage();
+ compare(msg.type, JSClient.QWebChannelMessageTypes.invokeMethod);
+ }
+
function test_disconnect()
{
var signalArg;