summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestcase.qdoc
diff options
context:
space:
mode:
authorLaszlo Papp <lpapp@kde.org>2022-07-01 06:15:17 +0100
committerLaszlo Papp <lpapp@kde.org>2022-07-09 21:08:10 +0100
commit07ada0b971a84483f3676b5fef46ff2bd6d26dbb (patch)
treebf1980cbbe1563f1e34425c97c6c38206cfa5590 /src/testlib/qtestcase.qdoc
parent14ce67629bd36f75b2a9a0b3caf5c4c5d59abeac (diff)
QTest: Support QKeySequence compare
Add a QTest::toString() override for QKeySequence. This is just calling QKeySequence::toString(). The default format is PortableText, which should be ascii. Deliberately avoided NativeText as it can return unicode, e.g. on Mac. This is necessary to get helpful information for test failures when using QCOMPARE for QKeySequence instances. Currently, the returned output would not only be not helpful, but even misleading: Actual (edit.keySequence()): <null> Expected (QKeySequence()) : <null> After adding the override, the output is neither misleading nor unhelpful: Actual (edit.keySequence()): "" Expected (keySequence) : "Return" Some special characters would be escaped in the output, like the literal double quote: Actual (edit.keySequence()): "Ctrl+N" Expected (QKeySequence("\"")): "\"" Change-Id: Ib4b28fca30f6f2ad86c62530767f94a151332e0a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/testlib/qtestcase.qdoc')
-rw-r--r--src/testlib/qtestcase.qdoc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/testlib/qtestcase.qdoc b/src/testlib/qtestcase.qdoc
index 2c46453968..654687c880 100644
--- a/src/testlib/qtestcase.qdoc
+++ b/src/testlib/qtestcase.qdoc
@@ -1597,6 +1597,13 @@
*/
/*!
+ \fn char *QTest::toString(const QKeySequence &ks)
+ \overload
+ \since 6.5
+ Returns a textual representation of the key sequence \a ks.
+*/
+
+/*!
\fn template <typename Tuple, int... I> char *QTest::toString(const Tuple &tuple, QtPrivate::IndexesList<I...> )
\internal
\since 5.12