diff options
3 files changed, 12 insertions, 33 deletions
diff --git a/tests/auto/network/socket/qtcpsocket/stressTest/stressTest.pro b/tests/auto/network/socket/qtcpsocket/stressTest/stressTest.pro index c7a4308b17..2eb00593e0 100644 --- a/tests/auto/network/socket/qtcpsocket/stressTest/stressTest.pro +++ b/tests/auto/network/socket/qtcpsocket/stressTest/stressTest.pro @@ -1,6 +1,6 @@ HEADERS += Test.h SOURCES += main.cpp Test.cpp -QT += network +QT = core network testlib CONFIG -= app_bundle CONFIG += console diff --git a/tests/auto/network/socket/qtcpsocket/test/test.pro b/tests/auto/network/socket/qtcpsocket/test/test.pro index 897a875013..6c6697bfdc 100644 --- a/tests/auto/network/socket/qtcpsocket/test/test.pro +++ b/tests/auto/network/socket/qtcpsocket/test/test.pro @@ -1,7 +1,6 @@ CONFIG += testcase -QT += widgets testlib -QT += core-private network-private +QT = core-private network-private testlib SOURCES += ../tst_qtcpsocket.cpp win32: { wince*: { @@ -10,8 +9,6 @@ wince*: { LIBS += -lws2_32 } } -QT += network -vxworks:QT -= gui TARGET = tst_qtcpsocket diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index 09bf8c98be..218e372e4d 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -63,10 +63,6 @@ #include <QHostAddress> #include <QHostInfo> #include <QMap> -#ifndef Q_OS_VXWORKS -#include <QMessageBox> -#include <QPushButton> -#endif #include <QPointer> #include <QProcess> #include <QStringList> @@ -175,7 +171,7 @@ private slots: void socketsInThreads(); void waitForReadyReadInASlot(); void remoteCloseError(); - void openMessageBoxInErrorSlot(); + void nestedEventLoopInErrorSlot(); #ifndef Q_OS_WIN void connectToLocalHostNoService(); #endif @@ -217,7 +213,7 @@ protected slots: void downloadBigFileSlot(); void recursiveReadyReadSlot(); void waitForReadyReadInASlotSlot(); - void messageBoxSlot(); + void enterLoopSlot(); void hostLookupSlot(); void abortiveClose_abortSlot(); void remoteCloseErrorSlot(); @@ -1829,35 +1825,29 @@ void tst_QTcpSocket::remoteCloseErrorSlot() static_cast<QTcpSocket *>(sender())->close(); } -void tst_QTcpSocket::messageBoxSlot() +void tst_QTcpSocket::enterLoopSlot() { -#if !defined(Q_OS_VXWORKS) // no gui QTcpSocket *socket = qobject_cast<QTcpSocket *>(sender()); socket->deleteLater(); - QMessageBox box; - QTimer::singleShot(100, &box, SLOT(close())); - // This should not delete the socket - box.exec(); + // enter nested event loop + QEventLoop loop; + QTimer::singleShot(100, &loop, SLOT(quit())); + loop.exec(); // Fire a non-0 singleshot to leave time for the delete QTimer::singleShot(250, this, SLOT(exitLoopSlot())); -#endif } //---------------------------------------------------------------------------------- -void tst_QTcpSocket::openMessageBoxInErrorSlot() +void tst_QTcpSocket::nestedEventLoopInErrorSlot() { -#if defined(Q_OS_VXWORKS) // no gui - QSKIP("no default gui available on VxWorks"); -#else QTcpSocket *socket = newSocket(); QPointer<QTcpSocket> p(socket); - connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(messageBoxSlot())); + connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(enterLoopSlot())); socket->connectToHost("hostnotfoundhostnotfound.troll.no", 9999); // Host not found, fyi enterLoop(30); QVERIFY(!p); -#endif } //---------------------------------------------------------------------------------- @@ -1981,16 +1971,9 @@ public slots: //---------------------------------------------------------------------------------- void tst_QTcpSocket::waitForConnectedInHostLookupSlot2() { -#if defined(Q_OS_WIN) || defined(Q_OS_VXWORKS) - QSKIP("waitForConnectedInHostLookupSlot2 is not run on Windows and VxWorks"); -#else - Foo foo; - QPushButton top("Go", 0); - top.show(); - connect(&top, SIGNAL(clicked()), &foo, SLOT(doIt())); - QTimer::singleShot(100, &top, SLOT(animateClick())); + QTimer::singleShot(100, &foo, SLOT(doIt())); QTimer::singleShot(5000, &foo, SLOT(exitLoop())); enterLoop(30); @@ -1999,7 +1982,6 @@ void tst_QTcpSocket::waitForConnectedInHostLookupSlot2() QVERIFY(foo.attemptedToConnect); QCOMPARE(foo.count, 1); -#endif } //---------------------------------------------------------------------------------- |