Merge lp:~lukas-kde/unity8/appdrawer-search-more into lp:unity8

Proposed by Lukáš Tinkl
Status: Needs review
Proposed branch: lp:~lukas-kde/unity8/appdrawer-search-more
Merge into: lp:unity8
Prerequisite: lp:~mzanetti/unity8/appdrawer-recent-apps
Diff against target: 384 lines (+91/-25)
14 files modified
plugins/Greeter/Unity/Launcher/launcheritem.cpp (+13/-0)
plugins/Greeter/Unity/Launcher/launcheritem.h (+3/-0)
plugins/Unity/Launcher/appdrawermodel.cpp (+3/-0)
plugins/Unity/Launcher/launcheritem.cpp (+13/-0)
plugins/Unity/Launcher/launcheritem.h (+3/-0)
plugins/Unity/Launcher/ualwrapper.cpp (+6/-4)
plugins/Unity/Launcher/ualwrapper.h (+1/-0)
plugins/Utils/appdrawerproxymodel.cpp (+24/-19)
qml/Launcher/Drawer.qml (+1/-0)
tests/mocks/Unity/Launcher/MockLauncherItem.cpp (+13/-0)
tests/mocks/Unity/Launcher/MockLauncherItem.h (+3/-0)
tests/plugins/Unity/Launcher/appdrawermodeltest.cpp (+6/-2)
tests/plugins/Unity/Launcher/ualwrapper.cpp (+1/-0)
tests/plugins/Unity/Launcher/ualwrapper.h (+1/-0)
To merge this branch: bzr merge lp:~lukas-kde/unity8/appdrawer-search-more
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Needs Fixing
Albert Astals Cid (community) Approve
Review via email: mp+321998@code.launchpad.net

This proposal supersedes a proposal from 2017-04-04.

Commit message

Appdrawer: search in more fields (appid and description), optimize and massively speed up

Description of the change

Prereq-archive: ppa:ci-train-ppa-service/2701

Appdrawer: search in more fields (appid and description), optimize and massively speed up

As I added more field to search in, it slowed down a bit. So I optimized the tiny bits throughout the AppDrawerProxyModel but the biggest bottleneck turned out to be the toplevel dynamicSortFilter in Drawer.qml

* Are there any related MPs required for this MP to build/function as expected? Please list.

Yes, https://code.launchpad.net/~lukas-kde/unity-api/launcheritem-description/+merge/321924 and https://code.launchpad.net/~mzanetti/unity8/appdrawer-recent-apps/+merge/319697

 * Did you perform an exploratory manual test run of your code change and any related functionality?

Yes

 * If you changed the UI, has there been a design review?

N/A

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal

I guess the startsWith -> contains change is the most "controversial" change here.

Maybe contains should be only for description? What do others think?

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
2919. By Lukáš Tinkl

restore sortRole

Revision history for this message
Albert Astals Cid (aacid) wrote :

> I guess the startsWith -> contains change is the most "controversial" change here.
>
> Maybe contains should be only for description? What do others think?

Given yesterday's news i guess it doesn't make sense to nitpick much over this.

Revision history for this message
Albert Astals Cid (aacid) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Yes

 * Did CI run pass? If not, please explain why.
Waiting

review: Approve
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
2920. By Lukáš Tinkl

merge parent

2921. By Lukáš Tinkl

fix segfaulting test (add the missing description field)

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
2922. By Lukáš Tinkl

don't crash

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2922
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3702/
Executed test runs:

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3702/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

^^ now it fails to build on zesty because of ual not being up to date (wrt xenial)

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2922
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3704/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/4922/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4950
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4758
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4758/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4758
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4758/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4758/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4758
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4758/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4758
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4758/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4758
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4758/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3704/rebuild

review: Needs Fixing (continuous-integration)

Unmerged revisions

2922. By Lukáš Tinkl

don't crash

2921. By Lukáš Tinkl

fix segfaulting test (add the missing description field)

2920. By Lukáš Tinkl

merge parent

2919. By Lukáš Tinkl

restore sortRole

2918. By Lukáš Tinkl

merge lp:~mzanetti/unity8/appdrawer-recent-apps

2917. By Lukáš Tinkl

invalidate and sort only after the source model had been set

2916. By Lukáš Tinkl

massive speedup by not using dynamicFilter \o/

2915. By Lukáš Tinkl

optimize the filterString search

2914. By Lukáš Tinkl

perform the search in appName and Description too

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/Greeter/Unity/Launcher/launcheritem.cpp'
--- plugins/Greeter/Unity/Launcher/launcheritem.cpp 2017-04-06 13:50:59 +0000
+++ plugins/Greeter/Unity/Launcher/launcheritem.cpp 2017-04-06 13:50:59 +0000
@@ -89,6 +89,19 @@
89 }89 }
90}90}
9191
92QString LauncherItem::description() const
93{
94 return m_description;
95}
96
97void LauncherItem::setDescription(const QString &description)
98{
99 if (m_description != description) {
100 m_description = description;
101 Q_EMIT descriptionChanged(m_description);
102 }
103}
104
92uint LauncherItem::popularity() const105uint LauncherItem::popularity() const
93{106{
94 // Not exposing usage order in greeter session at this point.107 // Not exposing usage order in greeter session at this point.
95108
=== modified file 'plugins/Greeter/Unity/Launcher/launcheritem.h'
--- plugins/Greeter/Unity/Launcher/launcheritem.h 2017-04-06 13:50:59 +0000
+++ plugins/Greeter/Unity/Launcher/launcheritem.h 2017-04-06 13:50:59 +0000
@@ -35,6 +35,7 @@
35 QString name() const override;35 QString name() const override;
36 QString icon() const override;36 QString icon() const override;
37 QStringList keywords() const override;37 QStringList keywords() const override;
38 QString description() const override;
38 uint popularity() const override;39 uint popularity() const override;
39 bool pinned() const override;40 bool pinned() const override;
40 bool running() const override;41 bool running() const override;
@@ -52,6 +53,7 @@
52 void setName(const QString &name);53 void setName(const QString &name);
53 void setIcon(const QString &icon);54 void setIcon(const QString &icon);
54 void setKeywords(const QStringList &keywords);55 void setKeywords(const QStringList &keywords);
56 void setDescription(const QString &description);
55 void setPinned(bool pinned);57 void setPinned(bool pinned);
56 void setRunning(bool running);58 void setRunning(bool running);
57 void setRecent(bool recent);59 void setRecent(bool recent);
@@ -67,6 +69,7 @@
67 QString m_name;69 QString m_name;
68 QString m_icon;70 QString m_icon;
69 QStringList m_keywords;71 QStringList m_keywords;
72 QString m_description;
70 bool m_pinned;73 bool m_pinned;
71 bool m_running;74 bool m_running;
72 bool m_recent;75 bool m_recent;
7376
=== modified file 'plugins/Unity/Launcher/appdrawermodel.cpp'
--- plugins/Unity/Launcher/appdrawermodel.cpp 2017-04-06 13:50:59 +0000
+++ plugins/Unity/Launcher/appdrawermodel.cpp 2017-04-06 13:50:59 +0000
@@ -32,6 +32,7 @@
32 }32 }
33 LauncherItem* item = new LauncherItem(appId, info.name, info.icon, this);33 LauncherItem* item = new LauncherItem(appId, info.name, info.icon, this);
34 item->setKeywords(info.keywords);34 item->setKeywords(info.keywords);
35 item->setDescription(info.description);
35 item->setPopularity(info.popularity);36 item->setPopularity(info.popularity);
36 m_list.append(item);37 m_list.append(item);
37 }38 }
@@ -59,6 +60,8 @@
59 return m_list.at(index.row())->icon();60 return m_list.at(index.row())->icon();
60 case RoleKeywords:61 case RoleKeywords:
61 return m_list.at(index.row())->keywords();62 return m_list.at(index.row())->keywords();
63 case RoleDescription:
64 return m_list.at(index.row())->description();
62 case RoleUsage:65 case RoleUsage:
63 return m_list.at(index.row())->popularity();66 return m_list.at(index.row())->popularity();
64 }67 }
6568
=== modified file 'plugins/Unity/Launcher/launcheritem.cpp'
--- plugins/Unity/Launcher/launcheritem.cpp 2017-04-06 13:50:59 +0000
+++ plugins/Unity/Launcher/launcheritem.cpp 2017-04-06 13:50:59 +0000
@@ -104,6 +104,19 @@
104 }104 }
105}105}
106106
107QString LauncherItem::description() const
108{
109 return m_description;
110}
111
112void LauncherItem::setDescription(const QString &description)
113{
114 if (m_description != description) {
115 m_description = description;
116 Q_EMIT descriptionChanged(m_description);
117 }
118}
119
107bool LauncherItem::pinned() const120bool LauncherItem::pinned() const
108{121{
109 return m_pinned;122 return m_pinned;
110123
=== modified file 'plugins/Unity/Launcher/launcheritem.h'
--- plugins/Unity/Launcher/launcheritem.h 2017-04-06 13:50:59 +0000
+++ plugins/Unity/Launcher/launcheritem.h 2017-04-06 13:50:59 +0000
@@ -39,6 +39,7 @@
39 QString name() const override;39 QString name() const override;
40 QString icon() const override;40 QString icon() const override;
41 QStringList keywords() const override;41 QStringList keywords() const override;
42 QString description() const override;
42 uint popularity() const override;43 uint popularity() const override;
43 bool pinned() const override;44 bool pinned() const override;
44 bool running() const override;45 bool running() const override;
@@ -56,6 +57,7 @@
56 void setName(const QString &name);57 void setName(const QString &name);
57 void setIcon(const QString &icon);58 void setIcon(const QString &icon);
58 void setKeywords(const QStringList &keywords);59 void setKeywords(const QStringList &keywords);
60 void setDescription(const QString &description);
59 void setPopularity(uint popularity);61 void setPopularity(uint popularity);
60 void setPinned(bool pinned);62 void setPinned(bool pinned);
61 void setRunning(bool running);63 void setRunning(bool running);
@@ -72,6 +74,7 @@
72 QString m_name;74 QString m_name;
73 QString m_icon;75 QString m_icon;
74 QStringList m_keywords;76 QStringList m_keywords;
77 QString m_description;
75 uint m_popularity;78 uint m_popularity;
76 bool m_pinned;79 bool m_pinned;
77 bool m_running;80 bool m_running;
7881
=== modified file 'plugins/Unity/Launcher/ualwrapper.cpp'
--- plugins/Unity/Launcher/ualwrapper.cpp 2017-04-06 13:50:59 +0000
+++ plugins/Unity/Launcher/ualwrapper.cpp 2017-04-06 13:50:59 +0000
@@ -66,14 +66,16 @@
6666
67 std::shared_ptr<Application> ualApp;67 std::shared_ptr<Application> ualApp;
68 ualApp = Application::create(ualAppId, Registry::getDefault());68 ualApp = Application::create(ualAppId, Registry::getDefault());
69 auto appInfo = ualApp->info();
6970
70 info.appId = appId;71 info.appId = appId;
71 info.name = QString::fromStdString(ualApp->info()->name());72 info.name = QString::fromStdString(appInfo->name());
72 info.icon = QString::fromStdString(ualApp->info()->iconPath());73 info.icon = QString::fromStdString(appInfo->iconPath());
73 for (const std::string &keyword : ualApp->info()->keywords().value()) {74 info.description = QString::fromStdString(appInfo->description());
75 for (const std::string &keyword : appInfo->keywords().value()) {
74 info.keywords << QString::fromStdString(keyword);76 info.keywords << QString::fromStdString(keyword);
75 }77 }
76 info.popularity = ualApp->info()->popularity();78 info.popularity = appInfo->popularity();
77 info.valid = true;79 info.valid = true;
78 } catch (const std::runtime_error &e) {80 } catch (const std::runtime_error &e) {
79 qWarning() << "ubuntu-app-launch threw an exception getting app info for appId:" << appId << ":" << e.what();81 qWarning() << "ubuntu-app-launch threw an exception getting app info for appId:" << appId << ":" << e.what();
8082
=== modified file 'plugins/Unity/Launcher/ualwrapper.h'
--- plugins/Unity/Launcher/ualwrapper.h 2017-04-06 13:50:59 +0000
+++ plugins/Unity/Launcher/ualwrapper.h 2017-04-06 13:50:59 +0000
@@ -25,6 +25,7 @@
25 bool valid = false;25 bool valid = false;
26 QString name;26 QString name;
27 QString icon;27 QString icon;
28 QString description;
28 QStringList keywords;29 QStringList keywords;
29 uint popularity = 0;30 uint popularity = 0;
30 };31 };
3132
=== modified file 'plugins/Utils/appdrawerproxymodel.cpp'
--- plugins/Utils/appdrawerproxymodel.cpp 2017-01-25 17:44:54 +0000
+++ plugins/Utils/appdrawerproxymodel.cpp 2017-04-06 13:50:59 +0000
@@ -25,7 +25,6 @@
25{25{
26 setSortRole(AppDrawerModelInterface::RoleName);26 setSortRole(AppDrawerModelInterface::RoleName);
27 setSortLocaleAware(true);27 setSortLocaleAware(true);
28 sort(0);
2928
30 connect(this, &QAbstractListModel::rowsInserted, this, &AppDrawerProxyModel::countChanged);29 connect(this, &QAbstractListModel::rowsInserted, this, &AppDrawerProxyModel::countChanged);
31 connect(this, &QAbstractListModel::rowsRemoved, this, &AppDrawerProxyModel::countChanged);30 connect(this, &QAbstractListModel::rowsRemoved, this, &AppDrawerProxyModel::countChanged);
@@ -45,6 +44,8 @@
45 setSortRole(m_sortBy == SortByAToZ ? AppDrawerModelInterface::RoleName : AppDrawerModelInterface::RoleUsage);44 setSortRole(m_sortBy == SortByAToZ ? AppDrawerModelInterface::RoleName : AppDrawerModelInterface::RoleUsage);
46 connect(m_source, &QAbstractItemModel::rowsRemoved, this, &AppDrawerProxyModel::invalidate);45 connect(m_source, &QAbstractItemModel::rowsRemoved, this, &AppDrawerProxyModel::invalidate);
47 connect(m_source, &QAbstractItemModel::rowsInserted, this, &AppDrawerProxyModel::invalidate);46 connect(m_source, &QAbstractItemModel::rowsInserted, this, &AppDrawerProxyModel::invalidate);
47 connect(m_source, &QAbstractItemModel::modelReset, this, &AppDrawerProxyModel::invalidate);
48 sort(0);
48 Q_EMIT sourceChanged();49 Q_EMIT sourceChanged();
49 }50 }
50}51}
@@ -59,7 +60,7 @@
59 if (m_group != group) {60 if (m_group != group) {
60 m_group = group;61 m_group = group;
61 Q_EMIT groupChanged();62 Q_EMIT groupChanged();
62 invalidateFilter();63 invalidate();
63 }64 }
64}65}
6566
@@ -73,7 +74,7 @@
73 if (m_filterLetter != filterLetter) {74 if (m_filterLetter != filterLetter) {
74 m_filterLetter = filterLetter;75 m_filterLetter = filterLetter;
75 Q_EMIT filterLetterChanged();76 Q_EMIT filterLetterChanged();
76 invalidateFilter();77 invalidate();
77 }78 }
78}79}
7980
@@ -87,7 +88,7 @@
87 if (m_filterString != filterString) {88 if (m_filterString != filterString) {
88 m_filterString = filterString;89 m_filterString = filterString;
89 Q_EMIT filterStringChanged();90 Q_EMIT filterStringChanged();
90 invalidateFilter();91 invalidate();
91 }92 }
92}93}
9394
@@ -113,10 +114,10 @@
113114
114QVariant AppDrawerProxyModel::data(const QModelIndex &index, int role) const115QVariant AppDrawerProxyModel::data(const QModelIndex &index, int role) const
115{116{
116 QModelIndex idx = mapToSource(index);117 const QModelIndex idx = mapToSource(index);
117 if (role == Qt::UserRole) {118 if (role == Qt::UserRole) {
118 QString name = m_source->data(idx, AppDrawerModelInterface::RoleName).toString();119 const QString name = m_source->data(idx, AppDrawerModelInterface::RoleName).toString();
119 return name.length() > 0 ? QString(name.at(0)).toUpper() : QChar();120 return !name.isEmpty() ? name.at(0).toUpper() : QChar();
120 }121 }
121 return m_source->data(idx, role);122 return m_source->data(idx, role);
122}123}
@@ -135,30 +136,34 @@
135{136{
136 Q_UNUSED(source_parent)137 Q_UNUSED(source_parent)
137138
139 const QModelIndex idx{m_source->index(source_row, 0)};
140
138 if (m_group == GroupByAToZ && source_row > 0) {141 if (m_group == GroupByAToZ && source_row > 0) {
139 QString currentName = m_source->data(m_source->index(source_row, 0), AppDrawerModelInterface::RoleName).toString();142 const QString currentName = m_source->data(idx, AppDrawerModelInterface::RoleName).toString();
140 QChar currentLetter = currentName.length() > 0 ? currentName.at(0) : QChar();143 const QChar currentLetter = !currentName.isEmpty() ? currentName.at(0).toLower() : QChar();
141 QString previousName = m_source->data(m_source->index(source_row - 1,0 ), AppDrawerModelInterface::RoleName).toString();144 const QString previousName = m_source->data(m_source->index(source_row - 1, 0), AppDrawerModelInterface::RoleName).toString();
142 QChar previousLetter = previousName.length() > 0 ? previousName.at(0) : QChar();145 const QChar previousLetter = !previousName.isEmpty() ? previousName.at(0).toLower() : QChar();
143 if (currentLetter.toLower() == previousLetter.toLower()) {146 if (currentLetter == previousLetter) {
144 return false;147 return false;
145 }148 }
146 } else if(m_group == GroupByAll && source_row > 0) {149 } else if (m_group == GroupByAll && source_row > 0) {
147 return false;150 return false;
148 }151 }
152
149 if (!m_filterLetter.isEmpty()) {153 if (!m_filterLetter.isEmpty()) {
150 QString currentName = m_source->data(m_source->index(source_row, 0), AppDrawerModelInterface::RoleName).toString();154 const QString currentName = m_source->data(idx, AppDrawerModelInterface::RoleName).toString();
151 QString currentLetter = currentName.length() > 0 ? QString(currentName.at(0)) : QString();155 const QString currentLetter = !currentName.isEmpty() ? QString(currentName.at(0)) : QString();
152 if (currentLetter.toLower() != m_filterLetter.toLower()) {156 if (currentLetter.toLower() != m_filterLetter.toLower()) {
153 return false;157 return false;
154 }158 }
155 }159 }
156 if (!m_filterString.isEmpty()) {160 if (!m_filterString.isEmpty()) {
157 QStringList allWords = m_source->data(m_source->index(source_row, 0), AppDrawerModelInterface::RoleKeywords).toStringList();161 const auto roles = {AppDrawerModelInterface::RoleAppId, AppDrawerModelInterface::RoleName,
158 allWords.prepend(m_source->data(m_source->index(source_row, 0), AppDrawerModelInterface::RoleName).toString());162 AppDrawerModelInterface::RoleDescription, AppDrawerModelInterface::RoleKeywords};
159 bool found = false;163 bool found = false;
160 Q_FOREACH (const QString &currentWord, allWords) {164 Q_FOREACH (const auto &role, roles) {
161 if (currentWord.startsWith(m_filterString, Qt::CaseInsensitive)) {165 const QString data = m_source->data(idx, role).toString();
166 if (data.contains(m_filterString, Qt::CaseInsensitive)) {
162 found = true;167 found = true;
163 break;168 break;
164 }169 }
165170
=== modified file 'qml/Launcher/Drawer.qml'
--- qml/Launcher/Drawer.qml 2017-03-24 11:51:31 +0000
+++ qml/Launcher/Drawer.qml 2017-04-06 13:50:59 +0000
@@ -79,6 +79,7 @@
79 source: appDrawerModel79 source: appDrawerModel
80 filterString: searchField.displayText80 filterString: searchField.displayText
81 sortBy: AppDrawerProxyModel.SortByAToZ81 sortBy: AppDrawerProxyModel.SortByAToZ
82 dynamicSortFilter: false
82 }83 }
8384
84 Item {85 Item {
8586
=== modified file 'tests/mocks/Unity/Launcher/MockLauncherItem.cpp'
--- tests/mocks/Unity/Launcher/MockLauncherItem.cpp 2017-04-06 13:50:59 +0000
+++ tests/mocks/Unity/Launcher/MockLauncherItem.cpp 2017-04-06 13:50:59 +0000
@@ -72,6 +72,19 @@
72 return m_keywords;72 return m_keywords;
73}73}
7474
75QString MockLauncherItem::description() const
76{
77 return m_description;
78}
79
80void MockLauncherItem::setDescription(const QString &description)
81{
82 if (m_description != description) {
83 m_description = description;
84 Q_EMIT descriptionChanged(m_description);
85 }
86}
87
75uint MockLauncherItem::popularity() const88uint MockLauncherItem::popularity() const
76{89{
77 return m_popularity;90 return m_popularity;
7891
=== modified file 'tests/mocks/Unity/Launcher/MockLauncherItem.h'
--- tests/mocks/Unity/Launcher/MockLauncherItem.h 2017-04-06 13:50:59 +0000
+++ tests/mocks/Unity/Launcher/MockLauncherItem.h 2017-04-06 13:50:59 +0000
@@ -40,6 +40,7 @@
40 QString name() const override;40 QString name() const override;
41 QString icon() const override;41 QString icon() const override;
42 QStringList keywords() const override;42 QStringList keywords() const override;
43 QString description() const override;
43 uint popularity() const override;44 uint popularity() const override;
4445
45 bool pinned() const override;46 bool pinned() const override;
@@ -56,6 +57,7 @@
5657
57private:58private:
58 void setKeywords(const QStringList &keywords);59 void setKeywords(const QStringList &keywords);
60 void setDescription(const QString &description);
59 void setPopularity(uint popularity);61 void setPopularity(uint popularity);
60 void setPinned(bool pinned);62 void setPinned(bool pinned);
61 void setRunning(bool running);63 void setRunning(bool running);
@@ -72,6 +74,7 @@
72 QString m_name;74 QString m_name;
73 QString m_icon;75 QString m_icon;
74 QStringList m_keywords;76 QStringList m_keywords;
77 QString m_description;
75 uint m_popularity;78 uint m_popularity;
76 bool m_pinned;79 bool m_pinned;
77 bool m_running;80 bool m_running;
7881
=== modified file 'tests/plugins/Unity/Launcher/appdrawermodeltest.cpp'
--- tests/plugins/Unity/Launcher/appdrawermodeltest.cpp 2017-04-06 13:50:59 +0000
+++ tests/plugins/Unity/Launcher/appdrawermodeltest.cpp 2017-04-06 13:50:59 +0000
@@ -24,16 +24,20 @@
24 Q_OBJECT24 Q_OBJECT
2525
26private:26private:
27 AppDrawerModel *appDrawerModel;27 AppDrawerModel *appDrawerModel{nullptr};
2828
29private Q_SLOTS:29private Q_SLOTS:
3030
31 void initTestCase() {31 void initTestCase() {
32 UalWrapper::s_list << QStringLiteral("app1") << QStringLiteral("app2");32 UalWrapper::s_list << QStringLiteral("app1") << QStringLiteral("app2");
33 appDrawerModel = new AppDrawerModel(this);33 appDrawerModel = new AppDrawerModel();
34 QCOMPARE(appDrawerModel->rowCount(QModelIndex()), 2);34 QCOMPARE(appDrawerModel->rowCount(QModelIndex()), 2);
35 }35 }
3636
37 void cleanupTestCase() {
38 appDrawerModel->deleteLater();
39 }
40
37 void testUalAppAddedRemoved() {41 void testUalAppAddedRemoved() {
38 QCOMPARE(appDrawerModel->rowCount(QModelIndex()), 2);42 QCOMPARE(appDrawerModel->rowCount(QModelIndex()), 2);
3943
4044
=== modified file 'tests/plugins/Unity/Launcher/ualwrapper.cpp'
--- tests/plugins/Unity/Launcher/ualwrapper.cpp 2017-04-06 13:50:59 +0000
+++ tests/plugins/Unity/Launcher/ualwrapper.cpp 2017-04-06 13:50:59 +0000
@@ -42,6 +42,7 @@
42 info.name = "App_" + appId;42 info.name = "App_" + appId;
43 info.icon = "/dummy/icon/path/" + appId + ".png";43 info.icon = "/dummy/icon/path/" + appId + ".png";
44 info.keywords << QStringLiteral("keyword1") << QStringLiteral("keyword2");44 info.keywords << QStringLiteral("keyword1") << QStringLiteral("keyword2");
45 info.description = "Dummy description";
45 info.popularity = 1;46 info.popularity = 1;
46 info.valid = true;47 info.valid = true;
47 return info;48 return info;
4849
=== modified file 'tests/plugins/Unity/Launcher/ualwrapper.h'
--- tests/plugins/Unity/Launcher/ualwrapper.h 2017-04-06 13:50:59 +0000
+++ tests/plugins/Unity/Launcher/ualwrapper.h 2017-04-06 13:50:59 +0000
@@ -28,6 +28,7 @@
28 QString name;28 QString name;
29 QString icon;29 QString icon;
30 QStringList keywords;30 QStringList keywords;
31 QString description;
31 uint popularity = 0;32 uint popularity = 0;
32 };33 };
3334

Subscribers

People subscribed via source and target branches