diff options
Diffstat (limited to 'tests/auto/declarative/qmlxmlhttprequest/data/responseText.qml')
-rw-r--r-- | tests/auto/declarative/qmlxmlhttprequest/data/responseText.qml | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/responseText.qml b/tests/auto/declarative/qmlxmlhttprequest/data/responseText.qml new file mode 100644 index 0000000..4bb3a7a --- /dev/null +++ b/tests/auto/declarative/qmlxmlhttprequest/data/responseText.qml @@ -0,0 +1,52 @@ +import Qt 4.6 + +QtObject { + property string url + property string expectedText + + property bool unsent: false + property bool opened: false + property bool sent: false + property bool headersReceived: false + + property bool loading: false + property bool done: false + + property bool reset: false + + property bool dataOK: false + + Component.onCompleted: { + var x = new XMLHttpRequest; + + unsent = (x.responseText == ""); + + x.open("GET", url); + + opened = (x.responseText == ""); + + // Test to the end + x.onreadystatechange = function() { + if (x.readyState == XMLHttpRequest.HEADERS_RECEIVED) { + headersReceived = (x.responseText == ""); + } else if (x.readyState == XMLHttpRequest.LOADING) { + if (x.responseText == expectedText) + loading = true; + } else if (x.readyState == XMLHttpRequest.DONE) { + if (x.responseText == expectedText) + done = true; + + dataOK = (x.responseText == expectedText); + + x.open("GET", url); + + reset = (x.responseText == ""); + } + } + + x.send() + + sent = (x.responseText == ""); + } +} + |