summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-06-07 12:10:01 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-06-11 15:36:07 +0000
commit96bc254c3b6c0f4291a46cd1ffb9ea22e71c59b0 (patch)
treea24b8e9be23552debb7184b329050a91722acaef /tests
parent1f0be296c4d0fe02ee8e0a061da70b2f16c5f315 (diff)
Hangul composition: use < base + count checks, not <= checks
Before Unicode 4.1.0 there was an error in the example code for Hangul normalization that used <= on the ends of some ranges of values, where they should have used < tests. This was faithfully copied but the need for correction has only lately come to light. Thanks to Ma Lin for pointing this out and providing the fix and test-cases. Fixes: QTBUG-71894 Change-Id: I5c7fec1f9fac1f7a25b2d5e9c3109a90a7ff49e1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 182afbe335a8bd494a86defc5d32da3ae8ec7920) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/text/qchar/tst_qchar.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/corelib/text/qchar/tst_qchar.cpp b/tests/auto/corelib/text/qchar/tst_qchar.cpp
index 0773fd7b82..3c621948fe 100644
--- a/tests/auto/corelib/text/qchar/tst_qchar.cpp
+++ b/tests/auto/corelib/text/qchar/tst_qchar.cpp
@@ -997,6 +997,25 @@ void tst_QChar::normalization_manual()
QVERIFY(decomposed.normalized(QString::NormalizationForm_KD) == decomposed);
QVERIFY(decomposed.normalized(QString::NormalizationForm_KC) == composed);
}
+ // QTBUG-71894 - erratum fixed in Unicode 4.1.0; SCount bounds are < not <=
+ {
+ // Hangul compose, test 0x11a7:
+ const QChar c[] = { QChar(0xae30), QChar(0x11a7), {} };
+ const QChar d[] = { QChar(0x1100), QChar(0x1175), QChar(0x11a7), {} };
+ const QString composed(c, 2);
+ const QString decomposed(d, 3);
+
+ QCOMPARE(decomposed.normalized(QString::NormalizationForm_C), composed);
+ }
+ {
+ // Hangul compose, test 0x11c3:
+ const QChar c[] = { QChar(0xae30), QChar(0x11c3), {} };
+ const QChar d[] = { QChar(0x1100), QChar(0x1175), QChar(0x11c3), {} };
+ const QString composed(c, 2);
+ const QString decomposed(d, 3);
+
+ QCOMPARE(decomposed.normalized(QString::NormalizationForm_C), composed);
+ }
}
void tst_QChar::normalizationCorrections()