on xenial help sign in
Drop useStorage argument and use exising LAUNCHER_TESTING define for this decision.
8e05f32Michael Zanetti
plugins/Unity/Launcher/backend/launcherbackend.cpp+4−4
@@ -38,13 +38,13 @@ public:
38 bool pinned;
38 bool pinned;
39};
39};
40
40
41−LauncherBackend::LauncherBackend(bool useStorage, QObject *parent):
41+LauncherBackend::LauncherBackend(QObject *parent):
42 QObject(parent),
42 QObject(parent),
43 m_accounts(nullptr)
43 m_accounts(nullptr)
44{
44{
45− if (useStorage) {
45+#ifndef LAUNCHER_TESTING
46− m_accounts = new AccountsServiceDBusAdaptor(this);
46+ m_accounts = new AccountsServiceDBusAdaptor(this);
47− }
47+#endif
48 m_user = qgetenv("USER");
48 m_user = qgetenv("USER");
49 syncFromAccounts();
49 syncFromAccounts();
50}
50}
plugins/Unity/Launcher/backend/launcherbackend.h+1−1
@@ -39,7 +39,7 @@ class LauncherBackend : public QObject
39
39
40
40
41public:
41public:
42− LauncherBackend(bool useStorage = true, QObject *parent = 0);
42+ LauncherBackend(QObject *parent = 0);
43 virtual ~LauncherBackend();
43 virtual ~LauncherBackend();
44
44
45 /**
45 /**
plugins/Unity/Launcher/launchermodel.cpp+1−1
@@ -27,7 +27,7 @@ using namespace unity::shell::application;
27
27
28LauncherModel::LauncherModel(QObject *parent):
28LauncherModel::LauncherModel(QObject *parent):
29 LauncherModelInterface(parent),
29 LauncherModelInterface(parent),
30− m_backend(new LauncherBackend(true, this)),
30+ m_backend(new LauncherBackend(this)),
31 m_appManager(0)
31 m_appManager(0)
32{
32{
33 connect(m_backend, SIGNAL(countChanged(QString,int)), SLOT(countChanged(QString,int)));
33 connect(m_backend, SIGNAL(countChanged(QString,int)), SLOT(countChanged(QString,int)));
tests/plugins/Unity/Launcher/launcherbackendtest.cpp+3−3
@@ -37,7 +37,7 @@ private Q_SLOTS:
37
37
38 void testFileNames()
38 void testFileNames()
39 {
39 {
40− LauncherBackend backend(false);
40+ LauncherBackend backend;
41
41
42 backend.setStoredApplications(QStringList() << "rel-icon" << "abs-icon" << "invalid");
42 backend.setStoredApplications(QStringList() << "rel-icon" << "abs-icon" << "invalid");
43 QCOMPARE(backend.storedApplications(), QStringList() << "rel-icon" << "abs-icon");
43 QCOMPARE(backend.storedApplications(), QStringList() << "rel-icon" << "abs-icon");
@@ -45,7 +45,7 @@ private Q_SLOTS:
45
45
46 void testPinning()
46 void testPinning()
47 {
47 {
48− LauncherBackend backend(false);
48+ LauncherBackend backend;
49
49
50 backend.setStoredApplications(QStringList() << "rel-icon" << "abs-icon");
50 backend.setStoredApplications(QStringList() << "rel-icon" << "abs-icon");
51 QCOMPARE(backend.isPinned("rel-icon"), false);
51 QCOMPARE(backend.isPinned("rel-icon"), false);
@@ -82,7 +82,7 @@ private Q_SLOTS:
82 QFETCH(QString, appId);
82 QFETCH(QString, appId);
83 QFETCH(QString, expectedIcon);
83 QFETCH(QString, expectedIcon);
84
84
85− LauncherBackend backend(false);
85+ LauncherBackend backend;
86 backend.setStoredApplications(QStringList() << appId);
86 backend.setStoredApplications(QStringList() << appId);
87
87
88 QCOMPARE(backend.icon(appId), expectedIcon);
88 QCOMPARE(backend.icon(appId), expectedIcon);