Changeset View
Changeset View
Standalone View
Standalone View
autotests/kstringhandlertest.cpp
1 | 1 | | |||
---|---|---|---|---|---|
2 | #include "kstringhandlertest.h" | 2 | #include "kstringhandlertest.h" | ||
3 | 3 | | |||
4 | #include <QRegularExpression> | ||||
4 | #include <QTest> | 5 | #include <QTest> | ||
5 | 6 | | |||
6 | QTEST_MAIN(KStringHandlerTest) | 7 | QTEST_MAIN(KStringHandlerTest) | ||
7 | 8 | | |||
8 | #include "kstringhandler.h" | 9 | #include "kstringhandler.h" | ||
9 | 10 | | |||
10 | QString KStringHandlerTest::test = QStringLiteral("The quick brown fox jumped over the lazy bridge. "); | 11 | QString KStringHandlerTest::test = QStringLiteral("The quick brown fox jumped over the lazy bridge. "); | ||
11 | 12 | | |||
Show All 40 Lines | 46 | { | |||
52 | expected << QStringLiteral("kparts") << QStringLiteral("reaches") << QStringLiteral("the parts other parts can't"); | 53 | expected << QStringLiteral("kparts") << QStringLiteral("reaches") << QStringLiteral("the parts other parts can't"); | ||
53 | QCOMPARE(KStringHandler::perlSplit(QLatin1Char(' '), | 54 | QCOMPARE(KStringHandler::perlSplit(QLatin1Char(' '), | ||
54 | QStringLiteral("kparts reaches the parts other parts can't"), 3), expected); | 55 | QStringLiteral("kparts reaches the parts other parts can't"), 3), expected); | ||
55 | 56 | | |||
56 | expected.clear(); | 57 | expected.clear(); | ||
57 | expected << QStringLiteral("Split") << QStringLiteral("me") << QStringLiteral("up ! I'm bored ! OK ?"); | 58 | expected << QStringLiteral("Split") << QStringLiteral("me") << QStringLiteral("up ! I'm bored ! OK ?"); | ||
58 | QCOMPARE(KStringHandler::perlSplit(QRegExp(QStringLiteral("[! ]")), | 59 | QCOMPARE(KStringHandler::perlSplit(QRegExp(QStringLiteral("[! ]")), | ||
59 | QStringLiteral("Split me up ! I'm bored ! OK ?"), 3), expected); | 60 | QStringLiteral("Split me up ! I'm bored ! OK ?"), 3), expected); | ||
61 | QCOMPARE(KStringHandler::perlSplit(QRegularExpression(QStringLiteral("[! ]")), | ||||
62 | QStringLiteral("Split me up ! I'm bored ! OK ?"), 3), expected); | ||||
60 | } | 63 | } | ||
61 | 64 | | |||
62 | void KStringHandlerTest::obscure() | 65 | void KStringHandlerTest::obscure() | ||
63 | { | 66 | { | ||
64 | // See bug 167900, obscure() produced chars that could not properly be converted to and from | 67 | // See bug 167900, obscure() produced chars that could not properly be converted to and from | ||
65 | // UTF8. The result was that storing passwords with '!' in them did not work. | 68 | // UTF8. The result was that storing passwords with '!' in them did not work. | ||
66 | QString test = QStringLiteral("!TEST!"); | 69 | QString test = QStringLiteral("!TEST!"); | ||
67 | QString obscured = KStringHandler::obscure(test); | 70 | QString obscured = KStringHandler::obscure(test); | ||
▲ Show 20 Lines • Show All 126 Lines • Show Last 20 Lines |