diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/tools/qchar/tst_qchar.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp index 5a2a4834db..0c51422f75 100644 --- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp @@ -75,6 +75,8 @@ private slots: void toCaseFolded(); void isDigit_data(); void isDigit(); + void isLetter_data(); + void isLetter(); void isPrint(); void isUpper(); void isLower(); @@ -244,6 +246,33 @@ void tst_QChar::isDigit() QCOMPARE(QChar(ucs).isDigit(), expected); } +static bool isExpectedLetter(ushort ucs) +{ + return (ucs >= 'a' && ucs <= 'z') || (ucs >= 'A' && ucs <= 'Z') + || ucs == 0xAA || ucs == 0xB5 || ucs == 0xBA + || (ucs >= 0xC0 && ucs <= 0xD6) + || (ucs >= 0xD8 && ucs <= 0xF6) + || (ucs >= 0xF8 && ucs <= 0xFF); +} + +void tst_QChar::isLetter_data() +{ + QTest::addColumn<ushort>("ucs"); + QTest::addColumn<bool>("expected"); + + for (ushort ucs = 0; ucs < 256; ++ucs) { + QString tag = QString::fromLatin1("0x%0").arg(QString::number(ucs, 16)); + QTest::newRow(tag.toLatin1()) << ucs << isExpectedLetter(ucs); + } +} + +void tst_QChar::isLetter() +{ + QFETCH(ushort, ucs); + QFETCH(bool, expected); + QCOMPARE(QChar(ucs).isLetter(), expected); +} + void tst_QChar::isPrint() { QVERIFY(QChar('A').isPrint()); |