Merge lp:~ralsina/ubuntuone-control-panel/darwicon into lp:ubuntuone-control-panel

Proposed by Roberto Alsina on 2012-08-30
Status: Merged
Approved by: Mike McCracken on 2012-08-30
Approved revision: 355
Merged at revision: 355
Proposed branch: lp:~ralsina/ubuntuone-control-panel/darwicon
Merge into: lp:ubuntuone-control-panel
Diff against target: 69 lines (+22/-1)
2 files modified
ubuntuone/controlpanel/gui/qt/main/__init__.py (+3/-1)
ubuntuone/controlpanel/gui/qt/main/tests/test_main.py (+19/-0)
To merge this branch: bzr merge lp:~ralsina/ubuntuone-control-panel/darwicon
Reviewer Review Type Date Requested Status
Mike McCracken (community) Approve on 2012-08-30
dobey (community) 2012-08-30 Approve on 2012-08-30
Review via email: mp+122122@code.launchpad.net

Commit Message

- Made --with-icon the default on Darwin

Description of the Change

Make --with-icon the default on Darwin, since there we can't control how u1cp is started.

To post a comment you must log in.
dobey (dobey) wrote :

Looks fine to me.

review: Approve
Mike McCracken (mikemc) wrote :

the newly added tests pass, works IRL.

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/main/__init__.py'
2--- ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-08-24 18:48:48 +0000
3+++ ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-08-30 18:36:18 +0000
4@@ -110,7 +110,9 @@
5 args = parser.parse_args(args=arg_list[bin_position:])
6 switch_to = args.switch_to
7 minimized = args.minimized
8- with_icon = args.with_icon
9+ # On Darwin, because of how apps are started, we need
10+ # this by default.
11+ with_icon = args.with_icon or sys.platform == 'darwin'
12 installer = args.installer
13 source.main(app)
14
15
16=== modified file 'ubuntuone/controlpanel/gui/qt/main/tests/test_main.py'
17--- ubuntuone/controlpanel/gui/qt/main/tests/test_main.py 2012-08-24 19:27:34 +0000
18+++ ubuntuone/controlpanel/gui/qt/main/tests/test_main.py 2012-08-30 18:36:18 +0000
19@@ -186,18 +186,35 @@
20
21 def test_truncate_argv(self):
22 """Ensure the binary name is not given to argparse."""
23+ self.patch(sys, 'platform', 'not-darwin')
24 main.main(["foo", "bar", sys.argv[0], "--minimized"])
25 self.assertEqual(self.start.args[1],
26 {'minimized': True, 'with_icon': False, 'installer': False})
27
28+ def test_darwin_defult_is_with_icon(self):
29+ """On Darwin, the default is to show the icon."""
30+ self.patch(sys, 'platform', 'darwin')
31+ main.main([sys.argv[0]])
32+ self.assertEqual(self.start.args[1],
33+ {'minimized': False, 'with_icon': True, 'installer': False})
34+
35+ def test_not_darwin_defult_is_with_icon(self):
36+ """On Not-darwin, the default is to not show the icon."""
37+ self.patch(sys, 'platform', 'not-darwin')
38+ main.main([sys.argv[0]])
39+ self.assertEqual(self.start.args[1],
40+ {'minimized': False, 'with_icon': False, 'installer': False})
41+
42 def test_minimized_option(self):
43 """Ensure the --minimized option is parsed and passed correctly."""
44+ self.patch(sys, 'platform', 'not-darwin')
45 main.main([sys.argv[0], "--minimized"])
46 self.assertEqual(self.start.args[1],
47 {'minimized': True, 'with_icon': False, 'installer': False})
48
49 def test_with_icon_option(self):
50 """Ensure the --minimized option is parsed and passed correctly."""
51+ self.patch(sys, 'platform', 'not-darwin')
52 main.main([sys.argv[0], "--with-icon"])
53 self.assertEqual(self.start.args[1],
54 {'minimized': False, 'with_icon': True, 'installer': False})
55@@ -218,12 +235,14 @@
56
57 def test_installer_option(self):
58 """Ensure the --installer option is parsed and passed correctly."""
59+ self.patch(sys, 'platform', 'not-darwin')
60 main.main([sys.argv[0], "--installer"])
61 self.assertEqual(self.start.args[1],
62 {'minimized': False, 'with_icon': False, 'installer': True})
63
64 def test_minimized_with_icon_options(self):
65 """Ensure you can be minimized and with icon at the same time."""
66+ self.patch(sys, 'platform', 'not-darwin')
67 main.main([sys.argv[0], "--minimized", "--with-icon"])
68 self.assertEqual(self.start.args[1],
69 {'minimized': True, 'with_icon': True, 'installer': False})

Subscribers

People subscribed via source and target branches