Changeset View
Changeset View
Standalone View
Standalone View
autotests/kstringhandlertest.cpp
Show First 20 Lines • Show All 147 Lines • ▼ Show 20 Line(s) | |||||
148 | { | 148 | { | ||
149 | QFETCH(QString, string); | 149 | QFETCH(QString, string); | ||
150 | QFETCH(QString, expected); | 150 | QFETCH(QString, expected); | ||
151 | 151 | | |||
152 | QCOMPARE(replaceZwsp(KStringHandler::preProcessWrap(string)), | 152 | QCOMPARE(replaceZwsp(KStringHandler::preProcessWrap(string)), | ||
153 | replaceZwsp(expected)); | 153 | replaceZwsp(expected)); | ||
154 | } | 154 | } | ||
155 | 155 | | |||
156 | void KStringHandlerTest::logicalLength_data() | ||||
157 | { | ||||
158 | QTest::addColumn<QString>("string"); | ||||
159 | QTest::addColumn<int>("expected"); | ||||
160 | | ||||
161 | QTest::newRow("Latin") << "foo bar baz" << 11; | ||||
162 | QTest::newRow("Chinese") << QString::fromUtf8("\xe4\xbd\xa0\xe5\xa5\xbd") << 4; | ||||
163 | QTest::newRow("Japanese") << QString::fromUtf8("\xe9\x9d\x92\xe3\x81\x84\xe7\xa9\xba") << 6; | ||||
164 | QTest::newRow("Korean") << QString::fromUtf8("\xed\x95\x9c\xea\xb5\xad\xec\x96\xb4") << 6; | ||||
165 | QTest::newRow("Mixed") << QString::fromUtf8("KDE\xe6\xa1\x8c\xe9\x9d\xa2") << 7; | ||||
166 | } | ||||
167 | | ||||
168 | void KStringHandlerTest::logicalLength() | ||||
169 | { | ||||
170 | QFETCH(QString, string); | ||||
171 | QFETCH(int, expected); | ||||
172 | QCOMPARE(KStringHandler::logicalLength(string), expected); | ||||
173 | } | ||||
174 | |