Merge lp:~dfly720/unity/fix-938353 into lp:unity

Proposed by Marco Mariani
Status: Superseded
Proposed branch: lp:~dfly720/unity/fix-938353
Merge into: lp:unity
Diff against target: 74 lines (+31/-3)
3 files modified
launcher/SwitcherView.cpp (+13/-2)
tests/autopilot/unity/emulators/switcher.py (+1/-1)
tests/autopilot/unity/tests/test_switcher.py (+17/-0)
To merge this branch: bzr merge lp:~dfly720/unity/fix-938353
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Review via email: mp+108264@code.launchpad.net

This proposal has been superseded by a proposal from 2012-06-01.

Description of the change

== Problem ==

Starting switcher in detail mode shows wrong label.

== Fix ==

Fix SwitcherView::SetModel

Now if you initiate the switcher in details mode, it show the *window title* and not the *application name*.

== Test ==

AP test added.

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

SwitcherView.cpp code looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/SwitcherView.cpp'
2--- launcher/SwitcherView.cpp 2012-05-07 19:52:54 +0000
3+++ launcher/SwitcherView.cpp 2012-05-31 23:49:21 +0000
4@@ -106,7 +106,8 @@
5 .add("vertical-size", vertical_size)
6 .add("text-size", text_size)
7 .add("animation-length", animation_length)
8- .add("spread-size", (float)spread_size);
9+ .add("spread-size", (float)spread_size)
10+ .add("label", text_view_->GetText());
11 }
12
13
14@@ -124,8 +125,18 @@
15 model->detail_selection.changed.connect (sigc::mem_fun (this, &SwitcherView::OnDetailSelectionChanged));
16 model->detail_selection_index.changed.connect (sigc::mem_fun (this, &SwitcherView::OnDetailSelectionIndexChanged));
17
18- if (model->Selection())
19+ if (!model->Selection())
20+ return;
21+
22+ if (model->detail_selection)
23+ {
24+ Window detail_window = model->DetailSelectionWindow();
25+ text_view_->SetText(model->Selection()->NameForWindow(detail_window));
26+ }
27+ else
28+ {
29 text_view_->SetText(model->Selection()->tooltip_text());
30+ }
31 }
32
33 void SwitcherView::OnIconSizeChanged (int size)
34
35=== modified file 'tests/autopilot/unity/emulators/switcher.py'
36--- tests/autopilot/unity/emulators/switcher.py 2012-05-08 16:13:17 +0000
37+++ tests/autopilot/unity/emulators/switcher.py 2012-05-31 23:49:21 +0000
38@@ -91,7 +91,7 @@
39 elif mode == SwitcherMode.DETAIL:
40 logger.debug("Initiating switcher detail mode with Alt+`")
41 self.keybinding_hold_part_then_tap("switcher/reveal_details")
42- self.controller.model.detail_selection.wait_for(True)
43+ self.visible.wait_for(True)
44 elif mode == SwitcherMode.ALL:
45 logger.debug("Initiating switcher in 'all workspaces' mode. Ctrl+Alt+Tab")
46 self.keybinding_hold_part_then_tap("switcher/reveal_all")
47
48=== modified file 'tests/autopilot/unity/tests/test_switcher.py'
49--- tests/autopilot/unity/tests/test_switcher.py 2012-05-08 16:13:17 +0000
50+++ tests/autopilot/unity/tests/test_switcher.py 2012-05-31 23:49:21 +0000
51@@ -49,6 +49,23 @@
52 self.addCleanup(self.switcher.terminate)
53 self.assertThat(self.switcher.mode, Equals(SwitcherMode.NORMAL))
54
55+ def test_first_detail_mode_has_correct_label(self):
56+ """Tests that details mode shows the correct label the first time.
57+ """
58+ app = self.start_app("Text Editor")
59+ sleep(1)
60+ self.switcher.initiate(SwitcherMode.DETAIL)
61+ self.addCleanup(self.switcher.terminate)
62+
63+ title = ""
64+ for window in app.get_windows():
65+ if (window.is_focused):
66+ title = window.title
67+ break
68+
69+ self.assertThat(self.switcher.controller.view.label, Eventually(Equals(title)))
70+
71+
72 def test_switcher_move_next(self):
73 """Test that pressing the next icon binding moves to the next icon"""
74 self.switcher.initiate()