Merge lp:~brandontschaefer/unity/keynav-terminate-lambda-passbyvalue into lp:unity

Proposed by Brandon Schaefer
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 2432
Proposed branch: lp:~brandontschaefer/unity/keynav-terminate-lambda-passbyvalue
Merge into: lp:unity
Diff against target: 39 lines (+7/-2)
2 files modified
launcher/LauncherController.cpp (+1/-1)
tests/autopilot/unity/tests/test_launcher.py (+6/-1)
To merge this branch: bzr merge lp:~brandontschaefer/unity/keynav-terminate-lambda-passbyvalue
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Review via email: mp+111317@code.launchpad.net

Commit message

Lambda function was using an undefined variable, changed to pass by value now.

Description of the change

Was passing by reference, need to pass by value for the local variable 'activate' to not be undefined.

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

While you are modifying the tests, can you move the super call in the tearDown method to be below the cancelling of the keynav?

review: Needs Fixing
Revision history for this message
Tim Penhey (thumper) wrote :

Thanks for the updates.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/LauncherController.cpp'
2--- launcher/LauncherController.cpp 2012-06-20 16:50:01 +0000
3+++ launcher/LauncherController.cpp 2012-06-20 23:38:20 +0000
4@@ -1197,7 +1197,7 @@
5 g_variant_new_boolean(pimpl->keynav_restore_window_));
6 }
7
8- pimpl->activate_idle_.reset(new glib::Idle([&] () {
9+ pimpl->activate_idle_.reset(new glib::Idle([activate, this] () {
10 if (activate)
11 pimpl->model_->Selection()->Activate(ActionArg(ActionArg::LAUNCHER, 0));
12
13
14=== modified file 'tests/autopilot/unity/tests/test_launcher.py'
15--- tests/autopilot/unity/tests/test_launcher.py 2012-06-20 20:52:20 +0000
16+++ tests/autopilot/unity/tests/test_launcher.py 2012-06-20 23:38:20 +0000
17@@ -268,9 +268,9 @@
18 self.launcher_instance.key_nav_start()
19
20 def tearDown(self):
21- super(LauncherKeyNavTests, self).tearDown()
22 if self.launcher.key_nav_is_active:
23 self.launcher_instance.key_nav_cancel()
24+ super(LauncherKeyNavTests, self).tearDown()
25
26 def test_launcher_keynav_initiate(self):
27 """Tests we can initiate keyboard navigation on the launcher."""
28@@ -415,6 +415,11 @@
29 self.keybinding("switcher/reveal_details")
30 self.assertThat(self.launcher.key_nav_is_active, Eventually(Equals(False)))
31
32+ def test_launcher_keynav_cancel_doesnt_activate_icon(self):
33+ """This tests when canceling keynav the current icon doesnt activate."""
34+
35+ self.keyboard.press_and_release("Escape")
36+ self.assertThat(self.dash.visible, Eventually(Equals(False)))
37
38 class LauncherIconsBehaviorTests(LauncherTestCase):
39 """Test the launcher icons interactions"""