summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestlog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/testlib/qtestlog.cpp')
-rw-r--r--src/testlib/qtestlog.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index b2efa1ac9c..037bed643d 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -58,6 +58,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__
@@ -267,7 +269,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);
@@ -282,6 +284,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;