Changeset View
Changeset View
Standalone View
Standalone View
autotests/kurifiltertest.cpp
Show All 19 Lines | |||||
20 | 20 | | |||
21 | #include <KUriFilter> | 21 | #include <KUriFilter> | ||
22 | #include <KSharedConfig> | 22 | #include <KSharedConfig> | ||
23 | #include <KConfigGroup> | 23 | #include <KConfigGroup> | ||
24 | #include <QLoggingCategory> | 24 | #include <QLoggingCategory> | ||
25 | 25 | | |||
26 | #include <QtTestWidgets> | 26 | #include <QtTestWidgets> | ||
27 | #include <QDir> | 27 | #include <QDir> | ||
28 | #include <QRegExp> | 28 | #include <QRegularExpression> | ||
29 | #include <QHostInfo> | 29 | #include <QHostInfo> | ||
30 | 30 | | |||
31 | #include <iostream> | 31 | #include <iostream> | ||
32 | 32 | | |||
33 | QTEST_MAIN(KUriFilterTest) | 33 | QTEST_MAIN(KUriFilterTest) | ||
34 | 34 | | |||
35 | static const char *const s_uritypes[] = { "NetProtocol", "LOCAL_FILE", "LOCAL_DIR", "EXECUTABLE", "HELP", "SHELL", "BLOCKED", "ERROR", "UNKNOWN" }; | 35 | static const char *const s_uritypes[] = { "NetProtocol", "LOCAL_FILE", "LOCAL_DIR", "EXECUTABLE", "HELP", "SHELL", "BLOCKED", "ERROR", "UNKNOWN" }; | ||
36 | #define NO_FILTERING -2 | 36 | #define NO_FILTERING -2 | ||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Line(s) | 104 | case KUriFilterData::Error: | |||
106 | qDebug() << "Reason:" << filterData->errorMsg(); | 106 | qDebug() << "Reason:" << filterData->errorMsg(); | ||
107 | break; | 107 | break; | ||
108 | default: | 108 | default: | ||
109 | qDebug() << "*** Result: Unknown or invalid resource."; | 109 | qDebug() << "*** Result: Unknown or invalid resource."; | ||
110 | } | 110 | } | ||
111 | 111 | | |||
112 | if (!expectedResult.isEmpty()) { | 112 | if (!expectedResult.isEmpty()) { | ||
113 | // Hack for other locales than english, normalize google hosts to google.com | 113 | // Hack for other locales than english, normalize google hosts to google.com | ||
114 | cmd.replace(QRegExp(QStringLiteral("www\\.google\\.[^/]*/")), QStringLiteral("www.google.com/")); | 114 | cmd.replace(QRegularExpression(QStringLiteral("www\\.google\\.[^/]*/")), QStringLiteral("www.google.com/")); | ||
115 | if (cmd != expectedResult) { | 115 | if (cmd != expectedResult) { | ||
116 | qWarning() << a; | 116 | qWarning() << a; | ||
117 | QCOMPARE(cmd, expectedResult); | 117 | QCOMPARE(cmd, expectedResult); | ||
118 | } | 118 | } | ||
119 | } | 119 | } | ||
120 | 120 | | |||
121 | if (expectedUriType != -1 && expectedUriType != filterData->uriType()) { | 121 | if (expectedUriType != -1 && expectedUriType != filterData->uriType()) { | ||
122 | qWarning() << a << "Got URI type" << s_uritypes[filterData->uriType()] | 122 | qWarning() << a << "Got URI type" << s_uritypes[filterData->uriType()] | ||
▲ Show 20 Lines • Show All 372 Lines • Show Last 20 Lines |