tst_qhostinfo: Fix IPv6 lookup detection on Windows.

Moved the QTcpServer test to init winsock before we use getaddrinfo.

Reviewed-by: Shane Kearns
(cherry picked from commit 0ccf01368adcabbb25958a55976083f72116a2d5)
This commit is contained in:
Martin Petersson 2011-05-20 10:04:18 +02:00
parent 0ebe0414d2
commit df2d6753ac

View File

@ -213,6 +213,13 @@ void tst_QHostInfo::initTestCase()
#else #else
ipv6Available = false; ipv6Available = false;
ipv6LookupsAvailable = false; ipv6LookupsAvailable = false;
QTcpServer server;
if (server.listen(QHostAddress("::1"))) {
// We have IPv6 support
ipv6Available = true;
}
#if !defined(QT_NO_GETADDRINFO) #if !defined(QT_NO_GETADDRINFO)
// check if the system getaddrinfo can do IPv6 lookups // check if the system getaddrinfo can do IPv6 lookups
struct addrinfo hint, *result = 0; struct addrinfo hint, *result = 0;
@ -235,13 +242,6 @@ void tst_QHostInfo::initTestCase()
#endif #endif
#endif #endif
QTcpServer server;
if (server.listen(QHostAddress("::1"))) {
// We have IPv6 support
ipv6Available = true;
}
// run each testcase with and without test enabled // run each testcase with and without test enabled
QTest::addColumn<bool>("cache"); QTest::addColumn<bool>("cache");
QTest::newRow("WithCache") << true; QTest::newRow("WithCache") << true;