Merge lp:~jonas-drange/ubuntu-system-settings/sim-name-editor into lp:ubuntu-system-settings
- sim-name-editor
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Ken VanDine |
Approved revision: | 808 |
Merged at revision: | 854 |
Proposed branch: | lp:~jonas-drange/ubuntu-system-settings/sim-name-editor |
Merge into: | lp:ubuntu-system-settings |
Prerequisite: | lp:~ken-vandine/ubuntu-system-settings/anchorkeyboard |
Diff against target: |
755 lines (+368/-115) 8 files modified
.bzrignore (+1/-0) plugins/cellular/Components/CMakeLists.txt (+1/-0) plugins/cellular/Components/CellularDualSim.qml (+13/-10) plugins/cellular/Components/Sim.qml (+1/-1) plugins/cellular/Components/SimEditor.qml (+165/-0) plugins/cellular/PageComponent.qml (+47/-16) tests/autopilot/ubuntu_system_settings/tests/__init__.py (+0/-9) tests/autopilot/ubuntu_system_settings/tests/test_cellular.py (+140/-79) |
To merge this branch: | bzr merge lp:~jonas-drange/ubuntu-system-settings/sim-name-editor |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ken VanDine | Approve | ||
PS Jenkins bot | continuous-integration | Needs Fixing | |
Review via email: mp+229070@code.launchpad.net |
This proposal supersedes a proposal from 2014-07-31.
Commit message
[cellular] add sim name editor for dual sim scenario
Description of the change
Hi,
this adds a component that allows for editing of sim names, as well as autopilot tests for this.
I also added pycache to the ignore list, since autopilot3 is creating this and it should be ignored.
A nasty bug caused by tests trying to edit a readonly dbus property was removed as well.
Refactored tests to work with new, dynamic sim names.
Thanks
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
Ken VanDine (ken-vandine) wrote : Posted in a previous version of this proposal | # |
Please remove debugging output, and see my inline comment
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:806
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:806
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:808
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:808
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Ken VanDine (ken-vandine) wrote : | # |
Looks good to me, works fine testing on device. I'm confident the test failure is from the bug in gsettings-qt which is in the silo to land with this.
Preview Diff
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2014-07-08 16:17:02 +0000 |
3 | +++ .bzrignore 2014-07-31 15:48:45 +0000 |
4 | @@ -19,3 +19,4 @@ |
5 | .cproject |
6 | .project |
7 | .settings |
8 | +__pycache__ |
9 | |
10 | === modified file 'plugins/cellular/Components/CMakeLists.txt' |
11 | --- plugins/cellular/Components/CMakeLists.txt 2014-07-21 14:29:00 +0000 |
12 | +++ plugins/cellular/Components/CMakeLists.txt 2014-07-31 15:48:45 +0000 |
13 | @@ -3,5 +3,6 @@ |
14 | data-helpers.js |
15 | CellularDualSim.qml |
16 | Sim.qml |
17 | + SimEditor.qml |
18 | ) |
19 | install(FILES ${QML_SOURCES} DESTINATION ${PLUGIN_QML_DIR}/cellular/Components) |
20 | |
21 | === modified file 'plugins/cellular/Components/CellularDualSim.qml' |
22 | --- plugins/cellular/Components/CellularDualSim.qml 2014-07-24 19:00:45 +0000 |
23 | +++ plugins/cellular/Components/CellularDualSim.qml 2014-07-31 15:48:45 +0000 |
24 | @@ -64,17 +64,20 @@ |
25 | text: i18n.tr("Cellular data:") |
26 | expanded: true |
27 | model: ["Off", "sim1", "sim2"] |
28 | - delegate: OptionSelectorDelegate { text: { |
29 | - var t; |
30 | - if (modelData === "sim1") { |
31 | - t = sim1.title |
32 | - } else if (modelData === "sim2") { |
33 | - t = sim2.title |
34 | - } else { |
35 | - t = i18n.tr(modelData); |
36 | + delegate: OptionSelectorDelegate { |
37 | + objectName: "use" + modelData |
38 | + text: { |
39 | + var t; |
40 | + if (modelData === "sim1") { |
41 | + t = sim1.title |
42 | + } else if (modelData === "sim2") { |
43 | + t = sim2.title |
44 | + } else { |
45 | + t = i18n.tr(modelData); |
46 | + } |
47 | + return t; |
48 | } |
49 | - return t; |
50 | - }} |
51 | + } |
52 | selectedIndex: [true, sim1.connMan.powered, sim2.connMan.powered].lastIndexOf(true) |
53 | onDelegateClicked: { |
54 | sim1.connMan.powered = (index === 1) |
55 | |
56 | === modified file 'plugins/cellular/Components/Sim.qml' |
57 | --- plugins/cellular/Components/Sim.qml 2014-07-24 19:00:45 +0000 |
58 | +++ plugins/cellular/Components/Sim.qml 2014-07-31 15:48:45 +0000 |
59 | @@ -27,12 +27,12 @@ |
60 | property alias simMng: simMng |
61 | property alias connMan: connMan |
62 | |
63 | + property string path |
64 | property string name |
65 | property string title: { |
66 | var number = simMng.subscriberNumbers[0] || simMng.subscriberIdentity; |
67 | return name + (number ? " (" + number + ")" : ""); |
68 | } |
69 | - property string path |
70 | |
71 | OfonoModem { |
72 | id: modem |
73 | |
74 | === added file 'plugins/cellular/Components/SimEditor.qml' |
75 | --- plugins/cellular/Components/SimEditor.qml 1970-01-01 00:00:00 +0000 |
76 | +++ plugins/cellular/Components/SimEditor.qml 2014-07-31 15:48:45 +0000 |
77 | @@ -0,0 +1,165 @@ |
78 | +/* |
79 | + * Copyright (C) 2014 Canonical Ltd |
80 | + * |
81 | + * This program is free software: you can redistribute it and/or modify |
82 | + * it under the terms of the GNU General Public License version 3 as |
83 | + * published by the Free Software Foundation. |
84 | + * |
85 | + * This program is distributed in the hope that it will be useful, |
86 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
87 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
88 | + * GNU General Public License for more details. |
89 | + * |
90 | + * You should have received a copy of the GNU General Public License |
91 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
92 | + * |
93 | + * Authors: |
94 | + * Jonas G. Drange <jonas.drange@canonical.com> |
95 | + * |
96 | +*/ |
97 | +import QtQuick 2.0 |
98 | +import Ubuntu.Components 1.1 |
99 | +import Ubuntu.Components.ListItems 0.1 as ListItem |
100 | + |
101 | +Column { |
102 | + |
103 | + id: simList |
104 | + |
105 | + anchors.left: parent.left |
106 | + anchors.right: parent.right |
107 | + |
108 | + states: [ |
109 | + State { |
110 | + name: "editing" |
111 | + PropertyChanges { |
112 | + target: editor |
113 | + visible: true |
114 | + } |
115 | + }, |
116 | + State { |
117 | + extend: "editing" |
118 | + name: "editingSim1" |
119 | + PropertyChanges { |
120 | + target: nameField |
121 | + text: sim1.name |
122 | + } |
123 | + ParentChange { |
124 | + target: editor |
125 | + parent: sim1Placeholder |
126 | + } |
127 | + }, |
128 | + State { |
129 | + extend: "editing" |
130 | + name: "editingSim2" |
131 | + PropertyChanges { |
132 | + target: nameField |
133 | + text: sim2.name |
134 | + } |
135 | + ParentChange { |
136 | + target: editor |
137 | + parent: sim2Placeholder |
138 | + } |
139 | + } |
140 | + ] |
141 | + |
142 | + ListItem.Standard { |
143 | + text: i18n.tr("Edit SIM Name") |
144 | + } |
145 | + |
146 | + |
147 | + ListItem.Standard { |
148 | + id: sim1Item |
149 | + text: sim1.title |
150 | + objectName: "editSim1" |
151 | + progression: true |
152 | + onClicked: { |
153 | + simList.state = "editingSim1"; |
154 | + nameField.forceActiveFocus(); |
155 | + } |
156 | + } |
157 | + |
158 | + Column { |
159 | + id: sim1Placeholder |
160 | + } |
161 | + |
162 | + ListItem.Standard { |
163 | + id: sim2Item |
164 | + text: sim2.title |
165 | + objectName: "editSim2" |
166 | + progression: true |
167 | + onClicked: { |
168 | + simList.state = "editingSim2"; |
169 | + nameField.forceActiveFocus(); |
170 | + } |
171 | + } |
172 | + |
173 | + Column { |
174 | + id: sim2Placeholder |
175 | + } |
176 | + |
177 | + Column { |
178 | + id: editor |
179 | + visible: false |
180 | + |
181 | + width: simList.width - units.gu(4) |
182 | + spacing: units.gu(2) |
183 | + anchors { |
184 | + horizontalCenter: simList.horizontalCenter |
185 | + } |
186 | + |
187 | + Item { |
188 | + height: units.gu(0.1) |
189 | + width: parent.width |
190 | + } |
191 | + |
192 | + TextField { |
193 | + id: nameField |
194 | + objectName: "nameField" |
195 | + maximumLength: 30 |
196 | + width: simList.width - units.gu(4) |
197 | + onTriggered: renameAction |
198 | + } |
199 | + |
200 | + Row { |
201 | + |
202 | + spacing: units.gu(2) |
203 | + |
204 | + Button { |
205 | + id: cancel |
206 | + objectName: "cancelRename" |
207 | + gradient: UbuntuColors.greyGradient |
208 | + text: i18n.tr("Cancel") |
209 | + width: (editor.width / 2) - units.gu(1) |
210 | + onClicked: { |
211 | + simList.state = ""; |
212 | + } |
213 | + } |
214 | + |
215 | + Button { |
216 | + id: rename |
217 | + objectName: "doRename" |
218 | + enabled: nameField.text |
219 | + text: i18n.tr("OK") |
220 | + width: (editor.width / 2) - units.gu(1) |
221 | + action: renameAction |
222 | + } |
223 | + } |
224 | + |
225 | + Action { |
226 | + id: renameAction |
227 | + onTriggered: { |
228 | + var tmpSimNames = {}; |
229 | + if (simList.state === "editingSim1") { |
230 | + tmpSimNames[sim1.path] = nameField.text; |
231 | + tmpSimNames[sim2.path] = sim2.name; |
232 | + } else if (simList.state === "editingSim2") { |
233 | + tmpSimNames[sim1.path] = sim1.name; |
234 | + tmpSimNames[sim2.path] = nameField.text; |
235 | + } |
236 | + phoneSettings.simNames = tmpSimNames; |
237 | + simList.state = ""; |
238 | + } |
239 | + } |
240 | + } |
241 | +} |
242 | + |
243 | |
244 | === modified file 'plugins/cellular/PageComponent.qml' |
245 | --- plugins/cellular/PageComponent.qml 2014-07-24 19:00:45 +0000 |
246 | +++ plugins/cellular/PageComponent.qml 2014-07-31 15:48:45 +0000 |
247 | @@ -19,6 +19,7 @@ |
248 | */ |
249 | |
250 | import QtQuick 2.0 |
251 | +import GSettings 1.0 |
252 | import SystemSettings 1.0 |
253 | import Ubuntu.Components 0.1 |
254 | import Ubuntu.Components.ListItems 0.1 as ListItem |
255 | @@ -34,32 +35,30 @@ |
256 | // pointers to sim 1 and 2, lazy loaded |
257 | property alias sim1: simOneLoader.item |
258 | property alias sim2: simTwoLoader.item |
259 | + property var modemsSorted: manager.modems.slice(0).sort() |
260 | |
261 | states: [ |
262 | State { |
263 | name: "singleSim" |
264 | StateChangeScript { |
265 | name: "loadSim" |
266 | - script: simOneLoader.setSource("Components/Sim.qml", { |
267 | - path: manager.modems[0], |
268 | - name: "SIM 1" |
269 | - }) |
270 | + script: { |
271 | + var p = modemsSorted[0]; |
272 | + simOneLoader.setSource("Components/Sim.qml", { |
273 | + path: p |
274 | + }); |
275 | + } |
276 | } |
277 | }, |
278 | State { |
279 | name: "dualSim" |
280 | + extend: "singleSim" |
281 | StateChangeScript { |
282 | name: "loadSecondSim" |
283 | script: { |
284 | - // the ordering is completely depending on manager |
285 | - // TODO: proper sim names (from gsettings?) |
286 | - simOneLoader.setSource("Components/Sim.qml", { |
287 | - path: manager.modems[0], |
288 | - name: "SIM 1" |
289 | - }); |
290 | + var p = modemsSorted[1]; |
291 | simTwoLoader.setSource("Components/Sim.qml", { |
292 | - path: manager.modems[1], |
293 | - name: "SIM 2" |
294 | + path: p |
295 | }); |
296 | } |
297 | } |
298 | @@ -82,7 +81,6 @@ |
299 | OfonoManager { |
300 | id: manager |
301 | Component.onCompleted: { |
302 | - console.warn('Manager complete with', modems.length, 'sims.'); |
303 | if (modems.length === 1) { |
304 | root.state = "singleSim"; |
305 | } else if (modems.length === 2) { |
306 | @@ -99,7 +97,6 @@ |
307 | sim1: sim1 |
308 | }); |
309 | } |
310 | - console.warn('sim1 loaded, loading CellularSingleSim.qml into cellData'); |
311 | } |
312 | } |
313 | |
314 | @@ -112,7 +109,6 @@ |
315 | sim1: sim1, |
316 | sim2: sim2 |
317 | }); |
318 | - console.warn('sim2 loaded, loading CellularDualSim.qml into cellData'); |
319 | } |
320 | } |
321 | |
322 | @@ -185,6 +181,41 @@ |
323 | progression: true |
324 | visible: showAllUI |
325 | } |
326 | - } |
327 | + |
328 | + SimEditor { |
329 | + visible: root.state === "dualSim" |
330 | + objectName: "simEditor" |
331 | + } |
332 | + } |
333 | + } |
334 | + |
335 | + GSettings { |
336 | + id: phoneSettings |
337 | + schema.id: "com.ubuntu.phone" |
338 | + Component.onCompleted: { |
339 | + // set default names |
340 | + var simNames = phoneSettings.simNames; |
341 | + var m0 = modemsSorted[0]; |
342 | + var m1 = modemsSorted[1]; |
343 | + if (!simNames[m0]) { |
344 | + simNames[m0] = "SIM 1"; |
345 | + } |
346 | + if (!simNames[m1]) { |
347 | + simNames[m1] = "SIM 2"; |
348 | + } |
349 | + phoneSettings.simNames = simNames; |
350 | + } |
351 | + } |
352 | + |
353 | + Binding { |
354 | + target: sim1 |
355 | + property: "name" |
356 | + value: phoneSettings.simNames[modemsSorted[0]] |
357 | + } |
358 | + |
359 | + Binding { |
360 | + target: sim2 |
361 | + property: "name" |
362 | + value: phoneSettings.simNames[modemsSorted[1]] |
363 | } |
364 | } |
365 | |
366 | === modified file 'tests/autopilot/ubuntu_system_settings/tests/__init__.py' |
367 | --- tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-07-25 18:12:58 +0000 |
368 | +++ tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-07-31 15:48:45 +0000 |
369 | @@ -167,11 +167,8 @@ |
370 | ) |
371 | |
372 | def mock_radio_settings(self, modem): |
373 | - modem_interfaces = modem.GetProperties()['Interfaces'] |
374 | - modem_interfaces.append(RDO_IFACE) |
375 | modem.AddProperty( |
376 | RDO_IFACE, 'TechnologyPreference', self.technology_preference) |
377 | - modem.SetProperty('Interfaces', modem_interfaces) |
378 | modem.AddMethods( |
379 | RDO_IFACE, |
380 | [('GetProperties', '', 'a{sv}', |
381 | @@ -264,12 +261,6 @@ |
382 | |
383 | super(UbuntuSystemSettingsOfonoTestCase, self).setUp(panel) |
384 | |
385 | - @classmethod |
386 | - def tearDownClass(cls): |
387 | - cls.p_mock.terminate() |
388 | - cls.p_mock.wait() |
389 | - super(UbuntuSystemSettingsOfonoTestCase, cls).tearDownClass() |
390 | - |
391 | |
392 | class CellularBaseTestCase(UbuntuSystemSettingsOfonoTestCase): |
393 | def setUp(self): |
394 | |
395 | === modified file 'tests/autopilot/ubuntu_system_settings/tests/test_cellular.py' |
396 | --- tests/autopilot/ubuntu_system_settings/tests/test_cellular.py 2014-07-24 20:30:20 +0000 |
397 | +++ tests/autopilot/ubuntu_system_settings/tests/test_cellular.py 2014-07-31 15:48:45 +0000 |
398 | @@ -6,6 +6,7 @@ |
399 | # by the Free Software Foundation. |
400 | |
401 | import dbus |
402 | +from gi.repository import Gio, GLib |
403 | from time import sleep |
404 | |
405 | from autopilot.introspection.dbus import StateNotFoundError |
406 | @@ -23,9 +24,9 @@ |
407 | PREFERENCE_2G = '2G only (saves battery)' |
408 | PREFERENCE_ANY = '2G/3G/4G (faster)' |
409 | PREFERENCE_OFF = 'Off' |
410 | -LABEL_SIM_1 = 'SIM 1 (08123)' |
411 | -LABEL_SIM_2 = 'SIM 2 (123456)' |
412 | -LABEL_OFF = 'Off' |
413 | +USE_OFF = "useOff" |
414 | +USE_SIM_1 = "usesim1" |
415 | +USE_SIM_2 = "usesim2" |
416 | |
417 | |
418 | class CellularTestCase(CellularBaseTestCase): |
419 | @@ -170,7 +171,7 @@ |
420 | objectName="dataRoamingSwitch" |
421 | ) |
422 | self.system_settings.main_view.scroll_to_and_click(roaming_switch) |
423 | - sleep(2) |
424 | + sleep(1.5) |
425 | self.assertEqual( |
426 | True, self.modem_0.Get(CONNMAN_IFACE, 'RoamingAllowed')) |
427 | |
428 | @@ -250,6 +251,12 @@ |
429 | |
430 | self.assert_selected_preference(2) |
431 | |
432 | + def test_that_sim_editor_is_hidden(self): |
433 | + editor = self.system_settings.main_view.cellular_page.select_single( |
434 | + objectName="simEditor" |
435 | + ) |
436 | + self.assertFalse(editor.get_properties()['visible']) |
437 | + |
438 | |
439 | class DualSimCellularTestCase(CellularBaseTestCase): |
440 | |
441 | @@ -311,7 +318,7 @@ |
442 | def use_selector(self, label): |
443 | obj = self.system_settings.main_view.cellular_page.select_single( |
444 | objectName="use" |
445 | - ).select_single('Label', text=label) |
446 | + ).select_single(objectName=label) |
447 | self.system_settings.main_view.scroll_to_and_click(obj) |
448 | |
449 | def assert_used(self, index): |
450 | @@ -321,107 +328,110 @@ |
451 | self.assertThat( |
452 | obj.selectedIndex, Eventually(Equals(index))) |
453 | |
454 | + def get_sim_name(self, num): |
455 | + obj = self.system_settings.main_view.cellular_page.select_single( |
456 | + objectName="simEditor" |
457 | + ).select_single(objectName="editSim%d" % num) |
458 | + return obj.get_properties()['text'] |
459 | + |
460 | + def rename_sim(self, num, new_name): |
461 | + obj = self.system_settings.main_view.cellular_page.select_single( |
462 | + objectName="simEditor" |
463 | + ).select_single(objectName="editSim%d" % num) |
464 | + self.system_settings.main_view.scroll_to_and_click(obj) |
465 | + field = self.system_settings.main_view.cellular_page.select_single( |
466 | + objectName="nameField" |
467 | + ) |
468 | + self.system_settings.main_view.scroll_to_and_click(field) |
469 | + self.system_settings.main_view.scroll_to_and_click( |
470 | + field.select_single(objectName="clear_button")) |
471 | + self.keyboard.type(new_name) |
472 | + self.system_settings.main_view.scroll_to_and_click( |
473 | + self.system_settings.main_view.cellular_page.select_single( |
474 | + objectName="doRename")) |
475 | + |
476 | def test_use_sim_1(self): |
477 | - self.use_selector(LABEL_OFF) |
478 | - self.use_selector(LABEL_SIM_1) |
479 | - sleep(0.7) |
480 | + self.use_selector(USE_OFF) |
481 | + self.use_selector(USE_SIM_1) |
482 | + sleep(0.7) |
483 | + self.assertEqual(True, self.modem_0.Get(CONNMAN_IFACE, 'Powered')) |
484 | + self.assertEqual(False, self.modem_1.Get(CONNMAN_IFACE, 'Powered')) |
485 | + |
486 | + def test_use_sim_2(self): |
487 | + self.use_selector(USE_OFF) |
488 | + self.use_selector(USE_SIM_2) |
489 | + sleep(0.7) |
490 | + self.assertEqual(False, self.modem_0.Get(CONNMAN_IFACE, 'Powered')) |
491 | self.assertEqual(True, self.modem_1.Get(CONNMAN_IFACE, 'Powered')) |
492 | - self.assertEqual(False, self.modem_0.Get(CONNMAN_IFACE, 'Powered')) |
493 | - |
494 | - def test_use_sim_2(self): |
495 | - self.use_selector(LABEL_OFF) |
496 | - self.use_selector(LABEL_SIM_2) |
497 | - sleep(0.7) |
498 | - self.assertEqual(True, self.modem_0.Get(CONNMAN_IFACE, 'Powered')) |
499 | - self.assertEqual(False, self.modem_1.Get(CONNMAN_IFACE, 'Powered')) |
500 | |
501 | def test_turn_off_both_sims(self): |
502 | - self.use_selector(LABEL_OFF) |
503 | + self.use_selector(USE_OFF) |
504 | sleep(0.7) |
505 | self.assertEqual(False, self.modem_0.Get(CONNMAN_IFACE, 'Powered')) |
506 | self.assertEqual(False, self.modem_1.Get(CONNMAN_IFACE, 'Powered')) |
507 | |
508 | def test_use_gsm_for_sim_1(self): |
509 | - self.use_selector(LABEL_SIM_1) |
510 | + self.use_selector(USE_SIM_1) |
511 | self.select_preference(PREFERENCE_2G) |
512 | sleep(0.7) |
513 | self.assertEqual( |
514 | - 'gsm', self.modem_1.Get(RDO_IFACE, 'TechnologyPreference')) |
515 | + 'gsm', self.modem_0.Get(RDO_IFACE, 'TechnologyPreference')) |
516 | |
517 | def test_use_any_for_sim_1(self): |
518 | - self.use_selector(LABEL_SIM_1) |
519 | + self.use_selector(USE_SIM_1) |
520 | self.select_preference(PREFERENCE_ANY) |
521 | sleep(0.7) |
522 | self.assertEqual( |
523 | - 'any', self.modem_1.Get(RDO_IFACE, 'TechnologyPreference')) |
524 | + 'any', self.modem_0.Get(RDO_IFACE, 'TechnologyPreference')) |
525 | |
526 | def test_use_gsm_for_sim_2(self): |
527 | - self.use_selector(LABEL_SIM_1) |
528 | + self.use_selector(USE_SIM_1) |
529 | self.select_preference(PREFERENCE_2G) |
530 | sleep(0.7) |
531 | self.assertEqual( |
532 | - 'gsm', self.modem_1.Get(RDO_IFACE, 'TechnologyPreference')) |
533 | + 'gsm', self.modem_0.Get(RDO_IFACE, 'TechnologyPreference')) |
534 | |
535 | def test_use_any_for_sim_2(self): |
536 | - self.use_selector(LABEL_SIM_1) |
537 | + self.use_selector(USE_SIM_2) |
538 | self.select_preference(PREFERENCE_ANY) |
539 | sleep(1) |
540 | self.assertEqual( |
541 | 'any', self.modem_1.Get(RDO_IFACE, 'TechnologyPreference')) |
542 | |
543 | def test_when_sim_1_comes_online_ui_is_correct(self): |
544 | - self.use_selector(LABEL_SIM_1) |
545 | + self.use_selector(USE_SIM_1) |
546 | self.select_preference(PREFERENCE_ANY) |
547 | - self.use_selector(LABEL_OFF) |
548 | + self.use_selector(USE_OFF) |
549 | sleep(0.7) |
550 | - self.modem_1.Set(CONNMAN_IFACE, 'Powered', True) |
551 | - self.modem_1.EmitSignal( |
552 | + self.modem_0.Set(CONNMAN_IFACE, 'Powered', True) |
553 | + self.modem_0.EmitSignal( |
554 | CONNMAN_IFACE, |
555 | 'PropertyChanged', |
556 | 'sv', |
557 | ['Powered', 'true']) |
558 | |
559 | self.assertEqual( |
560 | - 'any', self.modem_1.Get(RDO_IFACE, 'TechnologyPreference')) |
561 | + 'any', self.modem_0.Get(RDO_IFACE, 'TechnologyPreference')) |
562 | self.assert_used(1) |
563 | self.assert_selected_preference(1) |
564 | |
565 | def test_when_sim_2_comes_online_ui_is_correct(self): |
566 | - self.use_selector(LABEL_SIM_2) |
567 | + self.use_selector(USE_SIM_2) |
568 | self.select_preference(PREFERENCE_ANY) |
569 | - self.use_selector(LABEL_OFF) |
570 | + self.use_selector(USE_OFF) |
571 | sleep(0.7) |
572 | - self.modem_0.Set(CONNMAN_IFACE, 'Powered', True) |
573 | - self.modem_0.EmitSignal( |
574 | + self.modem_1.Set(CONNMAN_IFACE, 'Powered', True) |
575 | + self.modem_1.EmitSignal( |
576 | CONNMAN_IFACE, |
577 | 'PropertyChanged', |
578 | 'sv', |
579 | ['Powered', 'true']) |
580 | |
581 | self.assertEqual( |
582 | - 'any', self.modem_0.Get(RDO_IFACE, 'TechnologyPreference')) |
583 | + 'any', self.modem_1.Get(RDO_IFACE, 'TechnologyPreference')) |
584 | self.assert_used(2) |
585 | self.assert_selected_preference(1) |
586 | |
587 | - def test_both_sims_comes_online(self): |
588 | - self.use_selector(LABEL_OFF) |
589 | - sleep(2) |
590 | - self.modem_0.Set(CONNMAN_IFACE, 'Powered', True) |
591 | - self.modem_0.EmitSignal( |
592 | - CONNMAN_IFACE, |
593 | - 'PropertyChanged', |
594 | - 'sv', |
595 | - ['Powered', 'true']) |
596 | - |
597 | - self.modem_1.Set(CONNMAN_IFACE, 'Powered', True) |
598 | - self.modem_1.EmitSignal( |
599 | - CONNMAN_IFACE, |
600 | - 'PropertyChanged', |
601 | - 'sv', |
602 | - ['Powered', 'true']) |
603 | - self.assert_used(1) |
604 | - self.assert_selected_preference(0) |
605 | - |
606 | def test_roaming_switch(self): |
607 | roaming_switch = self.system_settings.main_view.select_single( |
608 | objectName="dataRoamingSwitch" |
609 | @@ -430,7 +440,7 @@ |
610 | self.assertTrue(roaming_switch.get_properties()['enabled']) |
611 | |
612 | # click off |
613 | - self.use_selector(LABEL_OFF) |
614 | + self.use_selector(USE_OFF) |
615 | |
616 | # assert roaming_switch is disabled |
617 | self.assertThat( |
618 | @@ -438,23 +448,23 @@ |
619 | Eventually(Equals(False))) |
620 | |
621 | def test_allow_roaming(self): |
622 | - self.use_selector(LABEL_SIM_1) |
623 | + self.use_selector(USE_SIM_1) |
624 | self.assertEqual( |
625 | - False, self.modem_1.Get(CONNMAN_IFACE, 'RoamingAllowed')) |
626 | + False, self.modem_0.Get(CONNMAN_IFACE, 'RoamingAllowed')) |
627 | roaming_switch = self.system_settings.main_view.select_single( |
628 | objectName="dataRoamingSwitch" |
629 | ) |
630 | self.system_settings.main_view.scroll_to_and_click(roaming_switch) |
631 | - sleep(2) |
632 | + sleep(1.5) |
633 | self.assertEqual( |
634 | - True, self.modem_1.Get(CONNMAN_IFACE, 'RoamingAllowed')) |
635 | + True, self.modem_0.Get(CONNMAN_IFACE, 'RoamingAllowed')) |
636 | |
637 | def test_no_radio_preference(self): |
638 | self.select_preference(PREFERENCE_ANY) |
639 | - self.use_selector(LABEL_OFF) |
640 | + self.use_selector(USE_OFF) |
641 | |
642 | - self.modem_1.Set(RDO_IFACE, 'TechnologyPreference', '') |
643 | - self.modem_1.EmitSignal( |
644 | + self.modem_0.Set(RDO_IFACE, 'TechnologyPreference', '') |
645 | + self.modem_0.EmitSignal( |
646 | CONNMAN_IFACE, |
647 | 'PropertyChanged', |
648 | 'sv', |
649 | @@ -464,18 +474,6 @@ |
650 | self.data_preference_selector.get_properties()['enabled'], |
651 | Eventually(Equals(False))) |
652 | |
653 | - def test_radio_preference_changes(self): |
654 | - self.use_selector(LABEL_SIM_1) |
655 | - |
656 | - self.modem_1.Set(RDO_IFACE, 'TechnologyPreference', 'any') |
657 | - self.modem_1.EmitSignal( |
658 | - RDO_IFACE, |
659 | - 'PropertyChanged', |
660 | - 'sv', |
661 | - ['TechnologyPreference', 'any']) |
662 | - |
663 | - self.assert_selected_preference(1) |
664 | - |
665 | # see |
666 | # https://gitorious.org/python-dbusmock/python-dbusmock/merge_requests/3 |
667 | @skip('skipped due to bug in dbusmock') |
668 | @@ -483,9 +481,7 @@ |
669 | self.navigate_to_carriers_page() |
670 | self.navigate_to_carrier_page_for_sim(1) |
671 | carriers = self.system_settings.main_view.choose_page.select_single( |
672 | - toolkit_emulators.ItemSelector, |
673 | - objectName="carrierSelector" |
674 | - ) |
675 | + toolkit_emulators.ItemSelector, objectName="carrierSelector") |
676 | manual = carriers.select_single('Label', text="my.cool.telco") |
677 | self.assertThat(manual, NotEquals(None)) |
678 | |
679 | @@ -496,8 +492,73 @@ |
680 | self.navigate_to_carriers_page() |
681 | self.navigate_to_carrier_page_for_sim(2) |
682 | carriers = self.system_settings.main_view.choose_page.select_single( |
683 | - toolkit_emulators.ItemSelector, |
684 | - objectName="carrierSelector" |
685 | - ) |
686 | + toolkit_emulators.ItemSelector, objectName="carrierSelector") |
687 | manual = carriers.select_single('Label', text="my.cool.telco") |
688 | self.assertThat(manual, NotEquals(None)) |
689 | + |
690 | + def test_radio_preference_changes(self): |
691 | + self.use_selector(USE_SIM_1) |
692 | + |
693 | + self.modem_0.Set(RDO_IFACE, 'TechnologyPreference', 'any') |
694 | + self.modem_0.EmitSignal( |
695 | + RDO_IFACE, |
696 | + 'PropertyChanged', |
697 | + 'sv', |
698 | + ['TechnologyPreference', 'any']) |
699 | + |
700 | + self.assert_selected_preference(1) |
701 | + |
702 | + def test_changing_sim1_name(self): |
703 | + gsettings = Gio.Settings.new('com.ubuntu.phone') |
704 | + old_name = gsettings.get_value('sim-names')['/ril_0'] |
705 | + new_name = 'FOO BAR' |
706 | + self.rename_sim(1, new_name) |
707 | + |
708 | + # wait for gsettings |
709 | + sleep(1) |
710 | + try: |
711 | + self.assertEqual( |
712 | + new_name, gsettings.get_value('sim-names')['/ril_0']) |
713 | + except Exception as e: |
714 | + raise e |
715 | + finally: |
716 | + self.rename_sim(1, old_name) |
717 | + sleep(1) |
718 | + |
719 | + def test_changing_sim2_name(self): |
720 | + gsettings = Gio.Settings.new('com.ubuntu.phone') |
721 | + old_name = gsettings.get_value('sim-names')['/ril_1'] |
722 | + new_name = 'BAR BAZ' |
723 | + self.rename_sim(2, new_name) |
724 | + |
725 | + # wait for gsettings |
726 | + sleep(1) |
727 | + try: |
728 | + self.assertEqual( |
729 | + new_name, gsettings.get_value('sim-names')['/ril_1']) |
730 | + except Exception as e: |
731 | + raise e |
732 | + finally: |
733 | + self.rename_sim(2, old_name) |
734 | + # wait for gsettings |
735 | + sleep(1) |
736 | + |
737 | + def test_changes_to_sim_names_in_gsettings_are_reflected_in_ui(self): |
738 | + gsettings = Gio.Settings.new('com.ubuntu.phone') |
739 | + old_names = gsettings.get_value('sim-names') |
740 | + |
741 | + new_names = old_names.unpack() |
742 | + new_names['/ril_0'] = 'BAS QUX' |
743 | + new_names = GLib.Variant('a{ss}', new_names) |
744 | + gsettings.set_value('sim-names', new_names) |
745 | + |
746 | + # wait for gsettings |
747 | + sleep(1) |
748 | + try: |
749 | + self.assertIn(new_names['/ril_0'], self.get_sim_name(1)) |
750 | + except Exception as e: |
751 | + raise e |
752 | + finally: |
753 | + gsettings.set_value('sim-names', old_names) |
754 | + # wait for gsettings |
755 | + sleep(1) |
FAILED: Continuous integration, rev:801 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- ci/1072/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- utopic- touch/2539 jenkins. qa.ubuntu. com/job/ generic- mediumtests- utopic/ 2047 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- utopic- amd64-ci/ 264 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- utopic- armhf-ci/ 264 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- utopic- armhf-ci/ 264/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- utopic- i386-ci/ 264 jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- runner- mako/2686 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/3782 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/3782/ artifact/ work/output/ *zip*/output. zip s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 10482 jenkins. qa.ubuntu. com/job/ autopilot- testrunner- otto-utopic/ 1715 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- amd64/2300 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- amd64/2300/ artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- system- settings- ci/1072/ rebuild
http://