summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2011-02-10 12:05:53 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2011-02-17 15:02:14 (GMT)
commit5b53b44a2be8478adeee4a9e4796345828ad0248 (patch)
tree151e6a11a01d4a9c37a2473afe6d267dc6a4e88b
parent1b5ee40f491daf0f0b1d44b648ffb7b0ca8b8a63 (diff)
downloadQt-5b53b44a2be8478adeee4a9e4796345828ad0248.zip
Qt-5b53b44a2be8478adeee4a9e4796345828ad0248.tar.gz
Qt-5b53b44a2be8478adeee4a9e4796345828ad0248.tar.bz2
Autotest: add a new test for parsing an introspection with unknown types
Task-number: QTBUG-17476
-rw-r--r--tests/auto/qdbusinterface/tst_qdbusinterface.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp
index c1938b1..37e1c64 100644
--- a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp
+++ b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp
@@ -169,6 +169,25 @@ public slots:
int MyObject::callCount = 0;
QVariantList MyObject::callArgs;
+class MyObjectUnknownType: public QObject
+{
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "com.trolltech.QtDBus.MyObject")
+ Q_CLASSINFO("D-Bus Introspection", ""
+" <interface name=\"com.trolltech.QtDBus.MyObjectUnknownTypes\" >\n"
+" <property access=\"readwrite\" type=\"~\" name=\"prop1\" />\n"
+" <signal name=\"somethingHappened\" >\n"
+" <arg direction=\"out\" type=\"~\" />\n"
+" </signal>\n"
+" <method name=\"ping\" >\n"
+" <arg direction=\"in\" type=\"~\" name=\"ping\" />\n"
+" <arg direction=\"out\" type=\"~\" name=\"ping\" />\n"
+" </method>\n"
+" <method name=\"regularMethod\" />\n"
+" </interface>\n"
+ "")
+};
+
class Spy: public QObject
{
Q_OBJECT
@@ -228,6 +247,7 @@ private slots:
void notValidDerived();
void invalidAfterServiceOwnerChanged();
void introspect();
+ void introspectUnknownTypes();
void callMethod();
void invokeMethod();
void invokeMethodWithReturn();
@@ -250,8 +270,7 @@ void tst_QDBusInterface::initTestCase()
con.registerObject("/", &obj, QDBusConnection::ExportAllProperties
| QDBusConnection::ExportAllSlots
- | QDBusConnection::ExportAllInvokables
- | QDBusConnection::ExportChildObjects);
+ | QDBusConnection::ExportAllInvokables);
}
void tst_QDBusInterface::notConnected()
@@ -322,6 +341,18 @@ void tst_QDBusInterface::introspect()
QVERIFY(mo->indexOfProperty("complexProp") != -1);
}
+void tst_QDBusInterface::introspectUnknownTypes()
+{
+ QDBusConnection con = QDBusConnection::sessionBus();
+ MyObjectUnknownType obj;
+ con.registerObject("/unknownTypes", &obj, QDBusConnection::ExportAllContents);
+ QDBusInterface iface(QDBusConnection::sessionBus().baseService(), QLatin1String("/unknownTypes"),
+ "com.trolltech.QtDBus.MyObjectUnknownTypes");
+
+ const QMetaObject *mo = iface.metaObject();
+ QVERIFY(mo->indexOfMethod("regularMethod()") != -1);
+}
+
void tst_QDBusInterface::callMethod()
{
QDBusConnection con = QDBusConnection::sessionBus();