summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/xmlhttprequest/data/text.qml
blob: 8c97504db64a18fdacfef7b79e1afb049e49c447 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import Qt 4.6

Object {
    property bool xmlTest: false
    property bool dataOK: false

    Script {
        function checkText(text, whitespacetext)
        {
            if (text == null)
                return;

            if (text.nodeName != "#text")
                return;

            if (text.nodeValue != "Hello world!")
                return;

            if (text.nodeType != 3)
                return;

            if (text.parentNode.nodeName != "item")
                return;

            if (text.childNodes.length != 0)
                return;

            if (text.firstChild != null)
                return;

            if (text.lastChild != null)
                return;

            if (text.previousSibling != null)
                return;

            if (text.nextSibling != null)
                return;

            if (text.attributes != null)
                return;

            if (text.wholeText != "Hello world!")
                return;

            if (text.data != "Hello world!")
                return;

            if (text.length != 12)
                return;

            if (text.isElementContentWhitespace != false)
                return;

            if (whitespacetext.nodeName != "#text")
                return;

            if (whitespacetext.nodeValue != "   ")
                return;

            if (whitespacetext.nodeType != 3)
                return;

            if (whitespacetext.parentNode.nodeName != "item")
                return;

            if (whitespacetext.childNodes.length != 0)
                return;

            if (whitespacetext.firstChild != null)
                return;

            if (whitespacetext.lastChild != null)
                return;

            if (whitespacetext.previousSibling != null)
                return;

            if (whitespacetext.nextSibling != null)
                return;

            if (whitespacetext.attributes != null)
                return;

            if (whitespacetext.wholeText != "   ")
                return;

            if (whitespacetext.data != "   ")
                return;

            if (whitespacetext.length != 3)
                return;

            if (whitespacetext.isElementContentWhitespace != true)
                return;

            xmlTest = true;
        }

        function checkXML(document)
        {
            checkText(document.documentElement.childNodes[0].childNodes[0],
                      document.documentElement.childNodes[1].childNodes[0]);

        }
    }

    Component.onCompleted: {
        var x = new XMLHttpRequest;

        x.open("GET", "text.xml");

        // Test to the end
        x.onreadystatechange = function() {
            if (x.readyState == XMLHttpRequest.DONE) {

                dataOK = true;

                if (x.responseXML != null)
                    checkXML(x.responseXML);

            }
        }

        x.send()
    }
}