diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-03 02:07:46 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-03 02:07:46 (GMT) |
commit | 0367742255f71cae623f35f82392993214bdb7db (patch) | |
tree | d667235e28e7f63ed3bee518aa3a3db0c9cbe4fe /tests | |
parent | fbf487762979846452e348b711f27a67c4edbc49 (diff) | |
parent | 2ef657cd68aaa790e940f8603085e0647583f5f6 (diff) | |
download | Qt-0367742255f71cae623f35f82392993214bdb7db.zip Qt-0367742255f71cae623f35f82392993214bdb7db.tar.gz Qt-0367742255f71cae623f35f82392993214bdb7db.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1:
update russian translations and phrasebook
Allow platform specific values for the double click radius.
Fix strict-aliasing breakage with SunCC: the union trick is a GCC extension.
QNAM HTTP: Fix invoking a method when being destructed right now
QAbstractSocket: Use new faster DNS function
Add DNS caching to QHostInfo
Make the icon visible when set on an action in a QSystemTrayIcon on Mac
Carbon : Setting palette brush to a pixmap does not work.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qhostinfo/tst_qhostinfo.cpp | 55 | ||||
-rw-r--r-- | tests/auto/qsslsocket/qsslsocket.pro | 2 | ||||
-rw-r--r-- | tests/auto/qsslsocket/tst_qsslsocket.cpp | 6 | ||||
-rw-r--r-- | tests/auto/qtcpsocket/qtcpsocket.pro | 3 | ||||
-rw-r--r-- | tests/auto/qtcpsocket/tst_qtcpsocket.cpp | 13 |
5 files changed, 75 insertions, 4 deletions
diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp index d5411d0..cbadcf5 100644 --- a/tests/auto/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp @@ -72,6 +72,7 @@ #endif #include <qhostinfo.h> +#include "private/qhostinfo_p.h" #if !defined(QT_NO_GETADDRINFO) # if !defined(Q_OS_WINCE) @@ -108,10 +109,11 @@ public: public slots: void init(); void cleanup(); + void initTestCase(); + private slots: void getSetCheck(); void staticInformation(); - void initTestCase(); void lookupIPv4_data(); void lookupIPv4(); void lookupIPv6_data(); @@ -128,6 +130,8 @@ private slots: void multipleSameLookups(); void multipleDifferentLookups(); + void cache(); + protected slots: void resultsReady(const QHostInfo &); @@ -205,10 +209,21 @@ void tst_QHostInfo::initTestCase() // We have IPv6 support ipv6Available = true; } + + + // run each testcase with and without test enabled + QTest::addColumn<bool>("cache"); + QTest::newRow("WithCache") << false; + QTest::newRow("WithoutCache") << true; } void tst_QHostInfo::init() { + // delete the cache so inidividual testcase results are independant from each other + qt_qhostinfo_clear_cache(); + + QFETCH_GLOBAL(bool, cache); + qt_qhostinfo_enable_cache(cache); } void tst_QHostInfo::cleanup() @@ -458,6 +473,44 @@ void tst_QHostInfo::multipleDifferentLookups() QTRY_VERIFY(lookupsDoneCounter == COUNT); } +void tst_QHostInfo::cache() +{ + QFETCH_GLOBAL(bool, cache); + if (!cache) + return; // test makes only sense when cache enabled + + // reset slot counter + lookupsDoneCounter = 0; + + // lookup once, wait in event loop, result should not come directly. + bool valid = true; + QHostInfo result = qt_qhostinfo_lookup("localhost", this, SLOT(resultsReady(QHostInfo)), &valid); + QTestEventLoop::instance().enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); + QVERIFY(valid == false); + QVERIFY(result.addresses().isEmpty()); + + // loopkup second time, result should come directly + valid = false; + result = qt_qhostinfo_lookup("localhost", this, SLOT(resultsReady(QHostInfo)), &valid); + QVERIFY(valid == true); + QVERIFY(!result.addresses().isEmpty()); + + // clear the cache + qt_qhostinfo_clear_cache(); + + // lookup third time, result should not come directly. + valid = true; + result = qt_qhostinfo_lookup("localhost", this, SLOT(resultsReady(QHostInfo)), &valid); + QTestEventLoop::instance().enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); + QVERIFY(valid == false); + QVERIFY(result.addresses().isEmpty()); + + // the slot should have been called 2 times. + QVERIFY(lookupsDoneCounter == 2); +} + void tst_QHostInfo::resultsReady(const QHostInfo &hi) { lookupDone = true; diff --git a/tests/auto/qsslsocket/qsslsocket.pro b/tests/auto/qsslsocket/qsslsocket.pro index 147175e..541b2d9 100644 --- a/tests/auto/qsslsocket/qsslsocket.pro +++ b/tests/auto/qsslsocket/qsslsocket.pro @@ -32,3 +32,5 @@ wince* { } else { DEFINES += SRCDIR=\\\"$$PWD/\\\" } + +requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index abd3237..ad2b50d 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -54,6 +54,8 @@ #include <QNetworkProxy> #include <QAuthenticator> +#include "private/qhostinfo_p.h" + #include "../network-settings.h" Q_DECLARE_METATYPE(QAbstractSocket::SocketState) @@ -288,6 +290,8 @@ void tst_QSslSocket::init() } QNetworkProxy::setApplicationProxy(proxy); } + + qt_qhostinfo_clear_cache(); } void tst_QSslSocket::cleanup() @@ -477,7 +481,7 @@ void tst_QSslSocket::simpleConnectWithIgnore() // Start connecting socket.connectToHost(QtNetworkSettings::serverName(), 993); - QCOMPARE(socket.state(), QAbstractSocket::HostLookupState); + QVERIFY(socket.state() != QAbstractSocket::UnconnectedState); // something must be in progress enterLoop(10); // Start handshake diff --git a/tests/auto/qtcpsocket/qtcpsocket.pro b/tests/auto/qtcpsocket/qtcpsocket.pro index 4bbec23..3d4eba3 100644 --- a/tests/auto/qtcpsocket/qtcpsocket.pro +++ b/tests/auto/qtcpsocket/qtcpsocket.pro @@ -3,3 +3,6 @@ TEMPLATE = subdirs !wince*: SUBDIRS = test stressTest wince*|symbian*|vxworks* : SUBDIRS = test + + +requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp index e638e287..ef7ff83 100644 --- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp @@ -92,6 +92,8 @@ #include <unistd.h> #endif +#include "private/qhostinfo_p.h" + #include "../network-settings.h" Q_DECLARE_METATYPE(QAbstractSocket::SocketError) @@ -315,6 +317,8 @@ void tst_QTcpSocket::init() } QNetworkProxy::setApplicationProxy(proxy); } + + qt_qhostinfo_clear_cache(); } QTcpSocket *tst_QTcpSocket::newSocket() const @@ -1059,7 +1063,9 @@ void tst_QTcpSocket::disconnectWhileLookingUp() // just connect and disconnect, then make sure nothing weird happened QTcpSocket *socket = newSocket(); socket->connectToHost(QtNetworkSettings::serverName(), 21); - QVERIFY(socket->state() == QAbstractSocket::HostLookupState); + + // check that connect is in progress + QVERIFY(socket->state() != QAbstractSocket::UnconnectedState); QFETCH(bool, doClose); if (doClose) { @@ -1665,7 +1671,10 @@ void tst_QTcpSocket::waitForConnectedInHostLookupSlot() connect(tmpSocket, SIGNAL(hostFound()), this, SLOT(hostLookupSlot())); tmpSocket->connectToHost(QtNetworkSettings::serverName(), 143); - loop.exec(); + // only execute the loop if not already connected + if (tmpSocket->state() != QAbstractSocket::ConnectedState) + loop.exec(); + QCOMPARE(timerSpy.count(), 0); delete tmpSocket; |