From a1f050fe4217d3a642ab7f4df8e50c21aa51689c Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 30 Sep 2010 15:26:05 +0200 Subject: QDeclarativeDebugClient: Make sure status is consistent When statusChanged() is called during handsake state() was not the same as the argument passed. Fix this by setting gotHello = true _before_ notifying the clients. Reviewed-by: Christiaan Janssen Task-number: QTBUG-14087 --- src/declarative/debugger/qdeclarativedebugclient.cpp | 3 +-- .../qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp | 5 +++++ tests/auto/declarative/shared/debugutil.cpp | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/declarative/debugger/qdeclarativedebugclient.cpp b/src/declarative/debugger/qdeclarativedebugclient.cpp index ce3faf6..5baaf70 100644 --- a/src/declarative/debugger/qdeclarativedebugclient.cpp +++ b/src/declarative/debugger/qdeclarativedebugclient.cpp @@ -136,7 +136,7 @@ void QDeclarativeDebugConnectionPrivate::readyRead() return; } - qDebug() << "Available server side plugins: " << serverPlugins; + gotHello = true; QHash::Iterator iter = plugins.begin(); for (; iter != plugins.end(); ++iter) { @@ -145,7 +145,6 @@ void QDeclarativeDebugConnectionPrivate::readyRead() newStatus = QDeclarativeDebugClient::Enabled; iter.value()->statusChanged(newStatus); } - gotHello = true; } while (protocol->packetsAvailable()) { diff --git a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp index 72af3eb..a5f9846 100644 --- a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp +++ b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp @@ -77,6 +77,10 @@ void tst_QDeclarativeDebugClient::initTestCase() new QDeclarativeEngine(this); m_conn = new QDeclarativeDebugConnection(this); + + QDeclarativeDebugTestClient client("tst_QDeclarativeDebugClient::handshake()", m_conn); + QDeclarativeDebugTestService service("tst_QDeclarativeDebugClient::handshake()"); + m_conn->connectToHost("127.0.0.1", 3770); QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Connection established"); @@ -84,6 +88,7 @@ void tst_QDeclarativeDebugClient::initTestCase() Q_ASSERT(ok); QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient()); + QTRY_COMPARE(client.status(), QDeclarativeDebugClient::Enabled); } void tst_QDeclarativeDebugClient::name() diff --git a/tests/auto/declarative/shared/debugutil.cpp b/tests/auto/declarative/shared/debugutil.cpp index 5f68e44..cbd055b 100644 --- a/tests/auto/declarative/shared/debugutil.cpp +++ b/tests/auto/declarative/shared/debugutil.cpp @@ -91,8 +91,9 @@ QByteArray QDeclarativeDebugTestClient::waitForResponse() return lastMsg; } -void QDeclarativeDebugTestClient::statusChanged(Status status) +void QDeclarativeDebugTestClient::statusChanged(Status stat) { + QCOMPARE(stat, status()); emit statusHasChanged(); } -- cgit v0.12