diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-06-04 12:35:10 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-06-04 12:35:10 (GMT) |
commit | 80b63705a64a2029800805e1fefe350543b15a70 (patch) | |
tree | 4ab82d06925a3ec23560f3a1e343402e735d5d9d /tests/auto | |
parent | f0f7da04358c82bb80c6670ca336ebd2154163a6 (diff) | |
download | Qt-80b63705a64a2029800805e1fefe350543b15a70.zip Qt-80b63705a64a2029800805e1fefe350543b15a70.tar.gz Qt-80b63705a64a2029800805e1fefe350543b15a70.tar.bz2 |
Autotest: add some tests for sending (or failing to) invalid D-Bus calls
Reviewed-by: TrustMe
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp b/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp index ad1a1b8..58bfabc 100644 --- a/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp +++ b/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp @@ -84,6 +84,8 @@ private slots: void sendArgument_data(); void sendArgument(); + void sendErrors(); + private: QProcess proc; }; @@ -782,5 +784,28 @@ void tst_QDBusMarshall::sendArgument() QCOMPARE(extracted, value); } +void tst_QDBusMarshall::sendErrors() +{ + QDBusConnection con = QDBusConnection::sessionBus(); + + QVERIFY(con.isConnected()); + QDBusMessage msg = QDBusMessage::createSignal("/foo", "local.interfaceName", + "signalName"); + msg << qVariantFromValue(QDBusObjectPath()); + + QTest::ignoreMessage(QtWarningMsg, "QDBusConnection: error: could not send signal path \"/foo\" interface \"local.interfaceName\" member \"signalName\""); + QVERIFY(!con.send(msg)); + + msg.setArguments(QVariantList()); + QDBusObjectPath path; + + QTest::ignoreMessage(QtWarningMsg, "QDBusObjectPath: invalid path \"abc\""); + path.setPath("abc"); + msg << qVariantFromValue(path); + + QTest::ignoreMessage(QtWarningMsg, "QDBusConnection: error: could not send signal path \"/foo\" interface \"local.interfaceName\" member \"signalName\""); + QVERIFY(!con.send(msg)); +} + QTEST_MAIN(tst_QDBusMarshall) #include "tst_qdbusmarshall.moc" |