diff options
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); |