diff options
Diffstat (limited to 'tests/auto/qml/tst_webchannelseparation.qml')
-rw-r--r-- | tests/auto/qml/tst_webchannelseparation.qml | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/tests/auto/qml/tst_webchannelseparation.qml b/tests/auto/qml/tst_webchannelseparation.qml index 289f8b2..8a74243 100644 --- a/tests/auto/qml/tst_webchannelseparation.qml +++ b/tests/auto/qml/tst_webchannelseparation.qml @@ -91,15 +91,16 @@ TestCase { } WebChannel.id: "myObj3" } + + property var lastFactoryObj + property var createdFactoryObjects: [] QtObject { id: myFactory - property var lastObj - property var createdObjects: [] function cleanup() { - while (createdObjects.length) { - var obj = createdObjects.shift(); + while (createdFactoryObjects.length) { + var obj = createdFactoryObjects.shift(); if (obj) { obj.destroy(); } @@ -108,9 +109,9 @@ TestCase { function create(id) { - lastObj = component.createObject(myFactory, {objectName: id}); - createdObjects.push(lastObj); - return lastObj; + lastFactoryObj = component.createObject(myFactory, {objectName: id}); + createdFactoryObjects.push(lastFactoryObj); + return lastFactoryObj; } WebChannel.id: "myFactory" } @@ -146,7 +147,8 @@ TestCase { client2.debug = false; // delete all created objects myFactory.cleanup(); - myFactory.lastObj = undefined; + lastFactoryObj = undefined; + createdFactoryObjects = []; // reschedule current task to end of event loop wait(1); } @@ -160,7 +162,7 @@ TestCase { var channel1 = client1.createChannel(function (channel1) { channel1.objects.myFactory.create("testObj1", function (obj1) { - testObj1 = myFactory.lastObj; + testObj1 = lastFactoryObj; testObj1Id = obj1.__id__; obj1.mySignal.connect(function (arg1_1, arg1_2) { @@ -182,7 +184,7 @@ TestCase { channel2 = client2.createChannel(function (channel2) { channel2.objects.myFactory.create("testObj2", function (obj2) { - testObj2 = myFactory.lastObj; + testObj2 = lastFactoryObj; testObj2Id = obj2.__id__; obj2.mySignal.connect(function (arg2_1, arg2_2) { console.debug("client 2 received signal 'mySignal'"); @@ -278,7 +280,7 @@ TestCase { var channel1 = client1.createChannel(function (channel1) { channel1.objects.myFactory.create("testObj1", function (obj1) { - testObj1 = myFactory.lastObj; + testObj1 = lastFactoryObj; testObj1Id = obj1.__id__; obj1.myPropertyChanged.connect(function (arg1_1) { @@ -300,7 +302,7 @@ TestCase { channel2 = client2.createChannel(function (channel2) { channel2.objects.myFactory.create("testObj2", function (obj2) { - testObj2 = myFactory.lastObj; + testObj2 = lastFactoryObj; testObj2Id = obj2.__id__; obj2.myPropertyChanged.connect(function (arg1_1) { console.debug("client 2 received property update 'myProperty' " + obj2.myProperty); |