diff options
Diffstat (limited to 'autotests')
-rw-r--r-- | autotests/kdesktopfiletest.cpp | 31 | ||||
-rw-r--r-- | autotests/kdesktopfiletest.h | 2 |
2 files changed, 33 insertions, 0 deletions
diff --git a/autotests/kdesktopfiletest.cpp b/autotests/kdesktopfiletest.cpp index 393a6a03..a0461964 100644 --- a/autotests/kdesktopfiletest.cpp +++ b/autotests/kdesktopfiletest.cpp @@ -255,3 +255,34 @@ void KDesktopFileTest::testTryExecWithAuthorizeAction() QVERIFY(!desktopFile.tryExec()); } } + +void KDesktopFileTest::testLocateLocal_data() +{ + QString systemConfigLocation = QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation).last(); + QString writableConfigLocation = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); + QString systemDataLocation = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation).last(); + QString writableDataLocation = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); + + QTest::addColumn<QString>("path"); + QTest::addColumn<QString>("result"); + + QTest::newRow("configLocation, system-wide") << systemConfigLocation + "/test.desktop" << writableConfigLocation + "/test.desktop"; + QTest::newRow("autostart, system-wide") << systemConfigLocation + "/autostart/test.desktop" << writableConfigLocation + "/autostart/test.desktop"; + QTest::newRow("dataLocation, system-wide") << systemDataLocation + "/test.desktop" << writableDataLocation + "/test.desktop"; + QTest::newRow("applications, system-wide") << systemDataLocation + "/applications/test.desktop" << writableDataLocation + "/applications/test.desktop"; + QTest::newRow("desktop-directories, system-wide") << systemDataLocation + "/desktop-directories/test.directory" << writableDataLocation + "/desktop-directories/test.directory"; + QTest::newRow("configLocation, writable") << writableConfigLocation + "/test.desktop" << writableConfigLocation + "/test.desktop"; + QTest::newRow("autostart, writable") << writableConfigLocation + "/autostart/test.desktop" << writableConfigLocation + "/autostart/test.desktop"; + QTest::newRow("dataLocation, writable") << writableDataLocation + "/test.desktop" << writableDataLocation + "/test.desktop"; + QTest::newRow("applications, writable") << writableDataLocation + "/applications/test.desktop" << writableDataLocation + "/applications/test.desktop"; + QTest::newRow("desktop-directories, writable") << writableDataLocation + "/desktop-directories/test.directory" << writableDataLocation + "/desktop-directories/test.directory"; + QTest::newRow("unknown location") << "/test.desktop" << writableDataLocation + "/test.desktop"; +} + +void KDesktopFileTest::testLocateLocal() +{ + QFETCH(QString, path); + QFETCH(QString, result); + + QCOMPARE(KDesktopFile::locateLocal(path), result); +} diff --git a/autotests/kdesktopfiletest.h b/autotests/kdesktopfiletest.h index eb0bd1df..ed6679a2 100644 --- a/autotests/kdesktopfiletest.h +++ b/autotests/kdesktopfiletest.h @@ -34,6 +34,8 @@ private Q_SLOTS: void testActionGroup(); void testIsAuthorizedDesktopFile(); void testTryExecWithAuthorizeAction(); + void testLocateLocal_data(); + void testLocateLocal(); }; |