summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-06-08 10:01:51 +0200
committerMarc Mutz <marc.mutz@kdab.com>2016-06-08 18:29:38 +0000
commit5a15545ee274a9caa33014755a3fdb7022c7ea8c (patch)
treea7ae98ffa8c53a3d9d7ea17a365e8b3e20e24612 /tests
parent4fb2b7411994852b742f944eba9d71d7d851aca5 (diff)
QDebug: fix streaming of QChars
Commit 9ef3ff30 introduced a new function, putUcs4(), to output QChar, char16_t, char32_t as a, possibly escaped, character literal, but got the order of stream modifiers wrong. Instead of applying the field width to the 'ucs' streaming, it applied it to the prefix '\u'. The same problem exists for the pad char, leading to the result '00\ue4' for a QChar containing ä (LATIN SMALL LETTER A WITH DIAERESIS) Fix by reordering the elements streamed so that the prefixes come last. Added a test. Change-Id: I6eaa0586501b9e780aaa3bb5dcec0e5c2f86a219 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/io/qdebug/tst_qdebug.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
index db2805ebf0..0c04c5058b 100644
--- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
+++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
@@ -363,14 +363,14 @@ void tst_QDebug::qDebugQChar() const
MessageHandlerSetter mhs(myMessageHandler);
{
QDebug d = qDebug();
- d << QChar('f');
- d.nospace().noquote() << QChar('o') << QChar('o');
+ d << QChar('f') << QChar(QLatin1Char('\xE4')); // f, ä
+ d.nospace().noquote() << QChar('o') << QChar('o') << QChar(QLatin1Char('\xC4')); // o, o, Ä
}
#ifndef QT_NO_MESSAGELOGCONTEXT
file = __FILE__; line = __LINE__ - 5; function = Q_FUNC_INFO;
#endif
QCOMPARE(s_msgType, QtDebugMsg);
- QCOMPARE(s_msg, QString::fromLatin1("'f' oo"));
+ QCOMPARE(s_msg, QString::fromLatin1("'f' '\\u00e4' oo\\u00c4"));
QCOMPARE(QString::fromLatin1(s_file), file);
QCOMPARE(s_line, line);
QCOMPARE(QString::fromLatin1(s_function), function);