Fix failing setSocketDescriptor test in QTcpSocket

setSocketDescriptor fails because socket is in the wrong state.
This is timing dependent, if qt-test-server is still in the DNS cache
then the test failed.
 - clear the DNS cache to avoid the host lookup state being skipped.

Change-Id: If159d514b1aa9b62a4834f6352d5e7b0a00a5724
Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
This commit is contained in:
Shane Kearns 2011-12-02 11:14:47 +00:00 committed by Qt by Nokia
parent f7d11b216a
commit 9138890bd6

View File

@ -583,6 +583,7 @@ void tst_QTcpSocket::setSocketDescriptor()
QVERIFY(socket->setSocketDescriptor(sock, QTcpSocket::UnconnectedState));
QCOMPARE(socket->socketDescriptor(), (int)sock);
qt_qhostinfo_clear_cache(); //avoid the HostLookupState being skipped due to address being in cache from previous test.
socket->connectToHost(QtNetworkSettings::serverName(), 143);
QCOMPARE(socket->state(), QTcpSocket::HostLookupState);
QCOMPARE(socket->socketDescriptor(), (int)sock);