Merge lp:~diegosarmentero/ubuntuone-control-panel/remove-button into lp:ubuntuone-control-panel

Proposed by Diego Sarmentero on 2012-01-04
Status: Merged
Approved by: Natalia Bidart on 2012-01-06
Approved revision: 255
Merged at revision: 251
Proposed branch: lp:~diegosarmentero/ubuntuone-control-panel/remove-button
Merge into: lp:ubuntuone-control-panel
Diff against target: 51 lines (+23/-0)
2 files modified
ubuntuone/controlpanel/gui/qt/devices.py (+1/-0)
ubuntuone/controlpanel/gui/qt/tests/test_devices.py (+22/-0)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntuone-control-panel/remove-button
Reviewer Review Type Date Requested Status
Natalia Bidart 2012-01-04 Approve on 2012-01-06
Roberto Alsina (community) Approve on 2012-01-05
Review via email: mp+87521@code.launchpad.net

Commit Message

Fixed: two remove buttons (LP: #904551).

Description of the Change

Fixed: two remove buttons (LP: #904551).

To post a comment you must log in.
Natalia Bidart (nataliabidart) wrote :

Need a test! ;-)

review: Needs Fixing
251. By Diego Sarmentero on 2012-01-04

changed close to deleteLater

252. By Diego Sarmentero on 2012-01-04

Adding test

253. By Diego Sarmentero on 2012-01-04

adding assert

254. By Diego Sarmentero on 2012-01-05

Adding show for the devices widget.

Roberto Alsina (ralsina) wrote :

+1

review: Approve
Natalia Bidart (nataliabidart) wrote :

== Python Lint Notices ==

ubuntuone/controlpanel/gui/qt/tests/test_devices.py:
    100: [C0111, DevicesPanelTestCase.test_remove_device_and_check_layout_state.delete_later] Missing docstring
    101: [W0201, DevicesPanelTestCase.test_remove_device_and_check_layout_state.delete_later] Attribute 'executed' defined outside __init__

review: Needs Fixing
255. By Diego Sarmentero on 2012-01-05

Fixing lint issues.

Natalia Bidart (nataliabidart) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/controlpanel/gui/qt/devices.py'
2--- ubuntuone/controlpanel/gui/qt/devices.py 2011-11-28 15:06:18 +0000
3+++ ubuntuone/controlpanel/gui/qt/devices.py 2012-01-05 15:28:23 +0000
4@@ -81,6 +81,7 @@
5 for i in reversed(range(children)):
6 widget = box.itemAt(i).widget()
7 box.removeWidget(widget)
8+ widget.deleteLater()
9
10 def update_device_info(self, device_info):
11 """Update one device."""
12
13=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_devices.py'
14--- ubuntuone/controlpanel/gui/qt/tests/test_devices.py 2011-11-28 15:06:18 +0000
15+++ ubuntuone/controlpanel/gui/qt/tests/test_devices.py 2012-01-05 15:28:23 +0000
16@@ -35,6 +35,7 @@
17 innerclass_ui = gui.devices_ui
18 innerclass_name = "Ui_Form"
19 class_ui = gui.DevicesPanel
20+ executed = False
21
22 @defer.inlineCallbacks
23 def setUp(self):
24@@ -88,6 +89,27 @@
25 device = self.ui.ui.list_devices.itemWidget(item)
26 self.assertEqual(device.text(), remote_device['name'])
27
28+ def test_remove_device_and_check_layout_state(self):
29+ """Test if the widget is properly removed."""
30+ self.ui.process_info(SAMPLE_DEVICES_INFO)
31+ self.ui.show()
32+
33+ self.assertEqual(self.ui.ui.local_device_box.count(), 1)
34+ local_device = self.ui.ui.local_device_box.itemAt(0).widget()
35+ self.executed = False
36+
37+ def delete_later(reference=None):
38+ """Fake delete later."""
39+ self.executed = True
40+ self.patch(local_device, "deleteLater", delete_later)
41+ self.ui.clear_device_info(self.ui.ui.local_device_box)
42+ self.ui.process_info(SAMPLE_DEVICES_INFO)
43+ self.assertEqual(self.ui.ui.local_device_box.count(), 1)
44+ local_device2 = self.ui.ui.local_device_box.itemAt(0).widget()
45+ self.assertNotEqual(local_device, local_device2)
46+ self.assertTrue(self.executed)
47+ self.assertFalse(local_device.isVisible())
48+
49 def test_process_info_twice(self):
50 """The widget is updated with the info."""
51 self.test_process_info()

Subscribers

People subscribed via source and target branches