diff options
author | Valery Kotov <kotov.valery@gmail.com> | 2015-04-07 20:34:44 +0300 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-04-16 17:44:29 +0000 |
commit | 43961057a973715856486c596959213bd911df73 (patch) | |
tree | 95a93b3f273a0540c5063331e942da738207bd27 /tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp | |
parent | 4930941197576c6017451856beb59a0ff8d045bd (diff) |
QML Engine: JSON XHR response type support
Support for "json" response type for QQmlXMLHttpRequest was
added.
[ChangeLog][QtQml][QQmlXMLHttpRequest] QQmlXMLHttpRequest now
supports "json" binary response type.
Change-Id: I21b7659c02dfdc6b64a73e1d2003e269d90b3b23
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp')
-rw-r--r-- | tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp index dd70f81d5e..d901c4dd14 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp +++ b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp @@ -88,6 +88,7 @@ private slots: void getAllResponseHeaders_sent(); void getAllResponseHeaders_args(); void getBinaryData(); + void getJsonData(); void status(); void status_data(); void statusText(); @@ -835,6 +836,23 @@ void tst_qqmlxmlhttprequest::getBinaryData() QTRY_VERIFY(object->property("readSize").toInt() == fileInfo.size()); } +void tst_qqmlxmlhttprequest::getJsonData() +{ + TestHTTPServer server; + QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString())); + QVERIFY(server.wait(testFileUrl("receive_json_data.expect"), + testFileUrl("receive_binary_data.reply"), + testFileUrl("json.data"))); + + QQmlComponent component(&engine, testFileUrl("receiveJsonData.qml")); + QScopedPointer<QObject> object(component.beginCreate(engine.rootContext())); + QVERIFY(!object.isNull()); + object->setProperty("url", "http://127.0.0.1:14445/json.data"); + component.completeCreate(); + + QTRY_VERIFY(object->property("result").toBool()); +} + void tst_qqmlxmlhttprequest::status() { QFETCH(QUrl, replyUrl); |