Merge lp:~lore-mattei/unity/fix-bug-891818 into lp:unity

Proposed by Lorenzo Mattei
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 2082
Proposed branch: lp:~lore-mattei/unity/fix-bug-891818
Merge into: lp:unity
Diff against target: 51 lines (+19/-0)
3 files modified
plugins/unityshell/src/DashView.cpp (+8/-0)
tests/autopilot/autopilot/emulators/unity/dash.py (+4/-0)
tests/autopilot/autopilot/tests/test_dash.py (+7/-0)
To merge this branch: bzr merge lp:~lore-mattei/unity/fix-bug-891818
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
Mirco Müller (community) Approve
Review via email: mp+95938@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Mirco Müller (macslow) wrote :

While your fix certainly does fix the stated issue, it is missing an autopilot-test to help strengthen the test-harness for unity, which helps us avoid future regressions for bugs that already have been fixed. This is part of our software-engineering QA.

And finally there's some "paperwork" needed before your branch can finally make it into trunk. You need to sign the contributor agreement and send it to the person managing this for unity. Please go to http://www.canonical.com/contributors for all the details.

Thanks sofar for you time and efforts!

review: Needs Fixing
Revision history for this message
Mirco Müller (macslow) wrote :

Thanks for signing the paperwork. Now with the added test this is good to go. Well done, Lorenzo!

review: Approve
Revision history for this message
Paweł Stołowski (stolowski) wrote :

I'm working on fixing this problem in unity-2d and there seems to be a generic consensus in unity-2d to avoid harcoding ALT+F4 and picking the key binding from window manager configuration instead. You may want to consider this.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

> I'm working on fixing this problem in unity-2d and there seems to be a generic
> consensus in unity-2d to avoid harcoding ALT+F4 and picking the key binding
> from window manager configuration instead. You may want to consider this.

Yes, that's true. On this case, the fix should be included into Nux itself, anyway for now this is a good local fix.

44 + """Dash must close on alt+F4."""
45 + self.dash.ensure_visible()

This is fine, but you'd also need to add after:

 self.addCleanup(self.dash.ensure_hidden)

This will ensure that if the test fails, the dash is hidden anyway.
Maybe, even including a small sleep after the alt+f4 press, could avoid false-negatives.

review: Needs Fixing
Revision history for this message
Lorenzo Mattei (lore-mattei) wrote :

> This is fine, but you'd also need to add after:
>
> self.addCleanup(self.dash.ensure_hidden)
>
> This will ensure that if the test fails, the dash is hidden anyway.

I think the self.dash.ensure_hidden() call in tearDown() will ensure that. Isn't it called even in case of fail?

> Maybe, even including a small sleep after the alt+f4 press, could avoid false-
> negatives.
Ok.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

> > This is fine, but you'd also need to add after:
> >
> > self.addCleanup(self.dash.ensure_hidden)
> >
> > This will ensure that if the test fails, the dash is hidden anyway.
>
> I think the self.dash.ensure_hidden() call in tearDown() will ensure that.
> Isn't it called even in case of fail?

Yes, sure. The version I checked, maybe was missing it.
Sorry.

review: Approve
Revision history for this message
Paweł Stołowski (stolowski) wrote :

> I'm working on fixing this problem in unity-2d and there seems to be a generic
> consensus in unity-2d to avoid harcoding ALT+F4 and picking the key binding
> from window manager configuration instead. You may want to consider this.

We decided to hardcode it for now in unity-2d after all, as it turned out require a lot of work to convert between Metacity and Qt, and it's not feasible right now.

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-02-14 10:18:15 +0000
3+++ plugins/unityshell/src/DashView.cpp 2012-03-07 14:05:19 +0000
4@@ -713,6 +713,14 @@
5 // Not sure if Enter should be a navigation key
6 direction = KEY_NAV_ENTER;
7 break;
8+ case NUX_VK_F4:
9+ // Maybe we should not do it here, but it needs to be checked where
10+ // we are able to know if alt is pressed.
11+ if (special_keys_state & NUX_STATE_ALT)
12+ {
13+ ubus_manager_.SendMessage(UBUS_PLACE_VIEW_CLOSE_REQUEST);
14+ }
15+ break;
16 default:
17 direction = KEY_NAV_NONE;
18 break;
19
20=== modified file 'tests/autopilot/autopilot/emulators/unity/dash.py'
21--- tests/autopilot/autopilot/emulators/unity/dash.py 2012-02-29 22:00:01 +0000
22+++ tests/autopilot/autopilot/emulators/unity/dash.py 2012-03-07 14:05:19 +0000
23@@ -115,6 +115,10 @@
24 active_lens_name = self.view.get_lensbar().active_lens
25 return self.view.get_lensview_by_name(active_lens_name)
26
27+ def close_with_alt_f4(self):
28+ """Send ALT+F4 in order to close the dash."""
29+ self._keyboard.press_and_release("Alt+F4")
30+
31
32 class DashController(UnityIntrospectionObject):
33 """The main dash controller object."""
34
35=== modified file 'tests/autopilot/autopilot/tests/test_dash.py'
36--- tests/autopilot/autopilot/tests/test_dash.py 2012-03-06 18:21:27 +0000
37+++ tests/autopilot/autopilot/tests/test_dash.py 2012-03-07 14:05:19 +0000
38@@ -71,6 +71,13 @@
39 self.dash.reveal_command_lens()
40 lensbar = self.dash.view.get_lensbar()
41 self.assertEqual(lensbar.active_lens, u'commands.lens')
42+
43+ def test_alt_f4_close_dash(self):
44+ """Dash must close on alt+F4."""
45+ self.dash.ensure_visible()
46+ self.dash.close_with_alt_f4()
47+ sleep(0.5)
48+ self.assertFalse(self.dash.get_is_visible())
49
50
51 class DashKeyNavTests(AutopilotTestCase):