summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2024-02-22 11:43:35 +0100
committerIvan Solovev <ivan.solovev@qt.io>2024-03-02 00:12:54 +0100
commitee612626f99d5a8da6814c2df90db00f9beb463f (patch)
tree5a92a286c27418b2b4e76e0faf01a24246f5fa82 /tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp
parenta08bafc9205d0b67f71a1896ad84272eeb294374 (diff)
Q(Latin1)Char: use comparison helper macros
Replace the existing friend relational operators with the macros. Add the previously-missing QChar vs `const char *` relational operators. These require out-of-line helper methods, because we need to interpret the `const char *` array as utf-8. The `const char *` relational operators cause ambiguities when comparing QChar with 0 (previously it was only handled by the nullptr_t overloads). As we have it in several places in our tests, I'd assume that the users can also do it. To resolve the ambiguities, mark the new relational operators as Q_WEAK_OVERLOADs. This allows to remove the dummy QChar vs `const char *` relational operators from tst_qstringapisymmetry, but at the same time requires that we introduce new dummy operators for QByteArray vs char16_t comparison. These will be fixed in a follow-up patch. For QLatin1Char - convert to uchar before doing the comparison, to match the behavior of QLatin1StringView and QChar. Extend QChar's unit tests. Task-number: QTBUG-117661 Change-Id: I9213fe05a5efdb96d48688f07bec9519f9887a77 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp')
-rw-r--r--tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp
index 854d0ac991..33bfdf163a 100644
--- a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp
+++ b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp
@@ -61,9 +61,8 @@ constexpr bool is_fake_comparator_v = false;
/*end*/
-MAKE_ALL(const char*, QChar)
-
-MAKE_ALL(QChar, const char*)
+MAKE_ALL(char16_t, QByteArray)
+MAKE_ALL(QByteArray, char16_t)
#undef MAKE_ALL
#undef MAKE_RELOP