QTest using DBus and custom datatype
-
Hi!
I need to make some tests on dbus functions that return a custom type. The type is declared also as metatype:
@ qRegisterMetaType<e_errorInterface>("e_errorInterface");
qDBusRegisterMetaType<e_errorInterface>();@I'm trying to follow "This Tutorial":http://qt-project.org/doc/qt-4.8/qtestlib-tutorial1.html
It works when I use the same method (toUpper) I think because it returns a QString and it is not passing through DBus!
The method is:
@e_errorInterface myMethod( argument );@
and it is called through dbus
@d_busAdaptor->myMethod( argument );@So I'm doing:
@QCOMPARE(dbus_adaptor->myMethod( argument ), noError);@where noError is an Enumerator with "e_errorInterface" type
but I'm getting an
@Undefined reference to"bool QTest::qCompare<QDBusReply<e_errorInterface>, e_errorInterface>(QDBusReply<e_errorInterface> const&, e_errorInterface const&, char const*, char const*, char const*, int)"@And if I try to use:
@VERIFY(dbus_adaptor->myMethod( argument ));@
the program compiles but when I launch it I get:
@ASSERT: "QTest::testLogger" in file qtestlog.cpp, line 266
Failed (core dump created)@Anybody has experience with this problem?
thanks -
Hi,
I'm not a specialist but since you get a QDBusReply, shouldn't you compare what value returns with noError ?
-
Yes, but, "noError" is a simple enumerator not a QDBusReply how can I compare them!?
-
Do you mean without QTest?
That is what I'm going to do! -
@
Undefined reference to"bool QTest::qCompare<QDBusReply<e_errorInterface>, e_errorInterface>(QDBusReply<e_errorInterface> const&, e_errorInterface const&, char const*, char const*, char const*, int)"@You seem to be getting a QDBusReply when calling your method, so you would need to first retrieve the value from that reply and then compare it to noError