diff options
Diffstat (limited to 'tests/auto/declarative/qdeclarativedebugclient')
-rw-r--r-- | tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp | 60 |
1 files changed, 23 insertions, 37 deletions
diff --git a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp index 7db0e60..72af3eb 100644 --- a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp +++ b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp @@ -66,9 +66,7 @@ private slots: void initTestCase(); void name(); - void isEnabled(); - void setEnabled(); - void isConnected(); + void status(); void sendMessage(); }; @@ -96,46 +94,33 @@ void tst_QDeclarativeDebugClient::name() QCOMPARE(client.name(), name); } -void tst_QDeclarativeDebugClient::isEnabled() +void tst_QDeclarativeDebugClient::status() { - QDeclarativeDebugClient client("tst_QDeclarativeDebugClient::isEnabled()", m_conn); - QCOMPARE(client.isEnabled(), false); -} + { + QDeclarativeDebugConnection dummyConn; + QDeclarativeDebugClient client("tst_QDeclarativeDebugClient::status()", &dummyConn); + QCOMPARE(client.status(), QDeclarativeDebugClient::NotConnected); + } -void tst_QDeclarativeDebugClient::setEnabled() -{ - QDeclarativeDebugTestService service("tst_QDeclarativeDebugClient::setEnabled()"); - QDeclarativeDebugTestClient client("tst_QDeclarativeDebugClient::setEnabled()", m_conn); + QDeclarativeDebugTestClient client("tst_QDeclarativeDebugClient::status()", m_conn); + QCOMPARE(client.status(), QDeclarativeDebugClient::Unavailable); - QCOMPARE(service.isEnabled(), false); + { + QDeclarativeDebugTestService service("tst_QDeclarativeDebugClient::status()"); + QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(statusHasChanged())); + QCOMPARE(client.status(), QDeclarativeDebugClient::Enabled); + } + QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(statusHasChanged())); - client.setEnabled(true); - QCOMPARE(client.isEnabled(), true); - QDeclarativeDebugTest::waitForSignal(&service, SIGNAL(enabledStateChanged())); - QCOMPARE(service.isEnabled(), true); - - client.setEnabled(false); - QCOMPARE(client.isEnabled(), false); - QDeclarativeDebugTest::waitForSignal(&service, SIGNAL(enabledStateChanged())); - QCOMPARE(service.isEnabled(), false); -} - -void tst_QDeclarativeDebugClient::isConnected() -{ - QDeclarativeDebugClient client1("tst_QDeclarativeDebugClient::isConnected() A", m_conn); - QCOMPARE(client1.isConnected(), true); - - QDeclarativeDebugConnection conn; - QDeclarativeDebugClient client2("tst_QDeclarativeDebugClient::isConnected() B", &conn); - QCOMPARE(client2.isConnected(), false); - - QDeclarativeDebugClient client3("tst_QDeclarativeDebugClient::isConnected() C", 0); - QCOMPARE(client3.isConnected(), false); + QCOMPARE(client.status(), QDeclarativeDebugClient::Unavailable); // duplicate plugin name - QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugClient: Conflicting plugin name \"tst_QDeclarativeDebugClient::isConnected() A\" "); - QDeclarativeDebugClient client4("tst_QDeclarativeDebugClient::isConnected() A", m_conn); - QCOMPARE(client4.isConnected(), false); + QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugClient: Conflicting plugin name \"tst_QDeclarativeDebugClient::status()\" "); + QDeclarativeDebugClient client2("tst_QDeclarativeDebugClient::status()", m_conn); + QCOMPARE(client2.status(), QDeclarativeDebugClient::NotConnected); + + QDeclarativeDebugClient client3("tst_QDeclarativeDebugClient::status3()", 0); + QCOMPARE(client3.status(), QDeclarativeDebugClient::NotConnected); } void tst_QDeclarativeDebugClient::sendMessage() @@ -145,6 +130,7 @@ void tst_QDeclarativeDebugClient::sendMessage() QByteArray msg = "hello!"; + QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(statusHasChanged())); client.sendMessage(msg); QByteArray resp = client.waitForResponse(); QCOMPARE(resp, msg); |