@@ -177,7 +177,7 @@ private Q_SLOTS:
177 appManager->addApplication(new MockApp("abs-icon"));
177 appManager->addApplication(new MockApp("abs-icon"));
178 QCOMPARE(launcherModel->rowCount(QModelIndex()), 1);
178 QCOMPARE(launcherModel->rowCount(QModelIndex()), 1);
180− appManager->addApplication(new MockApp("no-icon"));
180+ appManager->addApplication(new MockApp("rel-icon"));
181 QCOMPARE(launcherModel->rowCount(QModelIndex()), 2);
181 QCOMPARE(launcherModel->rowCount(QModelIndex()), 2);
183 launcherModel->m_settings->setStoredApplications(QStringList());
183 launcherModel->m_settings->setStoredApplications(QStringList());
@@ -199,6 +199,10 @@ private Q_SLOTS:
199 QString::fromUtf8(g_get_user_name()));
199 QString::fromUtf8(g_get_user_name()));
200 QVERIFY(removeReply.isValid());
200 QVERIFY(removeReply.isValid());
201 QCOMPARE(removeReply.value(), true);
201 QCOMPARE(removeReply.value(), true);
203+ // Some tests move the directory, so lets move it back if so.
204+ // But this will usually fail.
205+ QFile::rename("applications.old", "applications");
204 void testMove() {
208 void testMove() {
@@ -331,7 +335,7 @@ private Q_SLOTS:
332 void testApplicationRunning() {
336 void testApplicationRunning() {
333 launcherModel->pin("abs-icon");
337 launcherModel->pin("abs-icon");
334− launcherModel->pin("no-icon");
338+ launcherModel->pin("rel-icon");
336 QCOMPARE(launcherModel->get(0)->running(), true);
340 QCOMPARE(launcherModel->get(0)->running(), true);
337 QCOMPARE(launcherModel->get(1)->running(), true);
341 QCOMPARE(launcherModel->get(1)->running(), true);
@@ -340,7 +344,7 @@ private Q_SLOTS:
340 QCOMPARE(launcherModel->get(0)->running(), false);
344 QCOMPARE(launcherModel->get(0)->running(), false);
341 QCOMPARE(launcherModel->get(1)->running(), true);
345 QCOMPARE(launcherModel->get(1)->running(), true);
343− appManager->stopApplication("no-icon");
347+ appManager->stopApplication("rel-icon");
344 QCOMPARE(launcherModel->get(0)->running(), false);
348 QCOMPARE(launcherModel->get(0)->running(), false);
345 QCOMPARE(launcherModel->get(1)->running(), false);
349 QCOMPARE(launcherModel->get(1)->running(), false);
@@ -355,7 +359,7 @@ private Q_SLOTS:
355 QCOMPARE(launcherModel->get(0)->focused(), true);
359 QCOMPARE(launcherModel->get(0)->focused(), true);
356 QCOMPARE(launcherModel->get(1)->focused(), false);
360 QCOMPARE(launcherModel->get(1)->focused(), false);
358− appManager->focusApplication("no-icon");
362+ appManager->focusApplication("rel-icon");
359 QCOMPARE(launcherModel->rowCount(QModelIndex()), 2);
363 QCOMPARE(launcherModel->rowCount(QModelIndex()), 2);
360 QCOMPARE(launcherModel->get(0)->focused(), false);
364 QCOMPARE(launcherModel->get(0)->focused(), false);
361 QCOMPARE(launcherModel->get(1)->focused(), true);
365 QCOMPARE(launcherModel->get(1)->focused(), true);
@@ -377,8 +381,8 @@ private Q_SLOTS:
377 QCOMPARE(launcherModel->rowCount(), 2);
381 QCOMPARE(launcherModel->rowCount(), 2);
379 // stop the second one keeping it pinned so that it doesn't go away
383 // stop the second one keeping it pinned so that it doesn't go away
380− launcherModel->pin("no-icon");
384+ launcherModel->pin("rel-icon");
381− appManager->stopApplication("no-icon");
385+ appManager->stopApplication("rel-icon");
383 // find the first Quit item, should be there
387 // find the first Quit item, should be there
384 QuickListModel *model = qobject_cast<QuickListModel*>(launcherModel->get(0)->quickList());
388 QuickListModel *model = qobject_cast<QuickListModel*>(launcherModel->get(0)->quickList());
@@ -407,7 +411,7 @@ private Q_SLOTS:
407 // first app should be gone...
411 // first app should be gone...
408 QCOMPARE(launcherModel->rowCount(QModelIndex()), 1);
412 QCOMPARE(launcherModel->rowCount(QModelIndex()), 1);
409 // ... the second app (now at index 0) should still be there, pinned and stopped
413 // ... the second app (now at index 0) should still be there, pinned and stopped
410− QCOMPARE(launcherModel->get(0)->appId(), QStringLiteral("no-icon"));
414+ QCOMPARE(launcherModel->get(0)->appId(), QStringLiteral("rel-icon"));
411 QCOMPARE(launcherModel->get(0)->pinned(), true);
415 QCOMPARE(launcherModel->get(0)->pinned(), true);
412 QCOMPARE(launcherModel->get(0)->running(), false);
416 QCOMPARE(launcherModel->get(0)->running(), false);
@@ -602,17 +606,16 @@ private Q_SLOTS:
603 // pin both apps
607 // pin both apps
604 launcherModel->pin("abs-icon");
608 launcherModel->pin("abs-icon");
605− launcherModel->pin("no-icon");
609+ launcherModel->pin("rel-icon");
606 // close both apps
610 // close both apps
607 appManager->removeApplication(0);
611 appManager->removeApplication(0);
608 appManager->removeApplication(0);
612 appManager->removeApplication(0);
610 // "delete" the .desktop files
614 // "delete" the .desktop files
611− QString oldCurrent = QDir::currentPath();
612 if (deleted) {
615 if (deleted) {
613 // In testing mode, the launcher searches the current dir for the sample .desktop file
616 // In testing mode, the launcher searches the current dir for the sample .desktop file
614− // We can make that fail by changing the current dir
617+ // We can make that fail by moving the applications dir
615− QDir::setCurrent("..");
618+ QFile::rename("applications", "applications.old");
618 // Call refresh
621 // Call refresh
@@ -623,9 +626,6 @@ private Q_SLOTS:
623 QCOMPARE(reply.isValid(), true);
626 QCOMPARE(reply.isValid(), true);
625 QCOMPARE(launcherModel->rowCount(), deleted ? 0 : 2);
628 QCOMPARE(launcherModel->rowCount(), deleted ? 0 : 2);
627− // Restoring current dir
628− QDir::setCurrent(oldCurrent);
631 void testSettings() {
631 void testSettings() {
@@ -637,7 +637,7 @@ private Q_SLOTS:
638 // pin both apps
638 // pin both apps
639 launcherModel->pin("abs-icon");
639 launcherModel->pin("abs-icon");
640− launcherModel->pin("no-icon");
640+ launcherModel->pin("rel-icon");
641 QCOMPARE(spy.count(), 0);
641 QCOMPARE(spy.count(), 0);
643 // Now settings should have 2 apps
643 // Now settings should have 2 apps
@@ -659,9 +659,9 @@ private Q_SLOTS:
659 QCOMPARE(launcherModel->rowCount(), 1);
659 QCOMPARE(launcherModel->rowCount(), 1);
661 // Add them back but in reverse order
661 // Add them back but in reverse order
662− settings->simulateDConfChanged(QStringList() << "no-icon" << "abs-icon");
662+ settings->simulateDConfChanged(QStringList() << "rel-icon" << "abs-icon");
663 QCOMPARE(launcherModel->rowCount(), 2);
663 QCOMPARE(launcherModel->rowCount(), 2);
664− QCOMPARE(launcherModel->get(0)->appId(), QString("no-icon"));
664+ QCOMPARE(launcherModel->get(0)->appId(), QString("rel-icon"));
665 QCOMPARE(launcherModel->get(1)->appId(), QString("abs-icon"));
665 QCOMPARE(launcherModel->get(1)->appId(), QString("abs-icon"));
666 QCOMPARE(spy.count(), 2);
666 QCOMPARE(spy.count(), 2);
@@ -671,7 +671,7 @@ private Q_SLOTS:
671 QCOMPARE(launcherModel->rowCount(), getASConfig().count());
671 QCOMPARE(launcherModel->rowCount(), getASConfig().count());
673 int oldCount = launcherModel->rowCount();
673 int oldCount = launcherModel->rowCount();
674− appManager->addApplication(new MockApp("rel-icon"));
674+ appManager->addApplication(new MockApp("click-icon"));
675 QCOMPARE(launcherModel->rowCount(), oldCount + 1);
675 QCOMPARE(launcherModel->rowCount(), oldCount + 1);
676 QCOMPARE(launcherModel->rowCount(), getASConfig().count());
676 QCOMPARE(launcherModel->rowCount(), getASConfig().count());