diff options
Diffstat (limited to 'tests/auto/qml/tst_webchannel.qml')
-rw-r--r-- | tests/auto/qml/tst_webchannel.qml | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/auto/qml/tst_webchannel.qml b/tests/auto/qml/tst_webchannel.qml index f41c4fa..3bfbfc9 100644 --- a/tests/auto/qml/tst_webchannel.qml +++ b/tests/auto/qml/tst_webchannel.qml @@ -67,6 +67,8 @@ TestCase { WebChannel.id: "myOtherObj" } property var lastFactoryObj + QtObject{ id: bar; objectName: "bar" } + QtObject{ id: baz; objectName: "baz" } QtObject { id: myFactory function create(id) @@ -74,9 +76,13 @@ TestCase { lastFactoryObj = component.createObject(myFactory, {objectName: id}); return lastFactoryObj; } + property var objectInProperty: QtObject { + objectName: "foo" + } + property var otherObject: myObj + property var objects: [ bar, baz ]; WebChannel.id: "myFactory" } - Component { id: component QtObject { @@ -276,6 +282,15 @@ TestCase { lastFactoryObj.mySignal("foobar", 42); client.awaitSignal(); + // property should be wrapped + compare(channel.objects.myFactory.objectInProperty.objectName, "foo"); + // list property as well + compare(channel.objects.myFactory.objects.length, 2); + compare(channel.objects.myFactory.objects[0].objectName, "bar"); + compare(channel.objects.myFactory.objects[1].objectName, "baz"); + // also works with properties that reference other registered objects + compare(channel.objects.myFactory.otherObject, channel.objects.myObj); + // deleteLater call msg = client.awaitMessage(); compare(msg.type, JSClient.QWebChannelMessageTypes.invokeMethod); |