@@ -127,6 +127,9 @@ private Q_SLOTS:
127127
128128 appManager->addApplication(new MockApp("no-icon"));
129129 QCOMPARE(launcherModel->rowCount(QModelIndex()), 2);
130+
131+ qputenv("TEST_CLICK_DB", CMAKE_BINARY_DIR "/tests/data/click/db");
132+ qputenv("TEST_CLICK_USER", "test-user");
130133 }
131134
132135 // Removing apps from appmanager and launcher as pinned ones would stick
@@ -137,6 +140,8 @@ private Q_SLOTS:
137140 while (launcherModel->rowCount(QModelIndex()) > 0) {
138141 launcherModel->requestRemove(launcherModel->get(0)->appId());
139142 }
143+ qputenv("TEST_CLICK_DB", "");
144+ qputenv("TEST_CLICK_USER", "");
140145 }
141146
142147 void testMove() {
@@ -274,6 +279,19 @@ private Q_SLOTS:
274279 QCOMPARE(launcherModel->rowCount(QModelIndex()), 1);
275280 QCOMPARE(launcherModel->get(0)->appId(), QLatin1String("abs-icon"));
276281 }
282+
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"));
294+ }
277295};
278296
279297QTEST_GUILESS_MAIN(LauncherModelTest)