Merge lp:~mhr3/unity/fix-961338 into lp:unity

Proposed by Michal Hruby
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 2158
Proposed branch: lp:~mhr3/unity/fix-961338
Merge into: lp:unity
Diff against target: 74 lines (+53/-0)
2 files modified
plugins/unityshell/src/DashView.cpp (+6/-0)
tests/autopilot/autopilot/tests/test_dash.py (+47/-0)
To merge this branch: bzr merge lp:~mhr3/unity/fix-961338
Reviewer Review Type Date Requested Status
Gord Allott (community) Approve
Mikkel Kamstrup Erlandsen (community) Approve
Review via email: mp+98801@code.launchpad.net

Commit message

Set proper view_type on lenses when they're activated by shortcut

Description of the change

UNBLOCK - The lens' view type didn't get updated when a lens was activated by a shortcut, this caused the lens to ignore changes to filters.

Properly update the view_type.

Added AP test for the issue.

To post a comment you must log in.
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Good catch. Looking correct.

review: Approve
Revision history for this message
Gord Allott (gordallott) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/DashView.cpp'
2--- plugins/unityshell/src/DashView.cpp 2012-03-21 16:37:50 +0000
3+++ plugins/unityshell/src/DashView.cpp 2012-03-22 10:03:19 +0000
4@@ -139,6 +139,12 @@
5 LOG_DEBUG(logger) << "Setting ViewType " << ViewType::LENS_VIEW
6 << " on '" << home_lens_->id() << "'";
7 }
8+ else if (active_lens_view_)
9+ {
10+ // careful here, the lens_view's view_type doesn't get reset when the dash
11+ // hides, but lens' view_type does, so we need to update the lens directly
12+ active_lens_view_->lens()->view_type = ViewType::LENS_VIEW;
13+ }
14
15 renderer_.AboutToShow();
16 }
17
18=== modified file 'tests/autopilot/autopilot/tests/test_dash.py'
19--- tests/autopilot/autopilot/tests/test_dash.py 2012-03-21 12:31:11 +0000
20+++ tests/autopilot/autopilot/tests/test_dash.py 2012-03-22 10:03:19 +0000
21@@ -423,6 +423,53 @@
22 lens = self.dash.get_current_lens()
23 self.assertTrue(lens.no_results_active)
24
25+ def test_results_update_on_filter_changed(self):
26+ """This test makes sure the results change when filters change."""
27+ self.dash.reveal_application_lens()
28+ lens = self.dash.get_current_lens()
29+ self.keyboard.type(" ")
30+ sleep(1)
31+ results_category = lens.get_category_by_name("Installed")
32+ old_results = results_category.get_results()
33+
34+
35+ def activate_filter(add_cleanup = False):
36+ # Tabs to last category
37+ for i in range(lens.get_num_visible_categories()):
38+ self.keyboard.press_and_release('Tab')
39+
40+ self.keyboard.press_and_release('Tab')
41+ searchbar = self.dash.get_searchbar()
42+ self.assertTrue(searchbar.expander_has_focus)
43+
44+ filter_bar = lens.get_filterbar()
45+ if not searchbar.showing_filters:
46+ self.keyboard.press_and_release('Enter')
47+ self.assertTrue(searchbar.showing_filters)
48+ if add_cleanup: self.addCleanup(filter_bar.ensure_collapsed)
49+
50+ # Tab to the "Type" filter in apps lens
51+ self.keyboard.press_and_release('Tab')
52+ new_focused_filter = filter_bar.get_focused_filter()
53+ self.assertIsNotNone(new_focused_filter)
54+
55+ self.keyboard.press_and_release("Down")
56+ self.keyboard.press_and_release("Down")
57+ self.keyboard.press_and_release("Down")
58+ # We should be on the Education category
59+ self.keyboard.press_and_release('Enter')
60+
61+ activate_filter(True)
62+ self.addCleanup(activate_filter)
63+
64+ sleep(1)
65+ results_category = lens.get_category_by_name("Installed")
66+ results = results_category.get_results()
67+ self.assertIsNot(results, old_results)
68+
69+ # so we can clean up properly
70+ self.keyboard.press_and_release('BackSpace')
71+
72
73 class DashVisualTests(DashTestCase):
74 """Tests that the dash visual is correct."""