qt6-bb10/tests/auto
Thiago Macieira d4c7da9a07 CBOR: fix sorting of UTF16-to-UTF16 strings
This amends commit 394788c68e (its
ChangeLog applies to this commit too). That fixed sorting of UTF8-to-
UTF16, but when adding more unit tests, I've discovered that some UTF-16
strings also sorted incorrectly. There were two problems:

First, we were assuming that we could rely on the UTF-16 length as a
proxy for the UTF-8 one, but that's not true for some cases:
* both 1-, 2- and 3-codepoint UTF-8 sequences are 1 codepoint
  in UTF-16, so some strings would have identical UTF-16 length
* 4-codepoint UTF-8 sequences shrink to 2-codepoint UTF-16 ones
  (2:1) but 3-codepoint UTF-8 sequences shrink to 1 (3:1), so
  some strings would be longer in UTF-16 but shorter in UTF-8.

Second, QtPrivate::compareStrings performs UTF-16 codepoint comparisons
not Unicode character ones, so surrogate pairs were sorting before
U+E000 to U+FFFF.

To fix all of this, we need to decode the UTF-16 string into UTF-32 and
calculate the length of that in UTF-8 to be sure we have the sorting
order right.

Since this is a slight behavior change with a performance penalty, I am
choosing to backport only to 6.7. The penalty mostly does not apply to
6.8 due to commit 61556627f2.

Pick-to: 6.7
Change-Id: If1bf59ecbe014b569ba1fffd17c4c4ddcc874aac
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-04-12 21:41:16 -07:00
..
bic/data Add binary compatibility file for 6.6.0 2023-10-17 22:23:42 +03:00
cmake "Simplify" versionless targets 2024-03-12 20:27:42 +01:00
concurrent Fix truncation warning in generation_helpers 2024-03-18 20:10:34 +01:00
corelib CBOR: fix sorting of UTF16-to-UTF16 strings 2024-04-12 21:41:16 -07:00
dbus QDBusArgument: disambiguate between QMap on std::pair and std::map 2024-03-18 14:43:13 -07:00
gui Tests: make some QFile::open calls fail 2024-04-13 01:36:06 +02:00
guiapplauncher Turn the "concentriccircles" example into snippets, update screenshot 2023-12-14 20:06:32 +01:00
network Tests: make some QFile::open calls fail 2024-04-13 01:36:06 +02:00
opengl tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
other Clean up windows accessibility backend 2024-03-27 15:35:15 +01:00
printsupport Change license for tests files 2024-02-04 09:56:42 +01:00
shared Change license for tests files 2024-02-04 09:56:42 +01:00
sql CMake: Make a few more auto tests standalone 2024-03-14 01:14:18 +01:00
testlib QSignalSpy: separate messages for invalid and non-signal meta-methods 2024-03-22 15:31:39 +01:00
tools uic: use qOverload for ambiguous slots 2024-04-12 12:32:16 +00:00
wasm Revert "wasm: Proxy emscripten_fetch() to the main thread" 2024-04-05 14:41:23 +02:00
widgets Android: blacklist tst_QWidget::setParentChangesFocus 2024-04-12 20:12:18 +03:00
xml QtXml: fix leak in QDomText::splitText 2024-03-02 21:22:53 +01:00
CMakeLists.txt wasm: Add qdiriterator test + minor runtime fixes 2024-03-19 10:28:06 +01:00
network-settings.h Change license for tests files 2024-02-04 09:56:42 +01:00