diff options
author | Kari Oikarinen <kari.oikarinen@qt.io> | 2018-03-29 11:50:58 +0300 |
---|---|---|
committer | Kari Oikarinen <kari.oikarinen@qt.io> | 2018-05-08 12:35:40 +0000 |
commit | c580644fe91148f0cb5fde44d262678ef47c5faa (patch) | |
tree | 1149ccd95741fb82e9e7cca64635d7f245ff5b75 /tests/auto/network/socket/qlocalsocket | |
parent | 09d4faa008d77bc919b46d77f07a4e15a8f6cd21 (diff) |
tests/auto/network: Avoid unconditional qWait()s
Replace with QSignalSpy or QTRY_COMPARE when possible.
Task-number: QTBUG-63992
Change-Id: I18dc8837301424855487a12ee62451a5aeb21bf0
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'tests/auto/network/socket/qlocalsocket')
-rw-r--r-- | tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index 53d260f19e..779d55a77a 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -1225,12 +1225,13 @@ public: socket.write("testing\n"); exec(); } +signals: + void bytesWrittenReceived(); public slots: - void bytesWritten(qint64) { + void bytesWritten(qint64) { + emit bytesWrittenReceived(); exit(); - } - -private: + } }; /* @@ -1248,11 +1249,12 @@ void tst_QLocalSocket::bytesWrittenSignal() QLocalServer server; QVERIFY(server.listen("qlocalsocket_readyread")); WriteThread writeThread; + QSignalSpy receivedSpy(&writeThread, &WriteThread::bytesWrittenReceived); writeThread.start(); bool timedOut = false; QVERIFY(server.waitForNewConnection(3000, &timedOut)); QVERIFY(!timedOut); - QTest::qWait(2000); + QVERIFY(receivedSpy.wait(2000)); QVERIFY(writeThread.wait(2000)); } |