diff options
author | Kai Koehne <kai.koehne@theqtcompany.com> | 2014-10-16 15:12:59 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@theqtcompany.com> | 2014-10-27 08:59:02 +0100 |
commit | 5bfe794aaab34d6aa021b5640972509e3bc6ced8 (patch) | |
tree | 3d4357aa5cb927c66aac33ecba59b0b36697d55a /tests/auto/corelib/global/qlogging | |
parent | 1ffe1a9a7c5199e46bf280806456a5d86f314169 (diff) |
Remove trailing '\n' in qFormatLogMessage output
Do not automatically add a \n to all messages formatted by
qFormatLogMessage. Some backends require a final newline,
some don't, so it's best to only append it where it's actually needed.
The returned string will be null if the pattern is empty. This allows
to differentiate between the case that the pattern just didn't apply
(empty line is printed), and the case that qSetMessagePattern(QString())
have been called (nothing is printed).
Change-Id: I17fde997a4074f58f82de6dea129948155c322d6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'tests/auto/corelib/global/qlogging')
-rw-r--r-- | tests/auto/corelib/global/qlogging/tst_qlogging.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index 35bd518b3a..0a55da5b7e 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -886,25 +886,25 @@ void tst_qmessagehandler::formatLogMessage_data() #define BA QByteArrayLiteral QTest::newRow("basic") << "%{type} %{file} %{line} %{function} %{message}" - << "debug main.cpp 1 func msg\n" + << "debug main.cpp 1 func msg" << QtDebugMsg << BA("main.cpp") << 1 << BA("func") << BA("") << "msg"; // test the if conditions QString format = "[%{if-debug}D%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}] %{if-category}%{category}: %{endif}%{message}"; QTest::newRow("if-debug") - << format << "[D] msg\n" + << format << "[D] msg" << QtDebugMsg << BA("") << 0 << BA("func") << QByteArray() << "msg"; QTest::newRow("if_warning") - << format << "[W] msg\n" + << format << "[W] msg" << QtWarningMsg << BA("") << 0 << BA("func") << QByteArray() << "msg"; QTest::newRow("if_critical") - << format << "[C] msg\n" + << format << "[C] msg" << QtCriticalMsg << BA("") << 0 << BA("func") << QByteArray() << "msg"; QTest::newRow("if_fatal") - << format << "[F] msg\n" + << format << "[F] msg" << QtFatalMsg << BA("") << 0 << BA("func") << QByteArray() << "msg"; QTest::newRow("if_cat") - << format << "[F] cat: msg\n" + << format << "[F] cat: msg" << QtFatalMsg << BA("") << 0 << BA("func") << BA("cat") << "msg"; } |