summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2020-07-30 17:21:37 -0700
committerThiago Macieira <thiago.macieira@intel.com>2020-08-04 15:13:09 -0700
commitf2abfb39d775deffe16fe08a58c9518bd12c43f3 (patch)
treef02e90340330e216c433a2e24baa065a49809fd6 /tests
parent31c232d3b7297cbc288815297c75968d5c80ac18 (diff)
QDebug: add operator<<(const char16_t *)
Avoids the conversion from UTF-8 for uses that are not dumping a string. Mass conversion of Qt sources left for future opportunity. Fixes: QTBUG-85811 Change-Id: I4ca4a35b687b46c39030fffd1626ae6c3294cacf Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/io/qdebug/tst_qdebug.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
index 39897f3a58..ece9be642a 100644
--- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
+++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
@@ -49,6 +49,7 @@ private slots:
void assignment() const;
void warningWithoutDebug() const;
void criticalWithoutDebug() const;
+ void basics() const;
void debugWithBool() const;
void debugSpaceHandling() const;
void debugNoQuotes() const;
@@ -156,6 +157,46 @@ void tst_QDebug::criticalWithoutDebug() const
QCOMPARE(QString::fromLatin1(s_function), function);
}
+void tst_QDebug::basics() const
+{
+ // test simple types, without quoting or other modifications
+ // (bool tested in the next function)
+ MessageHandlerSetter mhs(myMessageHandler);
+
+ qDebug() << 'X';
+ QCOMPARE(s_msg, "X");
+
+ qDebug() << 123;
+ QCOMPARE(s_msg, "123");
+
+ qDebug() << 456U;
+ QCOMPARE(s_msg, "456");
+
+ qDebug() << -123L;
+ QCOMPARE(s_msg, "-123");
+
+ qDebug() << 456UL;
+ QCOMPARE(s_msg, "456");
+
+ qDebug() << Q_INT64_C(-123);
+ QCOMPARE(s_msg, "-123");
+
+ qDebug() << Q_UINT64_C(456);
+ QCOMPARE(s_msg, "456");
+
+ qDebug() << "Hello";
+ QCOMPARE(s_msg, "Hello");
+
+ qDebug() << u"World";
+ QCOMPARE(s_msg, "World");
+
+ qDebug() << (void *)0xfff;
+ QCOMPARE(s_msg, "0xfff");
+
+ qDebug() << nullptr;
+ QCOMPARE(s_msg, "(nullptr)");
+}
+
void tst_QDebug::debugWithBool() const
{
QString file, function;