Merge lp:~rperier/unity/command-lens-switching into lp:unity

Proposed by Romain Perier
Status: Superseded
Proposed branch: lp:~rperier/unity/command-lens-switching
Merge into: lp:unity
Diff against target: 52 lines (+11/-2)
3 files modified
dash/DashView.cpp (+4/-1)
dash/LensBar.h (+2/-1)
tests/autopilot/unity/tests/test_dash.py (+5/-0)
To merge this branch: bzr merge lp:~rperier/unity/command-lens-switching
Reviewer Review Type Date Requested Status
Łukasz Zemczak Needs Fixing
Review via email: mp+145882@code.launchpad.net

This proposal has been superseded by a proposal from 2013-03-29.

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 :

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 :

Updated, is it correct now ?

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

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 :

Besides the testing, code and fix looks fine.

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

Romain? Any news on this? :)

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

Unmerged revisions

3084. By Romain Perier

Improving autopilot test

3083. By Romain Perier

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

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-01-29 00:32:06 +0000
3+++ dash/DashView.cpp 2013-02-01 10:38:35 +0000
4@@ -1121,7 +1121,10 @@
5 }
6 else if (/* visible_ && */ handled_type == NOT_HANDLED)
7 {
8- ubus_manager_.SendMessage(UBUS_PLACE_VIEW_CLOSE_REQUEST, NULL,
9+ if (lens_bar_->GetActiveLensId() != id)
10+ lens_bar_->Activate(id);
11+ else
12+ ubus_manager_.SendMessage(UBUS_PLACE_VIEW_CLOSE_REQUEST, NULL,
13 glib::Source::Priority::HIGH);
14 }
15 else if (/* visible_ && */ handled_type == GOTO_DASH_URI)
16
17=== modified file 'dash/LensBar.h'
18--- dash/LensBar.h 2012-12-14 12:14:34 +0000
19+++ dash/LensBar.h 2013-02-01 10:38:35 +0000
20@@ -64,6 +64,8 @@
21
22 sigc::signal<void, std::string const&> lens_activated;
23
24+ std::string GetActiveLensId() const;
25+
26 private:
27 void SetupBackground();
28 void SetupLayout();
29@@ -81,7 +83,6 @@
30 std::string GetName() const;
31 void AddProperties(GVariantBuilder* builder);
32
33- std::string GetActiveLensId() const;
34 typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;
35
36 LensIcons icons_;
37
38=== modified file 'tests/autopilot/unity/tests/test_dash.py'
39--- tests/autopilot/unity/tests/test_dash.py 2013-01-28 11:00:19 +0000
40+++ tests/autopilot/unity/tests/test_dash.py 2013-02-01 10:38:35 +0000
41@@ -68,6 +68,11 @@
42 self.dash.ensure_visible()
43 self.dash.reveal_command_lens()
44 self.assertThat(self.dash.visible, Eventually(Equals(False)))
45+ # SWitch from command lens to the dash without closing the dash
46+ self.dash.ensure_hidden()
47+ self.dash.reveal_command_lens()
48+ self.dash.ensure_visible()
49+ self.assertThat(self.dash.active_lens, Eventually(Equals('home.lens')))
50
51 def test_alt_f4_close_dash(self):
52 """Dash must close on alt+F4."""