Merge lp:~brandontschaefer/unity/lp.1108956-fix into lp:unity

Proposed by Brandon Schaefer
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
Merged at revision: 3266
Proposed branch: lp:~brandontschaefer/unity/lp.1108956-fix
Merge into: lp:unity
Diff against target: 65 lines (+21/-3)
3 files modified
dash/DashView.cpp (+9/-2)
dash/LensBar.h (+2/-1)
tests/autopilot/unity/tests/test_dash.py (+10/-0)
To merge this branch: bzr merge lp:~brandontschaefer/unity/lp.1108956-fix
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Andrea Azzarone (community) Approve
Łukasz Zemczak Pending
Review via email: mp+156195@code.launchpad.net

This proposal supersedes a proposal from 2013-01-31.

Commit message

DashView: Don't close the dash when switching from the command lens to the home lens

Description of the change

When I open the command lens by pressing ALT+F2, if I press "Super" the dash is closed. It should not be closed, it should switch to the home lens instead. This is the suite of the bug 1019457 .

I already opened a bug for that, this is the bug https://bugs.launchpad.net/ubuntu/+source/unity/+bug/1108956

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote : Posted in a previous version of this proposal

Code looks good (one indentation on line 13 a part).

Thanks a lot!

On tests:

50 +

Please, remove this empty space

49 + self.assertThat(self.dash.visible, Eventually(Equals(False)))

Probably it's better to check this instead:
self.assertThat(self.dash.active_lens, Eventually(Equals('home.lens')))

Also, please add that assert statement also in the test_can_go_from_dash_to_command_lens test.

Revision history for this message
Romain Perier (rperier) wrote : Posted in a previous version of this proposal

Updated, is it correct now ?

Revision history for this message
Łukasz Zemczak (sil2100) wrote : Posted in a previous version of this proposal

Hi! I actually think that Marco had something different in mind ;)

So, it was good that there were 2 different tests before, so if you could revert to the previous state it was good.

The thing what we wanted to be changed is using self.assertThat(self.dash.active_lens, Eventually(Equals('home.lens'))) instead of self.assertThat(self.dash.visible, Eventually(Equals(False))) in the test_can_go_from_command_lens_to_dash test. Since this way we'll be checking that when pressing 'Super', that the home lens of the dash will be opened, not some other lens.

By 'Also, please add that assert statement also in the test_can_go_from_dash_to_command_lens test.' Marco probably meant for you to modify the previous test of test_can_go_from_dash_to_command_lens to also check if the command lens is opened. So, a check for self.assertThat(self.dash.active_lens, Eventually(Equals('commands.lens'))) . e.g.

    def test_can_go_from_dash_to_command_lens(self):
        """Switch to command lens without closing the dash."""
        self.dash.ensure_visible()
        self.dash.reveal_command_lens()
        self.assertThat(self.dash.visible, Eventually(Equals(False)))
        self.assertThat(self.dash.active_lens, Eventually(Equals('commands.lens')))
        # Here we make sure that the dash is closed and the commans lens opened

    def test_can_go_from_command_lens_to_dash(self):
        self.dash.reveal_command_lens()
        self.dash.ensure_visible()
        self.assertThat(self.dash.visible, Eventually(Equals(True)))
        self.assertThat(self.dash.active_lens, Eventually(Equals('home.lens')))
        # This way we check both if the dash is opened and the right lens

        # Remember about whitespaces!

Also, make sure you use the right identing. In python whitespaces are valid syntax elements, so make sure you use the same number of spaces as other blocks. Since I see you used tab-spaces, while we use only spaces for python autopilot tests.

review: Needs Fixing
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Posted in a previous version of this proposal

Besides the testing, code and fix looks fine.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote : Posted in a previous version of this proposal

Romain? Any news on this? :)

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote : Posted in a previous version of this proposal
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Removed my other MP, and just resubmitted over this one. (Thanks Marco for letting me know you can do that!)

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

This is going to cause some problems with autopilot. The problem being, ensure_hidden() uses the keybinding "dash/reveal", which is set to Super. The problem with this is if we try to hide while in the command lens we will just end up going to the home.lens and not actually hiding... though im running into the problem with trunk unity other lens such as the application lens. So this will cause regressions, so lets fix the AP tests before merging this.

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Turns out something was wrong with my system...but I had to use a explicit Super call other was ensure_visible() would fail after already opening the command lens. As the dash is visible, so ensure_visible will skip calling "dash/reveal".

3265. By Brandon Schaefer

Release the barrier if there are no launcher/subscribers to that monitor. Fixes: https://bugs.launchpad.net/bugs/1161726.

Approved by PS Jenkins bot, Stephen M. Webb, MC Return.

Revision history for this message
Andrea Azzarone (azzar1) wrote :

LGTM.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)
3266. By Brandon Schaefer

DashView: Don't close the dash when switching from the command lens to the home lens. Fixes: https://bugs.launchpad.net/bugs/1108956.

Approved by PS Jenkins bot, Andrea Azzarone.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/DashView.cpp'
2--- dash/DashView.cpp 2013-03-19 18:47:01 +0000
3+++ dash/DashView.cpp 2013-04-01 16:52:23 +0000
4@@ -1135,8 +1135,15 @@
5 }
6 else if (/* visible_ && */ handled_type == NOT_HANDLED)
7 {
8- ubus_manager_.SendMessage(UBUS_OVERLAY_CLOSE_REQUEST, NULL,
9- glib::Source::Priority::HIGH);
10+ if (lens_bar_->GetActiveLensId() != id)
11+ {
12+ lens_bar_->Activate(id);
13+ }
14+ else
15+ {
16+ ubus_manager_.SendMessage(UBUS_OVERLAY_CLOSE_REQUEST, NULL,
17+ glib::Source::Priority::HIGH);
18+ }
19 }
20 else if (/* visible_ && */ handled_type == GOTO_DASH_URI)
21 {
22
23=== modified file 'dash/LensBar.h'
24--- dash/LensBar.h 2012-12-14 12:14:34 +0000
25+++ dash/LensBar.h 2013-04-01 16:52:23 +0000
26@@ -61,6 +61,8 @@
27 void Activate(std::string id);
28 void ActivateNext();
29 void ActivatePrevious();
30+
31+ std::string GetActiveLensId() const;
32
33 sigc::signal<void, std::string const&> lens_activated;
34
35@@ -81,7 +83,6 @@
36 std::string GetName() const;
37 void AddProperties(GVariantBuilder* builder);
38
39- std::string GetActiveLensId() const;
40 typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;
41
42 LensIcons icons_;
43
44=== modified file 'tests/autopilot/unity/tests/test_dash.py'
45--- tests/autopilot/unity/tests/test_dash.py 2013-03-14 13:58:33 +0000
46+++ tests/autopilot/unity/tests/test_dash.py 2013-04-01 16:52:23 +0000
47@@ -73,8 +73,18 @@
48 """Switch to command lens without closing the dash."""
49 self.unity.dash.ensure_visible()
50 self.unity.dash.reveal_command_lens()
51+ self.assertThat(self.unity.dash.visible, Eventually(Equals(True)))
52 self.assertThat(self.unity.dash.active_lens, Eventually(Equals('commands.lens')))
53
54+ def test_can_go_from_command_lens_to_dash(self):
55+ """We must be able to go from the command lens to the dash (home lens)."""
56+ self.unity.dash.reveal_command_lens()
57+
58+ # Since the dash is visible we can't use ensure_visible().
59+ self.keybinding("dash/reveal", 0.1)
60+ self.assertThat(self.unity.dash.visible, Eventually(Equals(True)))
61+ self.assertThat(self.unity.dash.active_lens, Eventually(Equals('home.lens')))
62+
63 def test_alt_f4_close_dash(self):
64 """Dash must close on alt+F4."""
65 self.unity.dash.ensure_visible()