Merge lp:~nataliabidart/magicicada-gui/expand-status into lp:magicicada-gui
- expand-status
- Merge into trunk
Proposed by
Natalia Bidart
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Facundo Batista | ||||
Approved revision: | 27 | ||||
Merged at revision: | 24 | ||||
Proposed branch: | lp:~nataliabidart/magicicada-gui/expand-status | ||||
Merge into: | lp:magicicada-gui | ||||
Prerequisite: | lp:~nataliabidart/magicicada-gui/set-initial-state | ||||
Diff against target: |
383 lines (+132/-63) 3 files modified
data/ui/gui.glade (+2/-1) magicicada/__init__.py (+18/-10) magicicada/tests/test_magicicada.py (+112/-52) |
||||
To merge this branch: | bzr merge lp:~nataliabidart/magicicada-gui/expand-status | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
chicharreros | Pending | ||
Review via email: mp+25899@code.launchpad.net |
Commit message
Description of the change
Status label tweaks: added connection status, added ellipsize, added initial status.
To post a comment you must log in.
- 28. By Natalia Bidart
-
Merged trunk in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'data/ui/gui.glade' | |||
2 | --- data/ui/gui.glade 2010-05-16 21:43:51 +0000 | |||
3 | +++ data/ui/gui.glade 2010-05-24 16:14:33 +0000 | |||
4 | @@ -199,13 +199,14 @@ | |||
5 | 199 | </object> | 199 | </object> |
6 | 200 | <packing> | 200 | <packing> |
7 | 201 | <property name="expand">False</property> | 201 | <property name="expand">False</property> |
8 | 202 | <property name="padding">3</property> | ||
9 | 202 | <property name="position">0</property> | 203 | <property name="position">0</property> |
10 | 203 | </packing> | 204 | </packing> |
11 | 204 | </child> | 205 | </child> |
12 | 205 | <child> | 206 | <child> |
13 | 206 | <object class="GtkLabel" id="status_label"> | 207 | <object class="GtkLabel" id="status_label"> |
14 | 207 | <property name="visible">True</property> | 208 | <property name="visible">True</property> |
16 | 208 | <property name="label" translatable="yes">Service not started, click Start to continue.</property> | 209 | <property name="ellipsize">end</property> |
17 | 209 | </object> | 210 | </object> |
18 | 210 | <packing> | 211 | <packing> |
19 | 211 | <property name="position">1</property> | 212 | <property name="position">1</property> |
20 | 212 | 213 | ||
21 | === modified file 'magicicada/__init__.py' | |||
22 | --- magicicada/__init__.py 2010-05-23 10:23:35 +0000 | |||
23 | +++ magicicada/__init__.py 2010-05-24 16:14:33 +0000 | |||
24 | @@ -29,16 +29,16 @@ | |||
25 | 29 | gtk2reactor.install() | 29 | gtk2reactor.install() |
26 | 30 | 30 | ||
27 | 31 | from magicicada import syncdaemon | 31 | from magicicada import syncdaemon |
29 | 32 | from magicicada.helpers import get_data_file, get_builder, NO_OP, print_debug | 32 | from magicicada.helpers import get_data_file, get_builder, NO_OP |
30 | 33 | 33 | ||
31 | 34 | CONTENT_QUEUE = 'content' | 34 | CONTENT_QUEUE = 'content' |
32 | 35 | META_QUEUE = 'meta' | 35 | META_QUEUE = 'meta' |
33 | 36 | 36 | ||
34 | 37 | class MagicicadaUI(object): | 37 | class MagicicadaUI(object): |
35 | 38 | 38 | ||
36 | 39 | STATUS_JOINER = " - " | ||
37 | 39 | STATUS = { | 40 | STATUS = { |
40 | 40 | 'started': _('Service started, click Connect to continue.'), | 41 | 'initial': _('Service is not started, click Start to continue.'), |
39 | 41 | 'connected': _('Service connected. Doing internal synchronization...'), | ||
41 | 42 | } | 42 | } |
42 | 43 | 43 | ||
43 | 44 | def __init__(self, launchpad_available=False, on_destroy=NO_OP, | 44 | def __init__(self, launchpad_available=False, on_destroy=NO_OP, |
44 | @@ -142,7 +142,6 @@ | |||
45 | 142 | self.disconnect.set_sensitive(False) | 142 | self.disconnect.set_sensitive(False) |
46 | 143 | self.sd.disconnect() | 143 | self.sd.disconnect() |
47 | 144 | 144 | ||
48 | 145 | @print_debug | ||
49 | 146 | def on_status_icon_activate(self, widget, data=None): | 145 | def on_status_icon_activate(self, widget, data=None): |
50 | 147 | """Systray icon was clicked.""" | 146 | """Systray icon was clicked.""" |
51 | 148 | if self.main_window.get_property('visible'): | 147 | if self.main_window.get_property('visible'): |
52 | @@ -171,6 +170,11 @@ | |||
53 | 171 | self._activate_indicator(self.is_connected, sensitive=False) | 170 | self._activate_indicator(self.is_connected, sensitive=False) |
54 | 172 | self._activate_indicator(self.is_online, sensitive=False) | 171 | self._activate_indicator(self.is_online, sensitive=False) |
55 | 173 | 172 | ||
56 | 173 | cs = self.sd.current_state | ||
57 | 174 | self.on_status_changed(cs.name, cs.description) | ||
58 | 175 | self.on_meta_queue_changed(self.sd.meta_queue) | ||
59 | 176 | self.on_content_queue_changed(self.sd.content_queue) | ||
60 | 177 | |||
61 | 174 | def on_connected(self, *args, **kwargs): | 178 | def on_connected(self, *args, **kwargs): |
62 | 175 | """Callback'ed when syncadaemon is connected.""" | 179 | """Callback'ed when syncadaemon is connected.""" |
63 | 176 | self.connect.hide() | 180 | self.connect.hide() |
64 | @@ -199,12 +203,14 @@ | |||
65 | 199 | self._activate_indicator(self.is_online, sensitive=False) | 203 | self._activate_indicator(self.is_online, sensitive=False) |
66 | 200 | 204 | ||
67 | 201 | def on_status_changed(self, name=None, description=None, | 205 | def on_status_changed(self, name=None, description=None, |
70 | 202 | is_error=False, is_connected=True, | 206 | is_error=False, is_connected=True, is_online=True, |
71 | 203 | is_online=True, queues=None, connection=None): | 207 | queues=None, connection=None): |
72 | 204 | """Callback'ed when the SD status changed.""" | 208 | """Callback'ed when the SD status changed.""" |
76 | 205 | if description is None: | 209 | values = (v for v in (name, description, connection) if v) |
77 | 206 | description = '' | 210 | text = self.STATUS_JOINER.join(values) |
78 | 207 | self.status_label.set_text(description) | 211 | if not (text or self.sd.current_state.is_started): |
79 | 212 | text = self.STATUS['initial'] | ||
80 | 213 | self.status_label.set_text(text) | ||
81 | 208 | 214 | ||
82 | 209 | def _on_queue_changed(self, queue_name, items, *args, **kwargs): | 215 | def _on_queue_changed(self, queue_name, items, *args, **kwargs): |
83 | 210 | """Callback'ed when a queue changed.""" | 216 | """Callback'ed when a queue changed.""" |
84 | @@ -257,4 +263,6 @@ | |||
85 | 257 | 263 | ||
86 | 258 | self.on_meta_queue_changed(self.sd.meta_queue) | 264 | self.on_meta_queue_changed(self.sd.meta_queue) |
87 | 259 | self.on_content_queue_changed(self.sd.content_queue) | 265 | self.on_content_queue_changed(self.sd.content_queue) |
89 | 260 | self.on_status_changed(description=current_state.description) | 266 | self.on_status_changed(name=current_state.name, |
90 | 267 | description=current_state.description, | ||
91 | 268 | connection=current_state.connection) | ||
92 | 261 | 269 | ||
93 | === modified file 'magicicada/tests/test_magicicada.py' | |||
94 | --- magicicada/tests/test_magicicada.py 2010-05-23 10:23:35 +0000 | |||
95 | +++ magicicada/tests/test_magicicada.py 2010-05-24 16:14:33 +0000 | |||
96 | @@ -18,6 +18,8 @@ | |||
97 | 18 | 18 | ||
98 | 19 | """Tests for magicicada.""" | 19 | """Tests for magicicada.""" |
99 | 20 | 20 | ||
100 | 21 | import pango | ||
101 | 22 | |||
102 | 21 | from twisted.trial.unittest import TestCase | 23 | from twisted.trial.unittest import TestCase |
103 | 22 | 24 | ||
104 | 23 | from magicicada import MagicicadaUI, CONTENT_QUEUE, META_QUEUE, syncdaemon | 25 | from magicicada import MagicicadaUI, CONTENT_QUEUE, META_QUEUE, syncdaemon |
105 | @@ -28,6 +30,10 @@ | |||
106 | 28 | """A faked syncdaemon.""" | 30 | """A faked syncdaemon.""" |
107 | 29 | 31 | ||
108 | 30 | def __init__(self): | 32 | def __init__(self): |
109 | 33 | self.current_state = syncdaemon.State() | ||
110 | 34 | self.meta_queue = [] | ||
111 | 35 | self.content_queue = [] | ||
112 | 36 | |||
113 | 31 | self.on_started_callback = NO_OP | 37 | self.on_started_callback = NO_OP |
114 | 32 | self.on_stopped_callback = NO_OP | 38 | self.on_stopped_callback = NO_OP |
115 | 33 | self.on_connected_callback = NO_OP | 39 | self.on_connected_callback = NO_OP |
116 | @@ -38,14 +44,11 @@ | |||
117 | 38 | self.content_queue_changed_callback = NO_OP | 44 | self.content_queue_changed_callback = NO_OP |
118 | 39 | self.meta_queue_changed_callback = NO_OP | 45 | self.meta_queue_changed_callback = NO_OP |
119 | 40 | self.shutdown = NO_OP | 46 | self.shutdown = NO_OP |
128 | 41 | self.start = NO_OP | 47 | self.start = lambda: setattr(self.current_state, 'is_started', True) |
129 | 42 | self.quit = NO_OP | 48 | self.quit = lambda: setattr(self.current_state, 'is_started', False) |
130 | 43 | self.connect = NO_OP | 49 | self.connect = lambda: setattr(self.current_state, 'is_connected', True) |
131 | 44 | self.disconnect = NO_OP | 50 | self.disconnect = \ |
132 | 45 | 51 | lambda: setattr(self.current_state, 'is_connected', False) | |
125 | 46 | self.current_state = syncdaemon.State() | ||
126 | 47 | self.meta_queue = [] | ||
127 | 48 | self.content_queue = [] | ||
133 | 49 | 52 | ||
134 | 50 | 53 | ||
135 | 51 | class MagicicadaUITestCase(TestCase): | 54 | class MagicicadaUITestCase(TestCase): |
136 | @@ -62,6 +65,17 @@ | |||
137 | 62 | self.ui.on_main_window_destroy(self.ui.main_window) | 65 | self.ui.on_main_window_destroy(self.ui.main_window) |
138 | 63 | self._called = False | 66 | self._called = False |
139 | 64 | 67 | ||
140 | 68 | def do_start(self): | ||
141 | 69 | """Simulate that start fully happened.""" | ||
142 | 70 | self.ui.on_start_clicked(self.ui.start) | ||
143 | 71 | self.ui.on_started() | ||
144 | 72 | |||
145 | 73 | def do_connect(self): | ||
146 | 74 | """Simulate that connect fully happened.""" | ||
147 | 75 | self.do_start() | ||
148 | 76 | self.ui.on_connect_clicked(self.ui.connect) | ||
149 | 77 | self.ui.on_connected() | ||
150 | 78 | |||
151 | 65 | def assert_indicator_disabled(self, indicator): | 79 | def assert_indicator_disabled(self, indicator): |
152 | 66 | """Test that 'indicator' is not sensitive.""" | 80 | """Test that 'indicator' is not sensitive.""" |
153 | 67 | self.assertFalse(indicator.is_sensitive(), 'indicator is not sensitive') | 81 | self.assertFalse(indicator.is_sensitive(), 'indicator is not sensitive') |
154 | @@ -150,8 +164,7 @@ | |||
155 | 150 | 164 | ||
156 | 151 | def test_on_connect_clicked(self): | 165 | def test_on_connect_clicked(self): |
157 | 152 | """Test on_connect_clicked.""" | 166 | """Test on_connect_clicked.""" |
160 | 153 | self.ui.on_start_clicked(self.ui.start) # need to be started | 167 | self.do_start() # need to be started |
159 | 154 | self.ui.on_started() | ||
161 | 155 | self.ui.on_connect_clicked(self.ui.connect) | 168 | self.ui.on_connect_clicked(self.ui.connect) |
162 | 156 | 169 | ||
163 | 157 | self.assertTrue(self.ui.connect.get_property('visible')) | 170 | self.assertTrue(self.ui.connect.get_property('visible')) |
164 | @@ -170,8 +183,7 @@ | |||
165 | 170 | 183 | ||
166 | 171 | def test_on_stop_clicked(self): | 184 | def test_on_stop_clicked(self): |
167 | 172 | """Test on_stop_clicked.""" | 185 | """Test on_stop_clicked.""" |
170 | 173 | self.ui.on_start_clicked(self.ui.start) | 186 | self.do_start() |
169 | 174 | self.ui.on_started() | ||
171 | 175 | assert not self.ui.widget_enabled(self.ui.disconnect) | 187 | assert not self.ui.widget_enabled(self.ui.disconnect) |
172 | 176 | self.patch(self.ui, 'on_disconnect_clicked', self.set_called) | 188 | self.patch(self.ui, 'on_disconnect_clicked', self.set_called) |
173 | 177 | self.ui.on_stop_clicked(self.ui.stop) | 189 | self.ui.on_stop_clicked(self.ui.stop) |
174 | @@ -188,10 +200,7 @@ | |||
175 | 188 | 200 | ||
176 | 189 | def test_on_stop_clicked_if_connected(self): | 201 | def test_on_stop_clicked_if_connected(self): |
177 | 190 | """Test on_stop_clicked.""" | 202 | """Test on_stop_clicked.""" |
182 | 191 | self.ui.on_start_clicked(self.ui.start) | 203 | self.do_connect() |
179 | 192 | self.ui.on_started() | ||
180 | 193 | self.ui.on_connect_clicked(self.ui.connect) | ||
181 | 194 | self.ui.on_connected() | ||
183 | 195 | self.patch(self.ui, 'on_disconnect_clicked', self.set_called) | 204 | self.patch(self.ui, 'on_disconnect_clicked', self.set_called) |
184 | 196 | self.ui.on_stop_clicked(self.ui.stop) | 205 | self.ui.on_stop_clicked(self.ui.stop) |
185 | 197 | 206 | ||
186 | @@ -205,10 +214,7 @@ | |||
187 | 205 | 214 | ||
188 | 206 | def test_on_disconnect_clicked(self): | 215 | def test_on_disconnect_clicked(self): |
189 | 207 | """Test on_disconnect_clicked.""" | 216 | """Test on_disconnect_clicked.""" |
194 | 208 | self.ui.on_start_clicked(self.ui.start) | 217 | self.do_connect() |
191 | 209 | self.ui.on_started() | ||
192 | 210 | self.ui.on_connect_clicked(self.ui.connect) | ||
193 | 211 | self.ui.on_connected() | ||
195 | 212 | self.ui.on_disconnect_clicked(self.ui.disconnect) | 218 | self.ui.on_disconnect_clicked(self.ui.disconnect) |
196 | 213 | 219 | ||
197 | 214 | self.assertFalse(self.ui.connect.get_property('visible')) | 220 | self.assertFalse(self.ui.connect.get_property('visible')) |
198 | @@ -329,6 +335,14 @@ | |||
199 | 329 | 335 | ||
200 | 330 | self.assert_queue_store_correct(self.queue_store, data) | 336 | self.assert_queue_store_correct(self.queue_store, data) |
201 | 331 | 337 | ||
202 | 338 | def test_on_stopped_updates_queue(self): | ||
203 | 339 | """On SD stoppped, the UI updates the queue state.""" | ||
204 | 340 | cb = 'on_%s_queue_changed' % self.queue | ||
205 | 341 | self.patch(self.ui, cb, self.set_called) | ||
206 | 342 | self.ui.on_stopped() | ||
207 | 343 | self.assertTrue(self._called, | ||
208 | 344 | '%s was called on_stopped.' % cb) | ||
209 | 345 | |||
210 | 332 | 346 | ||
211 | 333 | class MagicicadaUIContentQueueTestCase(_MagicicadaUIQueueTestCase): | 347 | class MagicicadaUIContentQueueTestCase(_MagicicadaUIQueueTestCase): |
212 | 334 | """UI test cases for content queue view.""" | 348 | """UI test cases for content queue view.""" |
213 | @@ -345,28 +359,91 @@ | |||
214 | 345 | class MagicicadaUIStatusTestCase(MagicicadaUITestCase): | 359 | class MagicicadaUIStatusTestCase(MagicicadaUITestCase): |
215 | 346 | """UI test cases for the status label.""" | 360 | """UI test cases for the status label.""" |
216 | 347 | 361 | ||
217 | 362 | def assert_status_label_correct(self, name=None, description=None, | ||
218 | 363 | connection=None, expected=None): | ||
219 | 364 | """Test that the status label is of the form name: description.""" | ||
220 | 365 | if expected is None: | ||
221 | 366 | assert name is not None | ||
222 | 367 | assert description is not None | ||
223 | 368 | assert connection is not None | ||
224 | 369 | values = (name, description, connection) | ||
225 | 370 | expected = self.ui.STATUS_JOINER.join(values) | ||
226 | 371 | |||
227 | 372 | actual = self.ui.status_label.get_text() | ||
228 | 373 | msg = 'status label test must be "%s" (got "%s" instead).' | ||
229 | 374 | self.assertEqual(expected, actual, msg % (expected, actual)) | ||
230 | 375 | |||
231 | 348 | def test_callback_is_connected(self): | 376 | def test_callback_is_connected(self): |
232 | 349 | """Status callback is connected.""" | 377 | """Status callback is connected.""" |
233 | 350 | self.assertEqual(self.ui.sd.status_changed_callback, | 378 | self.assertEqual(self.ui.sd.status_changed_callback, |
234 | 351 | self.ui.on_status_changed, | 379 | self.ui.on_status_changed, |
235 | 352 | 'status_changed callback must be set') | 380 | 'status_changed callback must be set') |
236 | 353 | 381 | ||
237 | 382 | def test_status_label_ellipsizes(self): | ||
238 | 383 | """The status label ellipsizes.""" | ||
239 | 384 | expected = pango.ELLIPSIZE_END | ||
240 | 385 | actual = self.ui.status_label.get_ellipsize() | ||
241 | 386 | self.assertEqual(expected, actual, 'label ellipsizes is ELLIPSIZE_END.') | ||
242 | 387 | |||
243 | 354 | def test_on_status_changed_updates_status_label(self): | 388 | def test_on_status_changed_updates_status_label(self): |
248 | 355 | """On status changed the status label is updated.""" | 389 | """On status changed, the status label is updated.""" |
249 | 356 | kwargs = dict(name='test', description='the status for testing', | 390 | name = 'TEST' |
250 | 357 | is_error=False, is_connected=True, is_online=False, | 391 | description = 'the status for testing' |
251 | 358 | queues=None, connection=None) | 392 | connection = 'funny funny connection' |
252 | 393 | kwargs = dict(name=name, description=description, connection=connection) | ||
253 | 394 | |||
254 | 395 | # usual case, all values are defined | ||
255 | 359 | self.ui.on_status_changed(**kwargs) | 396 | self.ui.on_status_changed(**kwargs) |
257 | 360 | self.assertEqual(self.ui.status_label.get_text(), kwargs['description']) | 397 | self.assert_status_label_correct(**kwargs) |
258 | 398 | |||
259 | 399 | def test_on_status_changed_updates_status_label_even_on_weird_cases(self): | ||
260 | 400 | """On status changed, the status label is updated.""" | ||
261 | 401 | name = 'TEST' | ||
262 | 402 | description = 'the status for testing' | ||
263 | 403 | connection = 'funny funny connection' | ||
264 | 404 | kwargs = dict(name=name, description=description, connection=connection) | ||
265 | 405 | |||
266 | 406 | keywords = ('name', 'description', 'connection') # need ordering | ||
267 | 407 | for attr in keywords: | ||
268 | 408 | old_value = kwargs[attr] | ||
269 | 409 | |||
270 | 410 | # some weird cases: attr is '' or None | ||
271 | 411 | for value in ('', None): | ||
272 | 412 | kwargs[attr] = value | ||
273 | 413 | self.ui.on_status_changed(**kwargs) | ||
274 | 414 | others = (kwargs[k] for k in keywords if k != attr) | ||
275 | 415 | expected = self.ui.STATUS_JOINER.join(others) | ||
276 | 416 | self.assert_status_label_correct(expected=expected) | ||
277 | 417 | |||
278 | 418 | kwargs[attr] = old_value | ||
279 | 361 | 419 | ||
280 | 362 | def test_update_is_correct_for_status_label(self): | 420 | def test_update_is_correct_for_status_label(self): |
281 | 363 | """Correctly updates the status label.""" | 421 | """Correctly updates the status label.""" |
284 | 364 | expected = 'dummy test' | 422 | name = 'TEST' |
285 | 365 | self.ui.sd.current_state._set(description=expected) | 423 | description = 'the status for testing' |
286 | 424 | connection = 'funny funny connection' | ||
287 | 425 | kwargs = dict(name=name, description=description, connection=connection) | ||
288 | 426 | self.ui.sd.current_state._set(**kwargs) | ||
289 | 366 | 427 | ||
290 | 367 | self.ui.update() | 428 | self.ui.update() |
293 | 368 | 429 | self.assert_status_label_correct(**kwargs) | |
294 | 369 | self.assertEqual(expected, self.ui.status_label.get_text()) | 430 | |
295 | 431 | def test_on_stopped_updates_status_label(self): | ||
296 | 432 | """On SD stoppped, the UI updates the status label.""" | ||
297 | 433 | self.patch(self.ui, 'on_status_changed', self.set_called) | ||
298 | 434 | self.ui.on_stopped() | ||
299 | 435 | self.assertTrue(self._called, | ||
300 | 436 | 'on_status_changed was called on_stopped.') | ||
301 | 437 | |||
302 | 438 | def test_status_label_default_if_not_started(self): | ||
303 | 439 | """Status label is the default if not started.""" | ||
304 | 440 | self.assert_status_label_correct(expected=self.ui.STATUS['initial']) | ||
305 | 441 | |||
306 | 442 | def test_status_label_empty_if_started_and_no_name_nor_desc(self): | ||
307 | 443 | """Status label is empty if started but no name and no description.""" | ||
308 | 444 | self.do_start() | ||
309 | 445 | self.ui.on_status_changed(name=None, description=None) | ||
310 | 446 | self.assert_status_label_correct(expected='') | ||
311 | 370 | 447 | ||
312 | 371 | 448 | ||
313 | 372 | class MagicicadaUIConnectionTestCase(MagicicadaUITestCase): | 449 | class MagicicadaUIConnectionTestCase(MagicicadaUITestCase): |
314 | @@ -425,10 +502,7 @@ | |||
315 | 425 | 502 | ||
316 | 426 | def test_on_started_is_correct(self): | 503 | def test_on_started_is_correct(self): |
317 | 427 | """On SD started, the UI enables connect and indicator.""" | 504 | """On SD started, the UI enables connect and indicator.""" |
322 | 428 | # must have click start first | 505 | self.do_start() |
319 | 429 | self.ui.on_start_clicked(self.ui.start) | ||
320 | 430 | |||
321 | 431 | self.ui.on_started() | ||
323 | 432 | 506 | ||
324 | 433 | self.assertTrue(self.ui.widget_enabled(self.ui.stop)) | 507 | self.assertTrue(self.ui.widget_enabled(self.ui.stop)) |
325 | 434 | self.assertTrue(self.ui.widget_enabled(self.ui.connect)) | 508 | self.assertTrue(self.ui.widget_enabled(self.ui.connect)) |
326 | @@ -438,11 +512,7 @@ | |||
327 | 438 | 512 | ||
328 | 439 | def test_on_connected_is_correct(self): | 513 | def test_on_connected_is_correct(self): |
329 | 440 | """On SD connected, the UI enables indicator.""" | 514 | """On SD connected, the UI enables indicator.""" |
335 | 441 | self.ui.on_start_clicked(self.ui.start) | 515 | self.do_connect() |
331 | 442 | self.ui.on_started() | ||
332 | 443 | self.ui.on_connect_clicked(self.ui.start) | ||
333 | 444 | |||
334 | 445 | self.ui.on_connected() | ||
336 | 446 | 516 | ||
337 | 447 | self.assertTrue(self.ui.widget_enabled(self.ui.disconnect)) | 517 | self.assertTrue(self.ui.widget_enabled(self.ui.disconnect)) |
338 | 448 | self.assert_indicator_ready(self.ui.is_started) | 518 | self.assert_indicator_ready(self.ui.is_started) |
339 | @@ -451,10 +521,7 @@ | |||
340 | 451 | 521 | ||
341 | 452 | def test_on_online_is_correct(self): | 522 | def test_on_online_is_correct(self): |
342 | 453 | """On SD online, the UI enables indicator.""" | 523 | """On SD online, the UI enables indicator.""" |
347 | 454 | self.ui.on_start_clicked(self.ui.start) | 524 | self.do_connect() |
344 | 455 | self.ui.on_started() | ||
345 | 456 | self.ui.on_connect_clicked(self.ui.connect) | ||
346 | 457 | self.ui.on_connected() | ||
348 | 458 | 525 | ||
349 | 459 | self.ui.on_online() | 526 | self.ui.on_online() |
350 | 460 | 527 | ||
351 | @@ -464,8 +531,7 @@ | |||
352 | 464 | 531 | ||
353 | 465 | def test_on_stopped_is_correct(self): | 532 | def test_on_stopped_is_correct(self): |
354 | 466 | """On SD stopped, the UI disables stop and indicator.""" | 533 | """On SD stopped, the UI disables stop and indicator.""" |
357 | 467 | self.ui.on_start_clicked(self.ui.start) | 534 | self.do_start() |
356 | 468 | self.ui.on_started() | ||
358 | 469 | self.ui.on_stop_clicked(self.ui.stop) | 535 | self.ui.on_stop_clicked(self.ui.stop) |
359 | 470 | 536 | ||
360 | 471 | self.ui.on_stopped() | 537 | self.ui.on_stopped() |
361 | @@ -478,10 +544,7 @@ | |||
362 | 478 | 544 | ||
363 | 479 | def test_on_disconnected_is_correct(self): | 545 | def test_on_disconnected_is_correct(self): |
364 | 480 | """On SD disconnected, the UI disables connect and indicator.""" | 546 | """On SD disconnected, the UI disables connect and indicator.""" |
369 | 481 | self.ui.on_start_clicked(self.ui.start) | 547 | self.do_connect() |
366 | 482 | self.ui.on_started() | ||
367 | 483 | self.ui.on_connect_clicked(self.ui.connect) | ||
368 | 484 | self.ui.on_connected() | ||
370 | 485 | self.ui.on_disconnect_clicked(self.ui.disconnect) | 548 | self.ui.on_disconnect_clicked(self.ui.disconnect) |
371 | 486 | 549 | ||
372 | 487 | self.ui.on_disconnected() | 550 | self.ui.on_disconnected() |
373 | @@ -493,10 +556,7 @@ | |||
374 | 493 | 556 | ||
375 | 494 | def test_on_offline_is_correct(self): | 557 | def test_on_offline_is_correct(self): |
376 | 495 | """On SD offline, the UI disables indicator.""" | 558 | """On SD offline, the UI disables indicator.""" |
381 | 496 | self.ui.on_start_clicked(self.ui.start) | 559 | self.do_connect() |
378 | 497 | self.ui.on_started() | ||
379 | 498 | self.ui.on_connect_clicked(self.ui.connect) | ||
380 | 499 | self.ui.on_connected() | ||
382 | 500 | 560 | ||
383 | 501 | self.ui.on_offline() | 561 | self.ui.on_offline() |
384 | 502 | 562 |