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. QWarn in qtest does not print anything

QWarn in qtest does not print anything

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 2.0k 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.
  • G Offline
    G Offline
    gbonnema
    wrote on last edited by
    #1

    Probably a trivial error, I just don't know what it is. Searched google, but couldn't find anything relevant (lots of closed bugs though).

    I use Fedora 21, Qt5.4 and Qml 2, and I use QtTest. It all seems to work together fine, but my QWARN never prints anything, neither do I get messages from the Qt system that uses qwarn.

    I tried including <QDebug> to no avail.

    Does anyone know how to get QWARN to work?

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

      Hi,

      Without any code it's pretty much Crystal Ball debugging. Can you share your code ?

      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
      • G Offline
        G Offline
        gbonnema
        wrote on last edited by
        #3

        Hmm, bummer, I smashed my crystal ball ..... xD

        Okee, adding a sample from the code (would be a bit much to show everything, and probably not helpful). The QWARN you see here, compiles, but shows nothing. My suspicion is it is a macro that was commented unless something is defined.

        @
        #include <QtQml>

        #include "testport.h"
        #include "utils.h"

        TestPort::TestPort(QObject *parent) : QObject(parent)
        {

        }

        TestPort::~TestPort()
        {

        }

        /**

        • @brief TestPort::testPortCreation A simple test for creating a Port.
        • No further test necessary: QML takes care of all
          */
          void TestPort::testPortCreation() {
          model::Utils::registreModel();
          QQmlEngine engine;
          QQmlComponent component(&engine, QUrl("qrc:testport_1.qml"));
          model::Port *port = qobject_cast<model::Port *>(component.create());
          if (port) {
          QCOMPARE(port->name(), QString("testport1"));
          QCOMPARE(port->rdy(), QString("rdy1"));
          QCOMPARE(port->compName(), QString("compName1"));
          } else {
          QWARN("Creation of Port not successful. Recheck qml and qrc files.");
          QVERIFY(false);
          }

        }
        @

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

          Might be a silly question but are you sure that you are passing by the else case ?

          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
          • G Offline
            G Offline
            gbonnema
            wrote on last edited by
            #5

            Yep, completely. I have now added a std::cout << of component.errors() (broken down into strings) and finally got the error message. Still, the QWARN is silent.

            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