From f2bfd1f7913e21f8946ea9aa2f96ee4e38a942eb Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 8 Jun 2011 16:01:33 +0200 Subject: Fix errors in qsocketnotifier test Fixed the posixSockets test on linux Skipped the bogusFds test everywhere but symbian, as there is no behavioural consistency of QSocketNotifier with invalid fds between different OS. Reviewed-By: mread --- tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp index 550cef9..eb9a260 100644 --- a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp +++ b/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp @@ -57,7 +57,7 @@ #include #endif #include -#include +#include class tst_QSocketNotifier : public QObject { @@ -180,7 +180,7 @@ void tst_QSocketNotifier::unexpectedDisconnection() // we have to wait until sequence value changes // as any event can make us jump out processing QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents); - QVERIFY(timer.isActive); //escape if test would hang + QVERIFY(timer.isActive()); //escape if test would hang } while(tester.sequence <= 0); QVERIFY(readEnd1.state() == QAbstractSocket::ConnectedState); @@ -294,7 +294,7 @@ void tst_QSocketNotifier::posixSockets() QTestEventLoop::instance().enterLoop(3); QCOMPARE(readSpy.count(), 1); - QCOMPARE(writeSpy.count(), 0); + writeSpy.clear(); //depending on OS, write notifier triggers on creation or not. QCOMPARE(errorSpy.count(), 0); char buffer[100]; @@ -315,18 +315,17 @@ void tst_QSocketNotifier::posixSockets() void tst_QSocketNotifier::bogusFds() { -#ifndef Q_OS_WIN +#ifndef Q_OS_SYMBIAN + //behaviour of QSocketNotifier with an invalid fd is totally different across OS + //main point of this test was to check symbian backend doesn't crash + QSKIP("test only for symbian", SkipAll); +#else QTest::ignoreMessage(QtWarningMsg, "QSocketNotifier: Internal error"); -#endif QSocketNotifier max(std::numeric_limits::max(), QSocketNotifier::Read); QTest::ignoreMessage(QtWarningMsg, "QSocketNotifier: Invalid socket specified"); -#ifndef Q_OS_WIN QTest::ignoreMessage(QtWarningMsg, "QSocketNotifier: Internal error"); -#endif QSocketNotifier min(std::numeric_limits::min(), QSocketNotifier::Write); -#ifndef Q_OS_WIN QTest::ignoreMessage(QtWarningMsg, "QSocketNotifier: Internal error"); -#endif //bogus magic number is the first pseudo socket descriptor from symbian socket engine. QSocketNotifier bogus(0x40000000, QSocketNotifier::Exception); QSocketNotifier largestlegal(FD_SETSIZE - 1, QSocketNotifier::Read); @@ -350,6 +349,7 @@ void tst_QSocketNotifier::bogusFds() QCOMPARE(minspy.count(), 0); QCOMPARE(bogspy.count(), 0); QCOMPARE(llspy.count(), 0); +#endif } QTEST_MAIN(tst_QSocketNotifier) -- cgit v0.12