diff options
author | David Faure <david.faure@kdab.com> | 2013-12-29 10:07:24 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-06 13:24:14 +0100 |
commit | e5bfb9719bc76ca5bd73c5d7503cd2335cabb5fc (patch) | |
tree | f3bf69b93e09520fe21b45e5eb80b963acd2a99d /src/testlib/qtestlog.cpp | |
parent | bf32528f4b08b31bf25af6e2e4cb9b8edb7654cd (diff) |
QTestLib: use QT_MESSAGE_PATTERN when showing debug output
This makes debugging much more convenient, being able to see e.g.
the method name where qDebug is used. Note that this doesn't break
ignored messages, since qMessageFormatString is only called after
the test for ignored messages.
Change-Id: I7fc96e3f19efe48ac3a30fdd63e5b495c0d86e02
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Diffstat (limited to 'src/testlib/qtestlog.cpp')
-rw-r--r-- | src/testlib/qtestlog.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 60f3630709..bbca5b94e5 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -56,6 +56,8 @@ QT_BEGIN_NAMESPACE +Q_CORE_EXPORT QString qMessageFormatString(QtMsgType type, const QMessageLogContext &context, const QString& msg); + static void saveCoverageTool(const char * appname, bool testfailed, bool installedTestCoverage) { #ifdef __COVERAGESCANNER__ @@ -230,7 +232,7 @@ namespace QTest { return false; } - static void messageHandler(QtMsgType type, const QMessageLogContext & /*context*/, const QString &message) + static void messageHandler(QtMsgType type, const QMessageLogContext & context, const QString &message) { static QBasicAtomicInt counter = Q_BASIC_ATOMIC_INITIALIZER(QTest::maxWarnings); @@ -245,6 +247,9 @@ namespace QTest { // the message is expected, so just swallow it. return; + msg = qMessageFormatString(type, context, message).toLocal8Bit(); + msg.chop(1); // remove trailing newline + if (type != QtFatalMsg) { if (counter.load() <= 0) return; |