Merge lp:~mzanetti/unity-api/appdrawermodelinterface into lp:unity-api
- appdrawermodelinterface
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Lukáš Tinkl |
Approved revision: | 263 |
Merged at revision: | 257 |
Proposed branch: | lp:~mzanetti/unity-api/appdrawermodelinterface |
Merge into: | lp:unity-api |
Prerequisite: | lp:~ci-train-bot/unity-api/unity-api-ubuntu-zesty-2202 |
Diff against target: |
471 lines (+273/-11) 11 files modified
debian/changelog (+6/-0) include/unity/shell/launcher/AppDrawerModelInterface.h (+71/-0) include/unity/shell/launcher/CMakeLists.txt (+1/-1) include/unity/shell/launcher/LauncherItemInterface.h (+10/-6) test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt (+2/-0) test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.cpp (+89/-0) test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.h (+38/-0) test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp (+14/-0) test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h (+6/-0) test/qmltest/mocks/plugins/Unity/Launcher/TestLauncherPlugin.cpp (+4/-0) test/qmltest/unity/shell/launcher/tst_Launcher.qml (+32/-4) |
To merge this branch: | bzr merge lp:~mzanetti/unity-api/appdrawermodelinterface |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Lukáš Tinkl (community) | Approve | ||
Unity8 CI Bot | continuous-integration | Approve | |
Ubuntu Unity PS integration team | Pending | ||
Review via email: mp+312140@code.launchpad.net |
This proposal supersedes a proposal from 2016-11-04.
Commit message
Add AppDrawerModelI
Description of the change
Requires: lp:~mzanetti/unity8/appdrawer
See silo 2150 for working builds.
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
Lukáš Tinkl (lukas-kde) wrote : Posted in a previous version of this proposal | # |
LGTM, works fine with the u8 appdrawer branch
CI failing because of lp:1642673, passing locally
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:263
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Lukáš Tinkl (lukas-kde) wrote : | # |
Re-approving after after having been resubmitted
Preview Diff
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2016-11-30 10:47:05 +0000 | |||
3 | +++ debian/changelog 2016-11-30 10:47:05 +0000 | |||
4 | @@ -1,3 +1,9 @@ | |||
5 | 1 | unity-api (7.121) UNRELEASED; urgency=medium | ||
6 | 2 | |||
7 | 3 | * Add AppDrawerModelInterface | ||
8 | 4 | |||
9 | 5 | -- Michael Zanetti <michael.zanetti@canonical.com> Thu, 10 Nov 2016 19:14:25 +0100 | ||
10 | 6 | |||
11 | 1 | unity-api (7.120+17.04.20161123-0ubuntu1) zesty; urgency=medium | 7 | unity-api (7.120+17.04.20161123-0ubuntu1) zesty; urgency=medium |
12 | 2 | 8 | ||
13 | 3 | [ Andrea Azzarone ] | 9 | [ Andrea Azzarone ] |
14 | 4 | 10 | ||
15 | === added file 'include/unity/shell/launcher/AppDrawerModelInterface.h' | |||
16 | --- include/unity/shell/launcher/AppDrawerModelInterface.h 1970-01-01 00:00:00 +0000 | |||
17 | +++ include/unity/shell/launcher/AppDrawerModelInterface.h 2016-11-30 10:47:05 +0000 | |||
18 | @@ -0,0 +1,71 @@ | |||
19 | 1 | /* | ||
20 | 2 | * Copyright 2016 Canonical Ltd. | ||
21 | 3 | * | ||
22 | 4 | * This program is free software; you can redistribute it and/or modify | ||
23 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
24 | 6 | * the Free Software Foundation; version 3. | ||
25 | 7 | * | ||
26 | 8 | * This program is distributed in the hope that it will be useful, | ||
27 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
28 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
29 | 11 | * GNU Lesser General Public License for more details. | ||
30 | 12 | * | ||
31 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
32 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
33 | 15 | */ | ||
34 | 16 | |||
35 | 17 | #pragma once | ||
36 | 18 | |||
37 | 19 | #include <unity/SymbolExport.h> | ||
38 | 20 | |||
39 | 21 | #include <QAbstractListModel> | ||
40 | 22 | |||
41 | 23 | namespace unity { | ||
42 | 24 | namespace shell { | ||
43 | 25 | namespace launcher { | ||
44 | 26 | |||
45 | 27 | /** | ||
46 | 28 | * @brief A list of app drawer items to be displayed | ||
47 | 29 | * | ||
48 | 30 | * This model exposes all the items that should be shown in the app drawer. | ||
49 | 31 | */ | ||
50 | 32 | class UNITY_API AppDrawerModelInterface: public QAbstractListModel | ||
51 | 33 | { | ||
52 | 34 | Q_OBJECT | ||
53 | 35 | Q_ENUMS(Roles) | ||
54 | 36 | public: | ||
55 | 37 | /** | ||
56 | 38 | * @brief The Roles supported by the model | ||
57 | 39 | * | ||
58 | 40 | * See LauncherItemInterface properties for details. | ||
59 | 41 | */ | ||
60 | 42 | enum Roles { | ||
61 | 43 | RoleAppId, | ||
62 | 44 | RoleName, | ||
63 | 45 | RoleIcon, | ||
64 | 46 | RoleKeywords, | ||
65 | 47 | RoleUsage | ||
66 | 48 | }; | ||
67 | 49 | |||
68 | 50 | /// @cond | ||
69 | 51 | AppDrawerModelInterface(QObject* parent = nullptr): QAbstractListModel(parent) {} | ||
70 | 52 | /// @endcond | ||
71 | 53 | |||
72 | 54 | virtual ~AppDrawerModelInterface() {} | ||
73 | 55 | |||
74 | 56 | /// @cond | ||
75 | 57 | QHash<int, QByteArray> roleNames() const override { | ||
76 | 58 | QHash<int, QByteArray> roles; | ||
77 | 59 | roles.insert(RoleAppId, "appId"); | ||
78 | 60 | roles.insert(RoleName, "name"); | ||
79 | 61 | roles.insert(RoleIcon, "icon"); | ||
80 | 62 | roles.insert(RoleKeywords, "keywords"); | ||
81 | 63 | roles.insert(RoleUsage, "usage"); | ||
82 | 64 | return roles; | ||
83 | 65 | } | ||
84 | 66 | /// @endcond | ||
85 | 67 | }; | ||
86 | 68 | |||
87 | 69 | } | ||
88 | 70 | } | ||
89 | 71 | } | ||
90 | 0 | 72 | ||
91 | === modified file 'include/unity/shell/launcher/CMakeLists.txt' | |||
92 | --- include/unity/shell/launcher/CMakeLists.txt 2016-11-30 10:47:05 +0000 | |||
93 | +++ include/unity/shell/launcher/CMakeLists.txt 2016-11-30 10:47:05 +0000 | |||
94 | @@ -7,7 +7,7 @@ | |||
95 | 7 | 7 | ||
96 | 8 | set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) | 8 | set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) |
97 | 9 | 9 | ||
99 | 10 | set(VERSION 10) | 10 | set(VERSION 11) |
100 | 11 | set(PKGCONFIG_NAME "unity-shell-launcher") | 11 | set(PKGCONFIG_NAME "unity-shell-launcher") |
101 | 12 | set(PKGCONFIG_DESCRIPTION "Unity shell Launcher APIs") | 12 | set(PKGCONFIG_DESCRIPTION "Unity shell Launcher APIs") |
102 | 13 | set(PKGCONFIG_REQUIRES "Qt5Core") | 13 | set(PKGCONFIG_REQUIRES "Qt5Core") |
103 | 14 | 14 | ||
104 | === modified file 'include/unity/shell/launcher/LauncherItemInterface.h' | |||
105 | --- include/unity/shell/launcher/LauncherItemInterface.h 2016-05-11 10:48:13 +0000 | |||
106 | +++ include/unity/shell/launcher/LauncherItemInterface.h 2016-11-30 10:47:05 +0000 | |||
107 | @@ -1,5 +1,5 @@ | |||
108 | 1 | /* | 1 | /* |
110 | 2 | * Copyright 2013 Canonical Ltd. | 2 | * Copyright 2013-2106 Canonical Ltd. |
111 | 3 | * | 3 | * |
112 | 4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
113 | 5 | * it under the terms of the GNU Lesser General Public License as published by | 5 | * it under the terms of the GNU Lesser General Public License as published by |
114 | @@ -12,9 +12,6 @@ | |||
115 | 12 | * | 12 | * |
116 | 13 | * You should have received a copy of the GNU Lesser General Public License | 13 | * You should have received a copy of the GNU Lesser General Public License |
117 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
118 | 15 | * | ||
119 | 16 | * Authors: | ||
120 | 17 | * Michael Zanetti <michael.zanetti@canonical.com> | ||
121 | 18 | */ | 15 | */ |
122 | 19 | 16 | ||
123 | 20 | #ifndef UNITY_SHELL_LAUNCHER_LAUNCHERITEM_H | 17 | #ifndef UNITY_SHELL_LAUNCHER_LAUNCHERITEM_H |
124 | @@ -52,12 +49,17 @@ | |||
125 | 52 | /** | 49 | /** |
126 | 53 | * @brief The user visible name of the item. | 50 | * @brief The user visible name of the item. |
127 | 54 | */ | 51 | */ |
129 | 55 | Q_PROPERTY(QString name READ name CONSTANT) | 52 | Q_PROPERTY(QString name READ name NOTIFY nameChanged) |
130 | 56 | 53 | ||
131 | 57 | /** | 54 | /** |
132 | 58 | * @brief The full path to the icon to be shown for the item. | 55 | * @brief The full path to the icon to be shown for the item. |
133 | 59 | */ | 56 | */ |
135 | 60 | Q_PROPERTY(QString icon READ icon CONSTANT) | 57 | Q_PROPERTY(QString icon READ icon NOTIFY iconChanged) |
136 | 58 | |||
137 | 59 | /** | ||
138 | 60 | * @brief The keywords for this item. | ||
139 | 61 | */ | ||
140 | 62 | Q_PROPERTY(QStringList keywords READ keywords NOTIFY keywordsChanged) | ||
141 | 61 | 63 | ||
142 | 62 | /** | 64 | /** |
143 | 63 | * @brief A flag whether the item is pinned or not | 65 | * @brief A flag whether the item is pinned or not |
144 | @@ -137,6 +139,7 @@ | |||
145 | 137 | virtual QString appId() const = 0; | 139 | virtual QString appId() const = 0; |
146 | 138 | virtual QString name() const = 0; | 140 | virtual QString name() const = 0; |
147 | 139 | virtual QString icon() const = 0; | 141 | virtual QString icon() const = 0; |
148 | 142 | virtual QStringList keywords() const = 0; | ||
149 | 140 | virtual bool pinned() const = 0; | 143 | virtual bool pinned() const = 0; |
150 | 141 | virtual bool running() const = 0; | 144 | virtual bool running() const = 0; |
151 | 142 | virtual bool recent() const = 0; | 145 | virtual bool recent() const = 0; |
152 | @@ -151,6 +154,7 @@ | |||
153 | 151 | Q_SIGNALS: | 154 | Q_SIGNALS: |
154 | 152 | void nameChanged(const QString &name); | 155 | void nameChanged(const QString &name); |
155 | 153 | void iconChanged(const QString &icon); | 156 | void iconChanged(const QString &icon); |
156 | 157 | void keywordsChanged(const QStringList &keywords); | ||
157 | 154 | void pinnedChanged(bool pinned); | 158 | void pinnedChanged(bool pinned); |
158 | 155 | void runningChanged(bool running); | 159 | void runningChanged(bool running); |
159 | 156 | void recentChanged(bool running); | 160 | void recentChanged(bool running); |
160 | 157 | 161 | ||
161 | === modified file 'test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt' | |||
162 | --- test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt 2014-09-03 22:59:26 +0000 | |||
163 | +++ test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt 2016-11-30 10:47:05 +0000 | |||
164 | @@ -16,11 +16,13 @@ | |||
165 | 16 | ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/LauncherModelInterface.h | 16 | ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/LauncherModelInterface.h |
166 | 17 | ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/LauncherItemInterface.h | 17 | ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/LauncherItemInterface.h |
167 | 18 | ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/QuickListModelInterface.h | 18 | ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/QuickListModelInterface.h |
168 | 19 | ${CMAKE_SOURCE_DIR}/include/unity/shell/launcher/AppDrawerModelInterface.h | ||
169 | 19 | ${CMAKE_SOURCE_DIR}/include/unity/shell/application/ApplicationManagerInterface.h | 20 | ${CMAKE_SOURCE_DIR}/include/unity/shell/application/ApplicationManagerInterface.h |
170 | 20 | ${CMAKE_SOURCE_DIR}/include/unity/shell/application/ApplicationInfoInterface.h | 21 | ${CMAKE_SOURCE_DIR}/include/unity/shell/application/ApplicationInfoInterface.h |
171 | 21 | Mocks/MockLauncherModel.cpp | 22 | Mocks/MockLauncherModel.cpp |
172 | 22 | Mocks/MockLauncherItem.cpp | 23 | Mocks/MockLauncherItem.cpp |
173 | 23 | Mocks/MockQuickListModel.cpp | 24 | Mocks/MockQuickListModel.cpp |
174 | 25 | Mocks/MockAppDrawerModel.cpp | ||
175 | 24 | ${CMAKE_CURRENT_SOURCE_DIR}/../Application/Mocks/MockApplicationManager.cpp | 26 | ${CMAKE_CURRENT_SOURCE_DIR}/../Application/Mocks/MockApplicationManager.cpp |
176 | 25 | ${CMAKE_CURRENT_SOURCE_DIR}/../Application/Mocks/MockApplicationInfo.cpp | 27 | ${CMAKE_CURRENT_SOURCE_DIR}/../Application/Mocks/MockApplicationInfo.cpp |
177 | 26 | ) | 28 | ) |
178 | 27 | 29 | ||
179 | === added file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.cpp' | |||
180 | --- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.cpp 1970-01-01 00:00:00 +0000 | |||
181 | +++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.cpp 2016-11-30 10:47:05 +0000 | |||
182 | @@ -0,0 +1,89 @@ | |||
183 | 1 | /* | ||
184 | 2 | * Copyright 2016 Canonical Ltd. | ||
185 | 3 | * | ||
186 | 4 | * This program is free software; you can redistribute it and/or modify | ||
187 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
188 | 6 | * the Free Software Foundation; version 3. | ||
189 | 7 | * | ||
190 | 8 | * This program is distributed in the hope that it will be useful, | ||
191 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
192 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
193 | 11 | * GNU Lesser General Public License for more details. | ||
194 | 12 | * | ||
195 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
196 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
197 | 15 | */ | ||
198 | 16 | |||
199 | 17 | #include <Mocks/MockAppDrawerModel.h> | ||
200 | 18 | #include <Mocks/MockLauncherItem.h> | ||
201 | 19 | |||
202 | 20 | using namespace unity::shell::launcher; | ||
203 | 21 | |||
204 | 22 | MockAppDrawerModel::MockAppDrawerModel(QObject* parent): AppDrawerModelInterface(parent) | ||
205 | 23 | { | ||
206 | 24 | MockLauncherItem *item = new MockLauncherItem("phone-app", "/usr/share/applications/phone-app.desktop", "Phone", "phone-app", this); | ||
207 | 25 | item->setKeywords({"keyword1", "keyword2"}); | ||
208 | 26 | m_list.append(item); | ||
209 | 27 | item = new MockLauncherItem("camera-app", "/usr/share/applications/camera-app.desktop", "Camera", "camera", this); | ||
210 | 28 | item->setKeywords({"keyword1", "keyword2"}); | ||
211 | 29 | m_list.append(item); | ||
212 | 30 | item = new MockLauncherItem("gallery-app", "/usr/share/applications/gallery-app.desktop", "Gallery", "gallery", this); | ||
213 | 31 | item->setKeywords({"keyword1", "keyword2"}); | ||
214 | 32 | m_list.append(item); | ||
215 | 33 | item = new MockLauncherItem("facebook-webapp", "/usr/share/applications/facebook-webapp.desktop", "Facebook", "facebook", this); | ||
216 | 34 | item->setKeywords({"keyword1", "keyword2"}); | ||
217 | 35 | m_list.append(item); | ||
218 | 36 | item = new MockLauncherItem("webbrowser-app", "/usr/share/applications/webbrowser-app.desktop", "Browser", "browser", this); | ||
219 | 37 | item->setKeywords({"keyword1", "keyword2"}); | ||
220 | 38 | m_list.append(item); | ||
221 | 39 | item = new MockLauncherItem("twitter-webapp", "/usr/share/applications/twitter-webapp.desktop", "Twitter", "twitter", this); | ||
222 | 40 | item->setKeywords({"keyword1", "keyword2"}); | ||
223 | 41 | m_list.append(item); | ||
224 | 42 | item = new MockLauncherItem("gmail-webapp", "/usr/share/applications/gmail-webapp.desktop", "GMail", "gmail", this); | ||
225 | 43 | item->setKeywords({"keyword1", "keyword2"}); | ||
226 | 44 | m_list.append(item); | ||
227 | 45 | item = new MockLauncherItem("ubuntu-weather-app", "/usr/share/applications/ubuntu-weather-app.desktop", "Weather", "weather", this); | ||
228 | 46 | item->setKeywords({"keyword1", "keyword2"}); | ||
229 | 47 | m_list.append(item); | ||
230 | 48 | item = new MockLauncherItem("notes-app", "/usr/share/applications/notes-app.desktop", "Notepad", "notepad", this); | ||
231 | 49 | item->setKeywords({"keyword1", "keyword2"}); | ||
232 | 50 | m_list.append(item); | ||
233 | 51 | item = new MockLauncherItem("ubuntu-calendar-app", "/usr/share/applications/ubuntu-calendar-app.desktop","Calendar", "calendar", this); | ||
234 | 52 | item->setKeywords({"keyword1", "keyword2"}); | ||
235 | 53 | m_list.append(item); | ||
236 | 54 | } | ||
237 | 55 | |||
238 | 56 | MockAppDrawerModel::~MockAppDrawerModel() | ||
239 | 57 | { | ||
240 | 58 | while (!m_list.empty()) | ||
241 | 59 | { | ||
242 | 60 | m_list.takeFirst()->deleteLater(); | ||
243 | 61 | } | ||
244 | 62 | } | ||
245 | 63 | |||
246 | 64 | // cppcheck-suppress unusedFunction | ||
247 | 65 | int MockAppDrawerModel::rowCount(const QModelIndex& parent) const | ||
248 | 66 | { | ||
249 | 67 | Q_UNUSED(parent) | ||
250 | 68 | return m_list.count(); | ||
251 | 69 | } | ||
252 | 70 | |||
253 | 71 | QVariant MockAppDrawerModel::data(const QModelIndex& index, int role) const | ||
254 | 72 | { | ||
255 | 73 | LauncherItemInterface *item = m_list.at(index.row()); | ||
256 | 74 | switch(role) | ||
257 | 75 | { | ||
258 | 76 | case RoleAppId: | ||
259 | 77 | return item->appId(); | ||
260 | 78 | case RoleName: | ||
261 | 79 | return item->name(); | ||
262 | 80 | case RoleIcon: | ||
263 | 81 | return item->icon(); | ||
264 | 82 | case RoleKeywords: | ||
265 | 83 | return item->keywords(); | ||
266 | 84 | case RoleUsage: | ||
267 | 85 | return 1; | ||
268 | 86 | } | ||
269 | 87 | |||
270 | 88 | return QVariant(); | ||
271 | 89 | } | ||
272 | 0 | 90 | ||
273 | === added file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.h' | |||
274 | --- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.h 1970-01-01 00:00:00 +0000 | |||
275 | +++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockAppDrawerModel.h 2016-11-30 10:47:05 +0000 | |||
276 | @@ -0,0 +1,38 @@ | |||
277 | 1 | /* | ||
278 | 2 | * Copyright 2016 Canonical Ltd. | ||
279 | 3 | * | ||
280 | 4 | * This program is free software; you can redistribute it and/or modify | ||
281 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
282 | 6 | * the Free Software Foundation; version 3. | ||
283 | 7 | * | ||
284 | 8 | * This program is distributed in the hope that it will be useful, | ||
285 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
286 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
287 | 11 | * GNU Lesser General Public License for more details. | ||
288 | 12 | * | ||
289 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
290 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
291 | 15 | */ | ||
292 | 16 | |||
293 | 17 | #pragma once | ||
294 | 18 | |||
295 | 19 | #include <AppDrawerModelInterface.h> | ||
296 | 20 | |||
297 | 21 | class MockLauncherItem; | ||
298 | 22 | |||
299 | 23 | using namespace unity::shell::launcher; | ||
300 | 24 | |||
301 | 25 | class UNITY_API MockAppDrawerModel: public AppDrawerModelInterface | ||
302 | 26 | { | ||
303 | 27 | Q_OBJECT | ||
304 | 28 | |||
305 | 29 | public: | ||
306 | 30 | MockAppDrawerModel(QObject* parent = 0); | ||
307 | 31 | ~MockAppDrawerModel(); | ||
308 | 32 | |||
309 | 33 | int rowCount(const QModelIndex& parent) const override; | ||
310 | 34 | QVariant data(const QModelIndex& index, int role) const override; | ||
311 | 35 | |||
312 | 36 | private: | ||
313 | 37 | QList<MockLauncherItem*> m_list; | ||
314 | 38 | }; | ||
315 | 0 | 39 | ||
316 | === modified file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp' | |||
317 | --- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp 2016-05-18 13:43:40 +0000 | |||
318 | +++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp 2016-11-30 10:47:05 +0000 | |||
319 | @@ -61,6 +61,20 @@ | |||
320 | 61 | return m_icon; | 61 | return m_icon; |
321 | 62 | } | 62 | } |
322 | 63 | 63 | ||
323 | 64 | QStringList MockLauncherItem::keywords() const | ||
324 | 65 | { | ||
325 | 66 | return m_keywords; | ||
326 | 67 | } | ||
327 | 68 | |||
328 | 69 | void MockLauncherItem::setKeywords(const QStringList &keywords) | ||
329 | 70 | { | ||
330 | 71 | if (m_keywords != keywords) | ||
331 | 72 | { | ||
332 | 73 | m_keywords = keywords; | ||
333 | 74 | Q_EMIT keywordsChanged(m_keywords); | ||
334 | 75 | } | ||
335 | 76 | } | ||
336 | 77 | |||
337 | 64 | bool MockLauncherItem::pinned() const | 78 | bool MockLauncherItem::pinned() const |
338 | 65 | { | 79 | { |
339 | 66 | return m_pinned; | 80 | return m_pinned; |
340 | 67 | 81 | ||
341 | === modified file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h' | |||
342 | --- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h 2016-05-18 13:43:40 +0000 | |||
343 | +++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h 2016-11-30 10:47:05 +0000 | |||
344 | @@ -22,6 +22,8 @@ | |||
345 | 22 | 22 | ||
346 | 23 | #include <LauncherItemInterface.h> | 23 | #include <LauncherItemInterface.h> |
347 | 24 | 24 | ||
348 | 25 | #include <QStringList> | ||
349 | 26 | |||
350 | 25 | using namespace unity::shell::launcher; | 27 | using namespace unity::shell::launcher; |
351 | 26 | 28 | ||
352 | 27 | class UNITY_API MockLauncherItem: public LauncherItemInterface | 29 | class UNITY_API MockLauncherItem: public LauncherItemInterface |
353 | @@ -35,6 +37,9 @@ | |||
354 | 35 | QString name() const; | 37 | QString name() const; |
355 | 36 | QString icon() const; | 38 | QString icon() const; |
356 | 37 | 39 | ||
357 | 40 | QStringList keywords() const; | ||
358 | 41 | void setKeywords(const QStringList &keywords); | ||
359 | 42 | |||
360 | 38 | bool pinned() const; | 43 | bool pinned() const; |
361 | 39 | void setPinned(bool pinned); | 44 | void setPinned(bool pinned); |
362 | 40 | 45 | ||
363 | @@ -67,6 +72,7 @@ | |||
364 | 67 | QString m_desktopFile; | 72 | QString m_desktopFile; |
365 | 68 | QString m_name; | 73 | QString m_name; |
366 | 69 | QString m_icon; | 74 | QString m_icon; |
367 | 75 | QStringList m_keywords; | ||
368 | 70 | bool m_pinned; | 76 | bool m_pinned; |
369 | 71 | bool m_running; | 77 | bool m_running; |
370 | 72 | bool m_recent; | 78 | bool m_recent; |
371 | 73 | 79 | ||
372 | === modified file 'test/qmltest/mocks/plugins/Unity/Launcher/TestLauncherPlugin.cpp' | |||
373 | --- test/qmltest/mocks/plugins/Unity/Launcher/TestLauncherPlugin.cpp 2013-09-11 15:28:22 +0000 | |||
374 | +++ test/qmltest/mocks/plugins/Unity/Launcher/TestLauncherPlugin.cpp 2016-11-30 10:47:05 +0000 | |||
375 | @@ -21,9 +21,11 @@ | |||
376 | 21 | #include <Mocks/MockLauncherModel.h> | 21 | #include <Mocks/MockLauncherModel.h> |
377 | 22 | #include <Mocks/MockLauncherItem.h> | 22 | #include <Mocks/MockLauncherItem.h> |
378 | 23 | #include <Mocks/MockQuickListModel.h> | 23 | #include <Mocks/MockQuickListModel.h> |
379 | 24 | #include <Mocks/MockAppDrawerModel.h> | ||
380 | 24 | 25 | ||
381 | 25 | #include <LauncherModelInterface.h> | 26 | #include <LauncherModelInterface.h> |
382 | 26 | #include <LauncherItemInterface.h> | 27 | #include <LauncherItemInterface.h> |
383 | 28 | #include <AppDrawerModelInterface.h> | ||
384 | 27 | 29 | ||
385 | 28 | #include <QtQml/qqml.h> | 30 | #include <QtQml/qqml.h> |
386 | 29 | 31 | ||
387 | @@ -42,10 +44,12 @@ | |||
388 | 42 | qmlRegisterUncreatableType<LauncherModelInterface>(uri, 0, 1, "LauncherModelInterface", "Interface for the LauncherModel"); | 44 | qmlRegisterUncreatableType<LauncherModelInterface>(uri, 0, 1, "LauncherModelInterface", "Interface for the LauncherModel"); |
389 | 43 | qmlRegisterUncreatableType<LauncherItemInterface>(uri, 0, 1, "LauncherItemInterface", "Interface for the LauncherItem"); | 45 | qmlRegisterUncreatableType<LauncherItemInterface>(uri, 0, 1, "LauncherItemInterface", "Interface for the LauncherItem"); |
390 | 44 | qmlRegisterUncreatableType<QuickListModelInterface>(uri, 0, 1, "QuickListModelInterface", "Interface for the QuickListModel"); | 46 | qmlRegisterUncreatableType<QuickListModelInterface>(uri, 0, 1, "QuickListModelInterface", "Interface for the QuickListModel"); |
391 | 47 | qmlRegisterUncreatableType<AppDrawerModelInterface>(uri, 0, 1, "AppDrawerModelInterface", "Interface for the AppDrawerModel"); | ||
392 | 45 | 48 | ||
393 | 46 | qmlRegisterSingletonType<MockLauncherModel>(uri, 0, 1, "LauncherModel", modelProvider); | 49 | qmlRegisterSingletonType<MockLauncherModel>(uri, 0, 1, "LauncherModel", modelProvider); |
394 | 47 | qmlRegisterUncreatableType<MockLauncherItem>(uri, 0, 1, "LauncherItem", "Can't create LauncherItems in QML. Get them from the LauncherModel"); | 50 | qmlRegisterUncreatableType<MockLauncherItem>(uri, 0, 1, "LauncherItem", "Can't create LauncherItems in QML. Get them from the LauncherModel"); |
395 | 48 | qmlRegisterUncreatableType<MockQuickListModel>(uri, 0, 1, "QuickListModel", "Can't create QuickListModels in QML. Get them from the LauncherItems"); | 51 | qmlRegisterUncreatableType<MockQuickListModel>(uri, 0, 1, "QuickListModel", "Can't create QuickListModels in QML. Get them from the LauncherItems"); |
396 | 52 | qmlRegisterType<MockAppDrawerModel>(uri, 0, 1, "AppDrawerModel"); | ||
397 | 49 | 53 | ||
398 | 50 | // Need to register the appmanager here ourselves as there won't be a real AppManager plugin in this test | 54 | // Need to register the appmanager here ourselves as there won't be a real AppManager plugin in this test |
399 | 51 | qmlRegisterUncreatableType<unity::shell::application::ApplicationManagerInterface>(uri, 0, 1, "ApplicationManagerInterface", "Interface for the ApplicationManager"); | 55 | qmlRegisterUncreatableType<unity::shell::application::ApplicationManagerInterface>(uri, 0, 1, "ApplicationManagerInterface", "Interface for the ApplicationManager"); |
400 | 52 | 56 | ||
401 | === modified file 'test/qmltest/unity/shell/launcher/tst_Launcher.qml' | |||
402 | --- test/qmltest/unity/shell/launcher/tst_Launcher.qml 2016-11-30 10:47:05 +0000 | |||
403 | +++ test/qmltest/unity/shell/launcher/tst_Launcher.qml 2016-11-30 10:47:05 +0000 | |||
404 | @@ -1,5 +1,5 @@ | |||
405 | 1 | /* | 1 | /* |
407 | 2 | * Copyright 2013 Canonical Ltd. | 2 | * Copyright 2013-2016 Canonical Ltd. |
408 | 3 | * | 3 | * |
409 | 4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
410 | 5 | * it under the terms of the GNU Lesser General Public License as published by | 5 | * it under the terms of the GNU Lesser General Public License as published by |
411 | @@ -12,9 +12,6 @@ | |||
412 | 12 | * | 12 | * |
413 | 13 | * You should have received a copy of the GNU Lesser General Public License | 13 | * You should have received a copy of the GNU Lesser General Public License |
414 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
415 | 15 | * | ||
416 | 16 | * Authors: | ||
417 | 17 | * Michael Zanetti <michael.zanetti@canonical.com> | ||
418 | 18 | */ | 15 | */ |
419 | 19 | 16 | ||
420 | 20 | import QtQuick 2.0 | 17 | import QtQuick 2.0 |
421 | @@ -67,6 +64,15 @@ | |||
422 | 67 | } | 64 | } |
423 | 68 | } | 65 | } |
424 | 69 | 66 | ||
425 | 67 | |||
426 | 68 | Repeater { | ||
427 | 69 | id: appDrawerRepeater | ||
428 | 70 | model: AppDrawerModel {} | ||
429 | 71 | delegate: Item { | ||
430 | 72 | property var roles: model | ||
431 | 73 | } | ||
432 | 74 | } | ||
433 | 75 | |||
434 | 70 | function initTestCase() { | 76 | function initTestCase() { |
435 | 71 | if (repeater.count < 5) { | 77 | if (repeater.count < 5) { |
436 | 72 | print("This Test Suite requires at least 5 items in the model.") | 78 | print("This Test Suite requires at least 5 items in the model.") |
437 | @@ -138,6 +144,7 @@ | |||
438 | 138 | { tag: "Item.properties[appId]", constant: "appId", type: "string" }, | 144 | { tag: "Item.properties[appId]", constant: "appId", type: "string" }, |
439 | 139 | { tag: "Item.properties[name]", constant: "name", type: "string" }, | 145 | { tag: "Item.properties[name]", constant: "name", type: "string" }, |
440 | 140 | { tag: "Item.properties[icon]", constant: "icon", type: "string" }, | 146 | { tag: "Item.properties[icon]", constant: "icon", type: "string" }, |
441 | 147 | { tag: "Item.properties[keywords]", constant: "keywords", type: "object" }, | ||
442 | 141 | { tag: "Item.properties[pinned]", property: "pinned", type: "boolean" }, | 148 | { tag: "Item.properties[pinned]", property: "pinned", type: "boolean" }, |
443 | 142 | { tag: "Item.properties[recent]", property: "recent", type: "boolean" }, | 149 | { tag: "Item.properties[recent]", property: "recent", type: "boolean" }, |
444 | 143 | { tag: "Item.properties[running]", property: "running", type: "boolean" }, | 150 | { tag: "Item.properties[running]", property: "running", type: "boolean" }, |
445 | @@ -182,5 +189,26 @@ | |||
446 | 182 | 189 | ||
447 | 183 | verifyData(data); | 190 | verifyData(data); |
448 | 184 | } | 191 | } |
449 | 192 | |||
450 | 193 | function test_appdrawer_model_roles_data() { | ||
451 | 194 | return [ | ||
452 | 195 | { tag: "Model.roles[appId]", role: "appId", type: "string" }, | ||
453 | 196 | { tag: "Model.roles[name]", role: "name", type: "string" }, | ||
454 | 197 | { tag: "Model.roles[icon]", role: "icon", type: "string" }, | ||
455 | 198 | { tag: "Model.roles[keywords]", role: "keywords", type: "object" }, | ||
456 | 199 | { tag: "Model.roles[usage]", role: "usage", type: "number" }, | ||
457 | 200 | ]; | ||
458 | 201 | } | ||
459 | 202 | |||
460 | 203 | function test_appdrawer_model_roles(data) { | ||
461 | 204 | name = "AppDrawerModel" | ||
462 | 205 | try { | ||
463 | 206 | object = appDrawerRepeater.itemAt(0).roles; | ||
464 | 207 | } catch(err) { | ||
465 | 208 | object = undefined; | ||
466 | 209 | } | ||
467 | 210 | |||
468 | 211 | verifyData(data); | ||
469 | 212 | } | ||
470 | 185 | } | 213 | } |
471 | 186 | } | 214 | } |
FAILED: Continuous integration, rev:261 /unity8- jenkins. ubuntu. com/job/ lp-unity- api-ci/ 111/ /unity8- jenkins. ubuntu. com/job/ build/3382/ console /unity8- jenkins. ubuntu. com/job/ build-0- fetch/3410 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 3261 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 3261/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 3261 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 3261/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= zesty/3261/ console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 3261 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 3261/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 3261 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 3261/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= zesty/3261/ console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 3261 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 3261/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 3261 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 3261/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= zesty/3261/ console
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild: /unity8- jenkins. ubuntu. com/job/ lp-unity- api-ci/ 111/rebuild
https:/