Merge lp:~mterry/unity8/notify-authenticated into lp:unity8

Proposed by Michael Terry
Status: Superseded
Proposed branch: lp:~mterry/unity8/notify-authenticated
Merge into: lp:unity8
Diff against target: 558 lines (+368/-1)
21 files modified
plugins/LightDM/Greeter.cpp (+2/-0)
plugins/LightDM/Greeter.h (+2/-1)
plugins/Ubuntu/CMakeLists.txt (+1/-0)
plugins/Ubuntu/Connectivity/CMakeLists.txt (+10/-0)
plugins/Ubuntu/Connectivity/Connectivity.cpp (+33/-0)
plugins/Ubuntu/Connectivity/Connectivity.h (+33/-0)
plugins/Ubuntu/Connectivity/Connectivity.qmltypes (+17/-0)
plugins/Ubuntu/Connectivity/plugin.cpp (+34/-0)
plugins/Ubuntu/Connectivity/plugin.h (+31/-0)
plugins/Ubuntu/Connectivity/qmldir (+3/-0)
qml/Notifications/NotificationMenuItemFactory.qml (+5/-0)
qml/Shell.qml (+5/-0)
tests/mocks/Ubuntu/CMakeLists.txt (+1/-0)
tests/mocks/Ubuntu/Connectivity/CMakeLists.txt (+10/-0)
tests/mocks/Ubuntu/Connectivity/Connectivity.qmltypes (+18/-0)
tests/mocks/Ubuntu/Connectivity/MockConnectivity.cpp (+27/-0)
tests/mocks/Ubuntu/Connectivity/MockConnectivity.h (+36/-0)
tests/mocks/Ubuntu/Connectivity/plugin.cpp (+34/-0)
tests/mocks/Ubuntu/Connectivity/plugin.h (+31/-0)
tests/mocks/Ubuntu/Connectivity/qmldir (+3/-0)
tests/qmltests/tst_Shell.qml (+32/-0)
To merge this branch: bzr merge lp:~mterry/unity8/notify-authenticated
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Albert Astals Cid (community) Approve
Review via email: mp+231022@code.launchpad.net

This proposal has been superseded by a proposal from 2014-08-21.

Commit message

Always keep indicator/launcher locked state in sync with whether the user is authenticated. (LP:# 1357230)

Description of the change

Always keep indicator/launcher locked state in sync with whether the user is authenticated. (LP:# 1357230)

One of the properties used to determine whether the shell is locked was not notifiable for qml. This branch fixes that.

== Checklist ==

 * 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?
 - NA

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

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Test and fixes the issue.

Do you think an auto test for this makes sense?

review: Needs Information
Revision history for this message
Michael Terry (mterry) wrote :

> Do you think an auto test for this makes sense?

I didn't think so, because it felt like testing too small a piece. Like, we don't generally have tests to make sure a NOTIFY call works for other properties.

That said, I'd be happy to add one.

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

Sure, i didn't mean testing the signal works, that we know, i mean something like testing that the swiping of the greeter works.

Revision history for this message
Michael Terry (mterry) wrote :

There is a test added in https://code.launchpad.net/~mterry/unity8/interactive-while-locked/+merge/231253 for checking whether the indicators and/or launcher are enabled by default and respond to changes.

1163. By Michael Terry

Merge from trunk

1164. By Michael Terry

Add a small test to confirm that unlocked properties are correct

Revision history for this message
Michael Terry (mterry) wrote :

OK, added a test to check the unlocked property and whether the edges are enabled as they should be.

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

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

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

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1165. By Michael Terry

Merge from sim-unlock-on-boot

1166. By Michael Terry

Re-merge from sim-unlock-on-boot with its lifecycle merge

Unmerged revisions

1166. By Michael Terry

Re-merge from sim-unlock-on-boot with its lifecycle merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/LightDM/Greeter.cpp'
2--- plugins/LightDM/Greeter.cpp 2014-08-01 13:42:18 +0000
3+++ plugins/LightDM/Greeter.cpp 2014-08-21 14:47:14 +0000
4@@ -106,6 +106,7 @@
5 }
6
7 d->m_greeter->authenticate(username);
8+ Q_EMIT isAuthenticatedChanged();
9 Q_EMIT authenticationUserChanged(username);
10 }
11
12@@ -150,5 +151,6 @@
13 Q_EMIT promptlessChanged();
14 }
15
16+ Q_EMIT isAuthenticatedChanged();
17 Q_EMIT authenticationComplete();
18 }
19
20=== modified file 'plugins/LightDM/Greeter.h'
21--- plugins/LightDM/Greeter.h 2014-08-01 13:42:18 +0000
22+++ plugins/LightDM/Greeter.h 2014-08-21 14:47:14 +0000
23@@ -35,7 +35,7 @@
24 Q_OBJECT
25
26 Q_PROPERTY(bool active READ isActive WRITE setIsActive NOTIFY isActiveChanged)
27- Q_PROPERTY(bool authenticated READ isAuthenticated)
28+ Q_PROPERTY(bool authenticated READ isAuthenticated NOTIFY isAuthenticatedChanged)
29 Q_PROPERTY(QString authenticationUser READ authenticationUser NOTIFY authenticationUserChanged)
30 Q_PROPERTY(bool promptless READ promptless NOTIFY promptlessChanged)
31
32@@ -59,6 +59,7 @@
33 void authenticationComplete();
34 void authenticationUserChanged(const QString &user);
35 void isActiveChanged();
36+ void isAuthenticatedChanged();
37 void promptlessChanged();
38 void showGreeter();
39
40
41=== modified file 'plugins/Ubuntu/CMakeLists.txt'
42--- plugins/Ubuntu/CMakeLists.txt 2014-07-30 11:08:29 +0000
43+++ plugins/Ubuntu/CMakeLists.txt 2014-08-21 14:47:14 +0000
44@@ -1,3 +1,4 @@
45+add_subdirectory(Connectivity)
46 add_subdirectory(Gestures)
47 add_subdirectory(DownloadDaemonListener)
48 add_subdirectory(Payments)
49
50=== added directory 'plugins/Ubuntu/Connectivity'
51=== added file 'plugins/Ubuntu/Connectivity/CMakeLists.txt'
52--- plugins/Ubuntu/Connectivity/CMakeLists.txt 1970-01-01 00:00:00 +0000
53+++ plugins/Ubuntu/Connectivity/CMakeLists.txt 2014-08-21 14:47:14 +0000
54@@ -0,0 +1,10 @@
55+set(CONNECTIVITY_SOURCES
56+ plugin.cpp
57+ Connectivity.cpp
58+)
59+
60+add_library(Connectivity MODULE ${CONNECTIVITY_SOURCES})
61+
62+qt5_use_modules(Connectivity Qml DBus Core)
63+
64+add_unity8_plugin(Ubuntu.Connectivity 0.1 Ubuntu/Connectivity TARGETS Connectivity)
65
66=== added file 'plugins/Ubuntu/Connectivity/Connectivity.cpp'
67--- plugins/Ubuntu/Connectivity/Connectivity.cpp 1970-01-01 00:00:00 +0000
68+++ plugins/Ubuntu/Connectivity/Connectivity.cpp 2014-08-21 14:47:14 +0000
69@@ -0,0 +1,33 @@
70+/*
71+ * Copyright (C) 2014 Canonical, Ltd.
72+ *
73+ * This program is free software; you can redistribute it and/or modify
74+ * it under the terms of the GNU General Public License as published by
75+ * the Free Software Foundation; version 3.
76+ *
77+ * This program is distributed in the hope that it will be useful,
78+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
79+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
80+ * GNU General Public License for more details.
81+ *
82+ * You should have received a copy of the GNU General Public License
83+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
84+ */
85+
86+#include "Connectivity.h"
87+#include <QDBusConnection>
88+#include <QDBusInterface>
89+#include <QDBusPendingCall>
90+
91+Connectivity::Connectivity(QObject *parent)
92+ : QObject(parent)
93+{
94+}
95+
96+void Connectivity::unlockAllModems()
97+{
98+ QDBusInterface iface("com.ubuntu.connectivity1",
99+ "/com/ubuntu/connectivity1/Private",
100+ "com.ubuntu.connectivity1.Private");
101+ iface.asyncCall("UnlockAllModems");
102+}
103
104=== added file 'plugins/Ubuntu/Connectivity/Connectivity.h'
105--- plugins/Ubuntu/Connectivity/Connectivity.h 1970-01-01 00:00:00 +0000
106+++ plugins/Ubuntu/Connectivity/Connectivity.h 2014-08-21 14:47:14 +0000
107@@ -0,0 +1,33 @@
108+/*
109+ * Copyright (C) 2014 Canonical, Ltd.
110+ *
111+ * This program is free software; you can redistribute it and/or modify
112+ * it under the terms of the GNU General Public License as published by
113+ * the Free Software Foundation; version 3.
114+ *
115+ * This program is distributed in the hope that it will be useful,
116+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
117+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
118+ * GNU General Public License for more details.
119+ *
120+ * You should have received a copy of the GNU General Public License
121+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
122+ */
123+
124+#ifndef CONNECTIVITY_H
125+#define CONNECTIVITY_H
126+
127+#include <QObject>
128+
129+class Connectivity : public QObject
130+{
131+ Q_OBJECT
132+ Q_DISABLE_COPY(Connectivity)
133+
134+public:
135+ explicit Connectivity(QObject *parent = 0);
136+
137+ Q_INVOKABLE void unlockAllModems();
138+};
139+
140+#endif // CONNECTIVITY_H
141
142=== added file 'plugins/Ubuntu/Connectivity/Connectivity.qmltypes'
143--- plugins/Ubuntu/Connectivity/Connectivity.qmltypes 1970-01-01 00:00:00 +0000
144+++ plugins/Ubuntu/Connectivity/Connectivity.qmltypes 2014-08-21 14:47:14 +0000
145@@ -0,0 +1,17 @@
146+import QtQuick.tooling 1.1
147+
148+// This file describes the plugin-supplied types contained in the library.
149+// It is used for QML tooling purposes only.
150+//
151+// This file was auto-generated by:
152+// 'qmlplugindump -notrelocatable Ubuntu.Connectivity 0.1 plugins'
153+
154+Module {
155+ Component {
156+ name: "Connectivity"
157+ prototype: "QObject"
158+ exports: ["Ubuntu.Connectivity/Connectivity 0.1"]
159+ exportMetaObjectRevisions: [0]
160+ Method { name: "unlockAllModems" }
161+ }
162+}
163
164=== added file 'plugins/Ubuntu/Connectivity/plugin.cpp'
165--- plugins/Ubuntu/Connectivity/plugin.cpp 1970-01-01 00:00:00 +0000
166+++ plugins/Ubuntu/Connectivity/plugin.cpp 2014-08-21 14:47:14 +0000
167@@ -0,0 +1,34 @@
168+/*
169+ * Copyright (C) 2014 Canonical, Ltd.
170+ *
171+ * This program is free software; you can redistribute it and/or modify
172+ * it under the terms of the GNU General Public License as published by
173+ * the Free Software Foundation; version 3.
174+ *
175+ * This program is distributed in the hope that it will be useful,
176+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
177+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
178+ * GNU General Public License for more details.
179+ *
180+ * You should have received a copy of the GNU General Public License
181+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
182+ */
183+
184+#include "plugin.h"
185+#include "Connectivity.h"
186+
187+#include <QtQml>
188+
189+static QObject *service_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
190+{
191+ Q_UNUSED(engine)
192+ Q_UNUSED(scriptEngine)
193+ return new Connectivity();
194+}
195+
196+void BackendPlugin::registerTypes(const char *uri)
197+{
198+ Q_ASSERT(uri == QLatin1String("Ubuntu.Connectivity"));
199+
200+ qmlRegisterSingletonType<Connectivity>(uri, 0, 1, "Connectivity", service_provider);
201+}
202
203=== added file 'plugins/Ubuntu/Connectivity/plugin.h'
204--- plugins/Ubuntu/Connectivity/plugin.h 1970-01-01 00:00:00 +0000
205+++ plugins/Ubuntu/Connectivity/plugin.h 2014-08-21 14:47:14 +0000
206@@ -0,0 +1,31 @@
207+/*
208+ * Copyright (C) 2014 Canonical, Ltd.
209+ *
210+ * This program is free software; you can redistribute it and/or modify
211+ * it under the terms of the GNU General Public License as published by
212+ * the Free Software Foundation; version 3.
213+ *
214+ * This program is distributed in the hope that it will be useful,
215+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
216+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
217+ * GNU General Public License for more details.
218+ *
219+ * You should have received a copy of the GNU General Public License
220+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
221+ */
222+
223+#ifndef CONNECTIVITY_PLUGIN_H
224+#define CONNECTIVITY_PLUGIN_H
225+
226+#include <QQmlExtensionPlugin>
227+
228+class BackendPlugin : public QQmlExtensionPlugin
229+{
230+ Q_OBJECT
231+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
232+
233+public:
234+ void registerTypes(const char *uri);
235+};
236+
237+#endif // CONNECTIVITY_PLUGIN_H
238
239=== added file 'plugins/Ubuntu/Connectivity/qmldir'
240--- plugins/Ubuntu/Connectivity/qmldir 1970-01-01 00:00:00 +0000
241+++ plugins/Ubuntu/Connectivity/qmldir 2014-08-21 14:47:14 +0000
242@@ -0,0 +1,3 @@
243+module Ubuntu.Connectivity
244+plugin Connectivity
245+typeinfo Connectivity.qmltypes
246
247=== modified file 'qml/Notifications/NotificationMenuItemFactory.qml'
248--- qml/Notifications/NotificationMenuItemFactory.qml 2014-08-14 01:28:23 +0000
249+++ qml/Notifications/NotificationMenuItemFactory.qml 2014-08-21 14:47:14 +0000
250@@ -127,6 +127,11 @@
251 onCancel: {
252 menuModel.activate(menuIndex, false);
253 }
254+
255+ onEmergencyCall: {
256+ shell.activateApplication("dialer-app")
257+ menuModel.activate(menuIndex, false)
258+ }
259 }
260 }
261 }
262
263=== modified file 'qml/Shell.qml'
264--- qml/Shell.qml 2014-08-20 09:19:32 +0000
265+++ qml/Shell.qml 2014-08-21 14:47:14 +0000
266@@ -20,6 +20,7 @@
267 import Unity.Application 0.1
268 import Ubuntu.Components 0.1
269 import Ubuntu.Components.Popups 1.0
270+import Ubuntu.Connectivity 0.1
271 import Ubuntu.Gestures 0.1
272 import Ubuntu.SystemImage 0.1
273 import Unity.Launcher 0.1
274@@ -416,6 +417,10 @@
275 }
276 }
277
278+ Component.onCompleted: {
279+ Connectivity.unlockAllModems()
280+ }
281+
282 onUnlocked: greeter.hide()
283 onSelected: {
284 // Update launcher items for new user
285
286=== modified file 'tests/mocks/Ubuntu/CMakeLists.txt'
287--- tests/mocks/Ubuntu/CMakeLists.txt 2014-07-30 11:08:29 +0000
288+++ tests/mocks/Ubuntu/CMakeLists.txt 2014-08-21 14:47:14 +0000
289@@ -1,3 +1,4 @@
290+add_subdirectory(Connectivity)
291 add_subdirectory(DownloadDaemonListener)
292 add_subdirectory(Payments)
293 add_subdirectory(SystemImage)
294
295=== added directory 'tests/mocks/Ubuntu/Connectivity'
296=== added file 'tests/mocks/Ubuntu/Connectivity/CMakeLists.txt'
297--- tests/mocks/Ubuntu/Connectivity/CMakeLists.txt 1970-01-01 00:00:00 +0000
298+++ tests/mocks/Ubuntu/Connectivity/CMakeLists.txt 2014-08-21 14:47:14 +0000
299@@ -0,0 +1,10 @@
300+set(MOCK_CONNECTIVITY_SOURCES
301+ plugin.cpp
302+ MockConnectivity.cpp
303+)
304+
305+add_library(MockConnectivity MODULE ${MOCK_CONNECTIVITY_SOURCES})
306+
307+qt5_use_modules(MockConnectivity Qml Quick Core)
308+
309+add_unity8_mock(Ubuntu.Connectivity 0.1 Ubuntu/Connectivity TARGETS MockConnectivity)
310
311=== added file 'tests/mocks/Ubuntu/Connectivity/Connectivity.qmltypes'
312--- tests/mocks/Ubuntu/Connectivity/Connectivity.qmltypes 1970-01-01 00:00:00 +0000
313+++ tests/mocks/Ubuntu/Connectivity/Connectivity.qmltypes 2014-08-21 14:47:14 +0000
314@@ -0,0 +1,18 @@
315+import QtQuick.tooling 1.1
316+
317+// This file describes the plugin-supplied types contained in the library.
318+// It is used for QML tooling purposes only.
319+//
320+// This file was auto-generated by:
321+// 'qmlplugindump -notrelocatable Ubuntu.Connectivity 0.1 plugins'
322+
323+Module {
324+ Component {
325+ name: "MockConnectivity"
326+ prototype: "QObject"
327+ exports: ["Ubuntu.Connectivity/Connectivity 0.1"]
328+ exportMetaObjectRevisions: [0]
329+ Signal { name: "unlockingAllModems" }
330+ Method { name: "unlockAllModems" }
331+ }
332+}
333
334=== added file 'tests/mocks/Ubuntu/Connectivity/MockConnectivity.cpp'
335--- tests/mocks/Ubuntu/Connectivity/MockConnectivity.cpp 1970-01-01 00:00:00 +0000
336+++ tests/mocks/Ubuntu/Connectivity/MockConnectivity.cpp 2014-08-21 14:47:14 +0000
337@@ -0,0 +1,27 @@
338+/*
339+ * Copyright (C) 2014 Canonical, Ltd.
340+ *
341+ * This program is free software; you can redistribute it and/or modify
342+ * it under the terms of the GNU General Public License as published by
343+ * the Free Software Foundation; version 3.
344+ *
345+ * This program is distributed in the hope that it will be useful,
346+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
347+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
348+ * GNU General Public License for more details.
349+ *
350+ * You should have received a copy of the GNU General Public License
351+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
352+ */
353+
354+#include "MockConnectivity.h"
355+
356+MockConnectivity::MockConnectivity(QObject *parent)
357+ : QObject(parent)
358+{
359+}
360+
361+void MockConnectivity::unlockAllModems()
362+{
363+ Q_EMIT unlockingAllModems();
364+}
365
366=== added file 'tests/mocks/Ubuntu/Connectivity/MockConnectivity.h'
367--- tests/mocks/Ubuntu/Connectivity/MockConnectivity.h 1970-01-01 00:00:00 +0000
368+++ tests/mocks/Ubuntu/Connectivity/MockConnectivity.h 2014-08-21 14:47:14 +0000
369@@ -0,0 +1,36 @@
370+/*
371+ * Copyright (C) 2014 Canonical, Ltd.
372+ *
373+ * This program is free software; you can redistribute it and/or modify
374+ * it under the terms of the GNU General Public License as published by
375+ * the Free Software Foundation; version 3.
376+ *
377+ * This program is distributed in the hope that it will be useful,
378+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
379+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
380+ * GNU General Public License for more details.
381+ *
382+ * You should have received a copy of the GNU General Public License
383+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
384+ */
385+
386+#ifndef MOCK_CONNECTIVITY_H
387+#define MOCK_CONNECTIVITY_H
388+
389+#include <QObject>
390+
391+class MockConnectivity : public QObject
392+{
393+ Q_OBJECT
394+ Q_DISABLE_COPY(MockConnectivity)
395+
396+public:
397+ explicit MockConnectivity(QObject *parent = 0);
398+
399+ Q_INVOKABLE void unlockAllModems();
400+
401+Q_SIGNALS:
402+ void unlockingAllModems(); // only for mock
403+};
404+
405+#endif // MOCK_CONNECTIVITY_H
406
407=== added file 'tests/mocks/Ubuntu/Connectivity/plugin.cpp'
408--- tests/mocks/Ubuntu/Connectivity/plugin.cpp 1970-01-01 00:00:00 +0000
409+++ tests/mocks/Ubuntu/Connectivity/plugin.cpp 2014-08-21 14:47:14 +0000
410@@ -0,0 +1,34 @@
411+/*
412+ * Copyright (C) 2014 Canonical, Ltd.
413+ *
414+ * This program is free software; you can redistribute it and/or modify
415+ * it under the terms of the GNU General Public License as published by
416+ * the Free Software Foundation; version 3.
417+ *
418+ * This program is distributed in the hope that it will be useful,
419+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
420+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
421+ * GNU General Public License for more details.
422+ *
423+ * You should have received a copy of the GNU General Public License
424+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
425+ */
426+
427+#include "plugin.h"
428+#include "MockConnectivity.h"
429+
430+#include <QtQml>
431+
432+static QObject *service_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
433+{
434+ Q_UNUSED(engine)
435+ Q_UNUSED(scriptEngine)
436+ return new MockConnectivity();
437+}
438+
439+void BackendPlugin::registerTypes(const char *uri)
440+{
441+ Q_ASSERT(uri == QLatin1String("Ubuntu.Connectivity"));
442+
443+ qmlRegisterSingletonType<MockConnectivity>(uri, 0, 1, "Connectivity", service_provider);
444+}
445
446=== added file 'tests/mocks/Ubuntu/Connectivity/plugin.h'
447--- tests/mocks/Ubuntu/Connectivity/plugin.h 1970-01-01 00:00:00 +0000
448+++ tests/mocks/Ubuntu/Connectivity/plugin.h 2014-08-21 14:47:14 +0000
449@@ -0,0 +1,31 @@
450+/*
451+ * Copyright (C) 2014 Canonical, Ltd.
452+ *
453+ * This program is free software; you can redistribute it and/or modify
454+ * it under the terms of the GNU General Public License as published by
455+ * the Free Software Foundation; version 3.
456+ *
457+ * This program is distributed in the hope that it will be useful,
458+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
459+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
460+ * GNU General Public License for more details.
461+ *
462+ * You should have received a copy of the GNU General Public License
463+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
464+ */
465+
466+#ifndef MOCK_CONNECTIVITY_PLUGIN_H
467+#define MOCK_CONNECTIVITY_PLUGIN_H
468+
469+#include <QQmlExtensionPlugin>
470+
471+class BackendPlugin : public QQmlExtensionPlugin
472+{
473+ Q_OBJECT
474+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
475+
476+public:
477+ void registerTypes(const char *uri);
478+};
479+
480+#endif // MOCK_CONNECTIVITY_PLUGIN_H
481
482=== added file 'tests/mocks/Ubuntu/Connectivity/qmldir'
483--- tests/mocks/Ubuntu/Connectivity/qmldir 1970-01-01 00:00:00 +0000
484+++ tests/mocks/Ubuntu/Connectivity/qmldir 2014-08-21 14:47:14 +0000
485@@ -0,0 +1,3 @@
486+module Ubuntu.Connectivity
487+plugin MockConnectivity
488+typeinfo Connectivity.qmltypes
489
490=== modified file 'tests/qmltests/tst_Shell.qml'
491--- tests/qmltests/tst_Shell.qml 2014-07-29 11:35:10 +0000
492+++ tests/qmltests/tst_Shell.qml 2014-08-21 14:47:14 +0000
493@@ -21,6 +21,7 @@
494 import QtTest 1.0
495 import GSettings 1.0
496 import LightDM 0.1 as LightDM
497+import Ubuntu.Connectivity 0.1
498 import Unity.Application 0.1
499 import Unity.Test 0.1 as UT
500 import Powerd 0.1
501@@ -28,6 +29,7 @@
502 import "../../qml"
503
504 Item {
505+ id: root
506 width: shell.width
507 height: shell.height
508
509@@ -51,6 +53,11 @@
510 id: shell
511 }
512
513+ Component {
514+ id: shellComponent
515+ Shell {}
516+ }
517+
518 SignalSpy {
519 id: sessionSpy
520 signalName: "sessionStarted"
521@@ -61,6 +68,12 @@
522 signalName: "setCurrentScopeCalled"
523 }
524
525+ SignalSpy {
526+ id: unlockAllModemsSpy
527+ target: Connectivity
528+ signalName: "unlockingAllModems"
529+ }
530+
531 UT.UnityTestCase {
532 name: "Shell"
533 when: windowShown
534@@ -431,5 +444,24 @@
535
536 touchRelease(shell);
537 }
538+
539+ function test_unlockedProperties() {
540+ // Confirm that various properties have the correct values when unlocked
541+ tryCompare(shell, "locked", false)
542+
543+ var launcher = findChild(shell, "launcher")
544+ tryCompare(launcher, "available", true)
545+
546+ var indicators = findChild(shell, "indicators")
547+ tryCompare(indicators, "available", true)
548+ }
549+
550+ function test_unlockAllModemsOnBoot() {
551+ unlockAllModemsSpy.clear()
552+ // actually create an object so we notice the onCompleted signal
553+ var greeter = shellComponent.createObject(root)
554+ tryCompare(unlockAllModemsSpy, "count", 1)
555+ greeter.destroy()
556+ }
557 }
558 }

Subscribers

People subscribed via source and target branches