Merge lp:~ralsina/ubuntuone-control-panel/space-the-final-frontier into lp:ubuntuone-control-panel

Proposed by Roberto Alsina on 2012-08-28
Status: Merged
Approved by: dobey on 2012-09-14
Approved revision: 357
Merged at revision: 358
Proposed branch: lp:~ralsina/ubuntuone-control-panel/space-the-final-frontier
Merge into: lp:ubuntuone-control-panel
Diff against target: 82 lines (+13/-6)
2 files modified
ubuntuone/controlpanel/gui/qt/share_links_search.py (+2/-0)
ubuntuone/controlpanel/gui/qt/tests/test_share_links_search.py (+11/-6)
To merge this branch: bzr merge lp:~ralsina/ubuntuone-control-panel/space-the-final-frontier
Reviewer Review Type Date Requested Status
dobey (community) Approve on 2012-09-14
Manuel de la Peña (community) 2012-08-28 Approve on 2012-08-30
Review via email: mp+121675@code.launchpad.net

Commit Message

- Made handling of the space key more robust in the search field (LP:1042806)

Description of the Change

Be a bit more robust when theuser presses space in the search box in the file share tab.

This is hard to reproduce, it happens to me because of bug #1042885

To post a comment you must log in.
356. By Roberto Alsina on 2012-08-28

simpler test

357. By Roberto Alsina on 2012-08-28

typos

review: Approve
dobey (dobey) :
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/share_links_search.py'
2--- ubuntuone/controlpanel/gui/qt/share_links_search.py 2012-08-27 20:02:55 +0000
3+++ ubuntuone/controlpanel/gui/qt/share_links_search.py 2012-08-28 18:40:24 +0000
4@@ -131,6 +131,8 @@
5 def _key_space_pressed(self):
6 """The user pressed the space key."""
7 item = self.popup.list_widget.currentItem()
8+ if item is None:
9+ return False
10 widget = self.popup.list_widget.itemWidget(item)
11 self.setText(widget.name)
12 self.popup.hide()
13
14=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_share_links_search.py'
15--- ubuntuone/controlpanel/gui/qt/tests/test_share_links_search.py 2012-08-28 00:32:41 +0000
16+++ ubuntuone/controlpanel/gui/qt/tests/test_share_links_search.py 2012-08-28 18:40:24 +0000
17@@ -67,7 +67,7 @@
18 self.assertEqual(self.ui.prefix, '')
19
20 def test_key_down_pressed(self):
21- """Check the proper action are executed on key down pressed."""
22+ """Check the proper actions are executed on key down pressed."""
23 data1 = [{'path': 'folder1'}]
24 data2 = [{'realpath': 'folder2'}]
25 self.ui._process_volumes_info([(0, 0, data1), (0, 0, data2)])
26@@ -77,7 +77,7 @@
27 self.assertEqual(self.ui.popup.list_widget.currentRow(), 2)
28
29 def test_key_down_pressed_load_more_items(self):
30- """Check the proper action are executed on key down pressed."""
31+ """Check the proper actions are executed on key down pressed."""
32 data = []
33
34 def fake_fetch_more(filenames):
35@@ -99,7 +99,7 @@
36 self.assertEqual(data, [True])
37
38 def test_key_up_pressed(self):
39- """Check the proper action are executed on key up pressed."""
40+ """Check the proper actions are executed on key up pressed."""
41 data1 = [{'path': 'folder1'}]
42 data2 = [{'realpath': 'folder2'}]
43 self.ui._process_volumes_info([(0, 0, data1), (0, 0, data2)])
44@@ -109,7 +109,7 @@
45 self.assertEqual(self.ui.popup.list_widget.currentRow(), 0)
46
47 def test_key_up_pressed_stay_in_0(self):
48- """Check the proper action are executed on key up pressed."""
49+ """Check the proper actions are executed on key up pressed."""
50 data1 = [{'path': 'folder1'}]
51 data2 = [{'realpath': 'folder2'}]
52 self.ui._process_volumes_info([(0, 0, data1), (0, 0, data2)])
53@@ -120,7 +120,7 @@
54 self.assertEqual(self.ui.popup.list_widget.currentRow(), 0)
55
56 def test_key_return_pressed(self):
57- """Check the proper action are executed on key return pressed."""
58+ """Check the proper actions are executed on key return pressed."""
59 data1 = [{'path': 'folder1'}]
60 data2 = [{'realpath': 'folder2'}]
61 self.ui._process_volumes_info([(0, 0, data1), (0, 0, data2)])
62@@ -129,7 +129,7 @@
63 self.ui._key_return_pressed(current)
64
65 def test_key_space_pressed(self):
66- """Check the proper action are executed on key space pressed."""
67+ """Check the proper actions are executed on key space pressed."""
68 data = []
69
70 def fake_set_text(text):
71@@ -146,6 +146,11 @@
72 expected = ['iop']
73 self.assertEqual(expected, data)
74
75+ def test_key_space_pressed_without_selection(self):
76+ """Check the proper actions are executed on key space pressed."""
77+ self.ui.popup.list_widget.setCurrentItem(None)
78+ self.assertFalse(self.ui._key_space_pressed())
79+
80 def test_process_volumes_info(self):
81 """Check that _process_volumes_info obtain the proper info."""
82 data1 = [{'path': 'folder1'}]

Subscribers

People subscribed via source and target branches