summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@theqtcompany.com>2016-03-09 15:28:26 +0100
committerJoerg Bornemann <joerg.bornemann@theqtcompany.com>2016-03-10 15:03:37 +0000
commit39efe3c84db554411f2e2fc5e491659c5398a059 (patch)
tree4e24231a6dcb5318b7230ebd8ebe282c512606bf /tests
parent65f88f3a5ded7fa53f50314434673cdc30977a15 (diff)
Fix glitch in tst_QLocalSocket::sendData
In one code path the test checked for the emission of a readyRead() signal without waiting for it. This code path was never hit, neither on Windows nor on Unix platforms. Change-Id: Ifbe464400a2a1ba8eab49bd60315289040e6bbde Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
index 0505544a29..d12a6b53c3 100644
--- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
@@ -525,6 +525,7 @@ void tst_QLocalSocket::sendData()
// test creating a connection
socket.connectToServer(name);
bool timedOut = true;
+ int expectedReadyReadSignals = 0;
QCOMPARE(server.waitForNewConnection(3000, &timedOut), canListen);
@@ -548,15 +549,17 @@ void tst_QLocalSocket::sendData()
out << testLine << endl;
bool wrote = serverSocket->waitForBytesWritten(3000);
- if (!socket.canReadLine())
+ if (!socket.canReadLine()) {
+ expectedReadyReadSignals = 1;
QVERIFY(socket.waitForReadyRead());
+ }
QVERIFY(socket.bytesAvailable() >= 0);
QCOMPARE(socket.bytesToWrite(), (qint64)0);
QCOMPARE(socket.flush(), false);
QCOMPARE(socket.isValid(), canListen);
QCOMPARE(socket.readBufferSize(), (qint64)0);
- QCOMPARE(spyReadyRead.count(), 1);
+ QCOMPARE(spyReadyRead.count(), expectedReadyReadSignals);
QVERIFY(testLine.startsWith(in.readLine()));
@@ -571,7 +574,7 @@ void tst_QLocalSocket::sendData()
QCOMPARE(spyDisconnected.count(), canListen ? 1 : 0);
QCOMPARE(spyError.count(), canListen ? 0 : 1);
QCOMPARE(spyStateChanged.count(), canListen ? 4 : 2);
- QCOMPARE(spyReadyRead.count(), canListen ? 1 : 0);
+ QCOMPARE(spyReadyRead.count(), canListen ? expectedReadyReadSignals : 0);
server.close();