From b22f7a8af0a781885a64d0cd1001192c99872aef Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Thu, 29 Oct 2009 17:55:06 +0100 Subject: QLocalSocket test: stabilize test by calling waitFor... function ... to make sure bytes are availabe to read Reviewed-by: Aleksandar Sasha Babic --- tests/auto/qlocalsocket/tst_qlocalsocket.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp index ab7b0ac144..5ead049215 100644 --- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp @@ -587,14 +587,16 @@ void tst_QLocalSocket::readBufferOverflow() char buffer[dataBufferSize]; memset(buffer, 0, dataBufferSize); serverSocket->write(buffer, dataBufferSize); - serverSocket->flush(); + serverSocket->waitForBytesWritten(); + // wait until the first 128 bytes are ready to read QVERIFY(client.waitForReadyRead()); QCOMPARE(client.read(buffer, readBufferSize), qint64(readBufferSize)); -#if defined(QT_LOCALSOCKET_TCP) || defined(Q_OS_SYMBIAN) - QTest::qWait(250); -#endif + // wait until the second 128 bytes are ready to read + QVERIFY(client.waitForReadyRead()); QCOMPARE(client.read(buffer, readBufferSize), qint64(readBufferSize)); + // no more bytes available + QVERIFY(client.bytesAvailable() == 0); } // QLocalSocket/Server can take a name or path, check that it works as expected -- cgit v1.2.3