Changeset View
Changeset View
Standalone View
Standalone View
autotests/filemetadatawidgettest.cpp
Show All 23 Lines | |||||
24 | #include <QObject> | 24 | #include <QObject> | ||
25 | #include <QTest> | 25 | #include <QTest> | ||
26 | #include <QMap> | 26 | #include <QMap> | ||
27 | #include <QLabel> | 27 | #include <QLabel> | ||
28 | #include <QSignalSpy> | 28 | #include <QSignalSpy> | ||
29 | #include <QMetaType> | 29 | #include <QMetaType> | ||
30 | #include <QProcess> | 30 | #include <QProcess> | ||
31 | #include <QStandardPaths> | 31 | #include <QStandardPaths> | ||
32 | #include <QDir> | ||||
32 | #include <QDebug> | 33 | #include <QDebug> | ||
33 | 34 | | |||
34 | #include <KFileItem> | 35 | #include <KFileItem> | ||
35 | #include <KRatingWidget> | 36 | #include <KRatingWidget> | ||
36 | #include <KConfig> | 37 | #include <KConfig> | ||
37 | #include <KConfigGroup> | 38 | #include <KConfigGroup> | ||
38 | 39 | | |||
39 | void initLocale() | 40 | void initLocale() | ||
40 | { | 41 | { | ||
41 | QLocale::setDefault(QLocale("en_US")); | 42 | QLocale::setDefault(QLocale("en_US")); | ||
42 | } | 43 | } | ||
43 | Q_CONSTRUCTOR_FUNCTION(initLocale) | 44 | Q_CONSTRUCTOR_FUNCTION(initLocale) | ||
44 | 45 | | |||
45 | QTEST_MAIN(FileMetadataWidgetTest) | 46 | QTEST_MAIN(FileMetadataWidgetTest) | ||
46 | 47 | | |||
47 | void FileMetadataWidgetTest::initTestCase() | 48 | void FileMetadataWidgetTest::initTestCase() | ||
48 | { | 49 | { | ||
49 | qRegisterMetaType<KFileItemList>("KFileItemList"); | 50 | qRegisterMetaType<KFileItemList>("KFileItemList"); | ||
50 | 51 | | |||
51 | QStandardPaths::setTestModeEnabled(true); | 52 | QStandardPaths::setTestModeEnabled(true); | ||
53 | // Use our temp extractor | ||||
54 | const QString np = QFINDTESTDATA("../src"); | ||||
55 | const QString op = qgetenv("PATH"); | ||||
56 | qputenv("PATH", qPrintable(QStringLiteral("%1%2%3").arg(np).arg(QDir::listSeparator()).arg(op))); | ||||
57 | const auto extractorPath = QDir(QStringLiteral("%1/baloo_filemetadata_temp_extractor").arg(QFINDTESTDATA("../src"))).absolutePath(); | ||||
58 | QCOMPARE(QStandardPaths::findExecutable(QStringLiteral("baloo_filemetadata_temp_extractor")), extractorPath); | ||||
alexeymin: Missing space after comma? | |||||
52 | 59 | | |||
53 | KConfig balooConfig("baloofilerc", KConfig::NoGlobals); | 60 | KConfig balooConfig("baloofilerc", KConfig::NoGlobals); | ||
alexeymin: Should probably use `QDir::listSeparator()` instead of this `#ifdef` logic | |||||
michaelh: Great! Thanks. | |||||
54 | KConfigGroup balooSettings = balooConfig.group("General"); | 61 | KConfigGroup balooSettings = balooConfig.group("General"); | ||
55 | // If we use .writePathEntry here, the test will fail. | 62 | // If we use .writePathEntry here, the test will fail. | ||
56 | balooSettings.writeEntry(QStringLiteral("folders"), QString()); | 63 | balooSettings.writeEntry(QStringLiteral("folders"), QString()); | ||
57 | 64 | | |||
58 | // Ensure show configuration | 65 | // Ensure show configuration | ||
59 | KConfig config("baloofileinformationrc", KConfig::NoGlobals); | 66 | KConfig config("baloofileinformationrc", KConfig::NoGlobals); | ||
60 | KConfigGroup settings = config.group("Show"); | 67 | KConfigGroup settings = config.group("Show"); | ||
61 | const auto keys = settings.keyList(); | 68 | const auto keys = settings.keyList(); | ||
▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines |
Missing space after comma?