summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qchar/tst_qchar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/tools/qchar/tst_qchar.cpp')
-rw-r--r--tests/auto/corelib/tools/qchar/tst_qchar.cpp86
1 files changed, 85 insertions, 1 deletions
diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp
index 14c43d0088..1a568073cf 100644
--- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp
+++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp
@@ -276,8 +276,65 @@ void tst_QChar::isLetterOrNumber()
void tst_QChar::isPrint()
{
+ // noncharacters, reserved (General_Gategory =Cn)
+ QVERIFY(!QChar(0x2064).isPrint());
+ QVERIFY(!QChar(0x2069).isPrint());
+ QVERIFY(!QChar(0xfdd0).isPrint());
+ QVERIFY(!QChar(0xfdef).isPrint());
+ QVERIFY(!QChar(0xfff0).isPrint());
+ QVERIFY(!QChar(0xfff8).isPrint());
+ QVERIFY(!QChar(0xfffe).isPrint());
+ QVERIFY(!QChar(0xffff).isPrint());
+/*
+ QVERIFY(!QChar::isPrint(0xe0000u));
+ QVERIFY(!QChar::isPrint(0xe0002u));
+ QVERIFY(!QChar::isPrint(0xe001fu));
+ QVERIFY(!QChar::isPrint(0xe0080u));
+ QVERIFY(!QChar::isPrint(0xe00ffu));
+*/
+
+ // Other_Default_Ignorable_Code_Point, Variation_Selector
+ QVERIFY(QChar(0x034f).isPrint());
+ QVERIFY(QChar(0x115f).isPrint());
+ QVERIFY(QChar(0x180b).isPrint());
+ QVERIFY(QChar(0x180d).isPrint());
+ QVERIFY(QChar(0x3164).isPrint());
+ QVERIFY(QChar(0xfe00).isPrint());
+ QVERIFY(QChar(0xfe0f).isPrint());
+ QVERIFY(QChar(0xffa0).isPrint());
+/*
+ QVERIFY(QChar::isPrint(0xe0100u));
+ QVERIFY(QChar::isPrint(0xe01efu));
+*/
+
+ // Cf, Cs, Cc, White_Space, Annotation Characters
+ QVERIFY(!QChar(0x0008).isPrint());
+ QVERIFY(!QChar(0x000a).isPrint());
+ QVERIFY(QChar(0x0020).isPrint());
+ QVERIFY(QChar(0x00a0).isPrint());
+ QVERIFY(!QChar(0x00ad).isPrint());
+ QVERIFY(!QChar(0x0085).isPrint());
+ QVERIFY(!QChar(0xd800).isPrint());
+ QVERIFY(!QChar(0xdc00).isPrint());
+ QVERIFY(!QChar(0xfeff).isPrint());
+/*
+ QVERIFY(!QChar::isPrint(0x1d173u));
+*/
+
+ QVERIFY(QChar('0').isPrint());
QVERIFY(QChar('A').isPrint());
- QVERIFY(!QChar(0x1aff).isPrint()); // General_Gategory =Cn
+ QVERIFY(QChar('a').isPrint());
+
+ QVERIFY(!QChar(0x0370).isPrint()); // assigned in 5.1
+ QVERIFY(!QChar(0x0524).isPrint()); // assigned in 5.2
+ QVERIFY(!QChar(0x0526).isPrint()); // assigned in 6.0
+ QVERIFY(!QChar(0x08a0).isPrint()); // assigned in 6.1
+ QVERIFY(!QChar(0x1aff).isPrint()); // not assigned
+ QVERIFY(!QChar(0x1e9e).isPrint()); // assigned in 5.1
+/*
+ QVERIFY(!QChar::isPrint(0x1b000u)); // assigned in 6.0
+ QVERIFY(!QChar::isPrint(0x110d0u)); // assigned in 5.1
+*/
}
void tst_QChar::isUpper()
@@ -551,6 +608,14 @@ void tst_QChar::mirroredChar()
void tst_QChar::decomposition()
{
+ // Hangul syllables
+ for (uint ucs = 0xac00; ucs <= 0xd7af; ++ucs) {
+ QChar::Decomposition expected = QChar::unicodeVersion(ucs) > QChar::Unicode_Unassigned ? QChar::Canonical : QChar::NoDecomposition;
+ QString desc = QString::fromLatin1("ucs = 0x%1, tag = %2, expected = %3")
+ .arg(QString::number(ucs, 16)).arg(QChar::decompositionTag(ucs)).arg(expected);
+ QVERIFY2(QChar::decompositionTag(ucs) == expected, desc.toLatin1());
+ }
+
QVERIFY(QChar((ushort)0xa0).decompositionTag() == QChar::NoBreak);
QVERIFY(QChar((ushort)0xa8).decompositionTag() == QChar::Compat);
QVERIFY(QChar((ushort)0x41).decompositionTag() == QChar::NoDecomposition);
@@ -748,6 +813,25 @@ void tst_QChar::normalization_manual()
QVERIFY(composed.normalized(QString::NormalizationForm_KD) == decomposed);
QVERIFY(composed.normalized(QString::NormalizationForm_KC) == decomposed);
}
+ { // hangul
+ QString composed;
+ composed += QChar(0xc154);
+ composed += QChar(0x11f0);
+ QString decomposed;
+ decomposed += QChar(0x1109);
+ decomposed += QChar(0x1167);
+ decomposed += QChar(0x11f0);
+
+ QVERIFY(composed.normalized(QString::NormalizationForm_D) == decomposed);
+ QVERIFY(composed.normalized(QString::NormalizationForm_C) == composed);
+ QVERIFY(composed.normalized(QString::NormalizationForm_KD) == decomposed);
+ QVERIFY(composed.normalized(QString::NormalizationForm_KC) == composed);
+
+ QVERIFY(decomposed.normalized(QString::NormalizationForm_D) == decomposed);
+ QVERIFY(decomposed.normalized(QString::NormalizationForm_C) == composed);
+ QVERIFY(decomposed.normalized(QString::NormalizationForm_KD) == decomposed);
+ QVERIFY(decomposed.normalized(QString::NormalizationForm_KC) == composed);
+ }
}
void tst_QChar::normalizationCorrections()