qt6-bb10/tests/auto/corelib
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
..
animation Change license for tests files 2024-02-04 09:56:42 +01:00
global Skip tst_qcomparehelpers_cpp23 on Linux arm 2024-04-12 19:31:51 +02:00
io Tests: make some QFile::open calls fail 2024-04-13 01:36:06 +02:00
ipc Change license for tests files 2024-02-04 09:56:42 +01:00
itemmodels Change license for tests files 2024-02-04 09:56:42 +01:00
kernel JNI: check for pending exception first in getCleanJniObject() 2024-04-04 19:12:55 +00:00
mimetypes Change license for tests files 2024-02-04 09:56:42 +01:00
platform Android: fix 180 degree orientation issue 2024-04-12 02:20:51 +03:00
plugin tst_QFactoryLoader: includemocs 2024-03-12 14:23:42 +01:00
serialization CBOR: fix sorting of UTF16-to-UTF16 strings 2024-04-12 21:41:16 -07:00
text Pass QVariant to QSystemLocale::query() as rvalue reference 2024-04-09 16:41:27 +02:00
thread tst_qfuture: Update EXPECT_FAIL msvc condition 2024-03-18 14:59:26 +01:00
time QIcuTimeZonePrivate constructor: save iteration over all zone IDs 2024-02-08 15:40:03 +01:00
tools Fix warning: remove unused parameter 2024-04-04 00:51:46 +00:00
CMakeLists.txt tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00