summaryrefslogtreecommitdiffstats
path: root/tests/auto/network
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2017-05-27 00:54:56 +0200
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2017-06-08 04:00:54 +0000
commitf78a189da5d9e13a96a52b9d17cdc80df06ed8c8 (patch)
tree58001f219d2b107d8557cff4f84ce0074213b6e2 /tests/auto/network
parent678ff94ff29db1b0faa4aa8d486d4df544ce3247 (diff)
QSSLSocket::readData return -1 when socket is not connected
As QAbstractSocket::readData does and as the documentation of QIODevice says "this function returns -1 in those cases (that is, reading on a closed socket..." Change-Id: I1e64673f6a6d792a640bd6cb28b2bb5a0f18dc36 Reviewed-by: Aleix Pol Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/network')
-rw-r--r--tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
index f44e5261dd..90838e8831 100644
--- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
@@ -2162,6 +2162,13 @@ void tst_QSslSocket::waitForMinusOne()
// fifth verification: it should wait for 200 ms more
QVERIFY(socket.waitForDisconnected(-1));
+
+ // sixth verification: reading from a disconnected socket returns -1
+ // once we deplete the read buffer
+ QCOMPARE(socket.state(), QAbstractSocket::UnconnectedState);
+ socket.readAll();
+ char aux;
+ QCOMPARE(socket.read(&aux, 1), -1);
}
class VerifyServer : public QTcpServer