Initial import from the monolithic Qt.
[profile/ivi/qtdeclarative.git] / tests / auto / declarative / qdeclarativexmlhttprequest / data / attr.qml
1 import QtQuick 1.0
2
3 QtObject {
4     property bool xmlTest: false
5     property bool dataOK: false
6
7     function checkAttr(documentElement, attr)
8     {
9         if (attr == null)
10             return;
11
12         if (attr.name != "attr")
13             return;
14
15         if (attr.value != "myvalue")
16             return;
17
18         if (attr.ownerElement.tagName != documentElement.tagName)
19             return;
20
21         if (attr.nodeName != "attr")
22             return;
23
24         if (attr.nodeValue != "myvalue")
25             return;
26
27         if (attr.nodeType != 2)
28             return;
29
30         if (attr.childNodes.length != 0)
31             return;
32
33         if (attr.firstChild != null)
34             return;
35
36         if (attr.lastChild != null)
37             return;
38
39         if (attr.previousSibling != null)
40             return;
41
42         if (attr.nextSibling != null)
43             return;
44
45         if (attr.attributes != null)
46             return;
47
48         xmlTest = true;
49     }
50
51     function checkXML(document)
52     {
53         checkAttr(document.documentElement, document.documentElement.attributes[0]);
54     }
55
56     Component.onCompleted: {
57         var x = new XMLHttpRequest;
58
59         x.open("GET", "attr.xml");
60
61         // Test to the end
62         x.onreadystatechange = function() {
63             if (x.readyState == XMLHttpRequest.DONE) {
64
65                 dataOK = true;
66
67                 if (x.responseXML != null)
68                     checkXML(x.responseXML);
69
70             }
71         }
72
73         x.send()
74     }
75 }
76
77
78