Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-15256

QTest::ignoreMessage problem

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 5.3.0
    • 4.7.1
    • Core: I/O
    • None
    • gcc (Debian 4.4.4-8) 4.4.5 20100728 (prerelease)
    • 326e9c8962532f66109f94f224f891c4445ce87f

      With respect to the streaming qDebug / qWarning / qCritical / qFatal functions, the Qt documentation says:

      qWarning() << "Brush:" << myQBrush << "Other value:" << i;
      

      This syntax inserts a space between each item, and appends a newline at the end.

      In fact, an extra space is printed out before the final newline, so it does not behave exactly as documented.

      One of the notable effects of this is to make the usage of QTest::ignoreMessage quite confusing at times, e.g. consider the example:

      QTest::ignoreMessage(QtWarningMsg, "foo1");
      qWarning("foo1");
      QTest::ignoreMessage(QtWarningMsg, "foo2");
      qWarning() << "foo2";
      

      This test would fail with message:
      Did not receive message: "foo2"

      ...because the actual output message was "foo2 " (note trailing space).

        For Gerrit Dashboard: QTBUG-15256
        # Subject Branch Project Status CR V

            kkohne Kai Köhne
            nierob Nierob
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes