Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTest using DBus and custom datatype
Forum Updated to NodeBB v4.3 + New Features

QTest using DBus and custom datatype

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rfringuello89
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      I'm not a specialist but since you get a QDBusReply, shouldn't you compare what value returns with noError ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rfringuello89
        wrote on last edited by
        #3

        Yes, but, "noError" is a simple enumerator not a QDBusReply how can I compare them!?

        1 Reply Last reply
        0
        • R Offline
          R Offline
          rfringuello89
          wrote on last edited by
          #4

          Do you mean without QTest?
          That is what I'm going to do!

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @
            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

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved