diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-16 16:29:00 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-16 16:30:15 (GMT) |
commit | 90d398e5bef2a66ab944e1cc191c1ad6569e321a (patch) | |
tree | abd13ed6254edf69fa8a962b4e5835ea8ca839c8 /tests/auto/qdbusconnection/tst_qdbusconnection.cpp | |
parent | ba9857ce87d5b841f996b1c5c4246d9011e46fa3 (diff) | |
download | Qt-90d398e5bef2a66ab944e1cc191c1ad6569e321a.zip Qt-90d398e5bef2a66ab944e1cc191c1ad6569e321a.tar.gz Qt-90d398e5bef2a66ab944e1cc191c1ad6569e321a.tar.bz2 |
Fix an issue with the error signal in a callWithCallback not being
delivered queued.
Since we emit the signal while the locks are in place, we have to have
queued delivery.
Task-number: QT-760
Reviewed-by: Trust Me
Diffstat (limited to 'tests/auto/qdbusconnection/tst_qdbusconnection.cpp')
-rw-r--r-- | tests/auto/qdbusconnection/tst_qdbusconnection.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/qdbusconnection/tst_qdbusconnection.cpp index 5e2f3a9..96209b1 100644 --- a/tests/auto/qdbusconnection/tst_qdbusconnection.cpp +++ b/tests/auto/qdbusconnection/tst_qdbusconnection.cpp @@ -80,6 +80,8 @@ class tst_QDBusConnection: public QObject int signalsReceived; public slots: void oneSlot() { ++signalsReceived; } + void exitLoop() { ++signalsReceived; QTestEventLoop::instance().exitLoop(); } + void secondCallWithCallback(); private slots: void noConnection(); @@ -102,6 +104,7 @@ private slots: void multipleInterfacesInQObject(); void slotsWithLessParameters(); + void nestedCallWithCallback(); public: QString serviceName() const { return "com.trolltech.Qt.Autotests.QDBusConnection"; } @@ -618,6 +621,32 @@ void tst_QDBusConnection::slotsWithLessParameters() QCOMPARE(signalsReceived, 1); } +void tst_QDBusConnection::secondCallWithCallback() +{ + qDebug("Hello"); + QDBusConnection con = QDBusConnection::sessionBus(); + QDBusMessage msg = QDBusMessage::createMethodCall(con.baseService(), "/test", QString(), + "test0"); + con.callWithCallback(msg, this, SLOT(exitLoop()), SLOT(secondCallWithCallback())); +} + +void tst_QDBusConnection::nestedCallWithCallback() +{ + TestObject testObject; + QDBusConnection connection = QDBusConnection::sessionBus(); + QVERIFY(connection.registerObject("/test", &testObject, + QDBusConnection::ExportAllContents)); + + QDBusMessage msg = QDBusMessage::createMethodCall(connection.baseService(), "/test", QString(), + "ThisFunctionDoesntExist"); + signalsReceived = 0; + + connection.callWithCallback(msg, this, SLOT(exitLoop()), SLOT(secondCallWithCallback()), 10); + QTestEventLoop::instance().enterLoop(15); + QVERIFY(!QTestEventLoop::instance().timeout()); + QCOMPARE(signalsReceived, 1); +} + QString MyObject::path; QTEST_MAIN(tst_QDBusConnection) |