Prevents conflicts when tests are run in parallel.
Change-Id: Ic1652d963da291c7c41b31e2621874824fa575cb
Reviewed-by: Damian Jansen <damian.jansen@nokia.com>
#include "../../shared/testhttpserver.h"
#include "../../shared/util.h"
-#define SERVER_ADDR "http://127.0.0.1:14450"
-#define SERVER_PORT 14450
+#define SERVER_ADDR "http://127.0.0.1:14456"
+#define SERVER_PORT 14456
class tst_qqmlmoduleplugin : public QQmlDataTest
QQmlEngine engine;
QQmlComponent component(&engine);
- component.setData("import \"http://127.0.0.1:14450/com/nokia/PureQmlModule\" \nComponentA { width: 300; ComponentB{} }", QUrl());
+ component.setData("import \"" SERVER_ADDR "/com/nokia/PureQmlModule\" \nComponentA { width: 300; ComponentB{} }", QUrl());
QTRY_COMPARE(component.status(), QQmlComponent::Ready);
QObject *object = component.create();
#include <QtQuick/QQuickView>
#include <QtQuick/QQuickItem>
-#define SERVER_PORT 14448
+#define SERVER_PORT 14457
+#define SERVER_ADDR "http://localhost:14457"
class tst_qquickfontloader : public QQmlDataTest
{
#if defined(Q_OS_WIN)
QSKIP("Windows doesn't support font loading.");
#endif
- QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"http://localhost:14448/tarzeau_ocr_a.ttf\" }";
+ QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" SERVER_ADDR "/tarzeau_ocr_a.ttf\" }";
QQmlComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
#endif
server.addRedirect("olddir/oldname.ttf","../tarzeau_ocr_a.ttf");
- QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"http://localhost:14448/olddir/oldname.ttf\" }";
+ QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" SERVER_ADDR "/olddir/oldname.ttf\" }";
QQmlComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
#if defined(Q_OS_WIN)
QSKIP("Windows doesn't support font loading.");
#endif
- QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"http://localhost:14448/nonexist.ttf\" }";
- QTest::ignoreMessage(QtWarningMsg, "file::2:1: QML FontLoader: Cannot load font: \"http://localhost:14448/nonexist.ttf\"");
+ QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" SERVER_ADDR "/nonexist.ttf\" }";
+ QTest::ignoreMessage(QtWarningMsg, "file::2:1: QML FontLoader: Cannot load font: \"" SERVER_ADDR "/nonexist.ttf\"");
QQmlComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create());
QCOMPARE(statusSpy.count(), 0);
QTRY_COMPARE(fontObject->name(), QString("OCRA"));
- ctxt->setContextProperty("font", "http://localhost:14448/daniel.ttf");
+ ctxt->setContextProperty("font", SERVER_ADDR "/daniel.ttf");
QTRY_VERIFY(fontObject->status() == QQuickFontLoader::Loading);
QTRY_VERIFY(fontObject->status() == QQuickFontLoader::Ready);
QCOMPARE(nameSpy.count(), 1);
QCOMPARE(statusSpy.count(), 2);
QTRY_COMPARE(fontObject->name(), QString("OCRA"));
- ctxt->setContextProperty("font", "http://localhost:14448/daniel.ttf");
+ ctxt->setContextProperty("font", SERVER_ADDR "/daniel.ttf");
QTRY_VERIFY(fontObject->status() == QQuickFontLoader::Ready);
QCOMPARE(nameSpy.count(), 3);
QCOMPARE(statusSpy.count(), 2);
}
Component.onCompleted: {
- loader.setSource("http://127.0.0.1:14450/InitialPropertyValuesComponent.qml", {"canary": 6});
+ loader.setSource("http://127.0.0.1:14458/InitialPropertyValuesComponent.qml", {"canary": 6});
loader.active = true;
}
}
#include "testhttpserver.h"
#include "../../shared/util.h"
-#define SERVER_PORT 14450
+#define SERVER_PORT 14458
+#define SERVER_ADDR "http://localhost:14458"
class PeriodicIncubationController : public QObject,
public QQmlIncubationController
server.serveDirectory(dataDirectory());
QQmlComponent component(&engine);
- component.setData(QByteArray("import QtQuick 2.0\nLoader { property int signalCount : 0; source: \"http://127.0.0.1:14450/Rect120x60.qml\"; onLoaded: signalCount += 1 }"), testFileUrl("../dummy.qml"));
+ component.setData(QByteArray("import QtQuick 2.0\nLoader { property int signalCount : 0; source: \"" SERVER_ADDR "/Rect120x60.qml\"; onLoaded: signalCount += 1 }"), testFileUrl("../dummy.qml"));
if (component.isError())
qDebug() << component.errors();
QQuickLoader *loader = qobject_cast<QQuickLoader*>(component.create());
QQmlComponent component(&engine);
component.setData(QByteArray(
"import QtQuick 2.0\n"
- "import \"http://127.0.0.1:14450/\" as NW\n"
+ "import \"" SERVER_ADDR "/\" as NW\n"
"Item {\n"
" Component { id: comp; NW.Rect120x60 {} }\n"
" Loader { sourceComponent: comp } }")
QVERIFY(server.isValid());
server.serveDirectory(dataDirectory());
- QTest::ignoreMessage(QtWarningMsg, "http://127.0.0.1:14450/IDontExist.qml: File not found");
+ QTest::ignoreMessage(QtWarningMsg, SERVER_ADDR "/IDontExist.qml: File not found");
QQmlComponent component(&engine);
- component.setData(QByteArray("import QtQuick 2.0\nLoader { property int did_load: 123; source: \"http://127.0.0.1:14450/IDontExist.qml\"; onLoaded: did_load=456 }"), QUrl::fromLocalFile("http://127.0.0.1:14450/dummy.qml"));
+ component.setData(QByteArray("import QtQuick 2.0\nLoader { property int did_load: 123; source: \"" SERVER_ADDR "/IDontExist.qml\"; onLoaded: did_load=456 }"), QUrl(QString(SERVER_ADDR "/dummy.qml")));
QQuickLoader *loader = qobject_cast<QQuickLoader*>(component.create());
QVERIFY(loader != 0);
Text {
textFormat: Text.RichText
- text: "<img src='http://127.0.0.1:14453/exists.png'>"
+ text: "<img src='http://127.0.0.1:14459/exists.png'>"
}
Text {
textFormat: Text.RichText
- text: "<img src='http://127.0.0.1:14453/notexists.png'>"
+ text: "<img src='http://127.0.0.1:14459/notexists.png'>"
}
Text {
textFormat: Text.RichText
text: "<img src='exists.png'>"
- baseUrl: "http://127.0.0.1:14453/text.html"
+ baseUrl: "http://127.0.0.1:14459/text.html"
}
DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD)
+#define SERVER_PORT 14459
+#define SERVER_ADDR "http://127.0.0.1:14459"
+
Q_DECLARE_METATYPE(QQuickText::TextFormat)
class tst_qquicktext : public QQmlDataTest
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 http://127.0.0.1:14453/notexists.png - server replied: Not found";
+ << testFileUrl("embeddedImagesRemoteError.qml").toString()+":3:1: QML Text: Error downloading " SERVER_ADDR "/notexists.png - server replied: Not found";
QTest::newRow("remote") << testFileUrl("embeddedImagesRemoteRelative.qml") << "";
}
QFETCH(QUrl, qmlfile);
QFETCH(QString, error);
- TestHTTPServer server(14453);
+ TestHTTPServer server(SERVER_PORT);
server.serveDirectory(testFile("http"));
if (!error.isEmpty())
<< 181.;
QTest::newRow("absolute remote")
- << QUrl("http://127.0.0.1:14453/images/heart200.png")
+ << QUrl(SERVER_ADDR "/images/heart200.png")
<< QUrl()
<< QUrl()
<< 181.;
QTest::newRow("relative remote base 1")
<< QUrl("images/heart200.png")
- << QUrl("http://127.0.0.1:14453/")
+ << QUrl(SERVER_ADDR "/")
<< testFileUrl("nonexistant/app.qml")
<< 181.;
QTest::newRow("relative remote base 2")
<< QUrl("heart200.png")
- << QUrl("http://127.0.0.1:14453/images/")
+ << QUrl(SERVER_ADDR "/images/")
<< testFileUrl("nonexistant/app.qml")
<< 181.;
}
QFETCH(QUrl, contextUrl);
QFETCH(qreal, imgHeight);
- TestHTTPServer server(14453);
+ TestHTTPServer server(SERVER_PORT);
server.serveDirectory(testFile(""));
QByteArray baseUrlFragment;