@@ -127,6 +127,9 @@ private Q_SLOTS:
128 appManager->addApplication(new MockApp("no-icon"));
128 appManager->addApplication(new MockApp("no-icon"));
129 QCOMPARE(launcherModel->rowCount(QModelIndex()), 2);
129 QCOMPARE(launcherModel->rowCount(QModelIndex()), 2);
131+ qputenv("TEST_CLICK_DB", CMAKE_BINARY_DIR "/tests/data/click/db");
132+ qputenv("TEST_CLICK_USER", "test-user");
132 // Removing apps from appmanager and launcher as pinned ones would stick
135 // Removing apps from appmanager and launcher as pinned ones would stick
@@ -137,6 +140,8 @@ private Q_SLOTS:
137 while (launcherModel->rowCount(QModelIndex()) > 0) {
140 while (launcherModel->rowCount(QModelIndex()) > 0) {
138 launcherModel->requestRemove(launcherModel->get(0)->appId());
141 launcherModel->requestRemove(launcherModel->get(0)->appId());
143+ qputenv("TEST_CLICK_DB", "");
144+ qputenv("TEST_CLICK_USER", "");
142 void testMove() {
147 void testMove() {
@@ -274,6 +279,19 @@ private Q_SLOTS:
274 QCOMPARE(launcherModel->rowCount(QModelIndex()), 1);
279 QCOMPARE(launcherModel->rowCount(QModelIndex()), 1);
275 QCOMPARE(launcherModel->get(0)->appId(), QLatin1String("abs-icon"));
280 QCOMPARE(launcherModel->get(0)->appId(), QLatin1String("abs-icon"));
283+ void testGetUrlForAppId() {
284+ QCOMPARE(launcherModel->getUrlForAppId(QString()), QString());
285+ QCOMPARE(launcherModel->getUrlForAppId(""), QString());
286+ QCOMPARE(launcherModel->getUrlForAppId("not-an-app"), QString("application:///not-an-app.desktop"));
287+ QCOMPARE(launcherModel->getUrlForAppId("not_an_app"), QString("application:///not_an_app.desktop"));
288+ QCOMPARE(launcherModel->getUrlForAppId("notes-app"), QString("application:///notes-app.desktop"));
289+ QCOMPARE(launcherModel->getUrlForAppId("com.test.good"), QString("appid://com.test.good/application/1.2.3"));
290+ QCOMPARE(launcherModel->getUrlForAppId("com.test.good_application"), QString("appid://com.test.good/application/1.2.3"));
291+ // Note that this version change is intentional -- we want to fix old links to use latest current version
292+ QCOMPARE(launcherModel->getUrlForAppId("com.test.good_application_0.0.0"), QString("appid://com.test.good/application/1.2.3"));
293+ QCOMPARE(launcherModel->getUrlForAppId("com.test.good_application_1.2.3"), QString("appid://com.test.good/application/1.2.3"));
279QTEST_GUILESS_MAIN(LauncherModelTest)
297QTEST_GUILESS_MAIN(LauncherModelTest)