Merge lp:~jonas-drange/ubuntu-system-settings/hotspots-new-design into lp:ubuntu-system-settings

Proposed by Jonas G. Drange
Status: Merged
Approved by: Ken VanDine
Approved revision: 1523
Merged at revision: 1505
Proposed branch: lp:~jonas-drange/ubuntu-system-settings/hotspots-new-design
Merge into: lp:ubuntu-system-settings
Diff against target: 1291 lines (+670/-291)
18 files modified
debian/control (+3/-3)
plugins/CMakeLists.txt (+1/-0)
plugins/cellular/CMakeLists.txt (+0/-3)
plugins/cellular/Components/MultiSim.qml (+0/-19)
plugins/cellular/Components/SingleSim.qml (+0/-24)
plugins/cellular/cellular.settings (+1/-3)
plugins/hotspot/CMakeLists.txt (+12/-0)
plugins/hotspot/HotspotSetup.qml (+34/-7)
plugins/hotspot/PageComponent.qml (+114/-76)
plugins/hotspot/hotspot.settings (+18/-0)
plugins/hotspot/qmldir (+2/-0)
plugins/hotspot/settings-hotspot.svg (+182/-0)
tests/autopilot/ubuntu_system_settings/__init__.py (+46/-48)
tests/autopilot/ubuntu_system_settings/tests/__init__.py (+3/-1)
tests/autopilot/ubuntu_system_settings/tests/connectivity.py (+16/-2)
tests/autopilot/ubuntu_system_settings/tests/test_cellular.py (+1/-105)
tests/autopilot/ubuntu_system_settings/tests/test_hotspot.py (+230/-0)
tests/autopilot/ubuntu_system_settings/tests/test_plugins.py (+7/-0)
To merge this branch: bzr merge lp:~jonas-drange/ubuntu-system-settings/hotspots-new-design
Reviewer Review Type Date Requested Status
Ken VanDine Approve
PS Jenkins bot continuous-integration Needs Fixing
Jonas G. Drange Pending
Review via email: mp+268064@code.launchpad.net

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

Commit message

[hotspot] fixes ui bugs. Depends on suru-icon-theme 14.04+15.04.20150813~ to get the new hotspot icon. Depends on qml-module-ubuntu-connectivity (>= 0.5.3) to get new connectivity bindings.

Description of the change

[hotspot] fixes ui bugs. Depends on suru-icon-theme 14.04+15.04.20150813~ to get the new hotspot icon. Depends on qml-module-ubuntu-connectivity (>= 0.5.3) to get new connectivity bindings.

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

prune mp

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1514. By Jonas G. Drange

use lower case prop names for consistency and cut the USC prop sync

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1515. By Jonas G. Drange

we don't need to toggle the hotspot switch directly after enabling wifi. Also, we need to listen for change events directly for the switch to work properly.

1516. By Jonas G. Drange

we need a newer suru icon theme for the hotspot icon

1517. By Jonas G. Drange

improve the logic here

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)
1518. By Jonas G. Drange

use new lower case names

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

This branch is reverting your autopilot fixes in test_phone.py

review: Needs Fixing
1519. By Jonas G. Drange

revert phone changes, and use flightMode flag

1520. By Jonas G. Drange

revert indicatornetwork stuff we don't use

Revision history for this message
Ken VanDine (ken-vandine) wrote :

See comments inline

review: Needs Fixing
Revision history for this message
Ken VanDine (ken-vandine) :
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)
1521. By Jonas G. Drange

no 1.3 imports

1522. By Jonas G. Drange

unpollute diff

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)
1523. By Jonas G. Drange

bump package dep

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

Looks great!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2015-07-16 09:22:42 +0000
3+++ debian/control 2015-08-17 21:56:41 +0000
4@@ -23,7 +23,7 @@
5 libunity-api-dev,
6 libupower-glib-dev,
7 pkg-config,
8- qml-module-ubuntu-connectivity (>= 0.5.2),
9+ qml-module-ubuntu-connectivity (>= 0.5.3),
10 qt5-default,
11 qtbase5-dev,
12 qtdeclarative5-dev,
13@@ -71,7 +71,7 @@
14 powerd (>= 0.15) | gnome-settings-daemon,
15 qmenumodel-qml,
16 qtdeclarative5-folderlistmodel-plugin,
17- qml-module-ubuntu-connectivity (>= 0.5.2),
18+ qml-module-ubuntu-connectivity (>= 0.5.3),
19 qml-module-qtmultimedia | qml-module-qtmultimedia-gles,
20 qtdeclarative5-gsettings1.0 (>=0.1+14.10.20140801.1),
21 qtdeclarative5-ofono0.2 (>=0.70~),
22@@ -79,7 +79,7 @@
23 qtdeclarative5-ubuntu-content1,
24 qtdeclarative5-ubuntu-settings-components (>> 0.6),
25 qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 1.1.1347) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 1.1.1347),
26- suru-icon-theme,
27+ suru-icon-theme (>= 14.04+15.04.20150813~),
28 whoopsie-preferences (>= 0.9),
29 libsystemsettings1 (= ${binary:Version}),
30 system-image-dbus (>= 2.5),
31
32=== modified file 'plugins/CMakeLists.txt'
33--- plugins/CMakeLists.txt 2014-07-09 01:05:29 +0000
34+++ plugins/CMakeLists.txt 2015-08-17 21:56:41 +0000
35@@ -9,6 +9,7 @@
36 add_subdirectory(cellular)
37 add_subdirectory(example)
38 add_subdirectory(flight-mode)
39+add_subdirectory(hotspot)
40 add_subdirectory(language)
41 add_subdirectory(notifications)
42 add_subdirectory(orientation-lock)
43
44=== modified file 'plugins/cellular/CMakeLists.txt'
45--- plugins/cellular/CMakeLists.txt 2015-08-06 10:33:16 +0000
46+++ plugins/cellular/CMakeLists.txt 2015-08-17 21:56:41 +0000
47@@ -7,15 +7,12 @@
48 apn_manager.js
49 apn_editor.js
50 carriers.js
51- Common.qml
52 PageApnEditor.qml
53 PageChooseApn.qml
54 PageChooseCarrier.qml
55 PageCarrierAndApn.qml
56 PageCarriersAndApns.qml
57 PageComponent.qml
58- Hotspot.qml
59- HotspotSetup.qml
60 sims.js
61 )
62
63
64=== modified file 'plugins/cellular/Components/MultiSim.qml'
65--- plugins/cellular/Components/MultiSim.qml 2015-07-24 20:00:06 +0000
66+++ plugins/cellular/Components/MultiSim.qml 2015-08-17 21:56:41 +0000
67@@ -53,25 +53,6 @@
68 anchors { left: parent.left; right: parent.right }
69 }
70
71- ListItem.SingleValue {
72- text : i18n.tr("Hotspot disabled because Wi-Fi is off.")
73- visible: !hotspotItem.visible &&
74- UpdateManager.deviceName !== "mako"
75- }
76-
77- ListItem.SingleValue {
78- id: hotspotItem
79- text: i18n.tr("Wi-Fi hotspot")
80- progression: true
81- onClicked: {
82- pageStack.push(Qt.resolvedUrl("../Hotspot.qml"))
83- }
84- visible: (actionGroup.actionObject.valid ?
85- actionGroup.actionObject.state : false) &&
86- UpdateManager.deviceName !== "mako"
87-
88- }
89-
90 ListItem.Standard {
91 id: dataUsage
92 text: i18n.tr("Data usage statistics")
93
94=== modified file 'plugins/cellular/Components/SingleSim.qml'
95--- plugins/cellular/Components/SingleSim.qml 2015-07-24 20:00:06 +0000
96+++ plugins/cellular/Components/SingleSim.qml 2015-08-17 21:56:41 +0000
97@@ -22,11 +22,6 @@
98 import Ubuntu.Components 0.1
99 import Ubuntu.Components.ListItems 0.1 as ListItem
100
101-/* This is a temporary solution to the issue of Hotspots failing on mako. If
102-the device is mako, we hide the hotspot entry. Will be removed once lp:1434591
103-has been resolved. */
104-import Ubuntu.SystemSettings.Update 1.0
105-
106 Column {
107
108 objectName: "singleSim"
109@@ -64,25 +59,6 @@
110 }
111 }
112
113- ListItem.SingleValue {
114- text : i18n.tr("Hotspot disabled because Wi-Fi is off.")
115- visible: !hotspotItem.visible &&
116- UpdateManager.deviceName !== "mako"
117- }
118-
119- ListItem.SingleValue {
120- id: hotspotItem
121- objectName: "hotspotEntry"
122- text: i18n.tr("Wi-Fi hotspot")
123- progression: true
124- onClicked: {
125- pageStack.push(Qt.resolvedUrl("../Hotspot.qml"))
126- }
127- visible: (actionGroup.actionObject.valid ?
128- actionGroup.actionObject.state : false) &&
129- UpdateManager.deviceName !== "mako"
130- }
131-
132 ListItem.Standard {
133 text: i18n.tr("Data usage statistics")
134 progression: true
135
136=== modified file 'plugins/cellular/cellular.settings'
137--- plugins/cellular/cellular.settings 2015-08-10 09:27:01 +0000
138+++ plugins/cellular/cellular.settings 2015-08-17 21:56:41 +0000
139@@ -20,9 +20,7 @@
140 "lte",
141 "apn",
142 "roam",
143- "sim",
144- "hotspot",
145- "tethering"
146+ "sim"
147 ],
148 "has-dynamic-keywords": false,
149 "has-dynamic-visibility": false,
150
151=== added directory 'plugins/hotspot'
152=== added file 'plugins/hotspot/CMakeLists.txt'
153--- plugins/hotspot/CMakeLists.txt 1970-01-01 00:00:00 +0000
154+++ plugins/hotspot/CMakeLists.txt 2015-08-17 21:56:41 +0000
155@@ -0,0 +1,12 @@
156+set(QML_SOURCES
157+ Common.qml
158+ HotspotSetup.qml
159+ PageComponent.qml
160+)
161+
162+set(PLUG_DIR ${PLUGIN_PRIVATE_MODULE_DIR}/Ubuntu/SystemSettings/Hotspot)
163+
164+install(FILES qmldir DESTINATION ${PLUG_DIR})
165+install(FILES hotspot.settings DESTINATION ${PLUGIN_MANIFEST_DIR})
166+install(FILES settings-hotspot.svg DESTINATION ${PLUGIN_MANIFEST_DIR}/icons)
167+install(FILES ${QML_SOURCES} DESTINATION ${PLUGIN_QML_DIR}/hotspot)
168
169=== renamed file 'plugins/cellular/Common.qml' => 'plugins/hotspot/Common.qml'
170=== renamed file 'plugins/cellular/HotspotSetup.qml' => 'plugins/hotspot/HotspotSetup.qml'
171--- plugins/cellular/HotspotSetup.qml 2015-08-10 20:04:29 +0000
172+++ plugins/hotspot/HotspotSetup.qml 2015-08-17 21:56:41 +0000
173@@ -132,6 +132,10 @@
174 target: confirmButton
175 enabled: false
176 }
177+ PropertyChanges {
178+ target: enableWifiCaption
179+ visible: false
180+ }
181 }
182 ]
183
184@@ -208,6 +212,16 @@
185 }
186 }
187
188+ ListItem.Caption {
189+ id: enableWifiCaption
190+ anchors {
191+ left: parent.left
192+ right: parent.right
193+ }
194+ text: i18n.tr("In order to create a hotspot, you need to turn Wi-Fi on.")
195+ visible: !Connectivity.wifiEnabled && !hotspotSetupDialog.stored
196+ }
197+
198 Row {
199
200 anchors {
201@@ -230,11 +244,14 @@
202 objectName: "confirmButton"
203 width: (parent.width / 2) - units.gu(1)
204 text: hotspotSetupDialog.stored ? i18n.tr("Change") :
205- i18n.tr("Enable")
206+ i18n.tr("Start")
207 enabled: settingsValid()
208 activeFocusOnPress: false
209 onClicked: {
210- if (hotspotSetupDialog.stored) {
211+ if (!Connectivity.wifiEnabled &&
212+ !hotspotSetupDialog.stored) {
213+ enableWifiAction.trigger();
214+ } else if (hotspotSetupDialog.stored) {
215 changeAction.trigger()
216 } else {
217 enableAction.trigger();
218@@ -259,12 +276,22 @@
219 height: parent.height - units.gu(1.5)
220 }
221 }
222-
223- Button {
224- visible: showAllUI
225- // TRANSLATORS: This string is hidden.
226- text: i18n.tr("Start")
227+ }
228+ }
229+
230+ Action {
231+ id: enableWifiAction
232+ onTriggered: {
233+ hotspotSetupDialog.state = "STARTING";
234+
235+ // As soon as Wi-Fi has been turned on, trigger enableAction.
236+ function wifiUpdated (updated) {
237+ Connectivity.wifiEnabledUpdated.disconnect(wifiUpdated);
238+ enableAction.trigger();
239 }
240+
241+ Connectivity.wifiEnabledUpdated.connect(wifiUpdated);
242+ Connectivity.wifiEnabled = true;
243 }
244 }
245
246
247=== renamed file 'plugins/cellular/Hotspot.qml' => 'plugins/hotspot/PageComponent.qml'
248--- plugins/cellular/Hotspot.qml 2015-08-10 20:04:29 +0000
249+++ plugins/hotspot/PageComponent.qml 2015-08-17 21:56:41 +0000
250@@ -1,7 +1,9 @@
251 /*
252 * This file is part of system-settings
253 *
254- * Copyright (C) 2014 Canonical Ltd.
255+ * Copyright (C) 2014-2015 Canonical Ltd.
256+ *
257+ * Contact: Jonas G. Drange <jonas.drange@canonical.com>
258 *
259 * This program is free software: you can redistribute it and/or modify it
260 * under the terms of the GNU General Public License version 3, as published
261@@ -22,95 +24,129 @@
262 import Ubuntu.Components.ListItems 0.1 as ListItem
263 import Ubuntu.Components.Popups 0.1
264 import Ubuntu.Connectivity 1.0
265-import Ubuntu.Settings.Components 0.1 as USC
266-import Ubuntu.SystemSettings.Cellular 1.0
267+
268+/* This is a temporary solution to the issue of Hotspots failing on mako. If
269+the device is mako, we hide the hotspot entry. Will be removed once lp:1434591
270+has been resolved. */
271+import Ubuntu.SystemSettings.Update 1.0
272
273 ItemPage {
274
275- id: hotspot
276+ id: root
277 objectName: "hotspotPage"
278-
279- // TRANSLATORS: “Hotspot” is hidden.
280- title: showAllUI ? i18n.tr("Hotspot") : i18n.tr("Wi-Fi hotspot")
281-
282- // We disable the back action while a hotspot is in the process of either
283- // being enabled or disabled.
284- head.backAction: Action {
285- iconName: "back"
286- enabled: !Connectivity.unstoppableOperationHappening
287- onTriggered: {
288- pageStack.pop();
289+ title: i18n.tr("Hotspot")
290+
291+ states: [
292+ State {
293+ name: "disabled"
294+ // Undefined WifiEnabled means Connectivity is unavailable.
295+ // Disable for mako (see lp:1434591).
296+ when: (typeof Connectivity.wifiEnabled === "undefined" ||
297+ UpdateManager.deviceName === "mako") ||
298+ Connectivity.FlightMode
299+ PropertyChanges {
300+ target: hotspotItem
301+ enabled: false
302+ }
303+ PropertyChanges {
304+ target: hotspotSetupButton
305+ enabled: false
306+ }
307+ },
308+ State {
309+ name: "nowifi"
310+ when: Connectivity.wifiEnabled === false
311+ PropertyChanges {
312+ target: hotspotSwitchWhenWifiDisabled
313+ visible: true
314+ }
315 }
316- }
317+ ]
318
319 Loader {
320 id: setup
321 asynchronous: false
322 }
323
324- Column {
325+ Flickable {
326+ id: flick
327
328 anchors.fill: parent
329- spacing: units.gu(2)
330-
331- ListItem.Standard {
332- text: i18n.tr("Hotspot")
333- enabled: Connectivity.hotspotStored
334- control: Switch {
335- id: hotspotSwitch
336- objectName: "hotspotSwitch"
337- enabled: !switchSync.syncWaiting
338-
339- USC.ServerPropertySynchroniser {
340- id: switchSync
341- userTarget: hotspotSwitch
342- userProperty: "checked"
343- serverTarget: Connectivity
344- serverProperty: "hotspotEnabled"
345- useWaitBuffer: true
346-
347- // Since this blocks the UI thread, we wait until
348- // the UI has completed the checkbox animation before we
349- // ask the server to uipdate.
350- onSyncTriggered: {
351- triggerTimer.value = value;
352- triggerTimer.start();
353- }
354- }
355-
356- Timer {
357- id: triggerTimer
358- property bool value
359- interval: 250; repeat: false
360- onTriggered: Connectivity.hotspotEnabled = value
361- }
362- }
363- }
364-
365- ListItem.Caption {
366+ contentWidth: parent.width
367+ contentHeight: contentItem.childrenRect.height
368+ boundsBehavior: (contentHeight > root.height) ?
369+ Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
370+
371+ Column {
372 anchors {
373 left: parent.left
374 right: parent.right
375- leftMargin: units.gu(2)
376- rightMargin: units.gu(2)
377- }
378- text : hotspotSwitch.stored ?
379- i18n.tr("When hotspot is on, other devices can use your cellular data connection over Wi-Fi. Normal data charges apply.")
380- : i18n.tr("Other devices can use your cellular data connection over the Wi-Fi network. Normal data charges apply.")
381+ }
382+ spacing: units.gu(1)
383+
384+ ListItem.Standard {
385+ id: hotspotItem
386+ text: i18n.tr("Hotspot")
387+ enabled: Connectivity.hotspotStored
388+ onClicked: hotspotSwitch.trigger()
389+ control: Switch {
390+ id: hotspotSwitch
391+ objectName: "hotspotSwitch"
392+ enabled: parent.enabled
393+ checked: Connectivity.hotspotEnabled
394+ onTriggered: Connectivity.hotspotEnabled = checked
395+
396+ // Catch taps if Wi-Fi is disable and prompt user.
397+ MouseArea {
398+ id: hotspotSwitchWhenWifiDisabled
399+ anchors.fill: parent
400+ visible: false
401+ onClicked: enableWifiAction.diag = PopupUtils.open(
402+ enableWifiDialog
403+ );
404+ }
405+ }
406+ }
407+
408+ ListItem.Caption {
409+ anchors {
410+ left: parent.left
411+ right: parent.right
412+ }
413+ text : Connectivity.hotspotStored ?
414+ i18n.tr("When hotspot is on, other devices can use your cellular data connection over Wi-Fi. Normal data charges apply.")
415+ : i18n.tr("Other devices can use your cellular data connection over the Wi-Fi network. Normal data charges apply.")
416+ }
417+
418+ Button {
419+ id: hotspotSetupButton
420+ objectName: "hotspotSetupButton"
421+ anchors.horizontalCenter: parent.horizontalCenter
422+ width: parent.width - units.gu(4)
423+ text: Connectivity.hotspotStored ?
424+ i18n.tr("Change password/setup…") : i18n.tr("Set up hotspot…")
425+ onClicked: {
426+ setup.setSource(Qt.resolvedUrl("HotspotSetup.qml"));
427+ PopupUtils.open(setup.item, root, {});
428+ }
429+ }
430 }
431-
432- Button {
433- objectName: "hotspotSetupEntry"
434- anchors.horizontalCenter: parent.horizontalCenter
435- width: parent.width - units.gu(4)
436- text: Connectivity.hotspotStored ?
437- i18n.tr("Change password/setup…") : i18n.tr("Set up hotspot…")
438-
439- onClicked: {
440- setup.setSource(Qt.resolvedUrl("HotspotSetup.qml"));
441- PopupUtils.open(setup.item, hotspot, {
442- });
443+ }
444+
445+ Action {
446+ id: enableWifiAction
447+ property var diag
448+ onTriggered: {
449+ // As soon as Wi-Fi has been turned on, enable the hotspot.
450+ function wifiUpdated (updated) {
451+ Connectivity.wifiEnabledUpdated.disconnect(wifiUpdated);
452+ Connectivity.hotspotEnabled = true;
453+ PopupUtils.close(diag);
454 }
455+
456+ Connectivity.wifiEnabledUpdated.connect(wifiUpdated);
457+ hotspotSwitch.checked = true;
458+ Connectivity.wifiEnabled = true;
459 }
460 }
461
462@@ -119,11 +155,8 @@
463 Dialog {
464 id: dialogue
465 objectName: "enableWifiDialog"
466- // TRANSLATORS: This string is hidden.
467 title: i18n.tr("Wi-Fi is off")
468- // TRANSLATORS: This string is hidden.
469 text: i18n.tr("In order to create a hotspot, you need to turn Wi-Fi on.")
470- visible: showAllUI
471
472 Button {
473 text: i18n.tr("Cancel")
474@@ -132,9 +165,14 @@
475
476 Button {
477 objectName: "confirmEnable"
478- // TRANSLATORS: This string is hidden.
479 text: i18n.tr("Turn on Wi-Fi")
480+ onClicked: enableWifiAction.trigger()
481 }
482 }
483 }
484+
485+ Connections {
486+ target: Connectivity
487+ onHotspotEnabledUpdated: hotspotSwitch.checked = target.hotspotEnabled
488+ }
489 }
490
491=== added file 'plugins/hotspot/hotspot.settings'
492--- plugins/hotspot/hotspot.settings 1970-01-01 00:00:00 +0000
493+++ plugins/hotspot/hotspot.settings 2015-08-17 21:56:41 +0000
494@@ -0,0 +1,18 @@
495+{
496+ "icon": "preferences-network-hotspot-symbolic",
497+ "name": "Hotspot",
498+ "translations": "ubuntu-system-settings",
499+ "category": "network",
500+ "priority": 2,
501+ "form-factors": [
502+ "phone"
503+ ],
504+ "keywords": [
505+ "network",
506+ "hotspot",
507+ "tethering"
508+ ],
509+ "has-dynamic-keywords": false,
510+ "has-dynamic-visibility": false,
511+ "page-component": "PageComponent.qml"
512+}
513
514=== added file 'plugins/hotspot/qmldir'
515--- plugins/hotspot/qmldir 1970-01-01 00:00:00 +0000
516+++ plugins/hotspot/qmldir 2015-08-17 21:56:41 +0000
517@@ -0,0 +1,2 @@
518+module Ubuntu.SystemSettings.Hotspot
519+plugin UbuntuHotspotPanel
520
521=== added file 'plugins/hotspot/settings-hotspot.svg'
522--- plugins/hotspot/settings-hotspot.svg 1970-01-01 00:00:00 +0000
523+++ plugins/hotspot/settings-hotspot.svg 2015-08-17 21:56:41 +0000
524@@ -0,0 +1,182 @@
525+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
526+<!-- Created with Inkscape (http://www.inkscape.org/) -->
527+
528+<svg
529+ xmlns:dc="http://purl.org/dc/elements/1.1/"
530+ xmlns:cc="http://creativecommons.org/ns#"
531+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
532+ xmlns:svg="http://www.w3.org/2000/svg"
533+ xmlns="http://www.w3.org/2000/svg"
534+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
535+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
536+ width="96"
537+ height="96"
538+ id="svg4874"
539+ version="1.1"
540+ inkscape:version="0.91+devel r"
541+ viewBox="0 0 96 96.000001"
542+ sodipodi:docname="preferences-network-hotspot-symbolic.svg">
543+ <defs
544+ id="defs4876" />
545+ <sodipodi:namedview
546+ id="base"
547+ pagecolor="#ffffff"
548+ bordercolor="#666666"
549+ borderopacity="1.0"
550+ inkscape:pageopacity="0.0"
551+ inkscape:pageshadow="2"
552+ inkscape:zoom="5.6199991"
553+ inkscape:cx="-39.092542"
554+ inkscape:cy="39.181476"
555+ inkscape:document-units="px"
556+ inkscape:current-layer="g4780"
557+ showgrid="true"
558+ showborder="true"
559+ fit-margin-top="0"
560+ fit-margin-left="0"
561+ fit-margin-right="0"
562+ fit-margin-bottom="0"
563+ inkscape:snap-bbox="true"
564+ inkscape:bbox-paths="true"
565+ inkscape:bbox-nodes="true"
566+ inkscape:snap-bbox-edge-midpoints="true"
567+ inkscape:snap-bbox-midpoints="true"
568+ inkscape:object-paths="true"
569+ inkscape:snap-intersection-paths="true"
570+ inkscape:object-nodes="true"
571+ inkscape:snap-smooth-nodes="true"
572+ inkscape:snap-midpoints="true"
573+ inkscape:snap-object-midpoints="true"
574+ inkscape:snap-center="true"
575+ showguides="true"
576+ inkscape:guide-bbox="true"
577+ inkscape:snap-global="true">
578+ <inkscape:grid
579+ type="xygrid"
580+ id="grid5451"
581+ empspacing="8" />
582+ <sodipodi:guide
583+ orientation="1,0"
584+ position="8,-8.0000001"
585+ id="guide4063" />
586+ <sodipodi:guide
587+ orientation="1,0"
588+ position="4,-8.0000001"
589+ id="guide4065" />
590+ <sodipodi:guide
591+ orientation="0,1"
592+ position="-8,88.000001"
593+ id="guide4067" />
594+ <sodipodi:guide
595+ orientation="0,1"
596+ position="-8,92.000001"
597+ id="guide4069" />
598+ <sodipodi:guide
599+ orientation="0,1"
600+ position="104,4"
601+ id="guide4071" />
602+ <sodipodi:guide
603+ orientation="0,1"
604+ position="-5,8.0000001"
605+ id="guide4073" />
606+ <sodipodi:guide
607+ orientation="1,0"
608+ position="88,-8.0000001"
609+ id="guide4077" />
610+ <sodipodi:guide
611+ orientation="0,1"
612+ position="-8,84.000001"
613+ id="guide4074" />
614+ <sodipodi:guide
615+ orientation="1,0"
616+ position="12,-8.0000001"
617+ id="guide4076" />
618+ <sodipodi:guide
619+ orientation="1,0"
620+ position="84,-8.0000001"
621+ id="guide4080" />
622+ <sodipodi:guide
623+ position="48,-8.0000001"
624+ orientation="1,0"
625+ id="guide4170" />
626+ <sodipodi:guide
627+ position="-8,48"
628+ orientation="0,1"
629+ id="guide4172" />
630+ <sodipodi:guide
631+ position="92,-8.0000001"
632+ orientation="1,0"
633+ id="guide4760" />
634+ <sodipodi:guide
635+ position="106,12"
636+ orientation="0,1"
637+ id="guide4211" />
638+ </sodipodi:namedview>
639+ <metadata
640+ id="metadata4879">
641+ <rdf:RDF>
642+ <cc:Work
643+ rdf:about="">
644+ <dc:format>image/svg+xml</dc:format>
645+ <dc:type
646+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
647+ <dc:title></dc:title>
648+ </cc:Work>
649+ </rdf:RDF>
650+ </metadata>
651+ <g
652+ inkscape:label="Layer 1"
653+ inkscape:groupmode="layer"
654+ id="layer1"
655+ transform="translate(67.857146,-78.50504)">
656+ <g
657+ transform="matrix(0,-1,-1,0,373.50506,516.50504)"
658+ id="g4845"
659+ style="display:inline">
660+ <g
661+ inkscape:export-ydpi="90"
662+ inkscape:export-xdpi="90"
663+ inkscape:export-filename="next01.png"
664+ transform="matrix(-0.9996045,0,0,1,575.94296,-611.00001)"
665+ id="g4778"
666+ inkscape:label="Layer 1">
667+ <g
668+ transform="matrix(-1,0,0,1,575.99999,611)"
669+ id="g4780"
670+ style="display:inline">
671+ <rect
672+ style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;stroke:none;stroke-width:4;marker:none;enable-background:accumulate"
673+ id="rect4782"
674+ width="96.037987"
675+ height="96"
676+ x="-438.00244"
677+ y="345.36221"
678+ transform="scale(-1,1)" />
679+ <ellipse
680+ style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.60031652;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
681+ id="path4213"
682+ cx="-393.36221"
683+ cy="-389.98346"
684+ transform="matrix(0,-1,-1,0,0,0)"
685+ rx="7.9999995"
686+ ry="8.0031652" />
687+ <path
688+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.00079107;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
689+ d="m 349.9668,391.36133 v 4.00195 h 40.01758 v -4.00195 z"
690+ id="path4215"
691+ inkscape:connector-curvature="0" />
692+ <path
693+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.00079107;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
694+ d="m 415.98047,393.36133 c 0,6.65833 -2.5351,13.31837 -7.60547,18.38672 -10.14073,10.13669 -26.64247,10.13669 -36.7832,0 l 2.82812,-2.83008 c 8.61153,8.6081 22.51542,8.6081 31.12696,0 8.61153,-8.60811 8.61153,-22.50322 0,-31.11133 -8.61154,-8.6081 -22.51543,-8.6081 -31.12696,0 l -2.82812,-2.83008 c 10.14073,-10.1367 26.64247,-10.1367 36.7832,0 5.07037,5.06835 7.60547,11.72644 7.60547,18.38477 z"
695+ id="ellipse4202"
696+ inkscape:connector-curvature="0" />
697+ <path
698+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.00079107;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
699+ d="m 431.98828,393.36133 c 0,10.75327 -4.09896,21.50653 -12.29492,29.69922 -16.39192,16.38537 -43.02801,16.38537 -59.41992,0 l 2.82812,-2.82813 c 14.86272,14.85678 38.90096,14.85678 53.76367,0 14.86272,-14.85678 14.86272,-38.88345 0,-53.74023 -14.86271,-14.85679 -38.90095,-14.85679 -53.76367,0 l -2.82812,-2.83008 c 16.39191,-16.38538 43.028,-16.38538 59.41992,0 8.19596,8.19269 12.29492,18.94594 12.29492,29.69922 z"
700+ id="ellipse4204"
701+ inkscape:connector-curvature="0" />
702+ </g>
703+ </g>
704+ </g>
705+ </g>
706+</svg>
707
708=== modified file 'tests/autopilot/ubuntu_system_settings/__init__.py'
709--- tests/autopilot/ubuntu_system_settings/__init__.py 2015-08-14 14:38:43 +0000
710+++ tests/autopilot/ubuntu_system_settings/__init__.py 2015-08-17 21:56:41 +0000
711@@ -87,6 +87,10 @@
712 return self._go_to_page('entryComponent-cellular', 'cellularPage')
713
714 @autopilot.logging.log_action(logger.debug)
715+ def go_to_hotspot_page(self):
716+ return self._go_to_page('entryComponent-hotspot', 'hotspotPage')
717+
718+ @autopilot.logging.log_action(logger.debug)
719 def go_to_bluetooth_page(self):
720 return self._go_to_page('entryComponent-bluetooth', 'bluetoothPage')
721
722@@ -333,52 +337,8 @@
723 field.write(name)
724 self.pointing_device.click_object(ok)
725
726- """
727- :returns: Whether or not hotspot can be used.
728- """
729- @autopilot.logging.log_action(logger.debug)
730- def have_hotspot(self):
731- return self.wait_select_single(objectName='hotspotEntry').visible
732-
733- """
734- :param: Configuration with keys ssid and password.
735- :returns: Hotspot page.
736- """
737- @autopilot.logging.log_action(logger.debug)
738- def setup_hotspot(self, config=None):
739- hotspot_page = self._enter_hotspot()
740- hotspot_page.setup_hotspot(config)
741- return hotspot_page
742-
743- """
744- Enables hotspot.
745- :returns: Hotspot page.
746- """
747- @autopilot.logging.log_action(logger.debug)
748- def enable_hotspot(self):
749- hotspot_page = self._enter_hotspot()
750- hotspot_page.enable_hotspot()
751- return hotspot_page
752-
753- """
754- Disables hotspot.
755- :returns: Hotspot page.
756- """
757- @autopilot.logging.log_action(logger.debug)
758- def disable_hotspot(self):
759- hotspot_page = self._enter_hotspot()
760- hotspot_page.disable_hotspot()
761- return hotspot_page
762-
763- @autopilot.logging.log_action(logger.debug)
764- def _enter_hotspot(self):
765- obj = self.wait_select_single(objectName="hotspotEntry")
766- self.pointing_device.click_object(obj)
767- return self.get_root_instance().wait_select_single(
768- objectName='hotspotPage')
769-
770-
771-class Hotspot(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
772+
773+class HotspotPage(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
774
775 """Autopilot helper for Hotspot page."""
776
777@@ -398,7 +358,23 @@
778
779 @autopilot.logging.log_action(logger.debug)
780 def enable_hotspot(self):
781- self._switch.check()
782+ # We assume that the following AssertionError is due to the panel
783+ # instantly setting checked to False, prompting the user to turn on
784+ # Wi-Fi instead.
785+ try:
786+ self._switch.check(timeout=2)
787+ except AssertionError:
788+ pass
789+
790+ try:
791+ prompt = self.get_root_instance().wait_select_single(
792+ objectName='enableWifiDialog')
793+ except StateNotFoundError:
794+ prompt = None
795+
796+ if prompt:
797+ prompt.confirm_enable()
798+ prompt.wait_until_destroyed(timeout=5)
799
800 @autopilot.logging.log_action(logger.debug)
801 def disable_hotspot(self):
802@@ -406,7 +382,7 @@
803
804 @autopilot.logging.log_action(logger.debug)
805 def setup_hotspot(self, config):
806- obj = self.select_single(objectName='hotspotSetupEntry')
807+ obj = self.select_single(objectName='hotspotSetupButton')
808 self.pointing_device.click_object(obj)
809 setup = self.get_root_instance().wait_select_single(
810 objectName='hotspotSetup')
811@@ -423,6 +399,28 @@
812 def get_hotspot_status(self):
813 return self._switch.checked
814
815+ @autopilot.logging.log_action(logger.debug)
816+ def get_hotspot_possible(self):
817+ return self._switch.enabled
818+
819+
820+class HotspotEnableWifiDialog(
821+ ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
822+ """Autopilot helper for the 'Turn on Wi-Fi' dialog in hotspot panel."""
823+
824+ @classmethod
825+ def validate_dbus_object(cls, path, state):
826+ name = introspection.get_classname_from_path(path)
827+ if name == b'Dialog':
828+ if state['objectName'][1] == 'enableWifiDialog':
829+ return True
830+ return False
831+
832+ @autopilot.logging.log_action(logger.debug)
833+ def confirm_enable(self):
834+ button = self.select_single('Button', objectName='confirmEnable')
835+ self.pointing_device.click_object(button)
836+
837
838 class HotspotSetup(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
839
840
841=== modified file 'tests/autopilot/ubuntu_system_settings/tests/__init__.py'
842--- tests/autopilot/ubuntu_system_settings/tests/__init__.py 2015-08-06 17:15:50 +0000
843+++ tests/autopilot/ubuntu_system_settings/tests/__init__.py 2015-08-17 21:56:41 +0000
844@@ -395,7 +395,8 @@
845 context.SetProperty(key, value)
846
847
848-class HotspotBaseTestCase(CellularBaseTestCase):
849+class HotspotBaseTestCase(UbuntuSystemSettingsTestCase,
850+ dbusmock.DBusTestCase):
851
852 connectivity_parameters = {}
853 indicatornetwork_parameters = {}
854@@ -431,6 +432,7 @@
855 stdout=subprocess.PIPE)
856
857 super(HotspotBaseTestCase, self).setUp()
858+ self.hotspot_page = self.main_view.go_to_hotspot_page()
859
860 def tearDown(self):
861 self.ctv_mock.terminate()
862
863=== modified file 'tests/autopilot/ubuntu_system_settings/tests/connectivity.py'
864--- tests/autopilot/ubuntu_system_settings/tests/connectivity.py 2015-08-10 11:01:34 +0000
865+++ tests/autopilot/ubuntu_system_settings/tests/connectivity.py 2015-08-17 21:56:41 +0000
866@@ -47,6 +47,10 @@
867 self.SetProperty(PRIV_OBJ, PRIV_IFACE, 'HotspotPassword', value)
868
869
870+def set_wifi_enabled(self, value):
871+ self.SetProperty(NETS_OBJ, NETS_IFACE, 'WifiEnabled', value)
872+
873+
874 def load(mock, parameters):
875 global _parameters
876 _parameters = parameters
877@@ -54,6 +58,7 @@
878 mock.set_hotspot_enabled = set_hotspot_enabled
879 mock.set_hotspot_ssid = set_hotspot_ssid
880 mock.set_hotspot_password = set_hotspot_password
881+ mock.set_wifi_enabled = set_wifi_enabled
882
883 mock.AddObject(
884 NETS_OBJ,
885@@ -67,7 +72,16 @@
886 'HotspotStored': _parameters.get(
887 'HotspotStored', dbus.Boolean(False)
888 ),
889- 'UnstoppableOperationHappening': dbus.Boolean(False),
890+ 'FlightModeSwitchEnabled': _parameters.get(
891+ 'FlightModeSwitchEnabled', dbus.Boolean(False)
892+ ),
893+ 'WifiSwitchEnabled': _parameters.get(
894+ 'WifiSwitchEnabled', dbus.Boolean(False)
895+ ),
896+ 'HotspotSwitchEnabled': _parameters.get(
897+ 'HotspotSwitchEnabled', dbus.Boolean(False)
898+ ),
899+ 'FlightMode': _parameters.get('FlightMode', dbus.Boolean(False)),
900 'WifiEnabled': _parameters.get('WifiEnabled', dbus.Boolean(False)),
901 # One of online, offline and connecting.
902 'Status': _parameters.get('Status', 'offline')
903@@ -98,7 +112,7 @@
904 ),
905 (
906 'SetWifiEnabled', 'b', '',
907- ''
908+ 'objects["/"].set_wifi_enabled(self, args[0])'
909 ),
910 (
911 'SetHotspotSsid', 'ay', '',
912
913=== modified file 'tests/autopilot/ubuntu_system_settings/tests/test_cellular.py'
914--- tests/autopilot/ubuntu_system_settings/tests/test_cellular.py 2015-08-10 20:05:22 +0000
915+++ tests/autopilot/ubuntu_system_settings/tests/test_cellular.py 2015-08-17 21:56:41 +0000
916@@ -13,14 +13,10 @@
917 from testtools.matchers import Equals, raises, StartsWith
918
919 from ubuntu_system_settings.tests import (
920- CellularBaseTestCase, HotspotBaseTestCase, CONNMAN_IFACE, RDO_IFACE,
921+ CellularBaseTestCase, CONNMAN_IFACE, RDO_IFACE,
922 NETREG_IFACE)
923
924
925-from ubuntu_system_settings.tests.connectivity import (
926- PRIV_IFACE as CTV_PRIV_IFACE, NETS_IFACE as CTV_NETS_IFACE
927-)
928-
929 DEV_IFACE = 'org.freedesktop.NetworkManager.Device'
930
931
932@@ -307,106 +303,6 @@
933 Eventually(Equals('/ril_1')))
934
935
936-class HotspotNonExistantTestCase(HotspotBaseTestCase):
937-
938- connectivity_parameters = {
939- 'HotspotEnabled': False,
940- 'HotspotStored': False
941- }
942-
943- def test_setup(self):
944- ssid = 'bar'
945- password = 'zomgzomg'
946- config = {'ssid': ssid, 'password': password}
947-
948- hotspot_page = self.cellular_page.setup_hotspot(config)
949-
950- # Assert that the switch is on.
951- self.assertTrue(hotspot_page.get_hotspot_status())
952-
953- self.assertThat(
954- lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
955- Eventually(Equals(True))
956- )
957-
958- self.assertThat(
959- lambda: bytearray(
960- self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotSsid')
961- ).decode('UTF-8'),
962- Eventually(Equals(ssid))
963- )
964-
965- self.assertThat(
966- lambda: self.ctv_private.Get(CTV_PRIV_IFACE, 'HotspotPassword'),
967- Eventually(Equals(password))
968- )
969-
970- self.assertThat(
971- lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotStored'),
972- Eventually(Equals(True))
973- )
974-
975-
976-class HotspotExistsTestCase(HotspotBaseTestCase):
977-
978- connectivity_parameters = {
979- 'HotspotStored': True
980- }
981-
982- def test_enabling(self):
983- self.assertThat(
984- lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
985- Eventually(Equals(False))
986- )
987-
988- self.cellular_page.enable_hotspot()
989-
990- self.assertThat(
991- lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
992- Eventually(Equals(True))
993- )
994-
995- def test_changing(self):
996- ssid = 'bar'
997- password = 'zomgzomg'
998- config = {'ssid': ssid, 'password': password}
999- self.cellular_page.setup_hotspot(config)
1000-
1001- self.assertThat(
1002- lambda: bytearray(
1003- self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotSsid')
1004- ).decode('UTF-8'),
1005- Eventually(Equals(ssid))
1006- )
1007-
1008- self.assertThat(
1009- lambda: self.ctv_private.Get(CTV_PRIV_IFACE, 'HotspotPassword'),
1010- Eventually(Equals(password))
1011- )
1012-
1013-
1014-class HotspotEnabledTestCase(HotspotBaseTestCase):
1015-
1016- connectivity_parameters = {
1017- 'HotspotStored': True,
1018- 'HotspotEnabled': True
1019- }
1020-
1021- def test_disabling(self):
1022-
1023- self.assertThat(
1024- lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1025- Eventually(Equals(True))
1026- )
1027-
1028- self.cellular_page.disable_hotspot()
1029-
1030- self.assertThat(
1031- lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1032- Eventually(Equals(False))
1033- )
1034-
1035-
1036 class ApnTestCase(CellularBaseTestCase):
1037
1038 def test_remove_apn(self):
1039
1040=== added file 'tests/autopilot/ubuntu_system_settings/tests/test_hotspot.py'
1041--- tests/autopilot/ubuntu_system_settings/tests/test_hotspot.py 1970-01-01 00:00:00 +0000
1042+++ tests/autopilot/ubuntu_system_settings/tests/test_hotspot.py 2015-08-17 21:56:41 +0000
1043@@ -0,0 +1,230 @@
1044+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1045+# Copyright 2014 Canonical
1046+#
1047+# This program is free software: you can redistribute it and/or modify it
1048+# under the terms of the GNU General Public License version 3, as published
1049+# by the Free Software Foundation.
1050+
1051+from autopilot.matchers import Eventually
1052+from testtools.matchers import Equals
1053+
1054+from ubuntu_system_settings.tests import HotspotBaseTestCase
1055+
1056+from ubuntu_system_settings.tests.connectivity import (
1057+ PRIV_IFACE as CTV_PRIV_IFACE, NETS_IFACE as CTV_NETS_IFACE
1058+)
1059+
1060+
1061+class HotspotSetupTestCase(HotspotBaseTestCase):
1062+
1063+ connectivity_parameters = {
1064+ 'HotspotEnabled': False,
1065+ 'HotspotStored': False,
1066+ 'WifiEnabled': True,
1067+ 'HotspotSwitchEnabled': True
1068+ }
1069+
1070+ def test_setup(self):
1071+ ssid = 'bar'
1072+ password = 'zomgzomg'
1073+ config = {'ssid': ssid, 'password': password}
1074+
1075+ self.hotspot_page.setup_hotspot(config)
1076+
1077+ # Assert that the switch is on.
1078+ self.assertTrue(self.hotspot_page.get_hotspot_status())
1079+
1080+ self.assertThat(
1081+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1082+ Eventually(Equals(True))
1083+ )
1084+
1085+ self.assertThat(
1086+ lambda: bytearray(
1087+ self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotSsid')
1088+ ).decode('UTF-8'),
1089+ Eventually(Equals(ssid))
1090+ )
1091+
1092+ self.assertThat(
1093+ lambda: self.ctv_private.Get(CTV_PRIV_IFACE, 'HotspotPassword'),
1094+ Eventually(Equals(password))
1095+ )
1096+
1097+ self.assertThat(
1098+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotStored'),
1099+ Eventually(Equals(True))
1100+ )
1101+
1102+
1103+class HotspotExistsTestCase(HotspotBaseTestCase):
1104+
1105+ connectivity_parameters = {
1106+ 'HotspotStored': True,
1107+ 'WifiEnabled': True,
1108+ 'HotspotSwitchEnabled': True
1109+ }
1110+
1111+ def test_enabling(self):
1112+ self.assertThat(
1113+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1114+ Eventually(Equals(False))
1115+ )
1116+
1117+ self.hotspot_page.enable_hotspot()
1118+
1119+ self.assertThat(
1120+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1121+ Eventually(Equals(True))
1122+ )
1123+
1124+ def test_changing(self):
1125+ ssid = 'bar'
1126+ password = 'zomgzomg'
1127+ config = {'ssid': ssid, 'password': password}
1128+ self.hotspot_page.setup_hotspot(config)
1129+
1130+ self.assertThat(
1131+ lambda: bytearray(
1132+ self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotSsid')
1133+ ).decode('UTF-8'),
1134+ Eventually(Equals(ssid))
1135+ )
1136+
1137+ self.assertThat(
1138+ lambda: self.ctv_private.Get(CTV_PRIV_IFACE, 'HotspotPassword'),
1139+ Eventually(Equals(password))
1140+ )
1141+
1142+
1143+class HotspotRunningTestCase(HotspotBaseTestCase):
1144+
1145+ connectivity_parameters = {
1146+ 'HotspotStored': True,
1147+ 'HotspotEnabled': True,
1148+ 'WifiEnabled': True,
1149+ 'HotspotSwitchEnabled': True
1150+ }
1151+
1152+ def test_disabling(self):
1153+
1154+ self.assertThat(
1155+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1156+ Eventually(Equals(True))
1157+ )
1158+
1159+ self.hotspot_page.disable_hotspot()
1160+
1161+ self.assertThat(
1162+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1163+ Eventually(Equals(False))
1164+ )
1165+
1166+
1167+class HotspotChangeNoWiFiTestCase(HotspotBaseTestCase):
1168+
1169+ connectivity_parameters = {
1170+ 'HotspotStored': True,
1171+ 'HotspotEnabled': False,
1172+ 'WifiEnabled': False,
1173+ 'HotspotSwitchEnabled': True
1174+ }
1175+
1176+ def test_enabling(self):
1177+
1178+ self.assertThat(
1179+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1180+ Eventually(Equals(False))
1181+ )
1182+
1183+ self.assertThat(
1184+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'WifiEnabled'),
1185+ Eventually(Equals(False))
1186+ )
1187+
1188+ self.hotspot_page.enable_hotspot()
1189+
1190+ self.assertThat(
1191+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1192+ Eventually(Equals(True))
1193+ )
1194+
1195+ self.assertThat(
1196+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'WifiEnabled'),
1197+ Eventually(Equals(True))
1198+ )
1199+
1200+
1201+class HotspotSetupNoWiFiTestCase(HotspotBaseTestCase):
1202+
1203+ connectivity_parameters = {
1204+ 'HotspotStored': False,
1205+ 'HotspotEnabled': False,
1206+ 'WifiEnabled': False,
1207+ 'HotspotSwitchEnabled': True
1208+ }
1209+
1210+ def test_setup(self):
1211+ ssid = 'bar'
1212+ password = 'zomgzomg'
1213+ config = {'ssid': ssid, 'password': password}
1214+
1215+ self.assertThat(
1216+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotStored'),
1217+ Eventually(Equals(False))
1218+ )
1219+
1220+ self.assertThat(
1221+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'WifiEnabled'),
1222+ Eventually(Equals(False))
1223+ )
1224+
1225+ self.hotspot_page.setup_hotspot(config)
1226+
1227+ self.assertThat(
1228+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotStored'),
1229+ Eventually(Equals(True))
1230+ )
1231+
1232+ self.assertThat(
1233+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'HotspotEnabled'),
1234+ Eventually(Equals(True))
1235+ )
1236+
1237+ self.assertThat(
1238+ lambda: self.ctv_nets.Get(CTV_NETS_IFACE, 'WifiEnabled'),
1239+ Eventually(Equals(True))
1240+ )
1241+
1242+
1243+class HotspotChangeInFlightModeTestCase(HotspotBaseTestCase):
1244+
1245+ connectivity_parameters = {
1246+ 'HotspotStored': True,
1247+ 'HotspotEnabled': False,
1248+ 'WifiEnabled': True,
1249+ 'FlightMode': True,
1250+ 'HotspotSwitchEnabled': False
1251+ }
1252+
1253+ def test_switch_disabled(self):
1254+ self.assertFalse(self.hotspot_page.get_hotspot_possible())
1255+
1256+
1257+class HotspotSetupInFlightModeTestCase(
1258+ HotspotBaseTestCase):
1259+
1260+ connectivity_parameters = {
1261+ 'HotspotStored': False,
1262+ 'HotspotEnabled': False,
1263+ 'WifiEnabled': True,
1264+ 'FlightMode': True,
1265+ 'HotspotSwitchEnabled': False
1266+ }
1267+
1268+ def test_setup_disabled(self):
1269+ setup = self.hotspot_page.select_single(
1270+ objectName='hotspotSetupButton'
1271+ )
1272+ self.assertFalse(setup.enabled)
1273+ self.assertFalse(self.hotspot_page.get_hotspot_possible())
1274
1275=== modified file 'tests/autopilot/ubuntu_system_settings/tests/test_plugins.py'
1276--- tests/autopilot/ubuntu_system_settings/tests/test_plugins.py 2014-12-02 06:40:54 +0000
1277+++ tests/autopilot/ubuntu_system_settings/tests/test_plugins.py 2015-08-17 21:56:41 +0000
1278@@ -87,6 +87,13 @@
1279 )
1280 self.assertThat(plugin, NotEquals(None))
1281
1282+ def test_hotspot_plugin(self):
1283+ """ Checks whether the Hotspot plugin is available """
1284+ plugin = self.main_view.select_single(
1285+ objectName='entryComponent-hotspot'
1286+ )
1287+ self.assertThat(plugin, NotEquals(None))
1288+
1289 def test_background_plugin(self):
1290 """ Checks whether the Background plugin is available """
1291 plugin = self.main_view.select_single(

Subscribers

People subscribed via source and target branches