Skip 3 test methods if the test server isn't set up.
authorDavid Faure <faure@kde.org>
Sat, 23 Jun 2012 09:40:53 +0000 (11:40 +0200)
committerQt by Nokia <qt-info@nokia.com>
Sat, 23 Jun 2012 12:16:29 +0000 (14:16 +0200)
This makes things easier for developers touching QtCore and running
all QtCore unit tests.

Change-Id: I7aa832a6a1be07d90cacad2eecb2364285ff3818
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp

index 07a1fff..2712b19 100644 (file)
@@ -70,7 +70,6 @@ private slots:
 
 void tst_QIODevice::initTestCase()
 {
-    QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
 }
 
 // Testing get/set functions
@@ -96,6 +95,9 @@ void tst_QIODevice::constructing_QTcpSocket()
 #if defined(Q_OS_WINCE) && defined(WINCE_EMULATOR_TEST)
     QSKIP("Networking tests in a WinCE emulator are unstable");
 #endif
+    if (!QtNetworkSettings::verifyTestNetworkSettings())
+        QSKIP("No network test server available");
+
     QTcpSocket socket;
     QIODevice *device = &socket;
 
@@ -256,6 +258,8 @@ void tst_QIODevice::unget()
             result = QByteArray("ZXCV");
             lineResult = "ZXCV";
         } else {
+            if (!QtNetworkSettings::verifyTestNetworkSettings())
+                QSKIP("No network test server available");
             socket.connectToHost(QtNetworkSettings::serverName(), 80);
             socket.write("GET / HTTP/1.0\r\n\r\n");
             QVERIFY(socket.waitForReadyRead());
index b22723a..8119ca1 100644 (file)
@@ -253,8 +253,6 @@ tst_QTextStream::tst_QTextStream()
 
 void tst_QTextStream::initTestCase()
 {
-    QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
-
     testFileName = tempDir.path() + "/testfile";
 
     // chdir into the testdata dir and refer to our helper apps with relative paths
@@ -1108,6 +1106,9 @@ void tst_QTextStream::stillOpenWhenAtEnd()
 #ifdef Q_OS_WINCE
     QSKIP("Qt/CE: Cannot test network on emulator");
 #endif
+    if (!QtNetworkSettings::verifyTestNetworkSettings())
+        QSKIP("No network test server available");
+
     QTcpSocket socket;
     socket.connectToHost(QtNetworkSettings::serverName(), 143);
     QVERIFY(socket.waitForReadyRead(5000));