diff options
Diffstat (limited to 'tests/auto/corelib/tools')
-rw-r--r-- | tests/auto/corelib/tools/qchar/tst_qchar.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp index 0c51422f75..f16d32a4f9 100644 --- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp @@ -77,6 +77,8 @@ private slots: void isDigit(); void isLetter_data(); void isLetter(); + void isLetterOrNumber_data(); + void isLetterOrNumber(); void isPrint(); void isUpper(); void isLower(); @@ -273,6 +275,28 @@ void tst_QChar::isLetter() QCOMPARE(QChar(ucs).isLetter(), expected); } +void tst_QChar::isLetterOrNumber_data() +{ + QTest::addColumn<ushort>("ucs"); + QTest::addColumn<bool>("expected"); + + for (ushort ucs = 0; ucs < 256; ++ucs) { + bool isLetterOrNumber = isExpectedLetter(ucs) + || (ucs >= '0' && ucs <= '9') + || ucs == 0xB2 || ucs == 0xB3 || ucs == 0xB9 + || (ucs >= 0xBC && ucs <= 0xBE); + QString tag = QString::fromLatin1("0x%0").arg(QString::number(ucs, 16)); + QTest::newRow(tag.toLatin1()) << ucs << isLetterOrNumber; + } +} + +void tst_QChar::isLetterOrNumber() +{ + QFETCH(ushort, ucs); + QFETCH(bool, expected); + QCOMPARE(QChar(ucs).isLetterOrNumber(), expected); +} + void tst_QChar::isPrint() { QVERIFY(QChar('A').isPrint()); |