diff options
author | João Abecasis <joao@abecasis.name> | 2009-11-05 15:18:52 (GMT) |
---|---|---|
committer | João Abecasis <joao@abecasis.name> | 2009-11-05 15:18:52 (GMT) |
commit | ad3e723c334d72b746979b284910ac9b698b2d0b (patch) | |
tree | 28fa320fcbd38938345f30817d75f19716c4e534 /tests/auto/qdbusinterface/tst_qdbusinterface.cpp | |
parent | c4d8d7fd35c8ac7fd2c14208e5e7ca0a35c101e1 (diff) | |
parent | 4cd683231190443e5243f66098c7322e3808a131 (diff) | |
download | Qt-ad3e723c334d72b746979b284910ac9b698b2d0b.zip Qt-ad3e723c334d72b746979b284910ac9b698b2d0b.tar.gz Qt-ad3e723c334d72b746979b284910ac9b698b2d0b.tar.bz2 |
Merge commit 'origin/4.6' into large-file-support
Diffstat (limited to 'tests/auto/qdbusinterface/tst_qdbusinterface.cpp')
-rw-r--r-- | tests/auto/qdbusinterface/tst_qdbusinterface.cpp | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp index e31a3a0..62d6342 100644 --- a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp +++ b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp @@ -171,6 +171,13 @@ class tst_QDBusInterface: public QObject { Q_OBJECT MyObject obj; +public slots: + void testServiceOwnerChanged(const QString &service) + { + if (service == "com.example.Test") + QTestEventLoop::instance().exitLoop(); + } + private slots: void initTestCase(); @@ -235,32 +242,13 @@ void tst_QDBusInterface::invalidAfterServiceOwnerChanged() QDBusInterface invalidInterface("com.example.Test", "/"); QVERIFY(!invalidInterface.isValid()); + QTestEventLoop::instance().connect(connIface, SIGNAL(serviceOwnerChanged(QString, QString, QString)), + SLOT(exitLoop())); QVERIFY(connIface->registerService("com.example.Test") == QDBusConnectionInterface::ServiceRegistered); - QSignalSpy serviceOwnerChangedSpy(connIface, SIGNAL(serviceOwnerChanged(QString, QString, QString))); - - QEventLoop loop; - QObject::connect(connIface, SIGNAL(serviceOwnerChanged(QString, QString, QString)), - &loop, SLOT(quit())); - loop.exec(); - - // at least once, but other services might have changed while running the test, too. - QVERIFY(serviceOwnerChangedSpy.count() >= 1); - bool foundOurService = false; - for (int i = 0; i < serviceOwnerChangedSpy.count(); ++i) { - QList<QVariant> args = serviceOwnerChangedSpy.at(i); - QString name = args[0].toString(); - QString oldOwner = args[1].toString(); - QString newOwner = args[2].toString(); - if (name == QLatin1String("com.example.Test")) { - if (newOwner == conn.baseService()) { - foundOurService = true; - break; - } - } - } - QVERIFY(foundOurService); + QTestEventLoop::instance().enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); QVERIFY(!invalidInterface.isValid()); } |