diff options
-rw-r--r-- | src/corelib/tools/qchar.cpp | 2 | ||||
-rw-r--r-- | tests/auto/corelib/tools/qchar/tst_qchar.cpp | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp index 6efd9f20af..1ce19ec911 100644 --- a/src/corelib/tools/qchar.cpp +++ b/src/corelib/tools/qchar.cpp @@ -717,7 +717,7 @@ int QChar::digitValue(ushort ucs2) int QChar::digitValue(uint ucs4) { if (ucs4 > UNICODE_LAST_CODEPOINT) - return 0; + return -1; return qGetProp(ucs4)->digitValue; } diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp index e72af11fbb..215f4c18f2 100644 --- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp @@ -523,6 +523,9 @@ void tst_QChar::digitValue() QVERIFY(QChar::digitValue((ushort)0x1040) == 0); QVERIFY(QChar::digitValue((uint)0x1049) == 9); QVERIFY(QChar::digitValue((uint)0x1040) == 0); + + QVERIFY(QChar::digitValue((ushort)0xd800) == -1); + QVERIFY(QChar::digitValue((uint)UNICODE_LAST_CODEPOINT + 1) == -1); } void tst_QChar::decomposition() |