From 2aeaf16a1e31856a3051e6727c5ff2695fec9625 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 6 Aug 2009 14:33:23 +0200 Subject: fix tst_qlocalsocket::readBufferOverflow for Windows CE The TCP socket must get the chance to read data into its read buffer after the first read operation emptied it. Reviewed-by: thartman --- tests/auto/qlocalsocket/tst_qlocalsocket.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp index b861e62..177648d 100644 --- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp @@ -555,14 +555,17 @@ void tst_QLocalSocket::readBufferOverflow() QVERIFY(server.hasPendingConnections()); QLocalSocket* serverSocket = server.nextPendingConnection(); - char* buffer = (char*)qMalloc(dataBufferSize); + char buffer[dataBufferSize]; memset(buffer, 0, dataBufferSize); serverSocket->write(buffer, dataBufferSize); serverSocket->flush(); - qFree(buffer); QVERIFY(client.waitForReadyRead()); - QCOMPARE(client.readAll().size(), dataBufferSize); + QCOMPARE(client.read(buffer, readBufferSize), qint64(readBufferSize)); +#ifdef QT_LOCALSOCKET_TCP + QTest::qWait(250); +#endif + QCOMPARE(client.read(buffer, readBufferSize), qint64(readBufferSize)); } // QLocalSocket/Server can take a name or path, check that it works as expected -- cgit v0.12