summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-06-29 14:16:57 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-07-02 09:43:34 (GMT)
commita80d8f015f68cb2b6d5f4cc8b2893543122c5d2b (patch)
treef224d7822db10d6f3d8e1e927b1d3de1cd623e38
parentc4fa498f447bd569ee91e16f07bdb7954b5adc76 (diff)
downloadQt-a80d8f015f68cb2b6d5f4cc8b2893543122c5d2b.zip
Qt-a80d8f015f68cb2b6d5f4cc8b2893543122c5d2b.tar.gz
Qt-a80d8f015f68cb2b6d5f4cc8b2893543122c5d2b.tar.bz2
Autotest: make sure we create the QDBusInterface after the object exists.
The current code allows making calls to QDBusInterface objects that failed to introspect. It's technically a valid condition. You won't be able to connect to signals, get or set properties, but making calls was possible. I don't know if I want to keep this change in behaviour.
-rw-r--r--tests/auto/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/tests/auto/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp b/tests/auto/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
index c70c619..5d08c63 100644
--- a/tests/auto/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
+++ b/tests/auto/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
@@ -609,19 +609,22 @@ void tst_QDBusAbstractAdaptor::methodCalls()
QVERIFY(con.isConnected());
//QDBusInterface emptycon.baseService(), "/", QString());
- QDBusInterface if1(con.baseService(), "/", "local.Interface1", con);
- QDBusInterface if2(con.baseService(), "/", "local.Interface2", con);
- QDBusInterface if3(con.baseService(), "/", "local.Interface3", con);
- QDBusInterface if4(con.baseService(), "/", "local.Interface4", con);
- // must fail: no object
- //QCOMPARE(empty->call("method").type(), QDBusMessage::ErrorMessage);
- QCOMPARE(if1.call(QDBus::BlockWithGui, "method").type(), QDBusMessage::ErrorMessage);
+ {
+ // must fail: no object
+ QDBusInterface if1(con.baseService(), "/", "local.Interface1", con);
+ QCOMPARE(if1.call(QDBus::BlockWithGui, "method").type(), QDBusMessage::ErrorMessage);
+ }
QFETCH(int, nInterfaces);
MyObject obj(nInterfaces);
con.registerObject("/", &obj);
+ QDBusInterface if1(con.baseService(), "/", "local.Interface1", con);
+ QDBusInterface if2(con.baseService(), "/", "local.Interface2", con);
+ QDBusInterface if3(con.baseService(), "/", "local.Interface3", con);
+ QDBusInterface if4(con.baseService(), "/", "local.Interface4", con);
+
// must fail: no such method
QCOMPARE(if1.call(QDBus::BlockWithGui, "method").type(), QDBusMessage::ErrorMessage);
if (!nInterfaces--)
@@ -670,11 +673,11 @@ void tst_QDBusAbstractAdaptor::methodCallScriptable()
QDBusConnection con = QDBusConnection::sessionBus();
QVERIFY(con.isConnected());
- QDBusInterface if2(con.baseService(), "/", "local.Interface2", con);
-
MyObject obj(2);
con.registerObject("/", &obj);
+ QDBusInterface if2(con.baseService(), "/", "local.Interface2", con);
+
QCOMPARE(if2.call(QDBus::BlockWithGui,"scriptableMethod").type(), QDBusMessage::ReplyMessage);
QCOMPARE(slotSpy, "void Interface2::scriptableMethod()");
}