Merge lp:~saviq/unity8/fix-shellwithpin-test into lp:unity8

Proposed by Michał Sawicz
Status: Merged
Approved by: Michał Sawicz
Approved revision: 1357
Merged at revision: 1363
Proposed branch: lp:~saviq/unity8/fix-shellwithpin-test
Merge into: lp:unity8
Diff against target: 738 lines (+218/-69)
20 files modified
plugins/Unity/Indicators/indicator.cpp (+23/-8)
plugins/Unity/Indicators/indicator.h (+5/-1)
plugins/Unity/Indicators/indicatorsmanager.cpp (+17/-2)
plugins/Unity/Indicators/indicatorsmanager.h (+5/-0)
plugins/Unity/Indicators/indicatorsmodel.cpp (+23/-0)
plugins/Unity/Indicators/indicatorsmodel.h (+5/-0)
plugins/Unity/Indicators/rootactionstate.cpp (+4/-2)
plugins/Unity/Indicators/unitymenumodelcache.cpp (+6/-7)
qml/Panel/IndicatorItem.qml (+9/-1)
qml/Panel/Indicators.qml (+2/-2)
qml/Panel/Indicators/DefaultIndicatorWidget.qml (+2/-1)
qml/Panel/Indicators/VisibleIndicators.qml (+12/-1)
qml/Panel/MenuContent.qml (+15/-2)
qml/Shell.qml (+3/-0)
tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp (+13/-1)
tests/mocks/Unity/Indicators/fakeindicatorsmodel.h (+6/-0)
tests/qmltests/Panel/Indicators/tst_CachedUnityMenuModel.qml (+2/-2)
tests/qmltests/tst_Shell.qml (+13/-0)
tests/qmltests/tst_ShellWithPin.qml (+44/-39)
tests/utils/modules/Unity/Test/UnityTestCase.qml (+9/-0)
To merge this branch: bzr merge lp:~saviq/unity8/fix-shellwithpin-test
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Daniel d'Andrada (community) Abstain
Michael Zanetti (community) Approve
Review via email: mp+237922@code.launchpad.net

Commit message

Fix the ShellWithPin test and some functionality.

Top element can't be a positioner because popups and such anchor to it, breaking badly.

Description of the change

 * Are there any related MPs required for this MP to build/function as expected? Please list.
N
 * Did you perform an exploratory manual test run of your code change and any related functionality?
Y
 * Did you make sure that your branch does not contain spurious tags?
Y
 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A
 * 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
Michael Zanetti (mzanetti) wrote :

ack, cheers,

 * 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

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

yes

review: Approve
Revision history for this message
Daniel d'Andrada (dandrader) wrote :
Revision history for this message
Daniel d'Andrada (dandrader) :
review: Needs Information
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

> What about https://code.launchpad.net/~mterry/unity8/fix-
> shellwithpin/+merge/237849 ?

Hmm I missed that, but it wasn't enough anyway. The test passed, but you couldn't see it because Row complained that it won't work (Popup tried to fill Row).

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> > What about https://code.launchpad.net/~mterry/unity8/fix-
> > shellwithpin/+merge/237849 ?
>
> Hmm I missed that, but it wasn't enough anyway. The test passed, but you
> couldn't see it because Row complained that it won't work (Popup tried to fill
> Row).

Could you please absorb its changes (s/mouseClick/tap and the tap() improvements)?

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1356. By Michał Sawicz

Improve the tap() method

Revision history for this message
Michał Sawicz (saviq) wrote :

W dniu 10.10.2014 o 14:11, Daniel d'Andrada pisze:
> Could you please absorb its changes (s/mouseClick/tap and the tap() improvements)?

Yeah, done.

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

"""
123 - mouseClick(button, units.gu(1), units.gu(1))
124 + mouseClick(button, button.width / 2, button.height / 2)
"""

This part could use the new tap() as well.

review: Needs Fixing
1357. By Michał Sawicz

Use tap() everywhere in the touched file.

Revision history for this message
Michał Sawicz (saviq) wrote :

W dniu 10.10.2014 o 16:25, Daniel d'Andrada pisze:
> This part could use the new tap() as well.

Right, I shouldn't have touched the other... Replaced all of them, then.

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> W dniu 10.10.2014 o 16:25, Daniel d'Andrada pisze:
> > This part could use the new tap() as well.
>
> Right, I shouldn't have touched the other... Replaced all of them, then.

Thanks!

review: Abstain
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/Unity/Indicators/indicator.cpp'
2--- plugins/Unity/Indicators/indicator.cpp 2013-10-10 15:55:20 +0000
3+++ plugins/Unity/Indicators/indicator.cpp 2014-10-13 08:36:39 +0000
4@@ -31,24 +31,26 @@
5 {
6 }
7
8-void Indicator::init(const QString &profile, const QString& busName, const QSettings& settings)
9+void Indicator::init(const QString& busName, const QSettings& settings)
10 {
11+ // Save all keys we care about from the QSettings object. It's annoying
12+ // that we can't just copy the object.
13+ m_settings.clear();
14+ Q_FOREACH(const QString& key, settings.allKeys()) {
15+ if (key.endsWith("/Position") || key.endsWith("/ObjectPath")) {
16+ m_settings.insert(key, settings.value(key));
17+ }
18+ }
19+
20 setId(settings.value("Indicator Service/Name").toString());
21
22- QVariant pos = settings.value(profile + "/Position");
23- if (!pos.isValid())
24- pos = settings.value("Indicator Service/Position", QVariant::fromValue(0));
25- setPosition(pos.toInt());
26-
27 QString actionObjectPath = settings.value("Indicator Service/ObjectPath").toString();
28- QString menuObjectPath = settings.value(profile + "/ObjectPath").toString();
29
30 QVariantMap properties;
31 properties.clear();
32 properties.insert("busType", 1);
33 properties.insert("busName", busName);
34 properties.insert("actionsObjectPath", actionObjectPath);
35- properties.insert("menuObjectPath", menuObjectPath);
36 setIndicatorProperties(properties);
37 }
38
39@@ -78,6 +80,19 @@
40 }
41 }
42
43+void Indicator::setProfile(const QString& profile)
44+{
45+ QVariant pos = m_settings.value(profile + "/Position");
46+ if (!pos.isValid())
47+ pos = m_settings.value("Indicator Service/Position", QVariant::fromValue(0));
48+ setPosition(pos.toInt());
49+
50+ QString menuObjectPath = m_settings.value(profile + "/ObjectPath").toString();
51+ QVariantMap map = m_properties.toMap();
52+ map.insert("menuObjectPath", menuObjectPath);
53+ setIndicatorProperties(map);
54+}
55+
56 QVariant Indicator::indicatorProperties() const
57 {
58 return m_properties;
59
60=== modified file 'plugins/Unity/Indicators/indicator.h'
61--- plugins/Unity/Indicators/indicator.h 2013-10-10 15:47:40 +0000
62+++ plugins/Unity/Indicators/indicator.h 2014-10-13 08:36:39 +0000
63@@ -35,12 +35,15 @@
64 Indicator(QObject *parent = 0);
65 virtual ~Indicator();
66
67- void init(const QString &profile, const QString& busName, const QSettings& settings);
68+ void init(const QString& busName, const QSettings& settings);
69
70 QString identifier() const;
71 int position() const;
72 QVariant indicatorProperties() const;
73
74+public Q_SLOTS:
75+ void setProfile(const QString& profile);
76+
77 Q_SIGNALS:
78 void identifierChanged(const QString &identifier);
79 void positionChanged(int position);
80@@ -55,6 +58,7 @@
81 QString m_identifier;
82 int m_position;
83 QVariant m_properties;
84+ QVariantMap m_settings;
85 };
86
87 #endif // INDICATOR_H
88
89=== modified file 'plugins/Unity/Indicators/indicatorsmanager.cpp'
90--- plugins/Unity/Indicators/indicatorsmanager.cpp 2014-04-18 17:04:59 +0000
91+++ plugins/Unity/Indicators/indicatorsmanager.cpp 2014-10-13 08:36:39 +0000
92@@ -57,7 +57,7 @@
93 void IndicatorsManager::load(const QString& profile)
94 {
95 unload();
96- m_profile = profile;
97+ setProfile(profile);
98
99 QStringList xdgLocations = shellDataDirs();//QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
100
101@@ -216,6 +216,19 @@
102 }
103 }
104
105+QString IndicatorsManager::profile() const
106+{
107+ return m_profile;
108+}
109+
110+void IndicatorsManager::setProfile(const QString& profile)
111+{
112+ if (m_profile != profile) {
113+ m_profile = profile;
114+ Q_EMIT profileChanged(m_profile);
115+ }
116+}
117+
118 void IndicatorsManager::startVerify(const QString& path)
119 {
120 QHashIterator<QString, IndicatorData*> iter(m_indicatorsData);
121@@ -268,7 +281,9 @@
122 Indicator::Ptr new_indicator(new Indicator(this));
123 data->m_indicator = new_indicator;
124 QSettings settings(data->m_fileInfo.absoluteFilePath(), QSettings::IniFormat, this);
125- new_indicator->init(m_profile, data->m_fileInfo.fileName(), settings);
126+ new_indicator->init(data->m_fileInfo.fileName(), settings);
127+ new_indicator->setProfile(m_profile);
128+ QObject::connect(this, SIGNAL(profileChanged(const QString&)), new_indicator.data(), SLOT(setProfile(const QString&)));
129 return new_indicator;
130 }
131
132
133=== modified file 'plugins/Unity/Indicators/indicatorsmanager.h'
134--- plugins/Unity/Indicators/indicatorsmanager.h 2014-04-09 14:51:09 +0000
135+++ plugins/Unity/Indicators/indicatorsmanager.h 2014-10-13 08:36:39 +0000
136@@ -32,6 +32,7 @@
137 {
138 Q_OBJECT
139 Q_PROPERTY(bool loaded READ isLoaded NOTIFY loadedChanged)
140+ Q_PROPERTY(QString profile READ profile WRITE setProfile NOTIFY profileChanged)
141 public:
142 explicit IndicatorsManager(QObject* parent = 0);
143 ~IndicatorsManager();
144@@ -39,6 +40,9 @@
145 Q_INVOKABLE void load(const QString& profile);
146 Q_INVOKABLE void unload();
147
148+ QString profile() const;
149+ void setProfile(const QString& profile);
150+
151 Indicator::Ptr indicator(const QString& indicator_name);
152
153 QList<Indicator::Ptr> indicators();
154@@ -47,6 +51,7 @@
155
156 Q_SIGNALS:
157 void loadedChanged(bool);
158+ void profileChanged(const QString&);
159
160 void indicatorLoaded(const QString& indicator_name);
161 void indicatorAboutToBeUnloaded(const QString& indicator_name);
162
163=== modified file 'plugins/Unity/Indicators/indicatorsmodel.cpp'
164--- plugins/Unity/Indicators/indicatorsmodel.cpp 2014-01-30 14:54:01 +0000
165+++ plugins/Unity/Indicators/indicatorsmodel.cpp 2014-10-13 08:36:39 +0000
166@@ -56,6 +56,7 @@
167 m_manager = new IndicatorsManager(this);
168 QObject::connect(m_manager, SIGNAL(indicatorLoaded(const QString&)), this, SLOT(onIndicatorLoaded(const QString&)));
169 QObject::connect(m_manager, SIGNAL(indicatorAboutToBeUnloaded(const QString&)), this, SLOT(onIndicatorAboutToBeUnloaded(const QString&)));
170+ QObject::connect(m_manager, SIGNAL(profileChanged(const QString&)), this, SIGNAL(profileChanged()));
171
172 QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
173 QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
174@@ -81,6 +82,28 @@
175 }
176
177 /*!
178+ \qmlproperty IndicatorsModel::profile
179+ The indicator profile to use for the model.
180+
181+ \b Note: methods should only be called after the Component has completed.
182+*/
183+QString IndicatorsModel::profile() const
184+{
185+ return m_manager->profile();
186+}
187+
188+/*!
189+ \qmlproperty IndicatorsModel::setProfile
190+ Set the indicator profile to use for the model.
191+
192+ \b Note: methods should only be called after the Component has completed.
193+*/
194+void IndicatorsModel::setProfile(const QString &profile)
195+{
196+ m_manager->setProfile(profile);
197+}
198+
199+/*!
200 \qmlmethod IndicatorsModel::unload()
201
202 Load all indicators.
203
204=== modified file 'plugins/Unity/Indicators/indicatorsmodel.h'
205--- plugins/Unity/Indicators/indicatorsmodel.h 2014-01-30 14:54:01 +0000
206+++ plugins/Unity/Indicators/indicatorsmodel.h 2014-10-13 08:36:39 +0000
207@@ -34,6 +34,7 @@
208 Q_OBJECT
209 Q_ENUMS(Roles)
210 Q_PROPERTY(int count READ count NOTIFY countChanged)
211+ Q_PROPERTY(QString profile READ profile WRITE setProfile NOTIFY profileChanged)
212
213 public:
214
215@@ -45,6 +46,9 @@
216
217 Q_INVOKABLE QVariant data(int row, int role) const;
218
219+ QString profile() const;
220+ void setProfile(const QString& profile);
221+
222 /* QAbstractItemModel */
223 QHash<int, QByteArray> roleNames() const;
224 int columnCount(const QModelIndex &parent = QModelIndex()) const;
225@@ -55,6 +59,7 @@
226
227 Q_SIGNALS:
228 void countChanged();
229+ void profileChanged();
230 void indicatorDataChanged(const QVariant& data);
231
232 private Q_SLOTS:
233
234=== modified file 'plugins/Unity/Indicators/rootactionstate.cpp'
235--- plugins/Unity/Indicators/rootactionstate.cpp 2014-08-26 08:14:44 +0000
236+++ plugins/Unity/Indicators/rootactionstate.cpp 2014-10-13 08:36:39 +0000
237@@ -110,15 +110,17 @@
238 m_cachedState = m_menu->get(0, "actionState").toMap();
239
240 m_menu->setActionStateParser(oldParser);
241- } else {
242+ } else if (!m_menu) {
243 m_cachedState.clear();
244 }
245+ // else if m_menu->rowCount() == 0, let's leave existing cache in place
246+ // until the new menu comes in, to avoid flashing the UI empty for a moment
247 Q_EMIT updated();
248 }
249
250 bool RootActionState::isValid() const
251 {
252- return m_menu && m_menu->rowCount() > 0;
253+ return !m_cachedState.empty();
254 }
255
256 QString RootActionState::title() const
257
258=== modified file 'plugins/Unity/Indicators/unitymenumodelcache.cpp'
259--- plugins/Unity/Indicators/unitymenumodelcache.cpp 2014-08-20 09:16:28 +0000
260+++ plugins/Unity/Indicators/unitymenumodelcache.cpp 2014-10-13 08:36:39 +0000
261@@ -36,13 +36,12 @@
262 if (m_registry.contains(path))
263 return m_registry[path];
264
265- UnityMenuModel* menuModel = new UnityMenuModel;
266- connect(menuModel, &QObject::destroyed, this, [menuModel, this](QObject*) {
267- QList<QByteArray> keys = m_registry.keys(menuModel);
268- Q_FOREACH(const QByteArray& key, keys) {
269- m_registry.remove(key);
270- }
271- });
272+ // Parent the model to us, so it is not deleted by Qml. We want to keep
273+ // all models cached, because when we switch indicator profiles, we will
274+ // be switching paths often. And we want to keep the old model around,
275+ // ready to be used. Otherwise the UI might momentarily wait as we
276+ // populate the model from DBus yet again.
277+ UnityMenuModel* menuModel = new UnityMenuModel(this);
278 m_registry[path] = menuModel;
279
280 menuModel->setBusName(bus);
281
282=== modified file 'qml/Panel/IndicatorItem.qml'
283--- qml/Panel/IndicatorItem.qml 2014-09-29 10:24:58 +0000
284+++ qml/Panel/IndicatorItem.qml 2014-10-13 08:36:39 +0000
285@@ -31,7 +31,7 @@
286 opacity: dimmed ? 0.4 : 1
287 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.BriskDuration } }
288
289- onLoaded: {
290+ function updateProperties() {
291 for(var pName in indicatorProperties) {
292 if (item.hasOwnProperty(pName)) {
293 item[pName] = indicatorProperties[pName];
294@@ -39,6 +39,14 @@
295 }
296 }
297
298+ onLoaded: updateProperties()
299+
300+ onIndicatorPropertiesChanged: {
301+ if (status === Loader.Ready) {
302+ updateProperties();
303+ }
304+ }
305+
306 Binding {
307 target: item
308 property: "identifier"
309
310=== modified file 'qml/Panel/Indicators.qml'
311--- qml/Panel/Indicators.qml 2014-09-09 13:40:41 +0000
312+++ qml/Panel/Indicators.qml 2014-10-13 08:36:39 +0000
313@@ -30,8 +30,7 @@
314 property int panelHeight: units.gu(3)
315 property alias overFlowWidth: indicatorRow.overFlowWidth
316 property alias showAll: indicatorRow.showAll
317- // TODO: This should be sourced by device type (eg "desktop", "tablet", "phone"...)
318- property string profile: indicatorProfile
319+ property alias profile: visibleIndicators.profile
320
321 readonly property real hintValue: panelHeight + menuContent.headerHeight
322 readonly property int lockThreshold: openedHeight / 2
323@@ -171,6 +170,7 @@
324
325 VisibleIndicators {
326 id: visibleIndicators
327+ objectName: "visibleIndicators"
328 }
329
330 MenuContent {
331
332=== modified file 'qml/Panel/Indicators/DefaultIndicatorWidget.qml'
333--- qml/Panel/Indicators/DefaultIndicatorWidget.qml 2014-08-20 08:39:09 +0000
334+++ qml/Panel/Indicators/DefaultIndicatorWidget.qml 2014-10-13 08:36:39 +0000
335@@ -113,7 +113,8 @@
336
337 leftLabel = rootActionState.leftLabel ? rootActionState.leftLabel : "";
338 rightLabel = rootActionState.rightLabel ? rootActionState.rightLabel : "";
339- icons = rootActionState.icons;
340+ if (icons !== rootActionState.icons) // don't reset visual unless we need to
341+ icons = rootActionState.icons;
342 enabled = rootActionState.visible;
343 }
344 }
345
346=== modified file 'qml/Panel/Indicators/VisibleIndicators.qml'
347--- qml/Panel/Indicators/VisibleIndicators.qml 2014-09-29 10:24:58 +0000
348+++ qml/Panel/Indicators/VisibleIndicators.qml 2014-10-13 08:36:39 +0000
349@@ -23,6 +23,7 @@
350
351 Item {
352 property SortFilterProxyModel model: filterModel
353+ property alias profile: indicatorsModel.profile
354
355 SortFilterProxyModel {
356 id: filterModel
357@@ -56,15 +57,25 @@
358 id: item
359 objectName: model.identifier + "-delegate"
360 identifier: model.identifier
361- Component.onCompleted: {
362+
363+ function updateProperties() {
364 for(var pName in indicatorProperties) {
365 if (item.hasOwnProperty(pName)) {
366 item[pName] = indicatorProperties[pName];
367 }
368 }
369+ }
370+
371+ Component.onCompleted: {
372+ updateProperties();
373 updateVisibility();
374 }
375
376+ Connections {
377+ target: indicatorsModel
378+ onDataChanged: item.updateProperties()
379+ }
380+
381 onEnabledChanged: {
382 updateVisibility()
383 }
384
385=== modified file 'qml/Panel/MenuContent.qml'
386--- qml/Panel/MenuContent.qml 2014-09-29 10:24:58 +0000
387+++ qml/Panel/MenuContent.qml 2014-10-13 08:36:39 +0000
388@@ -69,13 +69,20 @@
389
390 IndicatorDelegate {
391 id: indicatorDelegate
392- Component.onCompleted: {
393+
394+ function updateProperties() {
395 for(var pName in indicatorProperties) {
396 if (indicatorDelegate.hasOwnProperty(pName)) {
397 indicatorDelegate[pName] = indicatorProperties[pName];
398 }
399 }
400 }
401+
402+ Component.onCompleted: updateProperties()
403+ Connections {
404+ target: content.indicatorsModel
405+ onDataChanged: indicatorDelegate.updateProperties()
406+ }
407 }
408 }
409 }
410@@ -115,7 +122,7 @@
411 }
412 }
413
414- onLoaded: {
415+ function updateProperties() {
416 for(var pName in indicatorProperties) {
417 if (item.hasOwnProperty(pName)) {
418 item[pName] = indicatorProperties[pName]
419@@ -123,6 +130,12 @@
420 }
421 }
422
423+ onLoaded: updateProperties()
424+ Connections {
425+ target: content.indicatorsModel
426+ onDataChanged: if (loader.status === Loader.Ready) loader.updateProperties()
427+ }
428+
429 Binding {
430 target: loader.item
431 property: "identifier"
432
433=== modified file 'qml/Shell.qml'
434--- qml/Shell.qml 2014-10-08 20:36:48 +0000
435+++ qml/Shell.qml 2014-10-13 08:36:39 +0000
436@@ -614,6 +614,9 @@
437 contentEnabled: edgeDemo.panelContentEnabled
438 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
439 panelHeight: units.gu(3)
440+
441+ // TODO: This should be sourced by device type (eg "desktop", "tablet", "phone"...)
442+ profile: LightDM.Greeter.active ? (indicatorProfile + "_greeter") : indicatorProfile
443 }
444
445 property bool topmostApplicationIsFullscreen:
446
447=== modified file 'tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp'
448--- tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp 2014-07-01 09:49:24 +0000
449+++ tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp 2014-10-13 08:36:39 +0000
450@@ -21,7 +21,8 @@
451 #include "indicators.h"
452
453 FakeIndicatorsModel::FakeIndicatorsModel(QObject *parent)
454- : QAbstractListModel(parent)
455+ : QAbstractListModel(parent),
456+ m_profile("phone")
457 {
458 QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
459 QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
460@@ -39,6 +40,17 @@
461 return rowCount();
462 }
463
464+QString FakeIndicatorsModel::profile() const
465+{
466+ return m_profile;
467+}
468+
469+void FakeIndicatorsModel::setProfile(const QString& profile)
470+{
471+ m_profile = profile;
472+ Q_EMIT profileChanged();
473+}
474+
475 void FakeIndicatorsModel::load(const QString&)
476 {
477 }
478
479=== modified file 'tests/mocks/Unity/Indicators/fakeindicatorsmodel.h'
480--- tests/mocks/Unity/Indicators/fakeindicatorsmodel.h 2014-03-03 12:01:09 +0000
481+++ tests/mocks/Unity/Indicators/fakeindicatorsmodel.h 2014-10-13 08:36:39 +0000
482@@ -27,6 +27,7 @@
483 Q_OBJECT
484 Q_ENUMS(Roles)
485 Q_PROPERTY(int count READ count NOTIFY countChanged)
486+ Q_PROPERTY(QString profile READ profile WRITE setProfile NOTIFY profileChanged)
487 public:
488
489 FakeIndicatorsModel(QObject *parent=0);
490@@ -39,6 +40,9 @@
491
492 Q_INVOKABLE QVariant data(int row, int role) const;
493
494+ QString profile() const;
495+ void setProfile(const QString& profile);
496+
497 /* QAbstractItemModel */
498 QHash<int, QByteArray> roleNames() const;
499 int columnCount(const QModelIndex &parent = QModelIndex()) const;
500@@ -48,12 +52,14 @@
501
502 Q_SIGNALS:
503 void countChanged();
504+ void profileChanged();
505
506 private:
507 int count() const;
508
509 typedef QHash<int, QVariant> Indicator;
510 QList<Indicator*> m_indicators;
511+ QString m_profile;
512 };
513
514 #endif // FAKE_INDICATORSMODEL_H
515
516=== modified file 'tests/qmltests/Panel/Indicators/tst_CachedUnityMenuModel.qml'
517--- tests/qmltests/Panel/Indicators/tst_CachedUnityMenuModel.qml 2014-08-20 09:16:28 +0000
518+++ tests/qmltests/Panel/Indicators/tst_CachedUnityMenuModel.qml 2014-10-13 08:36:39 +0000
519@@ -122,10 +122,10 @@
520 return cachedObject2;
521 }
522
523- function test_destroyAllDeletesModel() {
524+ function test_destroyAllKeepsModel() {
525 createAndDestroy("test6");
526 doGC();
527- compare(Indicators.UnityMenuModelCache.contains("/com/canonical/test6"), false);
528+ compare(Indicators.UnityMenuModelCache.contains("/com/canonical/test6"), true);
529 }
530
531 function test_destroyPartialKeepsModel() {
532
533=== modified file 'tests/qmltests/tst_Shell.qml'
534--- tests/qmltests/tst_Shell.qml 2014-10-06 16:39:10 +0000
535+++ tests/qmltests/tst_Shell.qml 2014-10-13 08:36:39 +0000
536@@ -65,6 +65,7 @@
537 property bool itemDestroyed: false
538 sourceComponent: Component {
539 Shell {
540+ property string indicatorProfile: "phone"
541 Component.onDestruction: {
542 shellLoader.itemDestroyed = true;
543 }
544@@ -446,6 +447,18 @@
545 && itemRectInShell.y + itemRectInShell.height <= shell.height;
546 }
547
548+ function test_greeterChangesIndicatorProfile() {
549+ var visibleIndicators = findChild(shell, "visibleIndicators");
550+ tryCompare(visibleIndicators, "profile", shell.indicatorProfile);
551+
552+ var greeter = findChild(shell, "greeter");
553+ greeter.show();
554+ tryCompare(visibleIndicators, "profile", shell.indicatorProfile + "_greeter");
555+
556+ greeter.hide();
557+ tryCompare(visibleIndicators, "profile", shell.indicatorProfile);
558+ }
559+
560 function test_focusRequestedHidesGreeter() {
561 var greeter = findChild(shell, "greeter");
562
563
564=== modified file 'tests/qmltests/tst_ShellWithPin.qml'
565--- tests/qmltests/tst_ShellWithPin.qml 2014-10-01 13:22:00 +0000
566+++ tests/qmltests/tst_ShellWithPin.qml 2014-10-13 08:36:39 +0000
567@@ -27,9 +27,10 @@
568
569 import "../../qml"
570
571-Row {
572+Item {
573 id: root
574- spacing: 0
575+ width: contentRow.width
576+ height: contentRow.height
577
578 QtObject {
579 id: applicationArguments
580@@ -47,34 +48,37 @@
581 }
582 }
583
584- Loader {
585- id: shellLoader
586-
587- width: units.gu(40)
588- height: units.gu(71)
589-
590- property bool itemDestroyed: false
591- sourceComponent: Component {
592- Shell {
593- Component.onDestruction: {
594- shellLoader.itemDestroyed = true
595+ Row {
596+ id: contentRow
597+
598+ Loader {
599+ id: shellLoader
600+
601+ width: units.gu(40)
602+ height: units.gu(71)
603+
604+ property bool itemDestroyed: false
605+ sourceComponent: Component {
606+ Shell {
607+ Component.onDestruction: {
608+ shellLoader.itemDestroyed = true
609+ }
610+ maxFailedLogins: maxRetriesTextField.text
611+ property string indicatorProfile: "phone"
612 }
613- maxFailedLogins: maxRetriesTextField.text
614 }
615 }
616- }
617-
618- Rectangle {
619- color: "white"
620- width: units.gu(30)
621- height: shellLoader.height
622-
623- Column {
624- anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
625- spacing: units.gu(1)
626- Row {
627- anchors { left: parent.left; right: parent.right }
628+
629+ Rectangle {
630+ color: "white"
631+ width: units.gu(30)
632+ height: shellLoader.height
633+
634+ Column {
635+ anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
636+ spacing: units.gu(1)
637 Button {
638+ anchors { left: parent.left; right: parent.right }
639 text: "Show Greeter"
640 onClicked: {
641 if (shellLoader.status !== Loader.Ready)
642@@ -86,15 +90,15 @@
643 }
644 }
645 }
646- }
647
648- Label {
649- text: "Max retries:"
650- color: "black"
651- }
652- TextField {
653- id: maxRetriesTextField
654- text: "-1"
655+ Label {
656+ text: "Max retries:"
657+ color: "black"
658+ }
659+ TextField {
660+ id: maxRetriesTextField
661+ text: "-1"
662+ }
663 }
664 }
665 }
666@@ -111,6 +115,7 @@
667 }
668
669 UT.UnityTestCase {
670+ id: testCase
671 name: "ShellWithPin"
672 when: windowShown
673
674@@ -182,7 +187,7 @@
675 for (var i = 0; i < pin.length; ++i) {
676 var character = pin.charAt(i)
677 var button = findChild(shell, "pinPadButton" + character)
678- mouseClick(button, units.gu(1), units.gu(1))
679+ tap(button)
680 }
681 }
682
683@@ -214,7 +219,7 @@
684 var launcher = findChild(shell, "launcher")
685 var stage = findChild(shell, "stage")
686
687- mouseClick(emergencyButton, units.gu(1), units.gu(1))
688+ tap(emergencyButton)
689
690 tryCompare(greeter, "lockedApp", "dialer-app")
691 tryCompare(greeter, "hasLockedApp", true)
692@@ -241,7 +246,7 @@
693 function test_emergencyCallCrash() {
694 var lockscreen = findChild(shell, "lockscreen")
695 var emergencyButton = findChild(lockscreen, "emergencyCallLabel")
696- mouseClick(emergencyButton, units.gu(1), units.gu(1))
697+ tap(emergencyButton)
698
699 tryCompare(lockscreen, "shown", false)
700 killApps() // kill dialer-app, as if it crashed
701@@ -251,7 +256,7 @@
702 function test_emergencyCallAppLaunch() {
703 var lockscreen = findChild(shell, "lockscreen")
704 var emergencyButton = findChild(lockscreen, "emergencyCallLabel")
705- mouseClick(emergencyButton, units.gu(1), units.gu(1))
706+ tap(emergencyButton)
707
708 tryCompare(lockscreen, "shown", false)
709 ApplicationManager.startApplication("gallery-app", ApplicationManager.NoFlag)
710@@ -296,7 +301,7 @@
711
712 var dialog = findChild(root, "infoPopup")
713 var button = findChild(dialog, "infoPopupOkButton")
714- mouseClick(button, units.gu(1), units.gu(1))
715+ tap(button)
716 tryCompareFunction(function() {return findChild(root, "infoPopup")}, null)
717
718 tryCompare(resetSpy, "count", 0)
719
720=== modified file 'tests/utils/modules/Unity/Test/UnityTestCase.qml'
721--- tests/utils/modules/Unity/Test/UnityTestCase.qml 2014-10-09 14:04:21 +0000
722+++ tests/utils/modules/Unity/Test/UnityTestCase.qml 2014-10-13 08:36:39 +0000
723@@ -321,7 +321,16 @@
724 event.commit()
725 }
726
727+ /*! \brief Tap the item with a touch event.
728+
729+ \param item The item to be tapped
730+ \param x The x coordinate of the tap, defaults to horizontal center
731+ \param y The y coordinate of the tap, defaults to vertical center
732+ */
733 function tap(item, x, y) {
734+ if (typeof x !== "number") x = item.width / 2;
735+ if (typeof y !== "number") y = item.height / 2;
736+
737 var root = fetchRootItem(item)
738 var rootPoint = item.mapToItem(root, x, y)
739

Subscribers

People subscribed via source and target branches