diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2010-09-30 15:49:19 (GMT) |
---|---|---|
committer | Kai Koehne <kai.koehne@nokia.com> | 2010-09-30 15:52:20 (GMT) |
commit | cfe198948f1e4867918176df38b3e0b49757a4b8 (patch) | |
tree | cd4fa4b3dc0827df1bf920e3d8245b94ba9c7141 /tests/auto/declarative | |
parent | 3b43389b78925ce87d660c343c925fa280b91e11 (diff) | |
download | Qt-cfe198948f1e4867918176df38b3e0b49757a4b8.zip Qt-cfe198948f1e4867918176df38b3e0b49757a4b8.tar.gz Qt-cfe198948f1e4867918176df38b3e0b49757a4b8.tar.bz2 |
QDeclarativeDebug: Make autotests more robust
Always flush sockets after sending data, and make autotests more robust
by using busy wait.
Reviewed-by: Christiaan Janssen
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r-- | tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp | 9 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp | 14 |
2 files changed, 10 insertions, 13 deletions
diff --git a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp index a5f9846..80241ba 100644 --- a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp +++ b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp @@ -112,12 +112,10 @@ void tst_QDeclarativeDebugClient::status() { QDeclarativeDebugTestService service("tst_QDeclarativeDebugClient::status()"); - QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(statusHasChanged())); - QCOMPARE(client.status(), QDeclarativeDebugClient::Enabled); + QTRY_COMPARE(client.status(), QDeclarativeDebugClient::Enabled); } - QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(statusHasChanged())); - QCOMPARE(client.status(), QDeclarativeDebugClient::Unavailable); + QTRY_COMPARE(client.status(), QDeclarativeDebugClient::Unavailable); // duplicate plugin name QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugClient: Conflicting plugin name \"tst_QDeclarativeDebugClient::status()\" "); @@ -135,7 +133,8 @@ void tst_QDeclarativeDebugClient::sendMessage() QByteArray msg = "hello!"; - QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(statusHasChanged())); + QTRY_COMPARE(client.status(), QDeclarativeDebugClient::Enabled); + client.sendMessage(msg); QByteArray resp = client.waitForResponse(); QCOMPARE(resp, msg); diff --git a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp index bce4713..538129c 100644 --- a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp +++ b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp @@ -103,12 +103,12 @@ void tst_QDeclarativeDebugService::status() { QDeclarativeDebugTestClient client("tst_QDeclarativeDebugService::status()", m_conn); - QDeclarativeDebugTest::waitForSignal(&service, SIGNAL(statusHasChanged())); - QCOMPARE(service.status(), QDeclarativeDebugService::Enabled); + QTRY_COMPARE(client.status(), QDeclarativeDebugClient::Enabled); + QTRY_COMPARE(service.status(), QDeclarativeDebugService::Enabled); } - QDeclarativeDebugTest::waitForSignal(&service, SIGNAL(statusHasChanged())); - QCOMPARE(service.status(), QDeclarativeDebugService::Unavailable); + + QTRY_COMPARE(service.status(), QDeclarativeDebugService::Unavailable); QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugService: Conflicting plugin name \"tst_QDeclarativeDebugService::status()\" "); @@ -123,10 +123,8 @@ void tst_QDeclarativeDebugService::sendMessage() QByteArray msg = "hello!"; - if (service.status() != QDeclarativeDebugService::Enabled) - QDeclarativeDebugTest::waitForSignal(&service, SIGNAL(statusHasChanged())); - if (client.status() != QDeclarativeDebugClient::Enabled) - QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(statusHasChanged())); + QTRY_COMPARE(client.status(), QDeclarativeDebugClient::Enabled); + QTRY_COMPARE(service.status(), QDeclarativeDebugService::Enabled); client.sendMessage(msg); QByteArray resp = client.waitForResponse(); |