diff options
Diffstat (limited to 'tests/auto/qml/qqmlxmlhttprequest/data/attr.qml')
-rw-r--r-- | tests/auto/qml/qqmlxmlhttprequest/data/attr.qml | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/attr.qml b/tests/auto/qml/qqmlxmlhttprequest/data/attr.qml new file mode 100644 index 0000000000..b1c081c5fd --- /dev/null +++ b/tests/auto/qml/qqmlxmlhttprequest/data/attr.qml @@ -0,0 +1,78 @@ +import QtQuick 2.0 + +QtObject { + property bool xmlTest: false + property bool dataOK: false + + function checkAttr(documentElement, attr) + { + if (attr == null) + return; + + if (attr.name != "attr") + return; + + if (attr.value != "myvalue") + return; + + if (attr.ownerElement.tagName != documentElement.tagName) + return; + + if (attr.nodeName != "attr") + return; + + if (attr.nodeValue != "myvalue") + return; + + if (attr.nodeType != 2) + return; + + if (attr.childNodes.length != 0) + return; + + if (attr.firstChild != null) + return; + + if (attr.lastChild != null) + return; + + if (attr.previousSibling != null) + return; + + if (attr.nextSibling != null) + return; + + if (attr.attributes != null) + return; + + xmlTest = true; + } + + function checkXML(document) + { + checkAttr(document.documentElement, document.documentElement.attributes[0]); + } + + Component.onCompleted: { + var x = new XMLHttpRequest; + + x.open("GET", "attr.xml"); + + // Test to the end + x.onreadystatechange = function() { + if (x.readyState == XMLHttpRequest.DONE) { + + dataOK = true; + + if (x.responseXML != null) + checkXML(x.responseXML); + + } + } + + x.send() + } +} + + + |