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>bb10
parent
65f88f3a5d
commit
39efe3c84d
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue