diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-13 04:47:54 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-13 04:47:54 (GMT) |
commit | 2e1ad8b5d2b1927e80a3bd08209a75199e241b3c (patch) | |
tree | f4c3a97b17d1a2f19b1aacd9c5d1658b97f6c24c /tests/auto/declarative/xmlhttprequest/data/cdata.qml | |
parent | 3e16a19ba08b68aa92fd1eed5d5455fe02ef073f (diff) | |
download | Qt-2e1ad8b5d2b1927e80a3bd08209a75199e241b3c.zip Qt-2e1ad8b5d2b1927e80a3bd08209a75199e241b3c.tar.gz Qt-2e1ad8b5d2b1927e80a3bd08209a75199e241b3c.tar.bz2 |
XMLHttpRequest tests
Diffstat (limited to 'tests/auto/declarative/xmlhttprequest/data/cdata.qml')
-rw-r--r-- | tests/auto/declarative/xmlhttprequest/data/cdata.qml | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/tests/auto/declarative/xmlhttprequest/data/cdata.qml b/tests/auto/declarative/xmlhttprequest/data/cdata.qml new file mode 100644 index 0000000..5faa359 --- /dev/null +++ b/tests/auto/declarative/xmlhttprequest/data/cdata.qml @@ -0,0 +1,135 @@ +import Qt 4.6 + +Object { + property bool xmlTest: false + property bool dataOK: false + + Script { + function checkCData(text, whitespacetext) + { + // This is essentially a copy of text.qml/checkText() + + if (text == null) + return; + + if (text.nodeName != "#cdata-section") + return; + + if (text.nodeValue != "Hello world!") + return; + + if (text.nodeType != 4) + 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 != "#cdata-section") + return; + + if (whitespacetext.nodeValue != " ") + return; + + if (whitespacetext.nodeType != 4) + 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) + { + checkCData(document.documentElement.childNodes[0].childNodes[0], + document.documentElement.childNodes[1].childNodes[0]); + + } + } + + Component.onCompleted: { + var x = new XMLHttpRequest; + + x.open("GET", "cdata.xml"); + + // Test to the end + x.onreadystatechange = function() { + if (x.readyState == XMLHttpRequest.DONE) { + + dataOK = true; + + if (x.responseXML != null) + checkXML(x.responseXML); + + } + } + + x.send() + } +} + + + + + |