--- /dev/null
- Host: 127.0.0.1:14445
+GET /json.data HTTP/1.1
+Accept-Language: en-US,*
+Content-Type: application/jsonrequest
+Connection: Keep-Alive
+Accept-Encoding: gzip, deflate
+User-Agent: Mozilla/5.0
++Host: {{ServerHostUrl}}
QTRY_VERIFY(object->property("readSize").toInt() == fileInfo.size());
}
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+void tst_qqmlxmlhttprequest::getJsonData()
+{
+ TestHTTPServer server;
- object->setProperty("url", "http://127.0.0.1:14445/json.data");
++ QVERIFY2(server.listen(), 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", server.urlString("/json.data"));
+ component.completeCreate();
+
+ QTRY_VERIFY(object->property("result").toBool());
+}
+
void tst_qqmlxmlhttprequest::status()
{
QFETCH(QUrl, replyUrl);
QFETCH(bool, remote);
QFETCH(QString, error);
+#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
+ if (qstrcmp(QTest::currentDataTag(), "remote") == 0
+ || qstrcmp(QTest::currentDataTag(), "remote not found") == 0) {
+ QSKIP("Remote tests cause occasional hangs in the CI system -- QTBUG-45655");
+ }
+#endif
+
TestHTTPServer server;
if (remote) {
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
server.serveDirectory(dataDirectory());
+ source = server.urlString(source);
+ error.replace(QStringLiteral("{{ServerBaseUrl}}"), server.baseUrl().toString());
}
if (!error.isEmpty())
QFETCH(bool, cache);
QFETCH(QString, error);
+
+#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
+ if (qstrcmp(QTest::currentDataTag(), "remote") == 0
+ || qstrcmp(QTest::currentDataTag(), "remote redirected") == 0
+ || qstrcmp(QTest::currentDataTag(), "remote svg") == 0
+ || qstrcmp(QTest::currentDataTag(), "remote svgz") == 0
+ || qstrcmp(QTest::currentDataTag(), "remote not found") == 0
+ ) {
+ QSKIP("Remote tests cause occasional hangs in the CI system -- QTBUG-45655");
+ }
+#endif
+
TestHTTPServer server;
if (remote) {
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
server.serveDirectory(dataDirectory());
- server.addRedirect("oldcolors.png", SERVER_ADDR "/colors.png");
+ server.addRedirect("oldcolors.png", server.urlString("/colors.png"));
+ source = server.urlString(source);
+ error.replace(QStringLiteral("{{ServerBaseUrl}}"), server.baseUrl().toString());
}
if (!error.isEmpty())
QTRY_COMPARE(statusSpy.count(), 3);
// Loading remote file again - should not go through 'Loading' state.
+ progressSpy.clear();
ctxt->setContextProperty("srcImage", testFileUrl("green.png"));
- ctxt->setContextProperty("srcImage", QString(SERVER_ADDR) + "/rect.png");
+ ctxt->setContextProperty("srcImage", server.url("/rect.png"));
QTRY_VERIFY(obj->status() == QQuickImage::Ready);
QTRY_VERIFY(obj->progress() == 1.0);
QTRY_COMPARE(sourceSpy.count(), 4);
QTest::newRow("local") << testFileUrl("embeddedImagesLocalRelative.qml") << "";
QTest::newRow("remote") << testFileUrl("embeddedImagesRemote.qml") << "";
QTest::newRow("remote-error") << testFileUrl("embeddedImagesRemoteError.qml")
- << testFileUrl("embeddedImagesRemoteError.qml").toString()+":3:1: QML Text: Error downloading " SERVER_ADDR "/notexists.png - server replied: Not found";
+ << testFileUrl("embeddedImagesRemoteError.qml").toString()+":3:1: QML Text: Error downloading {{ServerBaseUrl}}/notexists.png - server replied: Not found";
- QTest::newRow("remote") << testFileUrl("embeddedImagesRemoteRelative.qml") << "";
+ QTest::newRow("remote-relative") << testFileUrl("embeddedImagesRemoteRelative.qml") << "";
}
void tst_qquicktext::embeddedImages()
QFETCH(QUrl, qmlfile);
QFETCH(QString, error);
+#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
+ if (qstrcmp(QTest::currentDataTag(), "remote") == 0
+ || qstrcmp(QTest::currentDataTag(), "remote-error") == 0
+ || qstrcmp(QTest::currentDataTag(), "remote-relative") == 0) {
+ QSKIP("Remote tests cause occasional hangs in the CI system -- QTBUG-45655");
+ }
+#endif
+
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
server.serveDirectory(testFile("http"));
+ error.replace(QStringLiteral("{{ServerBaseUrl}}"), server.baseUrl().toString());
if (!error.isEmpty())
QTest::ignoreMessage(QtWarningMsg, error.toLatin1());