summaryrefslogtreecommitdiff
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/network-settings.h14
-rw-r--r--tests/auto/qxmlquery/tst_qxmlquery.cpp6
-rw-r--r--tests/auto/xmlpatterns/tst_xmlpatterns.cpp2
-rw-r--r--tests/auto/xmlpatterns/xmlpatterns.pro2
4 files changed, 15 insertions, 9 deletions
diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h
index 171a94d..5cf32d3 100644
--- a/tests/auto/network-settings.h
+++ b/tests/auto/network-settings.h
@@ -72,7 +72,7 @@ public:
#ifdef QT_NETWORK_LIB
static QHostAddress serverIP()
{
- return QHostInfo::fromName(serverName()).addresses().first();
+ return QHostInfo::fromName(serverName()).addresses().first();
}
#endif
@@ -143,20 +143,18 @@ public:
return false;
}
-};
#ifdef QT_NETWORK_LIB
-class QtNetworkSettingsInitializerCode {
-public:
- QtNetworkSettingsInitializerCode() {
+ static bool verifyTestNetworkSettings()
+ {
QHostInfo testServerResult = QHostInfo::fromName(QtNetworkSettings::serverName());
if (testServerResult.error() != QHostInfo::NoError) {
qWarning() << "Could not lookup" << QtNetworkSettings::serverName();
qWarning() << "Please configure the test environment!";
qWarning() << "See /etc/hosts or network-settings.h";
- qFatal("Exiting");
+ return false;
}
+ return true;
}
-};
-QtNetworkSettingsInitializerCode qtNetworkSettingsInitializer;
#endif
+};
diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp
index 241a43a..fd56c36 100644
--- a/tests/auto/qxmlquery/tst_qxmlquery.cpp
+++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp
@@ -96,6 +96,7 @@ public:
}
private Q_SLOTS:
+ void initTestCase();
void defaultConstructor() const;
void copyConstructor() const;
void constructorQXmlNamePool() const;
@@ -257,6 +258,11 @@ private:
const bool m_testNetwork;
};
+void tst_QXmlQuery::initTestCase()
+{
+ QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
+}
+
void tst_QXmlQuery::checkBaseURI(const QUrl &baseURI, const QString &candidate)
{
/* The use of QFileInfo::canonicalFilePath() takes into account that drive letters
diff --git a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp
index adb8111..d8559dc 100644
--- a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp
+++ b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp
@@ -108,6 +108,8 @@ tst_XmlPatterns::tst_XmlPatterns() : m_generatedTests(0)
void tst_XmlPatterns::initTestCase()
{
+ QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
+
QVERIFY(m_normalizeTestName.isValid());
QVERIFY(m_filenameInStderr.isValid());
diff --git a/tests/auto/xmlpatterns/xmlpatterns.pro b/tests/auto/xmlpatterns/xmlpatterns.pro
index 74678c3..8716b9a 100644
--- a/tests/auto/xmlpatterns/xmlpatterns.pro
+++ b/tests/auto/xmlpatterns/xmlpatterns.pro
@@ -1,6 +1,6 @@
TARGET = tst_xmlpatterns
CONFIG += testcase
-QT += testlib
+QT += network testlib
SOURCES += tst_xmlpatterns.cpp \
../qxmlquery/TestFundament.cpp