diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2012-04-08 10:18:45 +0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-11 01:42:12 +0200 |
commit | 50fefebc8403c0f293210c6dc5a98adb19776b76 (patch) | |
tree | 2a1f172378259216fce0ccb3420539b2e0a96f24 /tests | |
parent | 3b778df102e82a7cf4b1db7fca0bcfeadfe98857 (diff) |
replace hardcoded values with a surrogate handling methods
Change-Id: Iba079953c46a29404232d2dacbe0c90170097d51
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/tools/qchar/tst_qchar.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp index 215f4c18f2..6632776a86 100644 --- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp @@ -543,10 +543,10 @@ void tst_QChar::decomposition() { QString str; - str += QChar( (0x1D157 - 0x10000) / 0x400 + 0xd800 ); - str += QChar( ((0x1D157 - 0x10000) % 0x400) + 0xdc00 ); - str += QChar( (0x1D165 - 0x10000) / 0x400 + 0xd800 ); - str += QChar( ((0x1D165 - 0x10000) % 0x400) + 0xdc00 ); + str += QChar(QChar::highSurrogate(0x1D157)); + str += QChar(QChar::lowSurrogate(0x1D157)); + str += QChar(QChar::highSurrogate(0x1D165)); + str += QChar(QChar::lowSurrogate(0x1D165)); QVERIFY(QChar::decomposition(0x1D15e) == str); } @@ -629,14 +629,12 @@ void tst_QChar::normalization_data() for (int j = 0; j < c.size(); ++j) { bool ok; uint uc = c.at(j).toInt(&ok, 16); - if (uc < 0x10000) + if (!QChar::requiresSurrogates(uc)) { columns[i].append(QChar(uc)); - else { + } else { // convert to utf16 - ushort high = QChar::highSurrogate(uc); - ushort low = QChar::lowSurrogate(uc); - columns[i].append(QChar(high)); - columns[i].append(QChar(low)); + columns[i].append(QChar(QChar::highSurrogate(uc))); + columns[i].append(QChar(QChar::lowSurrogate(uc))); } } } |