summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2009-08-11 06:06:36 (GMT)
committerJanne Anttila <janne.anttila@digia.com>2009-08-11 06:06:36 (GMT)
commit5b80fbad54eccfc79f38c4f24d6267834b23e742 (patch)
tree3f79df094e466fe61e0fe8783275396ad0553475 /tests/auto
parent43d7bec69c7eb42b2c86d3f3b716245e069865e9 (diff)
downloadQt-5b80fbad54eccfc79f38c4f24d6267834b23e742.zip
Qt-5b80fbad54eccfc79f38c4f24d6267834b23e742.tar.gz
Qt-5b80fbad54eccfc79f38c4f24d6267834b23e742.tar.bz2
Unified QtNetworkSettings:severIP return type for all platforms.
This commit fixes the following autotest case build breaks on windows when compiling QtS60 sources: - q3socket - q3socketdevice - qhostinfo - qsocks5socketengine
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/network-settings.h25
-rw-r--r--tests/auto/qhostinfo/tst_qhostinfo.cpp6
-rw-r--r--tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp8
-rw-r--r--tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp16
4 files changed, 25 insertions, 30 deletions
diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h
index 9488fda..9b67910 100644
--- a/tests/auto/network-settings.h
+++ b/tests/auto/network-settings.h
@@ -37,12 +37,10 @@
**
****************************************************************************/
#include <QString>
-
-/*
#ifdef QT_NETWORK_LIB
#include <QtNetwork/QHostInfo>
#endif
-*/
+
#ifdef Q_OS_SYMBIAN
#include <sys/socket.h>
@@ -131,7 +129,9 @@ public:
//return "qt-test-server.wildcard.dev." + serverDomainName();
return "qttest.wildcard.dev." + serverDomainName();
}
- static const char *serverIP()
+
+#ifdef QT_NETWORK_LIB
+ static QHostAddress serverIP()
{
#ifdef Q_OS_SYMBIAN
loadTestSettings();
@@ -141,12 +141,13 @@ public:
if(serverIp.isNull()) {
serverIp = entry->recordValue().toAscii();
}
- return serverIp.data();
+ return QHostAddress(serverIp.data());
}
-#endif
- return "10.10.14.172";
+#endif
+ return QHostInfo::fromName(serverName()).addresses().first();
}
-
+#endif
+
static QByteArray expectedReplyIMAP()
{
#ifdef Q_OS_SYMBIAN
@@ -315,14 +316,6 @@ private:
}
#endif
-/*
-#ifdef QT_NETWORK_LIB
- static QHostAddress serverIP()
- {
- return QHostInfo::fromName(serverName()).addresses().first();
- }
-#endif
-*/
};
#ifdef Q_OS_SYMBIAN
diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp
index f4ad307..06fdf7b 100644
--- a/tests/auto/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp
@@ -92,6 +92,8 @@
//TESTED_CLASS=
//TESTED_FILES=
+const char * const lupinellaIp = "10.3.4.6";
+
class tst_QHostInfo : public QObject
{
@@ -216,8 +218,8 @@ void tst_QHostInfo::lookupIPv4_data()
#ifdef Q_OS_SYMBIAN
// Test server lookup
- QTest::newRow("lookup_01") << QtNetworkSettings::serverName() << QtNetworkSettings::serverIP() << int(QHostInfo::NoError);
- QTest::newRow("literal_ip4") << QtNetworkSettings::serverIP() << QtNetworkSettings::serverIP() << int(QHostInfo::NoError);
+ QTest::newRow("lookup_01") << QtNetworkSettings::serverName() << QtNetworkSettings::serverIP().toString() << int(QHostInfo::NoError);
+ QTest::newRow("literal_ip4") << QtNetworkSettings::serverIP() << QtNetworkSettings::serverIP().toString() << int(QHostInfo::NoError);
QTest::newRow("multiple_ip4") << "multi.dev.troll.no" << "1.2.3.4 1.2.3.5 10.3.3.31" << int(QHostInfo::NoError);
#else
QTest::newRow("empty") << "" << "" << int(QHostInfo::HostNotFound);
diff --git a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp
index 4287a16..0245e95 100644
--- a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp
+++ b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp
@@ -306,11 +306,11 @@ void tst_QHttpSocketEngine::simpleConnectToIMAP()
socketDevice.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3128));
- QVERIFY(!socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143));
+ QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143));
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState);
QVERIFY(socketDevice.waitForWrite());
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState);
- QVERIFY(socketDevice.peerAddress() == QHostAddress(QtNetworkSettings::serverIP()));
+ QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP());
QVERIFY(!socketDevice.localAddress().isNull());
QVERIFY(socketDevice.localPort() > 0);
@@ -695,11 +695,11 @@ void tst_QHttpSocketEngine::passwordAuth()
socketDevice.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3128, "qsockstest", "password"));
- QVERIFY(!socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143));
+ QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143));
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState);
QVERIFY(socketDevice.waitForWrite());
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState);
- QVERIFY(socketDevice.peerAddress() == QHostAddress(QtNetworkSettings::serverIP()));
+ QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP());
// Wait for the greeting
QVERIFY(socketDevice.waitForRead());
diff --git a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp
index d6628bd..ff78830 100644
--- a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp
+++ b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp
@@ -319,11 +319,11 @@ void tst_QSocks5SocketEngine::simpleConnectToIMAP()
socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080));
- QVERIFY(!socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143));
+ QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143));
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState);
QVERIFY(socketDevice.waitForWrite());
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState);
- QVERIFY(socketDevice.peerAddress() == QHostAddress(QtNetworkSettings::serverIP()));
+ QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP());
// Wait for the greeting
QVERIFY(socketDevice.waitForRead());
@@ -838,14 +838,14 @@ void tst_QSocks5SocketEngine::passwordAuth()
socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080, "qsockstest", "password"));
// Connect to imap.trolltech.com's IP
- QVERIFY(!socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143));
+ QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143));
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState);
QVERIFY(socketDevice.waitForWrite());
- if (!socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143)) {
+ if (!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)) {
qDebug("%d, %s", socketDevice.error(), socketDevice.errorString().toLatin1().constData());
}
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState);
- QVERIFY(socketDevice.peerAddress() == QHostAddress(QtNetworkSettings::serverIP()));
+ QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP());
// Wait for the greeting
QVERIFY(socketDevice.waitForRead());
@@ -904,16 +904,16 @@ void tst_QSocks5SocketEngine::passwordAuth2()
socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1081));
socketDevice.setReceiver(this);
- QVERIFY(!socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143));
+ QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143));
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState);
while (socketDevice.state() == QAbstractSocket::ConnectingState) {
QVERIFY(socketDevice.waitForWrite());
- socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143);
+ socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143);
}
if (socketDevice.state() != QAbstractSocket::ConnectedState)
qDebug("%d, %s", socketDevice.error(), socketDevice.errorString().toLatin1().constData());
QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState);
- QVERIFY(socketDevice.peerAddress() == QHostAddress(QtNetworkSettings::serverIP()));
+ QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP());
// Wait for the greeting
QVERIFY(socketDevice.waitForRead());