aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-22 17:15:30 +0200
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-04-25 12:02:55 +0000
commit79d56651edc05133ebae13bb93733373b10380f9 (patch)
treed60393857c0f1b28f9e34c55f4461e2f25c99a9e /tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
parentbfd596f36724029441d54095a126d25168e105c1 (diff)
Prospective fix for flakey "network" related QML testsv5.4.2
Replace hard-coded server ports with dynamically allocated ports. Change-Id: Iab8f9a88343a9f2c49af3cd700c954c13c3bf121 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Diffstat (limited to 'tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp')
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
index 0a8090ab07..521ed335b2 100644
--- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
@@ -44,9 +44,6 @@
#include "../../shared/testhttpserver.h"
#include "../../shared/util.h"
-#define SERVER_ADDR "http://127.0.0.1:14456"
-#define SERVER_PORT 14456
-
// Note: this test does not use module identifier directives in the qmldir files, because
// it would result in repeated attempts to insert types into the same namespace.
// This occurs because type registration is process-global, while the test
@@ -240,12 +237,13 @@ void tst_qqmlmoduleplugin::importPluginWithQmlFile()
void tst_qqmlmoduleplugin::remoteImportWithQuotedUrl()
{
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
server.serveDirectory(m_dataImportsDirectory);
QQmlEngine engine;
QQmlComponent component(&engine);
- component.setData("import \"" SERVER_ADDR "/org/qtproject/PureQmlModule\" \nComponentA { width: 300; ComponentB{} }", QUrl());
+ const QString qml = "import \"" + server.urlString("/org/qtproject/PureQmlModule") + "\" \nComponentA { width: 300; ComponentB{} }";
+ component.setData(qml.toUtf8(), QUrl());
QTRY_COMPARE(component.status(), QQmlComponent::Ready);
QObject *object = component.create();
@@ -261,7 +259,7 @@ void tst_qqmlmoduleplugin::remoteImportWithQuotedUrl()
void tst_qqmlmoduleplugin::remoteImportWithUnquotedUri()
{
TestHTTPServer server;
- QVERIFY2(server.listen(SERVER_PORT), qPrintable(server.errorString()));
+ QVERIFY2(server.listen(), qPrintable(server.errorString()));
server.serveDirectory(m_dataImportsDirectory);
QQmlEngine engine;