Merge lp:~unity-team/unity8/rtm-sharedunitymenumodel into lp:unity8/rtm-14.09

Proposed by Michał Sawicz
Status: Merged
Approved by: Michał Sawicz
Approved revision: 1277
Merged at revision: 1355
Proposed branch: lp:~unity-team/unity8/rtm-sharedunitymenumodel
Merge into: lp:unity8/rtm-14.09
Diff against target: 2734 lines (+958/-783)
66 files modified
plugins/AccountsService/AccountsService.qmltypes (+2/-0)
plugins/Dash/Dash.qmltypes (+3/-0)
plugins/LightDM/LightDM.qmltypes (+1/-0)
plugins/Ubuntu/Payments/Payments.qmltypes (+1/-0)
plugins/Unity/DashCommunicator/DashCommunicator.qmltypes (+17/-4)
plugins/Unity/Indicators/CMakeLists.txt (+1/-0)
plugins/Unity/Indicators/Indicators.qmltypes (+10/-7)
plugins/Unity/Indicators/plugin.cpp (+8/-2)
plugins/Unity/Indicators/plugin.h (+1/-1)
plugins/Unity/Indicators/sharedunitymenumodel.cpp (+87/-0)
plugins/Unity/Indicators/sharedunitymenumodel.h (+66/-0)
plugins/Unity/Indicators/unitymenumodelcache.cpp (+28/-13)
plugins/Unity/Indicators/unitymenumodelcache.h (+15/-9)
plugins/Unity/Launcher/Launcher.qmltypes (+17/-12)
plugins/Unity/Session/Session.qmltypes (+10/-0)
plugins/Utils/Utils.qmltypes (+6/-0)
qml/Greeter/Clock.qml (+9/-9)
qml/Panel/Indicators/CachedUnityMenuModel.qml (+0/-39)
qml/Panel/Indicators/IndicatorBase.qml (+2/-2)
tests/mocks/AccountsService/AccountsService.qmltypes (+2/-0)
tests/mocks/LightDM/LightDM.qmltypes (+1/-0)
tests/mocks/QMenuModel/QMenuModel.qmltypes (+1/-1)
tests/mocks/QMenuModel/unitymenumodel.cpp (+1/-2)
tests/mocks/QMenuModel/unitymenumodel.h (+6/-2)
tests/mocks/Ubuntu/Payments/Payments.qmltypes (+2/-0)
tests/mocks/Ubuntu/Telephony/Telephony.qmltypes (+2/-1)
tests/mocks/Unity/Application/Application.qmltypes (+13/-0)
tests/mocks/Unity/DashCommunicator/DashCommunicator.qmltypes (+2/-2)
tests/mocks/Unity/Indicators/CMakeLists.txt (+3/-10)
tests/mocks/Unity/Indicators/FakeMenuPage.qml (+0/-27)
tests/mocks/Unity/Indicators/Indicators.qmltypes (+41/-11)
tests/mocks/Unity/Indicators/IndicatorsModel.qml (+143/-35)
tests/mocks/Unity/Indicators/RootActionState.qml (+17/-9)
tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp (+60/-29)
tests/mocks/Unity/Indicators/fakeindicatorsmodel.h (+8/-2)
tests/mocks/Unity/Indicators/fakeplugin.cpp (+8/-4)
tests/mocks/Unity/Indicators/fakeunitymenumodelcache.cpp (+57/-0)
tests/mocks/Unity/Indicators/fakeunitymenumodelcache.h (+49/-0)
tests/mocks/Unity/Indicators/indicators_fake.qrc (+0/-14)
tests/mocks/Unity/Indicators/qml/fake_menu_page1.qml (+0/-35)
tests/mocks/Unity/Indicators/qml/fake_menu_page2.qml (+0/-35)
tests/mocks/Unity/Indicators/qml/fake_menu_page3.qml (+0/-35)
tests/mocks/Unity/Indicators/qml/fake_menu_page4.qml (+0/-35)
tests/mocks/Unity/Indicators/qml/fake_menu_page5.qml (+0/-35)
tests/mocks/Unity/Indicators/qml/fake_menu_widget1.qml (+0/-23)
tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml (+0/-23)
tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml (+0/-23)
tests/mocks/Unity/Indicators/qml/fake_menu_widget4.qml (+0/-23)
tests/mocks/Unity/Indicators/qml/fake_menu_widget5.qml (+0/-23)
tests/mocks/Unity/Indicators/qmldir (+0/-1)
tests/mocks/Unity/Launcher/Launcher.qmltypes (+13/-0)
tests/mocks/Unity/Unity.qmltypes (+32/-0)
tests/plugins/Unity/Indicators/CMakeLists.txt (+1/-0)
tests/plugins/Unity/Indicators/sharedunitymenumodeltest.cpp (+102/-0)
tests/qmltests/CMakeLists.txt (+7/-8)
tests/qmltests/Greeter/tst_Clock.qml (+57/-40)
tests/qmltests/Panel/Indicators/tst_CachedUnityMenuModel.qml (+0/-137)
tests/qmltests/Panel/Indicators/tst_DefaultIndicatorPage.qml (+21/-24)
tests/qmltests/Panel/Indicators/tst_DefaultIndicatorWidget.qml (+0/-8)
tests/qmltests/Panel/tst_IndicatorItem.qml (+1/-1)
tests/qmltests/Panel/tst_IndicatorRow.qml (+17/-19)
tests/qmltests/Panel/tst_Indicators.qml (+1/-0)
tests/qmltests/Panel/tst_MenuContent.qml (+0/-8)
tests/qmltests/tst_Shell.qml (+2/-0)
tests/qmltests/tst_ShellWithPin.qml (+2/-0)
tests/qmltests/tst_TabletShell.qml (+2/-0)
To merge this branch: bzr merge lp:~unity-team/unity8/rtm-sharedunitymenumodel
Reviewer Review Type Date Requested Status
Michał Sawicz Approve
Review via email: mp+238243@code.launchpad.net

Commit message

remove qml ownership confusion for caching unitymenumodels

Description of the change

Changed to use QSharedPointers for unitymenumodel owenership.
Renamed CachedUnityMenuModel -> SharedUnityMenuModel

Uses new method for mocking Indicators & menu content.

* 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?
n/a

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

To post a comment you must log in.
1277. By Nick Dedekind

use QPointer to track singleton destruction

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

As per the upstream change.

review: Approve
1278. By Michał Sawicz

Revert the .po changes from trunk.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/AccountsService/AccountsService.qmltypes'
2--- plugins/AccountsService/AccountsService.qmltypes 2014-09-01 12:18:53 +0000
3+++ plugins/AccountsService/AccountsService.qmltypes 2014-10-15 16:26:15 +0000
4@@ -23,6 +23,8 @@
5 }
6 Property { name: "user"; type: "string" }
7 Property { name: "demoEdges"; type: "bool" }
8+ Property { name: "enableLauncherWhileLocked"; type: "bool"; isReadonly: true }
9+ Property { name: "enableIndicatorsWhileLocked"; type: "bool"; isReadonly: true }
10 Property { name: "backgroundFile"; type: "string"; isReadonly: true }
11 Property { name: "statsWelcomeScreen"; type: "bool"; isReadonly: true }
12 Property { name: "passwordDisplayHint"; type: "PasswordDisplayHint"; isReadonly: true }
13
14=== modified file 'plugins/Dash/Dash.qmltypes'
15--- plugins/Dash/Dash.qmltypes 2014-08-14 01:28:06 +0000
16+++ plugins/Dash/Dash.qmltypes 2014-10-15 16:26:15 +0000
17@@ -40,9 +40,12 @@
18 Property { name: "forceNoClip"; type: "bool" }
19 Property { name: "stickyHeaderHeight"; type: "int"; isReadonly: true }
20 Property { name: "headerItemShownHeight"; type: "double"; isReadonly: true }
21+ Property { name: "cacheBuffer"; type: "double" }
22 Signal { name: "headerChanged" }
23 Method { name: "positionAtBeginning" }
24 Method { name: "showHeader" }
25+ Method { name: "firstCreatedIndex"; type: "int" }
26+ Method { name: "createdItemCount"; type: "int" }
27 Method {
28 name: "item"
29 type: "QQuickItem*"
30
31=== modified file 'plugins/LightDM/LightDM.qmltypes'
32--- plugins/LightDM/LightDM.qmltypes 2014-09-01 12:18:53 +0000
33+++ plugins/LightDM/LightDM.qmltypes 2014-10-15 16:26:15 +0000
34@@ -37,6 +37,7 @@
35 Signal { name: "isActiveChanged" }
36 Signal { name: "isAuthenticatedChanged" }
37 Signal { name: "showGreeter" }
38+ Signal { name: "hideGreeter" }
39 Signal {
40 name: "requestAuthenticationUser"
41 Parameter { name: "user"; type: "string" }
42
43=== modified file 'plugins/Ubuntu/Payments/Payments.qmltypes'
44--- plugins/Ubuntu/Payments/Payments.qmltypes 2014-06-27 20:53:24 +0000
45+++ plugins/Ubuntu/Payments/Payments.qmltypes 2014-10-15 16:26:15 +0000
46@@ -37,6 +37,7 @@
47 Parameter { name: "error"; type: "string" }
48 }
49 Signal { name: "purchaseCompleted" }
50+ Signal { name: "purchaseCancelled" }
51 Method { name: "start" }
52 }
53 }
54
55=== modified file 'plugins/Unity/DashCommunicator/DashCommunicator.qmltypes'
56--- plugins/Unity/DashCommunicator/DashCommunicator.qmltypes 2014-08-14 13:33:28 +0000
57+++ plugins/Unity/DashCommunicator/DashCommunicator.qmltypes 2014-10-15 16:26:15 +0000
58@@ -9,14 +9,14 @@
59 Module {
60 Component {
61 name: "DashCommunicator"
62- prototype: "QObject"
63+ prototype: "QThread"
64 exports: ["Unity.DashCommunicator/DashCommunicator 0.1"]
65 exportMetaObjectRevisions: [0]
66 Method {
67 name: "setCurrentScope"
68 Parameter { name: "scopeId"; type: "string" }
69 Parameter { name: "animate"; type: "bool" }
70- Parameter { name: "reset"; type: "bool" }
71+ Parameter { name: "isSwipe"; type: "bool" }
72 }
73 }
74 Component {
75@@ -28,7 +28,20 @@
76 name: "setCurrentScopeRequested"
77 Parameter { name: "scopeId"; type: "string" }
78 Parameter { name: "animate"; type: "bool" }
79- Parameter { name: "reset"; type: "bool" }
80- }
81+ Parameter { name: "isSwipe"; type: "bool" }
82+ }
83+ }
84+ Component {
85+ name: "QThread"
86+ prototype: "QObject"
87+ Signal { name: "started" }
88+ Signal { name: "finished" }
89+ Method {
90+ name: "start"
91+ Parameter { type: "Priority" }
92+ }
93+ Method { name: "start" }
94+ Method { name: "terminate" }
95+ Method { name: "quit" }
96 }
97 }
98
99=== modified file 'plugins/Unity/Indicators/CMakeLists.txt'
100--- plugins/Unity/Indicators/CMakeLists.txt 2014-07-30 16:00:55 +0000
101+++ plugins/Unity/Indicators/CMakeLists.txt 2014-10-15 16:26:15 +0000
102@@ -24,6 +24,7 @@
103 modelprinter.cpp
104 plugin.cpp
105 rootactionstate.cpp
106+ sharedunitymenumodel.cpp
107 unitymenumodelcache.cpp
108 unitymenumodelstack.cpp
109 visibleindicatorsmodel.cpp
110
111=== modified file 'plugins/Unity/Indicators/Indicators.qmltypes'
112--- plugins/Unity/Indicators/Indicators.qmltypes 2014-09-01 12:18:53 +0000
113+++ plugins/Unity/Indicators/Indicators.qmltypes 2014-10-15 16:26:15 +0000
114@@ -210,6 +210,16 @@
115 Signal { name: "indexChanged" }
116 }
117 Component {
118+ name: "SharedUnityMenuModel"
119+ prototype: "QObject"
120+ exports: ["Unity.Indicators/SharedUnityMenuModel 0.1"]
121+ exportMetaObjectRevisions: [0]
122+ Property { name: "busName"; type: "QByteArray" }
123+ Property { name: "menuObjectPath"; type: "QByteArray" }
124+ Property { name: "actions"; type: "QVariantMap" }
125+ Property { name: "model"; type: "UnityMenuModel"; isReadonly: true; isPointer: true }
126+ }
127+ Component {
128 name: "UnityMenuModelCache"
129 prototype: "QObject"
130 exports: ["Unity.Indicators/UnityMenuModelCache 0.1"]
131@@ -217,13 +227,6 @@
132 isSingleton: true
133 exportMetaObjectRevisions: [0]
134 Method {
135- name: "model"
136- type: "UnityMenuModel*"
137- Parameter { name: "bus"; type: "QByteArray" }
138- Parameter { name: "path"; type: "QByteArray" }
139- Parameter { name: "actions"; type: "QVariantMap" }
140- }
141- Method {
142 name: "contains"
143 type: "bool"
144 Parameter { name: "path"; type: "QByteArray" }
145
146=== modified file 'plugins/Unity/Indicators/plugin.cpp'
147--- plugins/Unity/Indicators/plugin.cpp 2014-07-30 16:00:55 +0000
148+++ plugins/Unity/Indicators/plugin.cpp 2014-10-15 16:26:15 +0000
149@@ -30,18 +30,23 @@
150 #include "menucontentactivator.h"
151 #include "modelprinter.h"
152 #include "rootactionstate.h"
153+#include "sharedunitymenumodel.h"
154 #include "unitymenumodelcache.h"
155 #include "unitymenumodelstack.h"
156 #include "visibleindicatorsmodel.h"
157
158+#include <unitymenumodel.h>
159+
160 static QObject* menuModelCacheSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) {
161 Q_UNUSED(engine);
162 Q_UNUSED(scriptEngine);
163- return new UnityMenuModelCache;
164+ return UnityMenuModelCache::singleton();
165 }
166
167-void Indicators2Plugin::registerTypes(const char *uri)
168+void IndicatorsPlugin::registerTypes(const char *uri)
169 {
170+ qRegisterMetaType<UnityMenuModel*>("UnityMenuModel*");
171+
172 qmlRegisterType<IndicatorsManager>(uri, 0, 1, "IndicatorsManager");
173 qmlRegisterType<IndicatorsModel>(uri, 0, 1, "IndicatorsModel");
174 qmlRegisterType<MenuContentActivator>(uri, 0, 1, "MenuContentActivator");
175@@ -49,6 +54,7 @@
176 qmlRegisterType<RootActionState>(uri, 0, 1, "RootActionState");
177 qmlRegisterType<ModelPrinter>(uri, 0, 1, "ModelPrinter");
178 qmlRegisterType<VisibleIndicatorsModel>(uri, 0, 1, "VisibleIndicatorsModel");
179+ qmlRegisterType<SharedUnityMenuModel>(uri, 0, 1, "SharedUnityMenuModel");
180
181 qmlRegisterSingletonType<UnityMenuModelCache>(uri, 0, 1, "UnityMenuModelCache", menuModelCacheSingleton);
182
183
184=== modified file 'plugins/Unity/Indicators/plugin.h'
185--- plugins/Unity/Indicators/plugin.h 2013-08-14 09:07:45 +0000
186+++ plugins/Unity/Indicators/plugin.h 2014-10-15 16:26:15 +0000
187@@ -22,7 +22,7 @@
188
189 #include <QtQml/QQmlExtensionPlugin>
190
191-class Indicators2Plugin : public QQmlExtensionPlugin
192+class IndicatorsPlugin : public QQmlExtensionPlugin
193 {
194 Q_OBJECT
195 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
196
197=== added file 'plugins/Unity/Indicators/sharedunitymenumodel.cpp'
198--- plugins/Unity/Indicators/sharedunitymenumodel.cpp 1970-01-01 00:00:00 +0000
199+++ plugins/Unity/Indicators/sharedunitymenumodel.cpp 2014-10-15 16:26:15 +0000
200@@ -0,0 +1,87 @@
201+/*
202+ * Copyright 2014 Canonical Ltd.
203+ *
204+ * This program is free software; you can redistribute it and/or modify
205+ * it under the terms of the GNU Lesser General Public License as published by
206+ * the Free Software Foundation; version 3.
207+ *
208+ * This program is distributed in the hope that it will be useful,
209+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
210+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
211+ * GNU Lesser General Public License for more details.
212+ *
213+ * You should have received a copy of the GNU Lesser General Public License
214+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
215+ *
216+ */
217+
218+#include "sharedunitymenumodel.h"
219+#include "unitymenumodelcache.h"
220+
221+SharedUnityMenuModel::SharedUnityMenuModel(QObject* parent)
222+ : QObject(parent)
223+{
224+}
225+
226+QByteArray SharedUnityMenuModel::busName() const
227+{
228+ return m_busName;
229+}
230+
231+void SharedUnityMenuModel::setBusName(const QByteArray& busName)
232+{
233+ if (m_busName != busName) {
234+ m_busName = busName;
235+ Q_EMIT busNameChanged();
236+ initialize();
237+ }
238+}
239+
240+QByteArray SharedUnityMenuModel::menuObjectPath() const
241+{
242+ return m_menuObjectPath;
243+}
244+
245+void SharedUnityMenuModel::setMenuObjectPath(const QByteArray& menuObjectPath)
246+{
247+ if (m_menuObjectPath != menuObjectPath) {
248+ m_menuObjectPath = menuObjectPath;
249+ Q_EMIT menuObjectPathChanged();
250+ initialize();
251+ }
252+}
253+
254+QVariantMap SharedUnityMenuModel::actions() const
255+{
256+ return m_actions;
257+}
258+
259+void SharedUnityMenuModel::setActions(const QVariantMap& actions)
260+{
261+ if (m_actions != actions) {
262+ m_actions = actions;
263+ Q_EMIT actionsChanged();
264+ initialize();
265+ }
266+}
267+
268+UnityMenuModel* SharedUnityMenuModel::model() const
269+{
270+ return m_model ? m_model.data() : nullptr;
271+}
272+
273+void SharedUnityMenuModel::initialize()
274+{
275+ if (m_busName.isEmpty() || m_menuObjectPath.isEmpty() || m_actions.isEmpty()) {
276+ if (!m_model.isNull()) {
277+ m_model.clear();
278+ Q_EMIT modelChanged();
279+ }
280+ } else {
281+ QSharedPointer<UnityMenuModel> model = UnityMenuModelCache::singleton()->model(m_busName, m_menuObjectPath, m_actions);
282+ if (model != m_model) {
283+ m_model = model;
284+ Q_EMIT modelChanged();
285+ }
286+ }
287+}
288
289=== added file 'plugins/Unity/Indicators/sharedunitymenumodel.h'
290--- plugins/Unity/Indicators/sharedunitymenumodel.h 1970-01-01 00:00:00 +0000
291+++ plugins/Unity/Indicators/sharedunitymenumodel.h 2014-10-15 16:26:15 +0000
292@@ -0,0 +1,66 @@
293+/*
294+ * Copyright 2014 Canonical Ltd.
295+ *
296+ * This program is free software; you can redistribute it and/or modify
297+ * it under the terms of the GNU Lesser General Public License as published by
298+ * the Free Software Foundation; version 3.
299+ *
300+ * This program is distributed in the hope that it will be useful,
301+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
302+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
303+ * GNU Lesser General Public License for more details.
304+ *
305+ * You should have received a copy of the GNU Lesser General Public License
306+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
307+ *
308+ */
309+
310+#ifndef SHAREDUNITYMENUMODEL_H
311+#define SHAREDUNITYMENUMODEL_H
312+
313+#include "unityindicatorsglobal.h"
314+
315+#include <QObject>
316+#include <QSharedPointer>
317+#include <QVariantMap>
318+
319+class UnityMenuModel;
320+
321+class UNITYINDICATORS_EXPORT SharedUnityMenuModel : public QObject
322+{
323+ Q_OBJECT
324+ Q_PROPERTY(QByteArray busName READ busName WRITE setBusName NOTIFY busNameChanged)
325+ Q_PROPERTY(QByteArray menuObjectPath READ menuObjectPath WRITE setMenuObjectPath NOTIFY menuObjectPathChanged)
326+ Q_PROPERTY(QVariantMap actions READ actions WRITE setActions NOTIFY actionsChanged)
327+ Q_PROPERTY(UnityMenuModel* model READ model NOTIFY modelChanged)
328+
329+public:
330+ SharedUnityMenuModel(QObject* parent = nullptr);
331+
332+ QByteArray busName() const;
333+ void setBusName(const QByteArray&);
334+
335+ QByteArray menuObjectPath() const;
336+ void setMenuObjectPath(const QByteArray&);
337+
338+ QVariantMap actions() const;
339+ void setActions(const QVariantMap&);
340+
341+ UnityMenuModel* model() const;
342+
343+Q_SIGNALS:
344+ void busNameChanged();
345+ void menuObjectPathChanged();
346+ void actionsChanged();
347+ void modelChanged();
348+
349+private:
350+ void initialize();
351+
352+ QByteArray m_busName;
353+ QByteArray m_menuObjectPath;
354+ QVariantMap m_actions;
355+ QSharedPointer<UnityMenuModel> m_model;
356+};
357+
358+#endif // SHAREDUNITYMENUMODEL_H
359
360=== modified file 'plugins/Unity/Indicators/unitymenumodelcache.cpp'
361--- plugins/Unity/Indicators/unitymenumodelcache.cpp 2014-08-20 09:16:28 +0000
362+++ plugins/Unity/Indicators/unitymenumodelcache.cpp 2014-10-15 16:26:15 +0000
363@@ -20,30 +20,45 @@
364 #include "unitymenumodelcache.h"
365 #include <unitymenumodel.h>
366
367+#include <QQmlEngine>
368+
369+QPointer<UnityMenuModelCache> UnityMenuModelCache::theCache = nullptr;
370+
371+UnityMenuModelCache* UnityMenuModelCache::singleton()
372+{
373+ if (theCache.isNull()) {
374+ theCache = new UnityMenuModelCache();
375+ }
376+ return theCache.data();
377+}
378+
379 UnityMenuModelCache::UnityMenuModelCache(QObject* parent)
380 : QObject(parent)
381 {
382 }
383
384-UnityMenuModelCache::~UnityMenuModelCache()
385-{
386-}
387-
388-UnityMenuModel* UnityMenuModelCache::model(const QByteArray& bus,
389- const QByteArray& path,
390- const QVariantMap& actions)
391+QSharedPointer<UnityMenuModel> UnityMenuModelCache::model(const QByteArray& bus,
392+ const QByteArray& path,
393+ const QVariantMap& actions)
394 {
395 if (m_registry.contains(path))
396 return m_registry[path];
397
398- UnityMenuModel* menuModel = new UnityMenuModel;
399- connect(menuModel, &QObject::destroyed, this, [menuModel, this](QObject*) {
400- QList<QByteArray> keys = m_registry.keys(menuModel);
401- Q_FOREACH(const QByteArray& key, keys) {
402- m_registry.remove(key);
403+ UnityMenuModel* model = new UnityMenuModel;
404+ QQmlEngine::setObjectOwnership(model, QQmlEngine::CppOwnership);
405+
406+ QSharedPointer<UnityMenuModel> menuModel(model);
407+ connect(model, &QObject::destroyed, this, [this] {
408+ QMutableHashIterator<QByteArray, QWeakPointer<UnityMenuModel>> iter(m_registry);
409+ while(iter.hasNext()) {
410+ auto keyVal = iter.next();
411+ if (keyVal.value().isNull()) {
412+ iter.remove();
413+ break;
414+ }
415 }
416 });
417- m_registry[path] = menuModel;
418+ m_registry[path] = menuModel.toWeakRef();
419
420 menuModel->setBusName(bus);
421 menuModel->setMenuObjectPath(path);
422
423=== modified file 'plugins/Unity/Indicators/unitymenumodelcache.h'
424--- plugins/Unity/Indicators/unitymenumodelcache.h 2014-08-26 08:14:44 +0000
425+++ plugins/Unity/Indicators/unitymenumodelcache.h 2014-10-15 16:26:15 +0000
426@@ -24,6 +24,8 @@
427
428 #include <QObject>
429 #include <QHash>
430+#include <QPointer>
431+#include <QWeakPointer>
432
433 class UnityMenuModel;
434
435@@ -32,15 +34,19 @@
436 Q_OBJECT
437 public:
438 UnityMenuModelCache(QObject*parent=nullptr);
439- ~UnityMenuModelCache();
440-
441- Q_INVOKABLE UnityMenuModel* model(const QByteArray& bus,
442- const QByteArray& path,
443- const QVariantMap& actions);
444- Q_INVOKABLE bool contains(const QByteArray& path);
445-
446-private:
447- QHash<QByteArray, UnityMenuModel*> m_registry;
448+
449+ static UnityMenuModelCache* singleton();
450+
451+ virtual QSharedPointer<UnityMenuModel> model(const QByteArray& bus,
452+ const QByteArray& path,
453+ const QVariantMap& actions);
454+
455+ // for tests use
456+ Q_INVOKABLE virtual bool contains(const QByteArray& path);
457+
458+protected:
459+ QHash<QByteArray, QWeakPointer<UnityMenuModel>> m_registry;
460+ static QPointer<UnityMenuModelCache> theCache;
461 };
462
463 #endif // UNITYMENUMODELCACHE_H
464
465=== modified file 'plugins/Unity/Launcher/Launcher.qmltypes'
466--- plugins/Unity/Launcher/Launcher.qmltypes 2014-06-26 07:47:57 +0000
467+++ plugins/Unity/Launcher/Launcher.qmltypes 2014-10-15 16:26:15 +0000
468@@ -13,14 +13,6 @@
469 exports: ["Unity.Launcher/LauncherItem 0.1"]
470 isCreatable: false
471 exportMetaObjectRevisions: [0]
472- Signal {
473- name: "favoriteChanged"
474- Parameter { name: "favorite"; type: "bool" }
475- }
476- Signal {
477- name: "runningChanged"
478- Parameter { name: "running"; type: "bool" }
479- }
480 }
481 Component {
482 name: "LauncherModel"
483@@ -30,6 +22,10 @@
484 isSingleton: true
485 exportMetaObjectRevisions: [0]
486 Method {
487+ name: "requestRemove"
488+ Parameter { name: "appId"; type: "string" }
489+ }
490+ Method {
491 name: "get"
492 type: "unity::shell::launcher::LauncherItemInterface*"
493 Parameter { name: "index"; type: "int" }
494@@ -49,10 +45,6 @@
495 Parameter { name: "appId"; type: "string" }
496 }
497 Method {
498- name: "requestRemove"
499- Parameter { name: "appId"; type: "string" }
500- }
501- Method {
502 name: "quickListActionInvoked"
503 Parameter { name: "appId"; type: "string" }
504 Parameter { name: "actionIndex"; type: "int" }
505@@ -88,6 +80,7 @@
506 Property { name: "recent"; type: "bool"; isReadonly: true }
507 Property { name: "progress"; type: "int"; isReadonly: true }
508 Property { name: "count"; type: "int"; isReadonly: true }
509+ Property { name: "countVisible"; type: "bool"; isReadonly: true }
510 Property { name: "focused"; type: "bool"; isReadonly: true }
511 Property {
512 name: "quickList"
513@@ -96,6 +89,14 @@
514 isPointer: true
515 }
516 Signal {
517+ name: "nameChanged"
518+ Parameter { name: "name"; type: "string" }
519+ }
520+ Signal {
521+ name: "iconChanged"
522+ Parameter { name: "icon"; type: "string" }
523+ }
524+ Signal {
525 name: "pinnedChanged"
526 Parameter { name: "pinned"; type: "bool" }
527 }
528@@ -116,6 +117,10 @@
529 Parameter { name: "count"; type: "int" }
530 }
531 Signal {
532+ name: "countVisibleChanged"
533+ Parameter { name: "countVisible"; type: "bool" }
534+ }
535+ Signal {
536 name: "focusedChanged"
537 Parameter { name: "focused"; type: "bool" }
538 }
539
540=== modified file 'plugins/Unity/Session/Session.qmltypes'
541--- plugins/Unity/Session/Session.qmltypes 2014-08-14 01:28:06 +0000
542+++ plugins/Unity/Session/Session.qmltypes 2014-10-15 16:26:15 +0000
543@@ -34,4 +34,14 @@
544 Method { name: "RequestReboot" }
545 Method { name: "RequestShutdown" }
546 }
547+ Component {
548+ name: "OrientationLock"
549+ prototype: "QObject"
550+ exports: ["Unity.Session/OrientationLock 0.1"]
551+ isCreatable: false
552+ isSingleton: true
553+ exportMetaObjectRevisions: [0]
554+ Property { name: "enabled"; type: "bool"; isReadonly: true }
555+ Property { name: "savedOrientation"; type: "Qt::ScreenOrientation" }
556+ }
557 }
558
559=== modified file 'plugins/Utils/Utils.qmltypes'
560--- plugins/Utils/Utils.qmltypes 2014-08-14 01:28:06 +0000
561+++ plugins/Utils/Utils.qmltypes 2014-10-15 16:26:15 +0000
562@@ -107,6 +107,12 @@
563 }
564 }
565 Component {
566+ name: "RelativeTimeFormatter"
567+ prototype: "TimeFormatter"
568+ exports: ["Utils/RelativeTimeFormatter 0.1"]
569+ exportMetaObjectRevisions: [0]
570+ }
571+ Component {
572 name: "TimeFormatter"
573 prototype: "QObject"
574 exports: ["Utils/GDateTimeFormatter 0.1", "Utils/TimeFormatter 0.1"]
575
576=== modified file 'qml/Greeter/Clock.qml'
577--- qml/Greeter/Clock.qml 2014-08-20 08:39:09 +0000
578+++ qml/Greeter/Clock.qml 2014-10-15 16:26:15 +0000
579@@ -34,21 +34,21 @@
580 }
581 }
582
583- CachedUnityMenuModel {
584+ Indicators.SharedUnityMenuModel {
585 id: timeModel
586 objectName: "timeModel"
587
588 busName: "com.canonical.indicator.datetime"
589- actionsObjectPath: "/com/canonical/indicator/datetime"
590+ actions: { "indicator": "/com/canonical/indicator/datetime" }
591 menuObjectPath: clock.visible ? "/com/canonical/indicator/datetime/phone" : ""
592+ }
593
594- Indicators.RootActionState {
595- menu: timeModel.model
596- onUpdated: {
597- if (timeLabel.text != rightLabel) {
598- timeLabel.text = rightLabel;
599- clock.currentDate = new Date();
600- }
601+ Indicators.RootActionState {
602+ menu: timeModel.model
603+ onUpdated: {
604+ if (timeLabel.text != rightLabel) {
605+ if (rightLabel != "") timeLabel.text = rightLabel;
606+ clock.currentDate = new Date();
607 }
608 }
609 }
610
611=== removed file 'qml/Panel/Indicators/CachedUnityMenuModel.qml'
612--- qml/Panel/Indicators/CachedUnityMenuModel.qml 2014-08-20 08:39:09 +0000
613+++ qml/Panel/Indicators/CachedUnityMenuModel.qml 1970-01-01 00:00:00 +0000
614@@ -1,39 +0,0 @@
615-/*
616- * Copyright 2013 Canonical Ltd.
617- *
618- * This program is free software; you can redistribute it and/or modify
619- * it under the terms of the GNU Lesser General Public License as published by
620- * the Free Software Foundation; version 3.
621- *
622- * This program is distributed in the hope that it will be useful,
623- * but WITHOUT ANY WARRANTY; without even the implied warranty of
624- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
625- * GNU Lesser General Public License for more details.
626- *
627- * You should have received a copy of the GNU Lesser General Public License
628- * along with this program. If not, see <http://www.gnu.org/licenses/>.
629- *
630- * Authors:
631- * Nick Dedekind <nick.dedekind@canonical.com>
632- */
633-
634-import QtQuick 2.0
635-import QMenuModel 0.1
636-import Unity.Indicators 0.1 as Indicators
637-
638-// Make sure we don't duplicate models.
639-Item {
640- id: cachedModel
641- property string busName
642- property string actionsObjectPath
643- property string menuObjectPath
644- readonly property bool ready: busName!=="" && actionsObjectPath!=="" && menuObjectPath!==""
645-
646- property var model: {
647- if (!ready) return null;
648-
649- return Indicators.UnityMenuModelCache.model(cachedModel.busName,
650- cachedModel.menuObjectPath,
651- { "indicator": cachedModel.actionsObjectPath });
652- }
653-}
654
655=== modified file 'qml/Panel/Indicators/IndicatorBase.qml'
656--- qml/Panel/Indicators/IndicatorBase.qml 2014-09-29 10:24:58 +0000
657+++ qml/Panel/Indicators/IndicatorBase.qml 2014-10-15 16:26:15 +0000
658@@ -37,10 +37,10 @@
659 property alias menuModel: cachedModel.model
660 property alias rootActionState: rootAction
661
662- CachedUnityMenuModel {
663+ SharedUnityMenuModel {
664 id: cachedModel
665 busName: indicatorItem.busName
666- actionsObjectPath: indicatorItem.actionsObjectPath
667+ actions: { "indicator": indicatorItem.actionsObjectPath }
668 menuObjectPath: indicatorItem.deviceMenuObjectPath
669 }
670
671
672=== modified file 'tests/mocks/AccountsService/AccountsService.qmltypes'
673--- tests/mocks/AccountsService/AccountsService.qmltypes 2014-09-01 12:18:53 +0000
674+++ tests/mocks/AccountsService/AccountsService.qmltypes 2014-10-15 16:26:15 +0000
675@@ -23,6 +23,8 @@
676 }
677 Property { name: "user"; type: "string" }
678 Property { name: "demoEdges"; type: "bool" }
679+ Property { name: "enableLauncherWhileLocked"; type: "bool" }
680+ Property { name: "enableIndicatorsWhileLocked"; type: "bool" }
681 Property { name: "backgroundFile"; type: "string" }
682 Property { name: "statsWelcomeScreen"; type: "bool" }
683 Property { name: "passwordDisplayHint"; type: "PasswordDisplayHint"; isReadonly: true }
684
685=== modified file 'tests/mocks/LightDM/LightDM.qmltypes'
686--- tests/mocks/LightDM/LightDM.qmltypes 2014-09-01 12:18:53 +0000
687+++ tests/mocks/LightDM/LightDM.qmltypes 2014-10-15 16:26:15 +0000
688@@ -37,6 +37,7 @@
689 Signal { name: "isActiveChanged" }
690 Signal { name: "isAuthenticatedChanged" }
691 Signal { name: "showGreeter" }
692+ Signal { name: "hideGreeter" }
693 Signal {
694 name: "requestAuthenticationUser"
695 Parameter { name: "user"; type: "string" }
696
697=== modified file 'tests/mocks/QMenuModel/QMenuModel.qmltypes'
698--- tests/mocks/QMenuModel/QMenuModel.qmltypes 2014-08-14 01:28:06 +0000
699+++ tests/mocks/QMenuModel/QMenuModel.qmltypes 2014-10-15 16:26:15 +0000
700@@ -18,12 +18,12 @@
701 prototype: "QAbstractListModel"
702 exports: ["QMenuModel/UnityMenuModel 0.1"]
703 exportMetaObjectRevisions: [0]
704- Property { name: "modelData"; type: "QVariant" }
705 Property { name: "busName"; type: "QByteArray" }
706 Property { name: "actions"; type: "QVariantMap" }
707 Property { name: "menuObjectPath"; type: "QByteArray" }
708 Property { name: "actionStateParser"; type: "ActionStateParser"; isPointer: true }
709 Property { name: "nameOwner"; type: "string"; isReadonly: true }
710+ Property { name: "modelData"; type: "QVariant" }
711 Method {
712 name: "insertRow"
713 Parameter { name: "row"; type: "int" }
714
715=== modified file 'tests/mocks/QMenuModel/unitymenumodel.cpp'
716--- tests/mocks/QMenuModel/unitymenumodel.cpp 2014-08-26 08:14:44 +0000
717+++ tests/mocks/QMenuModel/unitymenumodel.cpp 2014-10-15 16:26:15 +0000
718@@ -50,13 +50,12 @@
719 {
720 beginResetModel();
721
722- m_modelData.clear();
723 m_modelData = data.toList();
724+ Q_EMIT modelDataChanged();
725
726 endResetModel();
727 }
728
729-
730 void UnityMenuModel::insertRow(int row, const QVariant& data)
731 {
732 row = qMin(row, rowCount());
733
734=== modified file 'tests/mocks/QMenuModel/unitymenumodel.h'
735--- tests/mocks/QMenuModel/unitymenumodel.h 2014-08-26 08:14:44 +0000
736+++ tests/mocks/QMenuModel/unitymenumodel.h 2014-10-15 16:26:15 +0000
737@@ -27,13 +27,15 @@
738 class Q_DECL_EXPORT UnityMenuModel : public QAbstractListModel
739 {
740 Q_OBJECT
741- Q_PROPERTY(QVariant modelData READ modelData WRITE setModelData NOTIFY modelDataChanged)
742 Q_PROPERTY(QByteArray busName READ busName WRITE setBusName NOTIFY busNameChanged)
743 Q_PROPERTY(QVariantMap actions READ actions WRITE setActions NOTIFY actionsChanged)
744 Q_PROPERTY(QByteArray menuObjectPath READ menuObjectPath WRITE setMenuObjectPath NOTIFY menuObjectPathChanged)
745 Q_PROPERTY(ActionStateParser* actionStateParser READ actionStateParser WRITE setActionStateParser NOTIFY actionStateParserChanged)
746 Q_PROPERTY(QString nameOwner READ nameOwner NOTIFY nameOwnerChanged)
747
748+ // internal mock properties
749+ Q_PROPERTY(QVariant modelData READ modelData WRITE setModelData NOTIFY modelDataChanged)
750+
751 public:
752 UnityMenuModel(QObject *parent = nullptr);
753 virtual ~UnityMenuModel();
754@@ -81,8 +83,10 @@
755 void actionsChanged();
756 void menuObjectPathChanged();
757 void actionStateParserChanged();
758+ void nameOwnerChanged();
759+
760+ // Internal mock usage
761 void modelDataChanged();
762- void nameOwnerChanged();
763
764 private:
765 QVariantMap rowData(int row) const;
766
767=== modified file 'tests/mocks/Ubuntu/Payments/Payments.qmltypes'
768--- tests/mocks/Ubuntu/Payments/Payments.qmltypes 2014-06-27 20:53:24 +0000
769+++ tests/mocks/Ubuntu/Payments/Payments.qmltypes 2014-10-15 16:26:15 +0000
770@@ -37,6 +37,8 @@
771 Parameter { name: "error"; type: "string" }
772 }
773 Signal { name: "purchaseCompleted" }
774+ Signal { name: "purchaseCancelled" }
775 Method { name: "start" }
776+ Method { name: "process" }
777 }
778 }
779
780=== modified file 'tests/mocks/Ubuntu/Telephony/Telephony.qmltypes'
781--- tests/mocks/Ubuntu/Telephony/Telephony.qmltypes 2014-08-14 13:33:28 +0000
782+++ tests/mocks/Ubuntu/Telephony/Telephony.qmltypes 2014-10-15 16:26:15 +0000
783@@ -22,7 +22,8 @@
784 exportMetaObjectRevisions: [0]
785 Property { name: "phoneNumber"; type: "string" }
786 Property { name: "isConference"; type: "bool" }
787- Property { name: "elapsedTime"; type: "int"; isReadonly: true }
788+ Property { name: "elapsedTime"; type: "int" }
789+ Property { name: "elapsedTimerRunning"; type: "bool" }
790 }
791 Component {
792 name: "MockCallManager"
793
794=== modified file 'tests/mocks/Unity/Application/Application.qmltypes'
795--- tests/mocks/Unity/Application/Application.qmltypes 2014-09-01 12:24:06 +0000
796+++ tests/mocks/Unity/Application/Application.qmltypes 2014-10-15 16:26:15 +0000
797@@ -238,6 +238,7 @@
798 Property { name: "state"; type: "State"; isReadonly: true }
799 Property { name: "name"; type: "string"; isReadonly: true }
800 Property { name: "live"; type: "bool"; isReadonly: true }
801+ Property { name: "orientation"; type: "Qt::ScreenOrientation" }
802 Signal {
803 name: "typeChanged"
804 Parameter { type: "Type" }
805@@ -268,10 +269,15 @@
806 exportMetaObjectRevisions: [0]
807 Property { name: "name"; type: "string"; isReadonly: true }
808 Property { name: "surface"; type: "MirSurfaceItem"; isReadonly: true; isPointer: true }
809+ Property { name: "application"; type: "ApplicationInfo"; isReadonly: true; isPointer: true }
810 Property { name: "parentSession"; type: "Session"; isReadonly: true; isPointer: true }
811 Property { name: "childSessions"; type: "SessionModel"; isReadonly: true; isPointer: true }
812 Property { name: "live"; type: "bool"; isReadonly: true }
813 Signal {
814+ name: "applicationChanged"
815+ Parameter { type: "ApplicationInfo"; isPointer: true }
816+ }
817+ Signal {
818 name: "surfaceChanged"
819 Parameter { type: "MirSurfaceItem"; isPointer: true }
820 }
821@@ -368,6 +374,12 @@
822 Property { name: "stage"; type: "Stage"; isReadonly: true }
823 Property { name: "state"; type: "State"; isReadonly: true }
824 Property { name: "focused"; type: "bool"; isReadonly: true }
825+ Property { name: "splashTitle"; type: "string"; isReadonly: true }
826+ Property { name: "splashImage"; type: "QUrl"; isReadonly: true }
827+ Property { name: "splashShowHeader"; type: "bool"; isReadonly: true }
828+ Property { name: "splashColor"; type: "QColor"; isReadonly: true }
829+ Property { name: "splashColorHeader"; type: "QColor"; isReadonly: true }
830+ Property { name: "splashColorFooter"; type: "QColor"; isReadonly: true }
831 Signal {
832 name: "nameChanged"
833 Parameter { name: "name"; type: "string" }
834@@ -414,6 +426,7 @@
835 Property { name: "count"; type: "int"; isReadonly: true }
836 Property { name: "focusedApplicationId"; type: "string"; isReadonly: true }
837 Property { name: "suspended"; type: "bool" }
838+ Property { name: "forceDashActive"; type: "bool" }
839 Signal {
840 name: "focusRequested"
841 Parameter { name: "appId"; type: "string" }
842
843=== modified file 'tests/mocks/Unity/DashCommunicator/DashCommunicator.qmltypes'
844--- tests/mocks/Unity/DashCommunicator/DashCommunicator.qmltypes 2014-08-14 13:33:28 +0000
845+++ tests/mocks/Unity/DashCommunicator/DashCommunicator.qmltypes 2014-10-15 16:26:15 +0000
846@@ -34,13 +34,13 @@
847 name: "setCurrentScopeRequested"
848 Parameter { name: "scopeId"; type: "string" }
849 Parameter { name: "animate"; type: "bool" }
850- Parameter { name: "reset"; type: "bool" }
851+ Parameter { name: "isSwipe"; type: "bool" }
852 }
853 Method {
854 name: "mockSetCurrentScope"
855 Parameter { name: "scopeId"; type: "string" }
856 Parameter { name: "animate"; type: "bool" }
857- Parameter { name: "reset"; type: "bool" }
858+ Parameter { name: "isSwipe"; type: "bool" }
859 }
860 }
861 }
862
863=== modified file 'tests/mocks/Unity/Indicators/CMakeLists.txt'
864--- tests/mocks/Unity/Indicators/CMakeLists.txt 2014-08-20 08:39:09 +0000
865+++ tests/mocks/Unity/Indicators/CMakeLists.txt 2014-10-15 16:26:15 +0000
866@@ -12,24 +12,17 @@
867
868 set(IndicatorsFakeQml_SOURCES
869 fakeplugin.cpp
870+ fakeindicatorsmodel.cpp
871+ fakeunitymenumodelcache.cpp
872 ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/indicators.h
873 ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/menucontentactivator.cpp
874+ ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/sharedunitymenumodel.cpp
875 ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/unitymenumodelcache.cpp
876 ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/unitymenumodelstack.cpp
877 ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/visibleindicatorsmodel.cpp
878- fakeindicatorsmodel.cpp
879-)
880-
881-set(IndicatorsFakeQml_RESOURCES
882- indicators_fake.qrc
883-)
884-
885-qt5_add_resources(IndicatorsFakeQml_RESOURCES_RCC
886- ${IndicatorsFakeQml_RESOURCES}
887 )
888
889 add_library(IndicatorsFakeQml SHARED
890- ${IndicatorsFakeQml_RESOURCES_RCC}
891 ${IndicatorsFakeQml_SOURCES}
892 )
893 add_definitions(-DUNITYINDICATORS_LIBRARY)
894
895=== removed file 'tests/mocks/Unity/Indicators/FakeMenuPage.qml'
896--- tests/mocks/Unity/Indicators/FakeMenuPage.qml 2014-09-09 15:10:52 +0000
897+++ tests/mocks/Unity/Indicators/FakeMenuPage.qml 1970-01-01 00:00:00 +0000
898@@ -1,27 +0,0 @@
899-/*
900- * Copyright 2013 Canonical Ltd.
901- *
902- * This program is free software; you can redistribute it and/or modify
903- * it under the terms of the GNU General Public License as published by
904- * the Free Software Foundation; version 3.
905- *
906- * This program is distributed in the hope that it will be useful,
907- * but WITHOUT ANY WARRANTY; without even the implied warranty of
908- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
909- * GNU General Public License for more details.
910- *
911- * You should have received a copy of the GNU General Public License
912- * along with this program. If not, see <http://www.gnu.org/licenses/>.
913- */
914-
915-import QtQuick 2.0
916-
917-Flickable {
918- objectName: "fakeMenuPlugin"
919- // Make it compatible with the PluginItem interface
920- function reset() {
921- if (shell != undefined && shell.indicator_status != undefined) {
922- shell.indicator_status[objectName].reset++;
923- }
924- }
925-}
926
927=== modified file 'tests/mocks/Unity/Indicators/Indicators.qmltypes'
928--- tests/mocks/Unity/Indicators/Indicators.qmltypes 2014-09-01 12:18:53 +0000
929+++ tests/mocks/Unity/Indicators/Indicators.qmltypes 2014-10-15 16:26:15 +0000
930@@ -29,6 +29,7 @@
931 exports: ["Unity.Indicators/FakeIndicatorsModel 0.1"]
932 exportMetaObjectRevisions: [0]
933 Property { name: "count"; type: "int"; isReadonly: true }
934+ Property { name: "modelData"; type: "QVariant" }
935 Method {
936 name: "load"
937 Parameter { name: "profile"; type: "string" }
938@@ -39,6 +40,15 @@
939 Parameter { name: "row"; type: "QVariantMap" }
940 }
941 Method {
942+ name: "insert"
943+ Parameter { name: "row"; type: "int" }
944+ Parameter { name: "data"; type: "QVariantMap" }
945+ }
946+ Method {
947+ name: "remove"
948+ Parameter { name: "row"; type: "int" }
949+ }
950+ Method {
951 name: "data"
952 type: "QVariant"
953 Parameter { name: "row"; type: "int" }
954@@ -46,6 +56,27 @@
955 }
956 }
957 Component {
958+ name: "FakeUnityMenuModelCache"
959+ prototype: "UnityMenuModelCache"
960+ exports: ["Unity.Indicators/UnityMenuModelCache 0.1"]
961+ isCreatable: false
962+ isSingleton: true
963+ exportMetaObjectRevisions: [0]
964+ Method {
965+ name: "setCachedModelData"
966+ Parameter { name: "bus"; type: "QByteArray" }
967+ Parameter { name: "path"; type: "QByteArray" }
968+ Parameter { name: "actions"; type: "QVariantMap" }
969+ Parameter { name: "data"; type: "QVariant" }
970+ }
971+ Method {
972+ name: "setCachedModelData"
973+ Parameter { name: "bus"; type: "QByteArray" }
974+ Parameter { name: "path"; type: "QByteArray" }
975+ Parameter { name: "actions"; type: "QVariantMap" }
976+ }
977+ }
978+ Component {
979 name: "FlatMenuProxyModelRole"
980 prototype: "QObject"
981 exports: ["Unity.Indicators/FlatMenuProxyModelRole 0.1"]
982@@ -160,19 +191,18 @@
983 }
984 Component { name: "QIdentityProxyModel"; prototype: "QAbstractProxyModel" }
985 Component {
986+ name: "SharedUnityMenuModel"
987+ prototype: "QObject"
988+ exports: ["Unity.Indicators/SharedUnityMenuModel 0.1"]
989+ exportMetaObjectRevisions: [0]
990+ Property { name: "busName"; type: "QByteArray" }
991+ Property { name: "menuObjectPath"; type: "QByteArray" }
992+ Property { name: "actions"; type: "QVariantMap" }
993+ Property { name: "model"; type: "UnityMenuModel"; isReadonly: true; isPointer: true }
994+ }
995+ Component {
996 name: "UnityMenuModelCache"
997 prototype: "QObject"
998- exports: ["Unity.Indicators/UnityMenuModelCache 0.1"]
999- isCreatable: false
1000- isSingleton: true
1001- exportMetaObjectRevisions: [0]
1002- Method {
1003- name: "model"
1004- type: "UnityMenuModel*"
1005- Parameter { name: "bus"; type: "QByteArray" }
1006- Parameter { name: "path"; type: "QByteArray" }
1007- Parameter { name: "actions"; type: "QVariantMap" }
1008- }
1009 Method {
1010 name: "contains"
1011 type: "bool"
1012
1013=== modified file 'tests/mocks/Unity/Indicators/IndicatorsModel.qml'
1014--- tests/mocks/Unity/Indicators/IndicatorsModel.qml 2014-03-03 11:55:00 +0000
1015+++ tests/mocks/Unity/Indicators/IndicatorsModel.qml 2014-10-15 16:26:15 +0000
1016@@ -18,43 +18,151 @@
1017 import Unity.Indicators 0.1 as Indicators
1018
1019 Indicators.FakeIndicatorsModel {
1020+ id: root
1021+
1022+ Component.onCompleted: {
1023+ Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake1",
1024+ "/com/canonical/indicators/fake1",
1025+ "/com/canonical/indicators/fake1",
1026+ getUnityMenuModelData("fake-indicator-bluetooth",
1027+ "Bluetooth (F)",
1028+ "",
1029+ [ "image://theme/bluetooth-active" ]));
1030+ Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake2",
1031+ "/com/canonical/indicators/fake2",
1032+ "/com/canonical/indicators/fake2",
1033+ getUnityMenuModelData("fake-indicator-network",
1034+ "Network (F)",
1035+ "",
1036+ [ "image://theme/simcard-error", "image://theme/wifi-high" ]));
1037+ Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake3",
1038+ "/com/canonical/indicators/fake3",
1039+ "/com/canonical/indicators/fake3",
1040+ getUnityMenuModelData("fake-indicator-sound",
1041+ "Messages (F)",
1042+ "",
1043+ [ "image://theme/messages-new" ]));
1044+ Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake4",
1045+ "/com/canonical/indicators/fake4",
1046+ "/com/canonical/indicators/fake4",
1047+ getUnityMenuModelData("fake-indicator-power",
1048+ "Sound (F)",
1049+ "",
1050+ [ "image://theme/audio-volume-high" ]));
1051+ Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake5",
1052+ "/com/canonical/indicators/fake5",
1053+ "/com/canonical/indicators/fake5",
1054+ getUnityMenuModelData("fake-indicator-power",
1055+ "Battery (F)",
1056+ "",
1057+ [ "image://theme/battery-020" ]));
1058+ }
1059+
1060+ function getUnityMenuModelData(identifier, title, label, icons) {
1061+ var root = [{
1062+ "rowData": { // 1
1063+ "label": "",
1064+ "sensitive": true,
1065+ "isSeparator": false,
1066+ "icon": "",
1067+ "type": "com.canonical.indicator.root",
1068+ "ext": {},
1069+ "action": "",
1070+ "actionState": {
1071+ "title": title,
1072+ "label": label,
1073+ "icons": icons
1074+ },
1075+ "isCheck": false,
1076+ "isRadio": false,
1077+ "isToggled": false,
1078+ },
1079+ "submenu": []
1080+ }];
1081+
1082+ var submenus = [];
1083+ for (var i = 0; i < 8; i++) {
1084+ var submenu = {
1085+ "rowData": { // 1.1
1086+ "label": identifier,
1087+ "sensitive": true,
1088+ "isSeparator": false,
1089+ "icon": "",
1090+ "type": undefined,
1091+ "ext": {},
1092+ "action": "",
1093+ "actionState": {},
1094+ "isCheck": false,
1095+ "isRadio": false,
1096+ "isToggled": false,
1097+ }};
1098+ submenus.push(submenu);
1099+ }
1100+ root[0]["submenu"] = submenus;
1101+
1102+ return root;
1103+ }
1104+
1105+ property var originalModelData: [
1106+ {
1107+ "identifier": "indicator-fake1",
1108+ "widgetSource": "Indicators/DefaultIndicatorWidget.qml",
1109+ "pageSource": "Indicators/DefaultIndicatorPage.qml",
1110+ "indicatorProperties": {
1111+ "enabled": true,
1112+ "busName": "com.canonical.indicators.fake1",
1113+ "menuObjectPath": "/com/canonical/indicators/fake1",
1114+ "actionsObjectPath": "/com/canonical/indicators/fake1"
1115+ }
1116+ },
1117+ {
1118+ "identifier": "indicator-fake2",
1119+ "widgetSource": "Indicators/DefaultIndicatorWidget.qml",
1120+ "pageSource": "Indicators/DefaultIndicatorPage.qml",
1121+ "indicatorProperties": {
1122+ "enabled": true,
1123+ "busName": "com.canonical.indicators.fake2",
1124+ "menuObjectPath": "/com/canonical/indicators/fake2",
1125+ "actionsObjectPath": "/com/canonical/indicators/fake2"
1126+ }
1127+ },
1128+ {
1129+ "identifier": "indicator-fake3",
1130+ "widgetSource": "Indicators/DefaultIndicatorWidget.qml",
1131+ "pageSource": "Indicators/DefaultIndicatorPage.qml",
1132+ "indicatorProperties": {
1133+ "enabled": true,
1134+ "busName": "com.canonical.indicators.fake3",
1135+ "menuObjectPath": "/com/canonical/indicators/fake3",
1136+ "actionsObjectPath": "/com/canonical/indicators/fake3"
1137+ }
1138+ },
1139+ {
1140+ "identifier": "indicator-fake4",
1141+ "widgetSource": "Indicators/DefaultIndicatorWidget.qml",
1142+ "pageSource": "Indicators/DefaultIndicatorPage.qml",
1143+ "indicatorProperties": {
1144+ "enabled": true,
1145+ "busName": "com.canonical.indicators.fake4",
1146+ "menuObjectPath": "/com/canonical/indicators/fake4",
1147+ "actionsObjectPath": "/com/canonical/indicators/fake4"
1148+ }
1149+ },
1150+ {
1151+ "identifier": "indicator-fake5",
1152+ "widgetSource": "Indicators/DefaultIndicatorWidget.qml",
1153+ "pageSource": "Indicators/DefaultIndicatorPage.qml",
1154+ "indicatorProperties": {
1155+ "enabled": true,
1156+ "busName": "com.canonical.indicators.fake5",
1157+ "menuObjectPath": "/com/canonical/indicators/fake5",
1158+ "actionsObjectPath": "/com/canonical/indicators/fake5"
1159+ }
1160+ }
1161+ ]
1162
1163 function load(profile) {
1164 unload();
1165-
1166- append({ "identifier": "indicator-fake1",
1167- "position": 0,
1168- "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget1.qml",
1169- "pageSource": "qrc:/tests/indciators/qml/fake_menu_page1.qml",
1170- "indicatorProperties": { enabled: true }
1171- });
1172-
1173- append({ "identifier": "indicator-fake2",
1174- "position": 1,
1175- "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget2.qml",
1176- "pageSource": "qrc:/tests/indciators/qml/fake_menu_page2.qml",
1177- "indicatorProperties": { enabled: true }
1178- });
1179-
1180- append({ "identifier": "indicator-fake3",
1181- "position": 2,
1182- "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget3.qml",
1183- "pageSource": "qrc:/tests/indciators/qml/fake_menu_page3.qml",
1184- "indicatorProperties": { enabled: true }
1185- });
1186-
1187- append({ "identifier": "indicator-fake4",
1188- "position": 3,
1189- "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget4.qml",
1190- "pageSource": "qrc:/tests/indciators/qml/fake_menu_page4.qml",
1191- "indicatorProperties": { enabled: true }
1192- });
1193-
1194- append({ "identifier": "indicator-fake5",
1195- "position": 4,
1196- "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget5.qml",
1197- "pageSource": "qrc:/tests/indciators/qml/fake_menu_page5.qml",
1198- "indicatorProperties": { enabled: true }
1199- });
1200+ root.modelData = originalModelData;
1201 }
1202 }
1203
1204=== modified file 'tests/mocks/Unity/Indicators/RootActionState.qml'
1205--- tests/mocks/Unity/Indicators/RootActionState.qml 2013-10-28 18:19:15 +0000
1206+++ tests/mocks/Unity/Indicators/RootActionState.qml 2014-10-15 16:26:15 +0000
1207@@ -19,15 +19,23 @@
1208
1209 import QtQuick 2.0
1210
1211-QtObject {
1212- property var menu
1213- property bool valid: false
1214- property string title
1215- property string leftLabel
1216- property string rightLabel
1217- property var icons
1218- property string accessibleName
1219- property bool visible: true
1220+Item {
1221+ property var menu: null
1222+ property bool valid: cachedState !== undefined
1223+ property string title: cachedState && cachedState.hasOwnProperty("title") ? cachedState["title"] : ""
1224+ property string leftLabel: cachedState && cachedState.hasOwnProperty("pre-label") ? cachedState["pre-label"] : ""
1225+ property string rightLabel: cachedState && cachedState.hasOwnProperty("label") ? cachedState["label"] : ""
1226+ property var icons: cachedState && cachedState.hasOwnProperty("icons") ? cachedState["icons"] : []
1227+ property string accessibleName: cachedState && cachedState.hasOwnProperty("accessible-desc") ? cachedState["accessible-desc"] : ""
1228+ visible: cachedState && cachedState.hasOwnProperty("visible") ? cachedState["visible"] : true
1229+
1230+ property var cachedState: menu ? menu.get(0, "actionState") : undefined
1231+ Connections {
1232+ target: menu
1233+ onModelDataChanged: {
1234+ cachedState = menu.get(0, "actionState");
1235+ }
1236+ }
1237
1238 signal updated
1239
1240
1241=== modified file 'tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp'
1242--- tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp 2014-07-01 09:49:24 +0000
1243+++ tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp 2014-10-15 16:26:15 +0000
1244@@ -31,7 +31,6 @@
1245 /*! \internal */
1246 FakeIndicatorsModel::~FakeIndicatorsModel()
1247 {
1248- qDeleteAll(m_indicators);
1249 }
1250
1251 int FakeIndicatorsModel::count() const
1252@@ -47,29 +46,61 @@
1253 {
1254 beginResetModel();
1255
1256- qDeleteAll(m_indicators);
1257- m_indicators.clear();
1258-
1259- endResetModel();
1260-}
1261-
1262-
1263-void FakeIndicatorsModel::append(const QVariantMap& row)
1264-{
1265- Indicator* new_row = new QHash<int, QVariant>();
1266- for (auto iter = row.begin(); iter != row.end(); ++iter )
1267- {
1268- int key = roleNames().key(iter.key().toUtf8(), -1);
1269- if (key != -1) {
1270- new_row->insert(key, iter.value());
1271- }
1272- }
1273-
1274- beginInsertRows(QModelIndex(), m_indicators.count(), m_indicators.count());
1275-
1276- m_indicators.append(new_row);
1277-
1278- endInsertRows();
1279+ m_modelData.clear();
1280+ Q_EMIT modelDataChanged();
1281+
1282+ endResetModel();
1283+}
1284+
1285+
1286+void FakeIndicatorsModel::append(const QVariantMap& data)
1287+{
1288+ QList<QVariant> allData = m_modelData.toList();
1289+ beginInsertRows(QModelIndex(), allData.count(), allData.count());
1290+
1291+ allData.append(data);
1292+ m_modelData = allData;
1293+ Q_EMIT modelDataChanged();
1294+
1295+ endInsertRows();
1296+}
1297+
1298+void FakeIndicatorsModel::insert(int row, const QVariantMap& data)
1299+{
1300+ QList<QVariant> allData = m_modelData.toList();
1301+ row = qMax(0, qMin(row, allData.count()));
1302+
1303+ beginInsertRows(QModelIndex(), row, row);
1304+
1305+ allData.insert(row, data);
1306+ m_modelData = allData;
1307+ Q_EMIT modelDataChanged();
1308+
1309+ endInsertRows();
1310+}
1311+
1312+void FakeIndicatorsModel::remove(int row)
1313+{
1314+ QList<QVariant> allData = m_modelData.toList();
1315+ row = qMax(0, qMin(row, allData.count()));
1316+
1317+ beginRemoveRows(QModelIndex(), row, row);
1318+
1319+ allData.removeAt(row);
1320+ m_modelData = allData;
1321+ Q_EMIT modelDataChanged();
1322+
1323+ endRemoveRows();
1324+}
1325+
1326+void FakeIndicatorsModel::setModelData(const QVariant& modelData)
1327+{
1328+ beginResetModel();
1329+
1330+ m_modelData = modelData;
1331+ Q_EMIT modelDataChanged();
1332+
1333+ endResetModel();
1334 }
1335
1336 QHash<int, QByteArray> FakeIndicatorsModel::roleNames() const
1337@@ -91,18 +122,18 @@
1338 return 1;
1339 }
1340
1341-Q_INVOKABLE QVariant FakeIndicatorsModel::data(int row, int role) const
1342+QVariant FakeIndicatorsModel::data(int row, int role) const
1343 {
1344 return data(index(row, 0), role);
1345 }
1346
1347 QVariant FakeIndicatorsModel::data(const QModelIndex &index, int role) const
1348 {
1349- if (!index.isValid() || index.row() >= m_indicators.size())
1350+ QList<QVariant> dataList = m_modelData.toList();
1351+ if (!index.isValid() || index.row() >= dataList.size())
1352 return QVariant();
1353
1354- Indicator* indicator = m_indicators[index.row()];
1355- return indicator->value(role, QVariant());
1356+ return dataList[index.row()].toMap()[roleNames()[role]];
1357 }
1358
1359 QModelIndex FakeIndicatorsModel::parent(const QModelIndex&) const
1360@@ -112,5 +143,5 @@
1361
1362 int FakeIndicatorsModel::rowCount(const QModelIndex&) const
1363 {
1364- return m_indicators.count();
1365+ return m_modelData.toList().count();
1366 }
1367
1368=== modified file 'tests/mocks/Unity/Indicators/fakeindicatorsmodel.h'
1369--- tests/mocks/Unity/Indicators/fakeindicatorsmodel.h 2014-03-03 12:01:09 +0000
1370+++ tests/mocks/Unity/Indicators/fakeindicatorsmodel.h 2014-10-15 16:26:15 +0000
1371@@ -27,6 +27,7 @@
1372 Q_OBJECT
1373 Q_ENUMS(Roles)
1374 Q_PROPERTY(int count READ count NOTIFY countChanged)
1375+ Q_PROPERTY(QVariant modelData READ modelData WRITE setModelData NOTIFY modelDataChanged)
1376 public:
1377
1378 FakeIndicatorsModel(QObject *parent=0);
1379@@ -36,9 +37,14 @@
1380 Q_INVOKABLE void unload();
1381
1382 Q_INVOKABLE void append(const QVariantMap& row);
1383+ Q_INVOKABLE void insert(int row, const QVariantMap& data);
1384+ Q_INVOKABLE void remove(int row);
1385
1386 Q_INVOKABLE QVariant data(int row, int role) const;
1387
1388+ void setModelData(const QVariant& data);
1389+ QVariant modelData() const { return m_modelData; }
1390+
1391 /* QAbstractItemModel */
1392 QHash<int, QByteArray> roleNames() const;
1393 int columnCount(const QModelIndex &parent = QModelIndex()) const;
1394@@ -48,12 +54,12 @@
1395
1396 Q_SIGNALS:
1397 void countChanged();
1398+ void modelDataChanged();
1399
1400 private:
1401 int count() const;
1402
1403- typedef QHash<int, QVariant> Indicator;
1404- QList<Indicator*> m_indicators;
1405+ QVariant m_modelData;
1406 };
1407
1408 #endif // FAKE_INDICATORSMODEL_H
1409
1410=== modified file 'tests/mocks/Unity/Indicators/fakeplugin.cpp'
1411--- tests/mocks/Unity/Indicators/fakeplugin.cpp 2014-08-20 08:39:09 +0000
1412+++ tests/mocks/Unity/Indicators/fakeplugin.cpp 2014-10-15 16:26:15 +0000
1413@@ -26,19 +26,22 @@
1414 #include "fakeindicatorsmodel.h"
1415 #include "indicators.h"
1416 #include "menucontentactivator.h"
1417-#include "unitymenumodelcache.h"
1418+#include "sharedunitymenumodel.h"
1419+#include "fakeunitymenumodelcache.h"
1420 #include "unitymenumodelstack.h"
1421 #include "visibleindicatorsmodel.h"
1422
1423+#include <unitymenumodel.h>
1424+
1425 static QObject* menuModelCacheSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) {
1426 Q_UNUSED(engine);
1427 Q_UNUSED(scriptEngine);
1428- return new UnityMenuModelCache;
1429+ return FakeUnityMenuModelCache::singleton();
1430 }
1431
1432 void IndicatorsFakePlugin::registerTypes(const char * uri)
1433 {
1434- Q_INIT_RESOURCE(indicators_fake);
1435+ qRegisterMetaType<UnityMenuModel*>("UnityMenuModel*");
1436
1437 // internal
1438 qmlRegisterType<FakeIndicatorsModel>(uri, 0, 1, "FakeIndicatorsModel");
1439@@ -47,8 +50,9 @@
1440 qmlRegisterType<MenuContentActivator>(uri, 0, 1, "MenuContentActivator");
1441 qmlRegisterType<UnityMenuModelStack>(uri, 0, 1, "UnityMenuModelStack");
1442 qmlRegisterType<VisibleIndicatorsModel>(uri, 0, 1, "VisibleIndicatorsModel");
1443+ qmlRegisterType<SharedUnityMenuModel>(uri, 0, 1, "SharedUnityMenuModel");
1444
1445- qmlRegisterSingletonType<UnityMenuModelCache>(uri, 0, 1, "UnityMenuModelCache", menuModelCacheSingleton);
1446+ qmlRegisterSingletonType<FakeUnityMenuModelCache>(uri, 0, 1, "UnityMenuModelCache", menuModelCacheSingleton);
1447
1448 // external uncreatables
1449 qmlRegisterUncreatableType<MenuContentState>(uri, 0, 1, "MenuContentState", "Can't create MenuContentState class");
1450
1451=== added file 'tests/mocks/Unity/Indicators/fakeunitymenumodelcache.cpp'
1452--- tests/mocks/Unity/Indicators/fakeunitymenumodelcache.cpp 1970-01-01 00:00:00 +0000
1453+++ tests/mocks/Unity/Indicators/fakeunitymenumodelcache.cpp 2014-10-15 16:26:15 +0000
1454@@ -0,0 +1,57 @@
1455+/*
1456+ * Copyright 2014 Canonical Ltd.
1457+ *
1458+ * This program is free software; you can redistribute it and/or modify
1459+ * it under the terms of the GNU Lesser General Public License as published by
1460+ * the Free Software Foundation; version 3.
1461+ *
1462+ * This program is distributed in the hope that it will be useful,
1463+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1464+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1465+ * GNU Lesser General Public License for more details.
1466+ *
1467+ * You should have received a copy of the GNU Lesser General Public License
1468+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1469+ */
1470+
1471+#include "fakeunitymenumodelcache.h"
1472+#include <unitymenumodel.h>
1473+
1474+QPointer<FakeUnityMenuModelCache> FakeUnityMenuModelCache::theFakeCache = nullptr;
1475+
1476+FakeUnityMenuModelCache* FakeUnityMenuModelCache::singleton()
1477+{
1478+ if (theFakeCache.isNull()) {
1479+ theFakeCache = new FakeUnityMenuModelCache();
1480+ }
1481+ return theFakeCache.data();
1482+}
1483+
1484+FakeUnityMenuModelCache::FakeUnityMenuModelCache(QObject* parent)
1485+ : UnityMenuModelCache(parent)
1486+{
1487+}
1488+
1489+QSharedPointer<UnityMenuModel> FakeUnityMenuModelCache::model(const QByteArray& bus,
1490+ const QByteArray& path,
1491+ const QVariantMap& actions)
1492+{
1493+ return UnityMenuModelCache::singleton()->model(bus, path, actions);
1494+}
1495+
1496+bool FakeUnityMenuModelCache::contains(const QByteArray& path)
1497+{
1498+ return UnityMenuModelCache::singleton()->contains(path);
1499+}
1500+
1501+void FakeUnityMenuModelCache::setCachedModelData(const QByteArray& bus,
1502+ const QByteArray& path,
1503+ const QVariantMap& actions,
1504+ const QVariant& data)
1505+{
1506+ // keep a ref forever!
1507+ if (!m_models.contains(path)) {
1508+ m_models[path] = model(bus, path, actions);
1509+ }
1510+ m_models[path]->setModelData(data);
1511+}
1512
1513=== added file 'tests/mocks/Unity/Indicators/fakeunitymenumodelcache.h'
1514--- tests/mocks/Unity/Indicators/fakeunitymenumodelcache.h 1970-01-01 00:00:00 +0000
1515+++ tests/mocks/Unity/Indicators/fakeunitymenumodelcache.h 2014-10-15 16:26:15 +0000
1516@@ -0,0 +1,49 @@
1517+/*
1518+ * Copyright 2014 Canonical Ltd.
1519+ *
1520+ * This program is free software; you can redistribute it and/or modify
1521+ * it under the terms of the GNU Lesser General Public License as published by
1522+ * the Free Software Foundation; version 3.
1523+ *
1524+ * This program is distributed in the hope that it will be useful,
1525+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1526+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1527+ * GNU Lesser General Public License for more details.
1528+ *
1529+ * You should have received a copy of the GNU Lesser General Public License
1530+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1531+ */
1532+
1533+#ifndef FAKEUNITYMENUMODELCACHE_H
1534+#define FAKEUNITYMENUMODELCACHE_H
1535+
1536+#include "unitymenumodelcache.h"
1537+
1538+#include <QVariantMap>
1539+
1540+class FakeUnityMenuModelCache : public UnityMenuModelCache
1541+{
1542+ Q_OBJECT
1543+public:
1544+ FakeUnityMenuModelCache(QObject* parent = nullptr);
1545+
1546+ static FakeUnityMenuModelCache* singleton();
1547+
1548+ QSharedPointer<UnityMenuModel> model(const QByteArray& bus,
1549+ const QByteArray& path,
1550+ const QVariantMap& actions) override;
1551+ bool contains(const QByteArray& path) override;
1552+
1553+
1554+
1555+ Q_INVOKABLE void setCachedModelData(const QByteArray& bus,
1556+ const QByteArray& path,
1557+ const QVariantMap& actions,
1558+ const QVariant& data = QVariant());
1559+
1560+private:
1561+ static QPointer<FakeUnityMenuModelCache> theFakeCache;
1562+ QHash<QByteArray, QSharedPointer<UnityMenuModel>> m_models;
1563+};
1564+
1565+#endif // FAKEUNITYMENUMODELCACHE_H
1566
1567=== removed file 'tests/mocks/Unity/Indicators/indicators_fake.qrc'
1568--- tests/mocks/Unity/Indicators/indicators_fake.qrc 2013-06-17 09:02:14 +0000
1569+++ tests/mocks/Unity/Indicators/indicators_fake.qrc 1970-01-01 00:00:00 +0000
1570@@ -1,14 +0,0 @@
1571-<RCC>
1572- <qresource prefix="/tests/indciators">
1573- <file>qml/fake_menu_widget1.qml</file>
1574- <file>qml/fake_menu_widget2.qml</file>
1575- <file>qml/fake_menu_widget3.qml</file>
1576- <file>qml/fake_menu_widget4.qml</file>
1577- <file>qml/fake_menu_widget5.qml</file>
1578- <file>qml/fake_menu_page1.qml</file>
1579- <file>qml/fake_menu_page2.qml</file>
1580- <file>qml/fake_menu_page3.qml</file>
1581- <file>qml/fake_menu_page4.qml</file>
1582- <file>qml/fake_menu_page5.qml</file>
1583- </qresource>
1584-</RCC>
1585
1586=== removed directory 'tests/mocks/Unity/Indicators/qml'
1587=== removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_page1.qml'
1588--- tests/mocks/Unity/Indicators/qml/fake_menu_page1.qml 2014-01-14 16:44:35 +0000
1589+++ tests/mocks/Unity/Indicators/qml/fake_menu_page1.qml 1970-01-01 00:00:00 +0000
1590@@ -1,35 +0,0 @@
1591-/*
1592- * Copyright 2013 Canonical Ltd.
1593- *
1594- * This program is free software; you can redistribute it and/or modify
1595- * it under the terms of the GNU General Public License as published by
1596- * the Free Software Foundation; version 3.
1597- *
1598- * This program is distributed in the hope that it will be useful,
1599- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1600- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1601- * GNU General Public License for more details.
1602- *
1603- * You should have received a copy of the GNU General Public License
1604- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1605- */
1606-
1607-import QtQuick 2.0
1608-import Unity.Indicators 0.1 as Indicators
1609-
1610-Indicators.FakeMenuPage {
1611- id: menu_plugin1
1612-
1613- Rectangle {
1614- id: contents
1615- color: "red"
1616-
1617- height: 150
1618- width: 150
1619-
1620- anchors {
1621- horizontalCenter: parent.horizontalCenter
1622- verticalCenter: parent.verticalCenter
1623- }
1624- }
1625-}
1626
1627=== removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_page2.qml'
1628--- tests/mocks/Unity/Indicators/qml/fake_menu_page2.qml 2014-01-14 16:44:35 +0000
1629+++ tests/mocks/Unity/Indicators/qml/fake_menu_page2.qml 1970-01-01 00:00:00 +0000
1630@@ -1,35 +0,0 @@
1631-/*
1632- * Copyright 2013 Canonical Ltd.
1633- *
1634- * This program is free software; you can redistribute it and/or modify
1635- * it under the terms of the GNU General Public License as published by
1636- * the Free Software Foundation; version 3.
1637- *
1638- * This program is distributed in the hope that it will be useful,
1639- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1640- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1641- * GNU General Public License for more details.
1642- *
1643- * You should have received a copy of the GNU General Public License
1644- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1645- */
1646-
1647-import QtQuick 2.0
1648-import Unity.Indicators 0.1 as Indicators
1649-
1650-Indicators.FakeMenuPage {
1651- id: menu_plugin2
1652-
1653- Rectangle {
1654- id: contents
1655- color: "blue"
1656-
1657- height: 150
1658- width: 150
1659-
1660- anchors {
1661- horizontalCenter: parent.horizontalCenter
1662- verticalCenter: parent.verticalCenter
1663- }
1664- }
1665-}
1666
1667=== removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_page3.qml'
1668--- tests/mocks/Unity/Indicators/qml/fake_menu_page3.qml 2014-01-14 16:44:35 +0000
1669+++ tests/mocks/Unity/Indicators/qml/fake_menu_page3.qml 1970-01-01 00:00:00 +0000
1670@@ -1,35 +0,0 @@
1671-/*
1672- * Copyright 2013 Canonical Ltd.
1673- *
1674- * This program is free software; you can redistribute it and/or modify
1675- * it under the terms of the GNU General Public License as published by
1676- * the Free Software Foundation; version 3.
1677- *
1678- * This program is distributed in the hope that it will be useful,
1679- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1680- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1681- * GNU General Public License for more details.
1682- *
1683- * You should have received a copy of the GNU General Public License
1684- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1685- */
1686-
1687-import QtQuick 2.0
1688-import Unity.Indicators 0.1 as Indicators
1689-
1690-Indicators.FakeMenuPage {
1691- id: menu_plugin3
1692-
1693- Rectangle {
1694- id: contents
1695- color: "yellow"
1696-
1697- height: 150
1698- width: 150
1699-
1700- anchors {
1701- horizontalCenter: parent.horizontalCenter
1702- verticalCenter: parent.verticalCenter
1703- }
1704- }
1705-}
1706
1707=== removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_page4.qml'
1708--- tests/mocks/Unity/Indicators/qml/fake_menu_page4.qml 2014-01-14 16:44:35 +0000
1709+++ tests/mocks/Unity/Indicators/qml/fake_menu_page4.qml 1970-01-01 00:00:00 +0000
1710@@ -1,35 +0,0 @@
1711-/*
1712- * Copyright 2013 Canonical Ltd.
1713- *
1714- * This program is free software; you can redistribute it and/or modify
1715- * it under the terms of the GNU General Public License as published by
1716- * the Free Software Foundation; version 3.
1717- *
1718- * This program is distributed in the hope that it will be useful,
1719- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1720- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1721- * GNU General Public License for more details.
1722- *
1723- * You should have received a copy of the GNU General Public License
1724- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1725- */
1726-
1727-import QtQuick 2.0
1728-import Unity.Indicators 0.1 as Indicators
1729-
1730-Indicators.FakeMenuPage {
1731- id: menu_plugin4
1732-
1733- Rectangle {
1734- id: contents
1735- color: "green"
1736-
1737- height: 150
1738- width: 150
1739-
1740- anchors {
1741- horizontalCenter: parent.horizontalCenter
1742- verticalCenter: parent.verticalCenter
1743- }
1744- }
1745-}
1746
1747=== removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_page5.qml'
1748--- tests/mocks/Unity/Indicators/qml/fake_menu_page5.qml 2014-01-14 16:44:35 +0000
1749+++ tests/mocks/Unity/Indicators/qml/fake_menu_page5.qml 1970-01-01 00:00:00 +0000
1750@@ -1,35 +0,0 @@
1751-/*
1752- * Copyright 2013 Canonical Ltd.
1753- *
1754- * This program is free software; you can redistribute it and/or modify
1755- * it under the terms of the GNU General Public License as published by
1756- * the Free Software Foundation; version 3.
1757- *
1758- * This program is distributed in the hope that it will be useful,
1759- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1760- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1761- * GNU General Public License for more details.
1762- *
1763- * You should have received a copy of the GNU General Public License
1764- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1765- */
1766-
1767-import QtQuick 2.0
1768-import Unity.Indicators 0.1 as Indicators
1769-
1770-Indicators.FakeMenuPage {
1771- id: menu_plugin5
1772-
1773- Rectangle {
1774- id: contents
1775- color: "orange"
1776-
1777- height: 150
1778- width: 150
1779-
1780- anchors {
1781- horizontalCenter: parent.horizontalCenter
1782- verticalCenter: parent.verticalCenter
1783- }
1784- }
1785-}
1786
1787=== removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_widget1.qml'
1788--- tests/mocks/Unity/Indicators/qml/fake_menu_widget1.qml 2013-06-17 09:02:14 +0000
1789+++ tests/mocks/Unity/Indicators/qml/fake_menu_widget1.qml 1970-01-01 00:00:00 +0000
1790@@ -1,23 +0,0 @@
1791-/*
1792- * Copyright 2013 Canonical Ltd.
1793- *
1794- * This program is free software; you can redistribute it and/or modify
1795- * it under the terms of the GNU General Public License as published by
1796- * the Free Software Foundation; version 3.
1797- *
1798- * This program is distributed in the hope that it will be useful,
1799- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1800- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1801- * GNU General Public License for more details.
1802- *
1803- * You should have received a copy of the GNU General Public License
1804- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1805- */
1806-
1807-import QtQuick 2.0
1808-
1809-Rectangle {
1810- width: 40
1811- height: 40
1812- color : "red"
1813-}
1814
1815=== removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml'
1816--- tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml 2014-01-13 16:25:32 +0000
1817+++ tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml 1970-01-01 00:00:00 +0000
1818@@ -1,23 +0,0 @@
1819-/*
1820- * Copyright 2013 Canonical Ltd.
1821- *
1822- * This program is free software; you can redistribute it and/or modify
1823- * it under the terms of the GNU General Public License as published by
1824- * the Free Software Foundation; version 3.
1825- *
1826- * This program is distributed in the hope that it will be useful,
1827- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1828- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1829- * GNU General Public License for more details.
1830- *
1831- * You should have received a copy of the GNU General Public License
1832- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1833- */
1834-
1835-import QtQuick 2.0
1836-
1837-Rectangle {
1838- width: 40
1839- height: 40
1840- color : "blue"
1841-}
1842
1843=== removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml'
1844--- tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml 2014-01-13 16:25:32 +0000
1845+++ tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml 1970-01-01 00:00:00 +0000
1846@@ -1,23 +0,0 @@
1847-/*
1848- * Copyright 2013 Canonical Ltd.
1849- *
1850- * This program is free software; you can redistribute it and/or modify
1851- * it under the terms of the GNU General Public License as published by
1852- * the Free Software Foundation; version 3.
1853- *
1854- * This program is distributed in the hope that it will be useful,
1855- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1856- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1857- * GNU General Public License for more details.
1858- *
1859- * You should have received a copy of the GNU General Public License
1860- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1861- */
1862-
1863-import QtQuick 2.0
1864-
1865-Rectangle {
1866- width: 40
1867- height: 40
1868- color : "yellow"
1869-}
1870
1871=== removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_widget4.qml'
1872--- tests/mocks/Unity/Indicators/qml/fake_menu_widget4.qml 2013-06-17 09:02:14 +0000
1873+++ tests/mocks/Unity/Indicators/qml/fake_menu_widget4.qml 1970-01-01 00:00:00 +0000
1874@@ -1,23 +0,0 @@
1875-/*
1876- * Copyright 2013 Canonical Ltd.
1877- *
1878- * This program is free software; you can redistribute it and/or modify
1879- * it under the terms of the GNU General Public License as published by
1880- * the Free Software Foundation; version 3.
1881- *
1882- * This program is distributed in the hope that it will be useful,
1883- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1884- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1885- * GNU General Public License for more details.
1886- *
1887- * You should have received a copy of the GNU General Public License
1888- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1889- */
1890-
1891-import QtQuick 2.0
1892-
1893-Rectangle {
1894- width: 40
1895- height: 40
1896- color : "green"
1897-}
1898
1899=== removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_widget5.qml'
1900--- tests/mocks/Unity/Indicators/qml/fake_menu_widget5.qml 2013-06-17 09:02:14 +0000
1901+++ tests/mocks/Unity/Indicators/qml/fake_menu_widget5.qml 1970-01-01 00:00:00 +0000
1902@@ -1,23 +0,0 @@
1903-/*
1904- * Copyright 2013 Canonical Ltd.
1905- *
1906- * This program is free software; you can redistribute it and/or modify
1907- * it under the terms of the GNU General Public License as published by
1908- * the Free Software Foundation; version 3.
1909- *
1910- * This program is distributed in the hope that it will be useful,
1911- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1912- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1913- * GNU General Public License for more details.
1914- *
1915- * You should have received a copy of the GNU General Public License
1916- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1917- */
1918-
1919-import QtQuick 2.0
1920-
1921-Rectangle {
1922- width: 40
1923- height: 40
1924- color : "orange"
1925-}
1926
1927=== modified file 'tests/mocks/Unity/Indicators/qmldir'
1928--- tests/mocks/Unity/Indicators/qmldir 2014-08-20 08:39:09 +0000
1929+++ tests/mocks/Unity/Indicators/qmldir 2014-10-15 16:26:15 +0000
1930@@ -3,5 +3,4 @@
1931 typeinfo Indicators.qmltypes
1932
1933 IndicatorsModel 0.1 IndicatorsModel.qml
1934-FakeMenuPage 0.1 FakeMenuPage.qml
1935 RootActionState 0.1 RootActionState.qml
1936
1937=== modified file 'tests/mocks/Unity/Launcher/Launcher.qmltypes'
1938--- tests/mocks/Unity/Launcher/Launcher.qmltypes 2014-06-26 07:47:57 +0000
1939+++ tests/mocks/Unity/Launcher/Launcher.qmltypes 2014-10-15 16:26:15 +0000
1940@@ -85,6 +85,7 @@
1941 Property { name: "recent"; type: "bool"; isReadonly: true }
1942 Property { name: "progress"; type: "int"; isReadonly: true }
1943 Property { name: "count"; type: "int"; isReadonly: true }
1944+ Property { name: "countVisible"; type: "bool"; isReadonly: true }
1945 Property { name: "focused"; type: "bool"; isReadonly: true }
1946 Property {
1947 name: "quickList"
1948@@ -93,6 +94,14 @@
1949 isPointer: true
1950 }
1951 Signal {
1952+ name: "nameChanged"
1953+ Parameter { name: "name"; type: "string" }
1954+ }
1955+ Signal {
1956+ name: "iconChanged"
1957+ Parameter { name: "icon"; type: "string" }
1958+ }
1959+ Signal {
1960 name: "pinnedChanged"
1961 Parameter { name: "pinned"; type: "bool" }
1962 }
1963@@ -113,6 +122,10 @@
1964 Parameter { name: "count"; type: "int" }
1965 }
1966 Signal {
1967+ name: "countVisibleChanged"
1968+ Parameter { name: "countVisible"; type: "bool" }
1969+ }
1970+ Signal {
1971 name: "focusedChanged"
1972 Parameter { name: "focused"; type: "bool" }
1973 }
1974
1975=== modified file 'tests/mocks/Unity/Unity.qmltypes'
1976--- tests/mocks/Unity/Unity.qmltypes 2014-09-01 12:18:53 +0000
1977+++ tests/mocks/Unity/Unity.qmltypes 2014-10-15 16:26:15 +0000
1978@@ -30,6 +30,25 @@
1979 Parameter { name: "row"; type: "int" }
1980 Parameter { name: "role"; type: "int" }
1981 }
1982+ Method {
1983+ name: "setCount"
1984+ Parameter { name: "count"; type: "int" }
1985+ }
1986+ Method {
1987+ name: "resultModel"
1988+ type: "ResultsModel*"
1989+ Parameter { name: "row"; type: "int" }
1990+ }
1991+ Method {
1992+ name: "setLayout"
1993+ Parameter { name: "row"; type: "int" }
1994+ Parameter { name: "layout"; type: "string" }
1995+ }
1996+ Method {
1997+ name: "setHeaderLink"
1998+ Parameter { name: "row"; type: "int" }
1999+ Parameter { name: "headerLink"; type: "string" }
2000+ }
2001 }
2002 Component {
2003 name: "PreviewModel"
2004@@ -66,6 +85,10 @@
2005 exports: ["Unity/FakeResultsModel 0.2", "Unity/ResultsModel 0.2"]
2006 isCreatable: false
2007 exportMetaObjectRevisions: [0, 0]
2008+ Method {
2009+ name: "setResultCount"
2010+ Parameter { name: "result_count"; type: "int" }
2011+ }
2012 }
2013 Component {
2014 name: "Scope"
2015@@ -76,6 +99,15 @@
2016 name: "performQuery"
2017 Parameter { name: "query"; type: "string" }
2018 }
2019+ Signal { name: "refreshed" }
2020+ Method {
2021+ name: "setId"
2022+ Parameter { name: "id"; type: "string" }
2023+ }
2024+ Method {
2025+ name: "setName"
2026+ Parameter { name: "name"; type: "string" }
2027+ }
2028 Method {
2029 name: "setSearchInProgress"
2030 Parameter { name: "inProg"; type: "bool" }
2031
2032=== modified file 'tests/plugins/Unity/Indicators/CMakeLists.txt'
2033--- tests/plugins/Unity/Indicators/CMakeLists.txt 2013-12-10 14:22:43 +0000
2034+++ tests/plugins/Unity/Indicators/CMakeLists.txt 2014-10-15 16:26:15 +0000
2035@@ -40,3 +40,4 @@
2036 indicator_test(menucontentactivatortest ADDITIONAL_CPPS ${INDICATORS_DIR}/menucontentactivator.cpp)
2037 indicator_test(unitymenumodelstacktest ADDITIONAL_CPPS ${TEST_DIR}/mocks/QMenuModel/unitymenumodel.cpp ${INDICATORS_DIR}/unitymenumodelstack.cpp)
2038 indicator_test(rootactionstatetest ADDITIONAL_LIBS IndicatorsQml)
2039+indicator_test(sharedunitymenumodeltest ADDITIONAL_LIBS IndicatorsQml)
2040
2041=== added file 'tests/plugins/Unity/Indicators/sharedunitymenumodeltest.cpp'
2042--- tests/plugins/Unity/Indicators/sharedunitymenumodeltest.cpp 1970-01-01 00:00:00 +0000
2043+++ tests/plugins/Unity/Indicators/sharedunitymenumodeltest.cpp 2014-10-15 16:26:15 +0000
2044@@ -0,0 +1,102 @@
2045+/*
2046+ * Copyright 2014 Canonical Ltd.
2047+ *
2048+ * This program is free software; you can redistribute it and/or modify
2049+ * it under the terms of the GNU Lesser General Public License as published by
2050+ * the Free Software Foundation; version 3.
2051+ *
2052+ * This program is distributed in the hope that it will be useful,
2053+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2054+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2055+ * GNU Lesser General Public License for more details.
2056+ *
2057+ * You should have received a copy of the GNU Lesser General Public License
2058+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2059+ *
2060+ */
2061+
2062+#include "sharedunitymenumodel.h"
2063+#include "unitymenumodelcache.h"
2064+
2065+#include <QtTest>
2066+#include <unitymenumodel.h>
2067+
2068+class SharedUnityMenuModelTest : public QObject
2069+{
2070+ Q_OBJECT
2071+
2072+ SharedUnityMenuModel* createFullModel(const QByteArray& testId)
2073+ {
2074+ SharedUnityMenuModel* model = new SharedUnityMenuModel;
2075+ model->setBusName("com.canonical." + testId);
2076+ model->setMenuObjectPath("/com/canonical/" + testId);
2077+ QVariantMap actions;
2078+ actions["test"] = QString("/com/canonical/%1/actions").arg(QString(testId));
2079+ model->setActions(actions);
2080+
2081+ return model;
2082+ }
2083+
2084+private Q_SLOTS:
2085+
2086+ void testCreateModel()
2087+ {
2088+ QSharedPointer<SharedUnityMenuModel> model(createFullModel("test1"));
2089+ QVERIFY(model->model() != nullptr);
2090+ }
2091+
2092+ void testDifferentDataCreatesDifferentModels()
2093+ {
2094+ QSharedPointer<SharedUnityMenuModel> model1(createFullModel("test1"));
2095+ QSharedPointer<SharedUnityMenuModel> model2(createFullModel("test2"));
2096+
2097+ QVERIFY(model1->model() != model2->model());
2098+ }
2099+
2100+ void testSameDataCreatesSameModels()
2101+ {
2102+ QSharedPointer<SharedUnityMenuModel> model1(createFullModel("test1"));
2103+ QSharedPointer<SharedUnityMenuModel> model2(createFullModel("test1"));
2104+
2105+ QCOMPARE(model1->model(), model2->model());
2106+ }
2107+
2108+ void testSharedOwnership()
2109+ {
2110+ QSharedPointer<SharedUnityMenuModel> model1(createFullModel("test1"));
2111+ QSharedPointer<SharedUnityMenuModel> model2(createFullModel("test1"));
2112+
2113+ QCOMPARE(UnityMenuModelCache::singleton()->contains("/com/canonical/test1"), true);
2114+ model1.clear();
2115+ QCOMPARE(UnityMenuModelCache::singleton()->contains("/com/canonical/test1"), true);
2116+ model2.clear();
2117+ QCOMPARE(UnityMenuModelCache::singleton()->contains("/com/canonical/test1"), false);
2118+ }
2119+
2120+ // Tests that changing cached model data does not change the model path of others
2121+ void testLP1328646()
2122+ {
2123+ QSharedPointer<SharedUnityMenuModel> model1(createFullModel("test1"));
2124+ QSharedPointer<SharedUnityMenuModel> model2(createFullModel("test1"));
2125+
2126+ model2->setMenuObjectPath("/com/canonical/LP1328646");
2127+
2128+ QVERIFY(model1->model() != model2->model());
2129+ QCOMPARE(model1->model()->menuObjectPath(), QByteArray("/com/canonical/test1"));
2130+ QCOMPARE(model2->model()->menuObjectPath(), QByteArray("/com/canonical/LP1328646"));
2131+ }
2132+
2133+ // Tests that the cache is recreated if deleted.
2134+ void testDeletedCache()
2135+ {
2136+ QSharedPointer<SharedUnityMenuModel> model1(createFullModel("test1"));
2137+
2138+ QCOMPARE(UnityMenuModelCache::singleton()->contains("/com/canonical/test1"), true);
2139+ delete UnityMenuModelCache::singleton();
2140+ QCOMPARE(UnityMenuModelCache::singleton()->contains("/com/canonical/test1"), false);
2141+ }
2142+
2143+};
2144+
2145+QTEST_GUILESS_MAIN(SharedUnityMenuModelTest)
2146+#include "sharedunitymenumodeltest.moc"
2147
2148=== modified file 'tests/qmltests/CMakeLists.txt'
2149--- tests/qmltests/CMakeLists.txt 2014-10-01 13:22:00 +0000
2150+++ tests/qmltests/CMakeLists.txt 2014-10-15 16:26:15 +0000
2151@@ -19,9 +19,9 @@
2152 set(qmltest_DEFAULT_NO_ADD_TEST TRUE)
2153 set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "LC_ALL=C")
2154
2155-add_qml_test(. Shell ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
2156-add_qml_test(. ShellWithPin ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single-pin")
2157-add_qml_test(. TabletShell ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full")
2158+add_qml_test(. Shell ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single:${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
2159+add_qml_test(. ShellWithPin ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single-pin:${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
2160+add_qml_test(. TabletShell ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full:${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
2161 add_qml_test(Components Background)
2162 add_qml_test(Components Carousel)
2163 add_qml_test(Components DraggingArea)
2164@@ -72,14 +72,13 @@
2165 add_qml_test(Notifications Notifications)
2166 add_qml_test(Notifications VisualSnapDecisionsQueue)
2167 add_qml_test(Panel ActiveCallHint)
2168-add_qml_test(Panel IndicatorRow)
2169-add_qml_test(Panel Indicators)
2170-add_qml_test(Panel MenuContent)
2171-add_qml_test(Panel Panel)
2172+add_qml_test(Panel IndicatorRow ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
2173+add_qml_test(Panel Indicators ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
2174+add_qml_test(Panel MenuContent ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
2175+add_qml_test(Panel Panel ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
2176 add_qml_test(Panel SearchIndicator)
2177 add_qml_test(Panel/Indicators DefaultIndicatorWidget ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
2178 add_qml_test(Panel/Indicators DefaultIndicatorPage ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
2179-add_qml_test(Panel/Indicators CachedUnityMenuModel ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
2180 # These MenuItemFactory tests need the test/mocks/ to come before plugins/
2181 add_qml_test(Panel/Indicators MenuItemFactory IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks ${qmltest_DEFAULT_IMPORT_PATHS})
2182 add_qml_test(Panel/Indicators MessageMenuItemFactory IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks ${qmltest_DEFAULT_IMPORT_PATHS})
2183
2184=== modified file 'tests/qmltests/Greeter/tst_Clock.qml'
2185--- tests/qmltests/Greeter/tst_Clock.qml 2014-05-01 14:25:18 +0000
2186+++ tests/qmltests/Greeter/tst_Clock.qml 2014-10-15 16:26:15 +0000
2187@@ -19,7 +19,7 @@
2188 import ".."
2189 import "../../../qml/Greeter"
2190 import Ubuntu.Components 0.1
2191-import QMenuModel 0.1
2192+import Unity.Indicators 0.1 as Indicators
2193 import Unity.Test 0.1 as UT
2194
2195 Rectangle {
2196@@ -36,56 +36,73 @@
2197 }
2198 }
2199
2200- UnityMenuModel {
2201- id: menuModel
2202- modelData: [{
2203- "rowData": {
2204- "actionState": { "label": Qt.formatTime(new Date("October 13, 1975 11:13:00")) }
2205- }
2206- }]
2207+ function updateDatetimeModelTime(label) {
2208+ Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicator.datetime",
2209+ "/com/canonical/indicator/datetime/phone",
2210+ "/com/canonical/indicator/datetime",
2211+ [{
2212+ "rowData": {
2213+ "actionState": { "label": label }
2214+ }
2215+ }]);
2216 }
2217
2218 UT.UnityTestCase {
2219 name: "Clock"
2220+ when: windowShown
2221
2222 function init() {
2223- var cachedModel = findChild(clock, "timeModel");
2224- verify(cachedModel !== undefined);
2225- cachedModel.model = menuModel;
2226- }
2227-
2228- function test_customDate() {
2229- var dateObj = new Date("October 13, 1975 11:13:00")
2230- var dateString = Qt.formatDate(dateObj, Qt.DefaultLocaleLongDate)
2231- var timeString = Qt.formatTime(dateObj)
2232-
2233- clock.currentDate = dateObj
2234- var dateLabel = findChild(clock, "dateLabel")
2235- compare(dateLabel.text, dateString, "Not the expected date")
2236- var timeLabel = findChild(clock, "timeLabel")
2237- compare(timeLabel.text, timeString, "Not the expected time")
2238- }
2239-
2240- function test_dateUpdate() {
2241- var dateObj = new Date("October 13, 1975 11:13:00")
2242- var dateString = Qt.formatDate(dateObj, Qt.DefaultLocaleLongDate)
2243- var timeString = Qt.formatTime(dateObj)
2244-
2245+ updateDatetimeModelTime(Qt.formatTime(new Date("October 13, 1975 12:14:00")));
2246+ clock.visible = true;
2247+ }
2248+
2249+ // Test that the date portion of the clock updates with custom value.
2250+ // Time portion is controlled by indicators
2251+ function test_updateDate() {
2252+ var dateLabel = findChild(clock, "dateLabel");
2253+ var timeLabel = findChild(clock, "timeLabel");
2254+
2255+ var timeString = Qt.formatTime(new Date("October 13, 1975 12:14:00"));
2256+
2257+ // initial date.
2258+ var dateObj = new Date("October 13, 1975 11:13:00");
2259+ var dateString = Qt.formatDate(dateObj, Qt.DefaultLocaleLongDate);
2260+ clock.currentDate = dateObj;
2261+
2262+ compare(dateLabel.text, dateString, "Not the expected date");
2263+ compare(timeLabel.text, timeString, "Time should come from indicators");
2264+
2265+ // update date.
2266+ var dateObj2 = new Date("October 14, 1976 13:15:00");
2267+ var dateString2 = Qt.formatDate(dateObj2, Qt.DefaultLocaleLongDate);
2268+ clock.currentDate = dateObj2;
2269+
2270+ compare(dateLabel.text, dateString2, "Not the expected date");
2271+ compare(timeLabel.text,timeString, "Time should come from indicators");
2272+ }
2273+
2274+ // Test that the date portion of the clock updates with custom value.
2275+ // Time portion is controlled by indicators
2276+ function test_updateTime() {
2277+ var timeLabel = findChild(clock, "timeLabel");
2278+
2279+ var timeString1 = Qt.formatTime(new Date("October 13, 1975 11:15:00"));
2280+ var timeString2 = Qt.formatTime(new Date("October 14, 1976 12:16:00"));
2281+
2282+ updateDatetimeModelTime(timeString1);
2283+ compare(timeLabel.text, timeString1, "Time should come from indicators");
2284+
2285+ updateDatetimeModelTime(timeString2);
2286+ compare(timeLabel.text, timeString2, "Time should come from indicators");
2287+ }
2288+
2289+ function test_indicatorDisconnect() {
2290 clock.visible = false
2291 var timeModel = findInvisibleChild(clock, "timeModel")
2292-
2293 compare(timeModel.menuObjectPath, "", "Clock shouldn't be connected to Indicators when not visible.")
2294
2295- clock.currentDate = dateObj
2296-
2297- var dateLabel = findChild(clock, "dateLabel")
2298- compare(dateLabel.text, dateString, "Not the expected date")
2299- var timeLabel = findChild(clock, "timeLabel")
2300- compare(timeLabel.text, timeString, "Not the expected time")
2301-
2302 clock.visible = true
2303-
2304- verify(timeModel.menuObjectPath != "", "Should be connected to Indicators.")
2305+ verify(timeModel.menuObjectPath !== "", "Should be connected to Indicators.")
2306 }
2307 }
2308 }
2309
2310=== removed file 'tests/qmltests/Panel/Indicators/tst_CachedUnityMenuModel.qml'
2311--- tests/qmltests/Panel/Indicators/tst_CachedUnityMenuModel.qml 2014-08-20 09:16:28 +0000
2312+++ tests/qmltests/Panel/Indicators/tst_CachedUnityMenuModel.qml 1970-01-01 00:00:00 +0000
2313@@ -1,137 +0,0 @@
2314-/*
2315- * Copyright 2014 Canonical Ltd.
2316- *
2317- * This program is free software; you can redistribute it and/or modify
2318- * it under the terms of the GNU General Public License as published by
2319- * the Free Software Foundation; version 3.
2320- *
2321- * This program is distributed in the hope that it will be useful,
2322- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2323- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2324- * GNU General Public License for more details.
2325- *
2326- * You should have received a copy of the GNU General Public License
2327- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2328- */
2329-
2330-import QtQuick 2.0
2331-import QtTest 1.0
2332-import Unity.Test 0.1 as UT
2333-import QMenuModel 0.1
2334-import Unity.Indicators 0.1 as Indicators
2335-import "../../../../qml/Panel/Indicators"
2336-
2337-Item {
2338- id: root
2339- width: units.gu(40)
2340- height: units.gu(70)
2341-
2342- Component {
2343- id: model
2344- CachedUnityMenuModel {}
2345- }
2346-
2347- UT.UnityTestCase {
2348- name: "CachedUnityMenuModel"
2349- when: windowShown
2350-
2351- function cleanup() {
2352- doGC();
2353- }
2354-
2355- function doGC() {
2356- // need to put some wait cycles here to get gc going properly.
2357- wait(10);
2358- gc();
2359- wait(10);
2360- }
2361-
2362- function test_createDifferent() {
2363- var cachedObject = model.createObject(null,
2364- {
2365- "busName": "com.canonical.test1",
2366- "menuObjectPath": "/com/canonical/test1",
2367- "actionsObjectPath": "/com/canonical/test1"
2368- });
2369-
2370- var cachedObject2 = model.createObject(null,
2371- {
2372- "busName": "com.canonical.test2",
2373- "menuObjectPath": "/com/canonical/test2",
2374- "actionsObjectPath": "/com/canonical/test2"
2375- });
2376-
2377- verify(cachedObject.model !== cachedObject2.model);
2378- }
2379-
2380- function test_createSame() {
2381- var cachedObject = model.createObject(null,
2382- {
2383- "busName": "com.canonical.test3",
2384- "menuObjectPath": "/com/canonical/test3",
2385- "actionsObjectPath": "/com/canonical/test3"
2386- });
2387-
2388- var cachedObject2 = model.createObject(null,
2389- {
2390- "busName": "com.canonical.test3",
2391- "menuObjectPath": "/com/canonical/test3",
2392- "actionsObjectPath": "/com/canonical/test3"
2393- });
2394-
2395- verify(cachedObject.model === cachedObject2.model);
2396- }
2397-
2398- // Tests that changing cached model data does not change the model path of others
2399- function test_lp1328646() {
2400- var cachedObject = model.createObject(null,
2401- {
2402- "busName": "com.canonical.test4",
2403- "menuObjectPath": "/com/canonical/test4",
2404- "actionsObjectPath": "/com/canonical/test4"
2405- });
2406-
2407- var cachedObject2 = model.createObject(null,
2408- {
2409- "busName": "com.canonical.test4",
2410- "menuObjectPath": "/com/canonical/test4",
2411- "actionsObjectPath": "/com/canonical/test4"
2412- });
2413-
2414- cachedObject.menuObjectPath = "/com/canonical/test5";
2415- compare(cachedObject.model.menuObjectPath, "/com/canonical/test5");
2416- compare(cachedObject2.model.menuObjectPath, "/com/canonical/test4");
2417-
2418- verify(cachedObject.model !== cachedObject2.model);
2419- }
2420-
2421- function createAndDestroy(test) {
2422- var cachedObject = model.createObject(null,
2423- {
2424- "busName": "com.canonical."+test,
2425- "menuObjectPath": "/com/canonical/"+test,
2426- "actionsObjectPath": "/com/canonical/"+test
2427- });
2428- var cachedObject2 = model.createObject(null,
2429- {
2430- "busName": "com.canonical."+test,
2431- "menuObjectPath": "/com/canonical/"+test,
2432- "actionsObjectPath": "/com/canonical/"+test
2433- });
2434- cachedObject.destroy();
2435- return cachedObject2;
2436- }
2437-
2438- function test_destroyAllDeletesModel() {
2439- createAndDestroy("test6");
2440- doGC();
2441- compare(Indicators.UnityMenuModelCache.contains("/com/canonical/test6"), false);
2442- }
2443-
2444- function test_destroyPartialKeepsModel() {
2445- var model = createAndDestroy("test7");
2446- doGC();
2447- compare(Indicators.UnityMenuModelCache.contains("/com/canonical/test7"), true);
2448- }
2449- }
2450-}
2451
2452=== modified file 'tests/qmltests/Panel/Indicators/tst_DefaultIndicatorPage.qml'
2453--- tests/qmltests/Panel/Indicators/tst_DefaultIndicatorPage.qml 2014-09-29 10:24:58 +0000
2454+++ tests/qmltests/Panel/Indicators/tst_DefaultIndicatorPage.qml 2014-10-15 16:26:15 +0000
2455@@ -17,7 +17,7 @@
2456 import QtQuick 2.0
2457 import QtTest 1.0
2458 import Unity.Test 0.1 as UT
2459-import QMenuModel 0.1
2460+import Unity.Indicators 0.1 as Indicators
2461 import "../../../../qml/Panel/Indicators"
2462
2463 Item {
2464@@ -25,18 +25,14 @@
2465 width: units.gu(40)
2466 height: units.gu(70)
2467
2468- DefaultIndicatorPage {
2469+ DefaultIndicatorPage {
2470 id: page
2471-
2472 anchors.fill: parent
2473
2474- menuModel: UnityMenuModel {}
2475- busName: "test"
2476- actionsObjectPath: "test"
2477- menuObjectPath: "test"
2478-
2479 identifier: "test-indicator"
2480- rootMenuType: "com.canonical.indicator.root"
2481+ busName: "com.caninical.indicator.test"
2482+ actionsObjectPath: "/com/canonical/indicator/test"
2483+ menuObjectPath: "/com/canonical/indicator/test"
2484 }
2485
2486 property var fullMenuData: [{
2487@@ -113,29 +109,30 @@
2488 "submenu": []
2489 }]; // end row 1
2490
2491+ function initializeMenuData(data) {
2492+ Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicator.test",
2493+ "/com/canonical/indicator/test",
2494+ "/com/canonical/indicator/test",
2495+ data);
2496+ }
2497+
2498 UT.UnityTestCase {
2499 name: "DefaultIndicatorPage"
2500
2501 function init() {
2502- var mainMenu = findChild(page, "mainMenu");
2503- page.menuModel.modelData = [];
2504- verify(mainMenu.model !== null);
2505+ initializeMenuData([]);
2506 }
2507
2508 function test_reloadData() {
2509 var mainMenu = findChild(page, "mainMenu");
2510
2511- page.menuModel.modelData = [];
2512- tryCompare(mainMenu, "count", 0);
2513-
2514- page.menuModel.modelData = fullMenuData;
2515- tryCompare(mainMenu, "count", 3);
2516-
2517- page.menuModel.modelData = [];
2518- tryCompare(mainMenu, "count", 0);
2519-
2520- page.menuModel.modelData = fullMenuData;
2521- tryCompare(mainMenu, "count", 3);
2522+ tryCompare(mainMenu, "count", 0);
2523+
2524+ initializeMenuData(fullMenuData);
2525+ tryCompare(mainMenu, "count", 3);
2526+
2527+ initializeMenuData([]);
2528+ tryCompare(mainMenu, "count", 0);
2529 }
2530
2531 function test_traverse_rootMenuType_data() {
2532@@ -147,7 +144,7 @@
2533
2534 function test_traverse_rootMenuType(data) {
2535 page.rootMenuType = data.rootMenuType;
2536- page.menuModel.modelData = fullMenuData;
2537+ initializeMenuData(fullMenuData);
2538
2539 var mainMenu = findChild(page, "mainMenu");
2540 tryCompare(mainMenu, "count", data.expectedCount);
2541
2542=== modified file 'tests/qmltests/Panel/Indicators/tst_DefaultIndicatorWidget.qml'
2543--- tests/qmltests/Panel/Indicators/tst_DefaultIndicatorWidget.qml 2014-07-03 13:46:51 +0000
2544+++ tests/qmltests/Panel/Indicators/tst_DefaultIndicatorWidget.qml 2014-10-15 16:26:15 +0000
2545@@ -33,7 +33,6 @@
2546 top: parent.top
2547 }
2548
2549- menuModel: UnityMenuModel {}
2550 busName: "test"
2551 actionsObjectPath: "test"
2552 deviceMenuObjectPath: "test"
2553@@ -48,13 +47,6 @@
2554 name: "DefaultIndicatorWidget"
2555 when: windowShown
2556
2557- function init() {
2558- widget.rootActionState.icons = [];
2559- widget.rootActionState.leftLabel = "";
2560- widget.rootActionState.rightLabel = "";
2561- waitForRendering(widget)
2562- }
2563-
2564 // FIXME: add tests
2565 }
2566 }
2567
2568=== modified file 'tests/qmltests/Panel/tst_IndicatorItem.qml'
2569--- tests/qmltests/Panel/tst_IndicatorItem.qml 2014-01-07 14:29:23 +0000
2570+++ tests/qmltests/Panel/tst_IndicatorItem.qml 2014-10-15 16:26:15 +0000
2571@@ -43,7 +43,7 @@
2572
2573 function test_empty() {
2574 compare(indicatorItem.indicatorVisible, false, "IndicatorItem should not be visible.");
2575- indicatorItem.widgetSource = "qrc:/tests/indciators/qml/fake_menu_widget1.qml";
2576+ indicatorItem.widgetSource = "../../../qml/Panel/Indicators/DefaultIndicatorWidget.qml";
2577 tryCompare(indicatorItem, "indicatorVisible", true);
2578 }
2579 }
2580
2581=== modified file 'tests/qmltests/Panel/tst_IndicatorRow.qml'
2582--- tests/qmltests/Panel/tst_IndicatorRow.qml 2014-03-03 11:55:00 +0000
2583+++ tests/qmltests/Panel/tst_IndicatorRow.qml 2014-10-15 16:26:15 +0000
2584@@ -30,15 +30,6 @@
2585 width: units.gu(40)
2586 height: units.gu(60)
2587
2588- function init_test()
2589- {
2590- indicatorModel.load("test1");
2591-
2592- indicatorRow.state = "initial";
2593- indicatorRow.setCurrentItemIndex(-1);
2594- indicatorRow.unitProgress = 0.0;
2595- }
2596-
2597 PanelBackground {
2598 anchors.fill: indicatorRow
2599 }
2600@@ -63,20 +54,33 @@
2601 name: "IndicatorRow"
2602 when: windowShown
2603
2604+ function init() {
2605+ indicatorModel.load("test1");
2606+
2607+ indicatorRow.state = "initial";
2608+ indicatorRow.setCurrentItemIndex(-1);
2609+ indicatorRow.unitProgress = 0.0;
2610+ }
2611+
2612 function get_indicator_item(index) {
2613 return findChild(indicatorRow.row, "item" + index);
2614 }
2615
2616 function test_set_current_item() {
2617- init_test();
2618 indicatorRow.setCurrentItemIndex(0);
2619- compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier), "indicator-fake1", "Incorrect item at position 0");
2620+ compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier),
2621+ "indicator-fake1",
2622+ "Incorrect item at position 0");
2623
2624 indicatorRow.setCurrentItemIndex(1);
2625- compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier), "indicator-fake2", "Incorrect item at position 1");
2626+ compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier),
2627+ "indicator-fake2",
2628+ "Incorrect item at position 1");
2629
2630 indicatorRow.setCurrentItemIndex(2);
2631- compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier), "indicator-fake3", "Incorrect item at position 2");
2632+ compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier),
2633+ "indicator-fake3",
2634+ "Incorrect item at position 2");
2635 }
2636
2637 function test_highlight_data() {
2638@@ -93,8 +97,6 @@
2639 }
2640
2641 function test_highlight(data) {
2642- init_test();
2643-
2644 indicatorRow.unitProgress = data.progress;
2645 indicatorRow.setCurrentItemIndex(data.index);
2646
2647@@ -119,8 +121,6 @@
2648 }
2649
2650 function test_opacity(data) {
2651- init_test();
2652-
2653 indicatorRow.unitProgress = data.progress;
2654 indicatorRow.setCurrentItemIndex(data.index);
2655
2656@@ -145,8 +145,6 @@
2657 }
2658
2659 function test_dimmed(data) {
2660- init_test();
2661-
2662 indicatorRow.unitProgress = data.progress;
2663 indicatorRow.setCurrentItemIndex(data.index);
2664
2665
2666=== modified file 'tests/qmltests/Panel/tst_Indicators.qml'
2667--- tests/qmltests/Panel/tst_Indicators.qml 2014-07-30 16:01:09 +0000
2668+++ tests/qmltests/Panel/tst_Indicators.qml 2014-10-15 16:26:15 +0000
2669@@ -158,6 +158,7 @@
2670 function init_invisible_indicator(identifier) {
2671 tryCompareFunction(function() { return findChild(indicators, identifier+"-delegate") !== undefined }, true);
2672 var item = findChild(indicators, identifier+"-delegate");
2673+ verify(item !== null);
2674
2675 item.enabled = false;
2676 }
2677
2678=== modified file 'tests/qmltests/Panel/tst_MenuContent.qml'
2679--- tests/qmltests/Panel/tst_MenuContent.qml 2014-09-09 15:10:52 +0000
2680+++ tests/qmltests/Panel/tst_MenuContent.qml 2014-10-15 16:26:15 +0000
2681@@ -26,14 +26,6 @@
2682 width: units.gu(40)
2683 height: units.gu(70)
2684
2685- property var indicator_status: {
2686- 'indicator-fake1-page': { 'started': false, 'reset': 0 },
2687- 'indicator-fake2-page': { 'started': false, 'reset': 0 },
2688- 'indicator-fake3-page': { 'started': false, 'reset': 0 },
2689- 'indicator-fake4-page': { 'started': false, 'reset': 0 },
2690- 'indicator-fake5-page': { 'started': false, 'reset': 0 }
2691- }
2692-
2693 // Dummy objects
2694 Item { id: greeter }
2695 Item { id: handle }
2696
2697=== modified file 'tests/qmltests/tst_Shell.qml'
2698--- tests/qmltests/tst_Shell.qml 2014-10-06 16:39:10 +0000
2699+++ tests/qmltests/tst_Shell.qml 2014-10-15 16:26:15 +0000
2700@@ -65,6 +65,8 @@
2701 property bool itemDestroyed: false
2702 sourceComponent: Component {
2703 Shell {
2704+ property string indicatorProfile: "phone"
2705+
2706 Component.onDestruction: {
2707 shellLoader.itemDestroyed = true;
2708 }
2709
2710=== modified file 'tests/qmltests/tst_ShellWithPin.qml'
2711--- tests/qmltests/tst_ShellWithPin.qml 2014-10-01 13:22:00 +0000
2712+++ tests/qmltests/tst_ShellWithPin.qml 2014-10-15 16:26:15 +0000
2713@@ -56,6 +56,8 @@
2714 property bool itemDestroyed: false
2715 sourceComponent: Component {
2716 Shell {
2717+ property string indicatorProfile: "phone"
2718+
2719 Component.onDestruction: {
2720 shellLoader.itemDestroyed = true
2721 }
2722
2723=== modified file 'tests/qmltests/tst_TabletShell.qml'
2724--- tests/qmltests/tst_TabletShell.qml 2014-10-08 20:36:48 +0000
2725+++ tests/qmltests/tst_TabletShell.qml 2014-10-15 16:26:15 +0000
2726@@ -56,6 +56,8 @@
2727 property bool itemDestroyed: false
2728 sourceComponent: Component {
2729 Shell {
2730+ property string indicatorProfile: "phone"
2731+
2732 Component.onDestruction: {
2733 shellLoader.itemDestroyed = true
2734 }

Subscribers

People subscribed via source and target branches

to all changes: