Merge lp:~macslow/unity8/use-set-progress-api into lp:unity8

Proposed by Mirco Müller
Status: Merged
Approved by: Michael Zanetti
Approved revision: 1848
Merged at revision: 1888
Proposed branch: lp:~macslow/unity8/use-set-progress-api
Merge into: lp:unity8
Prerequisite: lp:~macslow/unity8/launcher-icon-wobble
Diff against target: 427 lines (+125/-43)
17 files modified
plugins/Greeter/Unity/Launcher/launchermodelas.cpp (+22/-12)
plugins/Unity/Launcher/asadapter.cpp (+1/-0)
plugins/Unity/Launcher/dbusinterface.cpp (+16/-4)
plugins/Unity/Launcher/dbusinterface.h (+1/-0)
plugins/Unity/Launcher/launchermodel.cpp (+1/-0)
qml/Launcher/LauncherDelegate.qml (+14/-14)
qml/Launcher/graphics/progressbar-fill@30.sci (+0/-5)
qml/Launcher/graphics/progressbar-trough@30.sci (+0/-5)
tests/mocks/Unity/Launcher/MockLauncherModel.cpp (+10/-0)
tests/mocks/Unity/Launcher/MockLauncherModel.h (+1/-0)
tests/plugins/Greeter/Unity/Launcher/launchermodelastest.cpp (+3/-0)
tests/qmltests/Launcher/tst_Launcher.qml (+40/-3)
tests/scripts/README (+4/-0)
tests/scripts/get-progress.sh (+3/-0)
tests/scripts/set-count-visible.sh (+3/-0)
tests/scripts/set-count.sh (+3/-0)
tests/scripts/set-progress.sh (+3/-0)
To merge this branch: bzr merge lp:~macslow/unity8/use-set-progress-api
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Michael Zanetti (community) Approve
Lukáš Tinkl Pending
Nick Dedekind Pending
Review via email: mp+265639@code.launchpad.net

This proposal supersedes a proposal from 2015-06-19.

Commit message

Added corresponding tests and visual tweaks to a launcher-item's progress-overlay.

Description of the change

Added corresponding tests and visual tweaks to a launcher-item's progress-overlay.

For the reviewers convenience here's a screencast of the branch in action on a device: https://www.youtube.com/watch?v=wdP0nYn__uk

* Are there any related MPs required for this MP to build/function as expected? Please list.
Yes. lp:~macslow/unity8/launcher-icon-wobble needs to be landed in unity8 first.

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

* Did you make sure that your branch does not contain spurious tags?
Yes.

* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
Not applicable.

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

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote : Posted in a previous version of this proposal

As I commented on the related unity-api branch, I don't think we need to define an API for that. Unity8 itself doesn't ever set the progress.

* You can then completely revert the change in launchermodeas.

* I haven't tested it yet, but reading through the code it seems you didn't wire up the Set method on D-Bus.

* in asadapter.cpp you need to sync the progress value to AS too.

* in launchermodelas.cpp you need to read the change from AS and set that to the LauncherItems

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote : Posted in a previous version of this proposal

See inline comments

review: Needs Fixing (code-review)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Nick Dedekind (nick-dedekind) wrote : Posted in a previous version of this proposal

Small comment, otherwise code looks

review: Needs Fixing
Revision history for this message
Nick Dedekind (nick-dedekind) wrote : Posted in a previous version of this proposal

Having a "progressVisible" property only for the test is a bit of overkill. Can you go in on the "progressOverlay" named object with findChild and change visibility.

review: Needs Fixing
Revision history for this message
Nick Dedekind (nick-dedekind) wrote : Posted in a previous version of this proposal

*check visiblilty

Revision history for this message
Mirco Müller (macslow) wrote : Posted in a previous version of this proposal

> Having a "progressVisible" property only for the test is a bit of overkill.
> Can you go in on the "progressOverlay" named object with findChild and change
> visibility.

This and inline comment addressed with r1837.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote : Posted in a previous version of this proposal

Approving, looks good now

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

No

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

Yes

* Did you make sure that your branch does not contain spurious tags?

Yes

* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?

Yes

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

Yes

review: Approve
Revision history for this message
Michael Zanetti (mzanetti) wrote : Posted in a previous version of this proposal

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

So you did that? Both? How come it doesn't work then?

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote : Posted in a previous version of this proposal

"progress" doesn't show up in introspection:

# qdbus com.canonical.Unity /com/canonical/Unity/Launcher/webbrowser_2Dapp
property readwrite int com.canonical.Unity.Launcher.Item.count
property readwrite bool com.canonical.Unity.Launcher.Item.countVisible
signal void org.freedesktop.DBus.Properties.PropertiesChanged(QString interface_name, QVariantMap changed_properties, QStringList invalidated_properties)
method QDBusVariant org.freedesktop.DBus.Properties.Get(QString interface_name, QString property_name)
method QVariantMap org.freedesktop.DBus.Properties.GetAll(QString interface_name)
method void org.freedesktop.DBus.Properties.Set(QString interface_name, QString property_name, QDBusVariant value)
method QString org.freedesktop.DBus.Introspectable.Introspect()
method QString org.freedesktop.DBus.Peer.GetMachineId()
method void org.freedesktop.DBus.Peer.Ping()

====

There are some minor inline comments

Revision history for this message
Michael Zanetti (mzanetti) wrote : Posted in a previous version of this proposal

 * 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.

as much as it could

 * Did you make sure that the branch does not contain spurious tags?

yes

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

reapproving as per superseded MP

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1849. By Mirco Müller

Merged again with launcher-icon-wobble branch.

1850. By Mirco Müller

Fixed alertViaCountAndCountVisible qmltest.

1851. By Mirco Müller

Sorted out another issue with alertViaCountAndCountVisible qmltest.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/Greeter/Unity/Launcher/launchermodelas.cpp'
2--- plugins/Greeter/Unity/Launcher/launchermodelas.cpp 2015-07-25 13:57:22 +0000
3+++ plugins/Greeter/Unity/Launcher/launchermodelas.cpp 2015-07-25 13:57:22 +0000
4@@ -207,16 +207,24 @@
5 Q_FOREACH (LauncherItem* item, m_list) {
6 bool found = false;
7 Q_FOREACH(const QVariant &asItem, items) {
8- if (asItem.toMap().value("id").toString() == item->appId()) {
9+ QVariantMap cachedMap = asItem.toMap();
10+ if (cachedMap.value("id").toString() == item->appId()) {
11 // Only keep and update it if we either show unpinned or it is pinned
12- if (!m_onlyPinned || asItem.toMap().value("pinned").toBool()) {
13+ if (!m_onlyPinned || cachedMap.value("pinned").toBool()) {
14 found = true;
15- item->setName(asItem.toMap().value("name").toString());
16- item->setIcon(asItem.toMap().value("icon").toString());
17- item->setCount(asItem.toMap().value("count").toInt());
18- item->setCountVisible(asItem.toMap().value("countVisible").toBool());
19+ item->setName(cachedMap.value("name").toString());
20+ item->setIcon(cachedMap.value("icon").toString());
21+ item->setCount(cachedMap.value("count").toInt());
22+ item->setCountVisible(cachedMap.value("countVisible").toBool());
23+ item->setProgress(cachedMap.value("progress").toInt());
24 int idx = m_list.indexOf(item);
25- Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleName << RoleIcon);
26+ Q_EMIT dataChanged(index(idx),
27+ index(idx),
28+ {RoleName,
29+ RoleIcon,
30+ RoleCount,
31+ RoleCountVisible,
32+ RoleProgress});
33 }
34 break;
35 }
36@@ -254,14 +262,16 @@
37 }
38
39 if (itemIndex == -1) {
40+ QVariantMap chachedMap = entry.toMap();
41 // Need to add it. Just add it into the addedIndex to keep same ordering as the list in AS.
42- LauncherItem *item = new LauncherItem(entry.toMap().value("id").toString(),
43- entry.toMap().value("name").toString(),
44- entry.toMap().value("icon").toString(),
45+ LauncherItem *item = new LauncherItem(chachedMap.value("id").toString(),
46+ chachedMap.value("name").toString(),
47+ chachedMap.value("icon").toString(),
48 this);
49 item->setPinned(true);
50- item->setCount(entry.toMap().value("count").toInt());
51- item->setCountVisible(entry.toMap().value("countVisible").toBool());
52+ item->setCount(chachedMap.value("count").toInt());
53+ item->setCountVisible(chachedMap.value("countVisible").toBool());
54+ item->setProgress(chachedMap.value("progress").toInt());
55 beginInsertRows(QModelIndex(), newPosition, newPosition);
56 m_list.insert(newPosition, item);
57 endInsertRows();
58
59=== modified file 'plugins/Unity/Launcher/asadapter.cpp'
60--- plugins/Unity/Launcher/asadapter.cpp 2015-02-11 14:13:26 +0000
61+++ plugins/Unity/Launcher/asadapter.cpp 2015-07-25 13:57:22 +0000
62@@ -56,5 +56,6 @@
63 details.insert("count", item->count());
64 details.insert("countVisible", item->countVisible());
65 details.insert("pinned", item->pinned());
66+ details.insert("progress", item->progress());
67 return details;
68 }
69
70=== modified file 'plugins/Unity/Launcher/dbusinterface.cpp'
71--- plugins/Unity/Launcher/dbusinterface.cpp 2015-07-25 13:57:22 +0000
72+++ plugins/Unity/Launcher/dbusinterface.cpp 2015-07-25 13:57:22 +0000
73@@ -62,6 +62,7 @@
74 "<interface name=\"com.canonical.Unity.Launcher.Item\">"
75 "<property name=\"count\" type=\"i\" access=\"readwrite\" />"
76 "<property name=\"countVisible\" type=\"b\" access=\"readwrite\" />"
77+ "<property name=\"progress\" type=\"i\" access=\"readwrite\" />"
78 "<method name=\"Alert\" />"
79 "</interface>";
80 return nodeiface;
81@@ -175,33 +176,44 @@
82
83 QVariantList retval;
84 if (message.member() == "Get") {
85+ QString cachedString = message.arguments()[1].toString();
86 if (!item) {
87 return false;
88 }
89- if (message.arguments()[1].toString() == "count") {
90+ if (cachedString == "count") {
91 retval.append(QVariant::fromValue(QDBusVariant(item->count())));
92- } else if (message.arguments()[1].toString() == "countVisible") {
93+ } else if (cachedString == "countVisible") {
94 retval.append(QVariant::fromValue(QDBusVariant(item->countVisible())));
95+ } else if (cachedString == "progress") {
96+ retval.append(QVariant::fromValue(QDBusVariant(item->progress())));
97 }
98 } else if (message.member() == "Set") {
99- if (message.arguments()[1].toString() == "count") {
100+ QString cachedString = message.arguments()[1].toString();
101+ if (cachedString == "count") {
102 int newCount = message.arguments()[2].value<QDBusVariant>().variant().toInt();
103 if (!item || newCount != item->count()) {
104 Q_EMIT countChanged(appid, newCount);
105 notifyPropertyChanged("com.canonical.Unity.Launcher.Item", encodeAppId(appid), "count", QVariant(newCount));
106 }
107- } else if (message.arguments()[1].toString() == "countVisible") {
108+ } else if (cachedString == "countVisible") {
109 bool newVisible = message.arguments()[2].value<QDBusVariant>().variant().toBool();
110 if (!item || newVisible != item->countVisible()) {
111 Q_EMIT countVisibleChanged(appid, newVisible);
112 notifyPropertyChanged("com.canonical.Unity.Launcher.Item", encodeAppId(appid), "countVisible", newVisible);
113 }
114+ } else if (cachedString == "progress") {
115+ int newProgress = message.arguments()[2].value<QDBusVariant>().variant().toInt();
116+ if (!item || newProgress != item->progress()) {
117+ Q_EMIT progressChanged(appid, newProgress);
118+ notifyPropertyChanged("com.canonical.Unity.Launcher.Item", encodeAppId(appid), "progress", QVariant(newProgress));
119+ }
120 }
121 } else if (message.member() == "GetAll") {
122 if (item) {
123 QVariantMap all;
124 all.insert("count", item->count());
125 all.insert("countVisible", item->countVisible());
126+ all.insert("progress", item->progress());
127 retval.append(all);
128 }
129 } else {
130
131=== modified file 'plugins/Unity/Launcher/dbusinterface.h'
132--- plugins/Unity/Launcher/dbusinterface.h 2015-07-25 13:57:22 +0000
133+++ plugins/Unity/Launcher/dbusinterface.h 2015-07-25 13:57:22 +0000
134@@ -36,6 +36,7 @@
135 Q_SIGNALS:
136 void countChanged(const QString &appId, int count);
137 void countVisibleChanged(const QString &appId, bool countVisible);
138+ void progressChanged(const QString &appId, int progress);
139 void refreshCalled();
140 void alertCalled(const QString &appId);
141
142
143=== modified file 'plugins/Unity/Launcher/launchermodel.cpp'
144--- plugins/Unity/Launcher/launchermodel.cpp 2015-07-25 13:57:22 +0000
145+++ plugins/Unity/Launcher/launchermodel.cpp 2015-07-25 13:57:22 +0000
146@@ -40,6 +40,7 @@
147 {
148 connect(m_dbusIface, &DBusInterface::countChanged, this, &LauncherModel::countChanged);
149 connect(m_dbusIface, &DBusInterface::countVisibleChanged, this, &LauncherModel::countVisibleChanged);
150+ connect(m_dbusIface, &DBusInterface::progressChanged, this, &LauncherModel::progressChanged);
151 connect(m_dbusIface, &DBusInterface::refreshCalled, this, &LauncherModel::refresh);
152 connect(m_dbusIface, &DBusInterface::alertCalled, this, &LauncherModel::alert);
153
154
155=== modified file 'qml/Launcher/LauncherDelegate.qml'
156--- qml/Launcher/LauncherDelegate.qml 2015-07-25 13:57:22 +0000
157+++ qml/Launcher/LauncherDelegate.qml 2015-07-25 13:57:22 +0000
158@@ -153,7 +153,7 @@
159 objectName: "countEmblem"
160 anchors {
161 right: parent.right
162- top: parent.top
163+ bottom: parent.bottom
164 margins: units.dp(3)
165 }
166 width: Math.min(root.itemWidth, Math.max(units.gu(2), countLabel.implicitWidth + units.gu(1)))
167@@ -178,23 +178,21 @@
168 }
169 }
170
171- BorderImage {
172+ UbuntuShape {
173 id: progressOverlay
174 objectName: "progressOverlay"
175+
176 anchors {
177 left: iconItem.left
178 right: iconItem.right
179- bottom: iconItem.bottom
180- leftMargin: units.gu(1)
181- rightMargin: units.gu(1)
182- bottomMargin: units.gu(1)
183+ verticalCenter: parent.verticalCenter
184+ leftMargin: units.gu(1.5)
185+ rightMargin: units.gu(1.5)
186 }
187- height: units.gu(1.5)
188+ height: units.gu(1)
189 visible: root.progress > -1
190- source: "graphics/progressbar-trough.sci"
191-
192- // For fill calculation we need to remove the 2 units of border defined in .sci file
193- property int adjustedWidth: width - units.gu(2)
194+ color: UbuntuColors.darkGrey
195+ borderSource: "none"
196
197 Item {
198 anchors {
199@@ -202,20 +200,22 @@
200 top: parent.top
201 bottom: parent.bottom
202 }
203- width: Math.min(100, root.progress) / 100 * parent.adjustedWidth + units.gu(1)
204+ width: Math.min(100, root.progress) / 100 * parent.width
205 clip: true
206
207- BorderImage {
208+ UbuntuShape {
209 anchors {
210 left: parent.left
211 top: parent.top
212 bottom: parent.bottom
213 }
214+ color: "white"
215+ borderSource: "none"
216 width: progressOverlay.width
217- source: "graphics/progressbar-fill.sci"
218 }
219 }
220 }
221+
222 Image {
223 objectName: "focusedHighlight"
224 anchors {
225
226=== removed file 'qml/Launcher/graphics/progressbar-fill@30.png'
227Binary files qml/Launcher/graphics/progressbar-fill@30.png 2013-08-19 19:34:03 +0000 and qml/Launcher/graphics/progressbar-fill@30.png 1970-01-01 00:00:00 +0000 differ
228=== removed file 'qml/Launcher/graphics/progressbar-fill@30.sci'
229--- qml/Launcher/graphics/progressbar-fill@30.sci 2013-08-19 19:34:03 +0000
230+++ qml/Launcher/graphics/progressbar-fill@30.sci 1970-01-01 00:00:00 +0000
231@@ -1,5 +0,0 @@
232-border.left: 36
233-border.top: 16
234-border.bottom: 28
235-border.right: 36
236-source: progressbar-fill@30.png
237\ No newline at end of file
238
239=== removed file 'qml/Launcher/graphics/progressbar-trough@30.png'
240Binary files qml/Launcher/graphics/progressbar-trough@30.png 2013-08-19 19:34:03 +0000 and qml/Launcher/graphics/progressbar-trough@30.png 1970-01-01 00:00:00 +0000 differ
241=== removed file 'qml/Launcher/graphics/progressbar-trough@30.sci'
242--- qml/Launcher/graphics/progressbar-trough@30.sci 2013-08-19 19:34:03 +0000
243+++ qml/Launcher/graphics/progressbar-trough@30.sci 1970-01-01 00:00:00 +0000
244@@ -1,5 +0,0 @@
245-border.left: 36
246-border.top: 16
247-border.bottom: 26
248-border.right: 36
249-source: progressbar-trough@30.png
250\ No newline at end of file
251
252=== modified file 'tests/mocks/Unity/Launcher/MockLauncherModel.cpp'
253--- tests/mocks/Unity/Launcher/MockLauncherModel.cpp 2015-07-25 13:57:22 +0000
254+++ tests/mocks/Unity/Launcher/MockLauncherModel.cpp 2015-07-25 13:57:22 +0000
255@@ -215,6 +215,16 @@
256 return -1;
257 }
258
259+void MockLauncherModel::setProgress(const QString &appId, int progress)
260+{
261+ int index = findApp(appId);
262+ if (index >= 0) {
263+ m_list.at(index)->setProgress(progress);
264+ QModelIndex modelIndex = this->index(index);
265+ Q_EMIT dataChanged(modelIndex, modelIndex, QVector<int>() << RoleProgress);
266+ }
267+}
268+
269 void MockLauncherModel::setUser(const QString &username)
270 {
271 Q_UNUSED(username)
272
273=== modified file 'tests/mocks/Unity/Launcher/MockLauncherModel.h'
274--- tests/mocks/Unity/Launcher/MockLauncherModel.h 2015-07-25 13:57:22 +0000
275+++ tests/mocks/Unity/Launcher/MockLauncherModel.h 2015-07-25 13:57:22 +0000
276@@ -55,6 +55,7 @@
277
278 // For testing
279 Q_INVOKABLE void emitHint();
280+ Q_INVOKABLE void setProgress(const QString &appId, int progress);
281 Q_INVOKABLE void setCount(const QString &appId, int count);
282 Q_INVOKABLE void setCountVisible(const QString &appId, bool countVisible);
283
284
285=== modified file 'tests/plugins/Greeter/Unity/Launcher/launchermodelastest.cpp'
286--- tests/plugins/Greeter/Unity/Launcher/launchermodelastest.cpp 2015-02-11 14:11:26 +0000
287+++ tests/plugins/Greeter/Unity/Launcher/launchermodelastest.cpp 2015-07-25 13:57:22 +0000
288@@ -43,6 +43,7 @@
289 item.insert("name", "Item 1");
290 item.insert("icon", "fake.svg");
291 item.insert("count", 0);
292+ item.insert("progress", 0);
293 item.insert("countVisible", false);
294 item.insert("pinned", true);
295 list.append(item);
296@@ -67,6 +68,7 @@
297 inSync &= model->get(i)->name() == list.at(i).value("name").toString();
298 inSync &= model->get(i)->icon() == list.at(i).value("icon").toString();
299 inSync &= model->get(i)->count() == list.at(i).value("count").toInt();
300+ inSync &= model->get(i)->progress() == list.at(i).value("progress").toInt();
301 inSync &= model->get(i)->countVisible() == list.at(i).value("countVisible").toBool();
302 }
303 return inSync;
304@@ -111,6 +113,7 @@
305 newEntry.insert("name", "New app");
306 newEntry.insert("icon", "some-icon.svg");
307 newEntry.insert("count", 0);
308+ newEntry.insert("progress", 42);
309 newEntry.insert("countVisible", false);
310 newEntry.insert("pinned", true);
311 newList.append(newEntry);
312
313=== modified file 'tests/qmltests/Launcher/tst_Launcher.qml'
314--- tests/qmltests/Launcher/tst_Launcher.qml 2015-07-25 13:57:22 +0000
315+++ tests/qmltests/Launcher/tst_Launcher.qml 2015-07-25 13:57:22 +0000
316@@ -98,12 +98,38 @@
317 spacing: units.gu(1)
318
319 Button {
320+ text: "35% bar"
321+ onClicked: LauncherModel.setProgress(LauncherModel.get(parseInt(appIdEntryBar.displayText)).appId, 35)
322+ Layout.fillWidth: true
323+ }
324+
325+ TextArea {
326+ id: appIdEntryBar
327+ anchors.verticalCenter: parent.verticalCenter
328+ width: units.gu(4)
329+ height: units.gu(4)
330+ autoSize: true
331+ text: "2"
332+ maximumLineCount: 1
333+ }
334+
335+ Button {
336+ text: "no bar"
337+ onClicked: LauncherModel.setProgress(LauncherModel.get(parseInt(appIdEntryBar.displayText)).appId, -1)
338+ Layout.fillWidth: true
339+ }
340+ }
341+
342+ Row {
343+ spacing: units.gu(1)
344+
345+ Button {
346 text: "set alert"
347- onClicked: LauncherModel.setAlerting(LauncherModel.get(parseInt(appIdEntry.displayText)).appId, true)
348+ onClicked: LauncherModel.setAlerting(LauncherModel.get(parseInt(appIdEntryAlert.displayText)).appId, true)
349 }
350
351 TextArea {
352- id: appIdEntry
353+ id: appIdEntryAlert
354 anchors.verticalCenter: parent.verticalCenter
355 width: units.gu(5)
356 height: units.gu(4)
357@@ -115,7 +141,7 @@
358
359 Button {
360 text: "unset alert"
361- onClicked: LauncherModel.setAlerting(LauncherModel.get(parseInt(appIdEntry.displayText)).appId, false)
362+ onClicked: LauncherModel.setAlerting(LauncherModel.get(parseInt(appIdEntryAlert.displayText)).appId, false)
363 }
364 }
365 }
366@@ -672,6 +698,17 @@
367 waitUntilLauncherDisappears();
368 }
369
370+ function test_progressChangeViaModel() {
371+ dragLauncherIntoView();
372+ var item = findChild(launcher, "launcherDelegate0")
373+ verify(item != undefined)
374+ LauncherModel.setProgress(LauncherModel.get(0).appId, -1)
375+ compare(findChild(item, "progressOverlay").visible, false)
376+ LauncherModel.setProgress(LauncherModel.get(0).appId, 20)
377+ compare(findChild(item, "progressOverlay").visible, true)
378+ LauncherModel.setProgress(LauncherModel.get(0).appId, 0)
379+ }
380+
381 function test_alertPeekingIcon() {
382 var listView = findChild(launcher, "launcherListView")
383 verify(listView != undefined)
384
385=== modified file 'tests/scripts/README'
386--- tests/scripts/README 2015-07-25 13:57:22 +0000
387+++ tests/scripts/README 2015-07-25 13:57:22 +0000
388@@ -3,3 +3,7 @@
389 launcher-icon related:
390 * list-launcher-icons.sh - get all icons of unity8-launcher
391 * alert-launcher-icon.sh - trigger alert/wiggle of unfocused launcher-icon
392+ * get-progress.sh - get progress-value of a launcher-icon
393+ * set-progress.sh - set progress-value of a launcher-icon
394+ * set-count.sh - set the count of a launcher-icon
395+ * set-count-visible.sh - set the count-visible flag of a launcher-icon
396
397=== added file 'tests/scripts/get-progress.sh'
398--- tests/scripts/get-progress.sh 1970-01-01 00:00:00 +0000
399+++ tests/scripts/get-progress.sh 2015-07-25 13:57:22 +0000
400@@ -0,0 +1,3 @@
401+#!/bin/sh
402+
403+qdbus com.canonical.Unity.Launcher /com/canonical/Unity/Launcher/$1 org.freedesktop.DBus.Properties.Get com.canonical.Unity.Launcher.Item progress
404
405=== added file 'tests/scripts/set-count-visible.sh'
406--- tests/scripts/set-count-visible.sh 1970-01-01 00:00:00 +0000
407+++ tests/scripts/set-count-visible.sh 2015-07-25 13:57:22 +0000
408@@ -0,0 +1,3 @@
409+#!/bin/sh
410+
411+qdbus com.canonical.Unity.Launcher /com/canonical/Unity/Launcher/$1 org.freedesktop.DBus.Properties.Set com.canonical.Unity.Launcher.Item countVisible $2
412
413=== added file 'tests/scripts/set-count.sh'
414--- tests/scripts/set-count.sh 1970-01-01 00:00:00 +0000
415+++ tests/scripts/set-count.sh 2015-07-25 13:57:22 +0000
416@@ -0,0 +1,3 @@
417+#!/bin/sh
418+
419+qdbus com.canonical.Unity.Launcher /com/canonical/Unity/Launcher/$1 org.freedesktop.DBus.Properties.Set com.canonical.Unity.Launcher.Item count $2
420
421=== added file 'tests/scripts/set-progress.sh'
422--- tests/scripts/set-progress.sh 1970-01-01 00:00:00 +0000
423+++ tests/scripts/set-progress.sh 2015-07-25 13:57:22 +0000
424@@ -0,0 +1,3 @@
425+#!/bin/sh
426+
427+qdbus com.canonical.Unity.Launcher /com/canonical/Unity/Launcher/$1 org.freedesktop.DBus.Properties.Set com.canonical.Unity.Launcher.Item progress $2

Subscribers

People subscribed via source and target branches