Use V4 binding for non-final properties where possible
[profile/ivi/qtdeclarative.git] / tests / auto / qml / qqmlecmascript / data / sequenceConversion.threads.qml
1 import QtQuick 2.0
2 import Qt.test 1.0
3
4 Item {
5     id: root
6     objectName: "root"
7
8     MySequenceConversionObject {
9         id: msco
10         objectName: "msco"
11     }
12
13     property bool success: false
14     property bool finished: false
15
16     function testIntSequence() {
17         msco.intListProperty = [ 0, 1, 2, 3, 4, 5, 6, 7 ];
18         worker.sendSequence(msco.intListProperty);
19     }
20
21     function testQrealSequence() {
22         msco.qrealListProperty = [ 0.1, 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1 ];
23         worker.sendSequence(msco.qrealListProperty);
24     }
25
26     function testBoolSequence() {
27         msco.boolListProperty = [ false, true, true, false, false, true, false, true ];
28         worker.sendSequence(msco.boolListProperty);
29     }
30
31     function testStringSequence() {
32         msco.stringListProperty = [ "one", "two", "three", "four" ];
33         worker.sendSequence(msco.stringListProperty);
34     }
35
36     function testQStringSequence() {
37         msco.qstringListProperty = [ "one", "two", "three", "four" ];
38         worker.sendSequence(msco.qstringListProperty);
39     }
40
41     function testUrlSequence() {
42         msco.urlListProperty = [ "www.example1.com", "www.example2.com", "www.example3.com", "www.example4.com" ];
43         worker.sendSequence(msco.urlListProperty);
44     }
45
46     function testVariantSequence() {
47         msco.variantListProperty = [ "one", true, 3, "four" ];
48         worker.sendSequence(msco.variantListProperty);
49     }
50
51     WorkerScript {
52         id: worker
53         source: "threadScript.js"
54
55         property variant expected
56         property variant response
57
58         function sendSequence(seq) {
59             root.success = false;
60             root.finished = false;
61             worker.expected = seq;
62             worker.sendMessage(seq);
63         }
64
65         onMessage: {
66             worker.response = messageObject;
67             if (worker.response.toString() == worker.expected.toString())
68                 root.success = true;
69             else
70                 root.success = false;
71             root.finished = true;
72         }
73     }
74 }