From 58ea5d52b4f30fc1d029db05b09b60fef49a6f2a Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Wed, 24 Feb 2010 20:13:24 +0100 Subject: Unicode character property 'General_Category=Cn' was erroneously ignored causing two related bugs in QChar::category() and QChar::isPrint(). As described in tr44, 4.2.8 Default Values General_Category character property should be setted to Cn for all codepoints omitted in UCD. Instead they was mapped to QChar::NoCategory (=0) which have no equivalent in Unicode specs and as result was ignored in filtering by binary mask. Merge-request: 480 Reviewed-by: Thiago Macieira --- tests/auto/qchar/tst_qchar.cpp | 13 +++++++++++++ util/unicode/main.cpp | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/auto/qchar/tst_qchar.cpp b/tests/auto/qchar/tst_qchar.cpp index 547147c..6227c2e 100644 --- a/tests/auto/qchar/tst_qchar.cpp +++ b/tests/auto/qchar/tst_qchar.cpp @@ -72,6 +72,7 @@ private slots: void toLower(); void toTitle(); void toCaseFolded(); + void isPrint(); void isUpper(); void isLower(); void category(); @@ -218,6 +219,12 @@ void tst_QChar::toCaseFolded() QVERIFY(QChar::toCaseFolded((ushort)0xb5) == 0x3bc); } +void tst_QChar::isPrint() +{ + QVERIFY(QChar('A').isPrint()); + QVERIFY(!QChar(0x1aff).isPrint()); // General_Gategory =Cn +} + void tst_QChar::isUpper() { QVERIFY(QChar('A').isUpper()); @@ -259,6 +266,12 @@ void tst_QChar::category() QVERIFY(QChar::category(0xd900u) == QChar::Other_Surrogate); QVERIFY(QChar::category(0xdc00u) == QChar::Other_Surrogate); QVERIFY(QChar::category(0xdc01u) == QChar::Other_Surrogate); + + QVERIFY(QChar::category((uint)0x10fffdu) == QChar::Other_PrivateUse); + QVERIFY(QChar::category((uint)0x110000u) == QChar::NoCategory); + + QVERIFY(QChar::category((uint)0x1aff) == QChar::Other_NotAssigned); + QVERIFY(QChar::category((uint)0x10ffffu) == QChar::Other_NotAssigned); } void tst_QChar::direction() diff --git a/util/unicode/main.cpp b/util/unicode/main.cpp index 14d8046..d7ee084 100644 --- a/util/unicode/main.cpp +++ b/util/unicode/main.cpp @@ -368,7 +368,7 @@ static int appendToSpecialCaseMap(const QList &map) struct UnicodeData { UnicodeData(int codepoint = 0) { - p.category = QChar::NoCategory; + p.category = QChar::Other_NotAssigned; // Cn p.combiningClass = 0; p.direction = QChar::DirL; -- cgit v0.12