Merge lp:~jonas-drange/ubuntu-system-settings/cellular-slot2-online-status-not-persisting-1375832 into lp:ubuntu-system-settings

Proposed by Jonas G. Drange
Status: Merged
Approved by: Ken VanDine
Approved revision: 1110
Merged at revision: 1115
Proposed branch: lp:~jonas-drange/ubuntu-system-settings/cellular-slot2-online-status-not-persisting-1375832
Merge into: lp:ubuntu-system-settings
Diff against target: 153 lines (+35/-20)
6 files modified
plugins/cellular/PageComponent.qml (+1/-1)
plugins/cellular/sims.js (+4/-0)
plugins/phone/PageComponent.qml (+3/-2)
plugins/phone/sims.js (+4/-0)
tests/autopilot/ubuntu_system_settings/tests/__init__.py (+7/-7)
tests/autopilot/ubuntu_system_settings/tests/test_cellular.py (+16/-10)
To merge this branch: bzr merge lp:~jonas-drange/ubuntu-system-settings/cellular-slot2-online-status-not-persisting-1375832
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ken VanDine Approve
Review via email: mp+237070@code.launchpad.net

Commit message

[wifi/phone] dynamically chooses what SIM to use when there's only one present.

Description of the change

[wifi/phone] dynamically chooses what SIM to use when there's only one present.

To post a comment you must log in.
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Looks good and works fine

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

fix sim comes online test

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

adapt to new test data

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/cellular/PageComponent.qml'
2--- plugins/cellular/PageComponent.qml 2014-08-19 10:58:01 +0000
3+++ plugins/cellular/PageComponent.qml 2014-10-06 12:14:05 +0000
4@@ -47,7 +47,7 @@
5 name: "singleSim"
6 StateChangeScript {
7 script: loader.setSource("Components/SingleSim.qml", {
8- sim: Sims.get(0)
9+ sim: Sims.getFirstPresent()
10 })
11 }
12 when: simsLoaded && (Sims.getPresentCount() === 1)
13
14=== modified file 'plugins/cellular/sims.js'
15--- plugins/cellular/sims.js 2014-08-19 10:58:01 +0000
16+++ plugins/cellular/sims.js 2014-10-06 12:14:05 +0000
17@@ -13,6 +13,10 @@
18 return getAll()[n];
19 }
20
21+function getFirstPresent () {
22+ return getPresent()[0];
23+}
24+
25 function getCount () {
26 return getAll().length;
27 }
28
29=== modified file 'plugins/phone/PageComponent.qml'
30--- plugins/phone/PageComponent.qml 2014-08-28 17:33:40 +0000
31+++ plugins/phone/PageComponent.qml 2014-10-06 12:14:05 +0000
32@@ -46,8 +46,9 @@
33 State {
34 name: "singleSim"
35 StateChangeScript {
36- script: loader.setSource("SingleSim.qml", { sim: Sims.get(0) })
37-
38+ script: loader.setSource("SingleSim.qml", {
39+ sim: Sims.getFirstPresent()
40+ })
41 }
42 when: simsLoaded && (Sims.getPresentCount() === 1)
43 },
44
45=== modified file 'plugins/phone/sims.js'
46--- plugins/phone/sims.js 2014-08-19 15:59:18 +0000
47+++ plugins/phone/sims.js 2014-10-06 12:14:05 +0000
48@@ -13,6 +13,10 @@
49 return getAll()[n];
50 }
51
52+function getFirstPresent () {
53+ return getPresent()[0];
54+}
55+
56 function getCount () {
57 return getAll().length;
58 }
59
60=== modified file 'tests/autopilot/ubuntu_system_settings/tests/__init__.py'
61--- tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-09-26 12:52:31 +0000
62+++ tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-10-06 12:14:05 +0000
63@@ -110,7 +110,6 @@
64 dbusmock.DBusTestCase):
65 """Class for cellular tests which sets up an Ofono mock """
66
67- technology_preference = 'gsm'
68 use_sims = 1
69
70 @property
71@@ -183,11 +182,12 @@
72 ]
73 )
74
75- def mock_radio_settings(self, modem):
76- modem.AddProperty(
77- RDO_IFACE, 'TechnologyPreference', self.technology_preference)
78- modem.AddProperty(
79- RDO_IFACE, 'ModemTechnologies', ['gsm', 'umts', 'lte'])
80+ def mock_radio_settings(self, modem, preference='gsm',
81+ technologies=['gsm', 'umts', 'lte']):
82+ modem.AddProperty(
83+ RDO_IFACE, 'TechnologyPreference', preference)
84+ modem.AddProperty(
85+ RDO_IFACE, 'ModemTechnologies', technologies)
86 modem.AddMethods(
87 RDO_IFACE,
88 [('GetProperties', '', 'a{sv}',
89@@ -260,7 +260,7 @@
90 self.get_all_operators(second_modem)),
91 ])
92 self.mock_carriers(second_modem)
93- self.mock_radio_settings(self.modem_1)
94+ self.mock_radio_settings(self.modem_1, technologies=['gsm'])
95 self.mock_connection_manager(self.modem_1)
96 self.mock_call_forwarding(self.modem_1)
97 self.mock_call_settings(self.modem_1)
98
99=== modified file 'tests/autopilot/ubuntu_system_settings/tests/test_cellular.py'
100--- tests/autopilot/ubuntu_system_settings/tests/test_cellular.py 2014-08-25 11:33:04 +0000
101+++ tests/autopilot/ubuntu_system_settings/tests/test_cellular.py 2014-10-06 12:14:05 +0000
102@@ -378,13 +378,6 @@
103 self.assertEqual(
104 'gsm', self.modem_0.Get(RDO_IFACE, 'TechnologyPreference'))
105
106- def test_use_umts_for_sim_2(self):
107- self.use_selector(USE_SIM_2)
108- self.select_preference(PREFERENCE_UMTS)
109- sleep(1)
110- self.assertEqual(
111- 'umts', self.modem_1.Get(RDO_IFACE, 'TechnologyPreference'))
112-
113 def test_when_sim_1_comes_online_ui_is_correct(self):
114 self.use_selector(USE_SIM_1)
115 self.select_preference(PREFERENCE_UMTS)
116@@ -404,7 +397,7 @@
117
118 def test_when_sim_2_comes_online_ui_is_correct(self):
119 self.use_selector(USE_SIM_2)
120- self.select_preference(PREFERENCE_UMTS)
121+ self.select_preference(PREFERENCE_2G)
122 self.use_selector(USE_OFF)
123 sleep(2)
124 self.modem_1.Set(CONNMAN_IFACE, 'Powered', True)
125@@ -415,9 +408,9 @@
126 ['Powered', 'true'])
127
128 self.assertEqual(
129- 'umts', self.modem_1.Get(RDO_IFACE, 'TechnologyPreference'))
130+ 'gsm', self.modem_1.Get(RDO_IFACE, 'TechnologyPreference'))
131 self.assert_used(2)
132- self.assert_selected_preference(1)
133+ self.assert_selected_preference(0)
134
135 def test_roaming_switch(self):
136 roaming_switch = self.system_settings.main_view.select_single(
137@@ -673,3 +666,16 @@
138 self.assertThat(
139 lambda: self.system_settings.main_view.select_single(
140 objectName='singleSim'), raises(StateNotFoundError))
141+
142+ # regression test for 1375832
143+ # tests that the second slot only exposes gsm, which
144+ # the testdata indicates
145+ def test_slot_two(self):
146+ self.modem_0.EmitSignal(
147+ SIM_IFACE,
148+ 'PropertyChanged',
149+ 'sv',
150+ ['Present', 'False'])
151+ self.select_preference(PREFERENCE_2G)
152+ self.assertRaises(StateNotFoundError,
153+ self.select_preference, PREFERENCE_UMTS)

Subscribers

People subscribed via source and target branches