summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsocketnotifier
diff options
context:
space:
mode:
authorAleksandar Sasha Babic <aleksandar.babic@nokia.com>2009-08-13 11:48:47 (GMT)
committerAleksandar Sasha Babic <aleksandar.babic@nokia.com>2009-08-13 11:57:38 (GMT)
commit962a44bb6113d095b64eb90fa5e6c70944c9c16a (patch)
tree77b5ed17e722f30e53416b05b3ee9a44b0a90dcf /tests/auto/qsocketnotifier
parentd66b8241d1aba1b50f9ecd30d069a7c077d06d13 (diff)
downloadQt-962a44bb6113d095b64eb90fa5e6c70944c9c16a.zip
Qt-962a44bb6113d095b64eb90fa5e6c70944c9c16a.tar.gz
Qt-962a44bb6113d095b64eb90fa5e6c70944c9c16a.tar.bz2
We feel that test case should be changed,
as we cant expect that order of the event hansling will be same on all platforms. For example, on Symbian quit will happen first, on Linux not. It is better to check if we processed 2 events in total. Reviewed by: Axis
Diffstat (limited to 'tests/auto/qsocketnotifier')
-rw-r--r--tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp28
1 files changed, 8 insertions, 20 deletions
diff --git a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp
index 501f257..8f9dab9 100644
--- a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp
+++ b/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp
@@ -70,10 +70,9 @@ tst_QSocketNotifier::~tst_QSocketNotifier()
class UnexpectedDisconnectTester : public QObject
{
Q_OBJECT
- int sequence;
-
public:
QNativeSocketEngine *readEnd1, *readEnd2;
+ int sequence;
UnexpectedDisconnectTester(QNativeSocketEngine *s1, QNativeSocketEngine *s2)
: readEnd1(s1), readEnd2(s2), sequence(0)
@@ -86,25 +85,18 @@ public:
connect(notifier2, SIGNAL(activated(int)), SLOT(handleActivated()));
}
- const int getSequence() {
- return sequence;
- }
-
- void incSequence() {
- ++sequence;
- }
-
public slots:
void handleActivated()
{
char data1[1], data2[1];
- incSequence();
- if (getSequence() == 1) {
+ ++sequence;
+ if (sequence == 1) {
// read from both ends
(void) readEnd1->read(data1, sizeof(data1));
(void) readEnd2->read(data2, sizeof(data2));
emit finished();
- } else if (getSequence() == 2) {
+ } else if (sequence == 2) {
+ // we should never get here
QCOMPARE(readEnd2->read(data2, sizeof(data2)), qint64(-2));
QVERIFY(readEnd2->isValid());
}
@@ -169,16 +161,12 @@ 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);
- } while(tester.getSequence() <= 0);
+ } while(tester.sequence <= 0);
QVERIFY(readEnd1.state() == QAbstractSocket::ConnectedState);
QVERIFY(readEnd2.state() == QAbstractSocket::ConnectedState);
-#if defined(Q_OS_WIN)
- qWarning("### Windows returns 1 activation, Unix returns 2.");
- QCOMPARE(tester.getSequence(), 1);
-#else
- QCOMPARE(tester.getSequence(), 2);
-#endif
+
+ QCOMPARE(tester.sequence, 2);
readEnd1.close();
readEnd2.close();