Merge lp:~azzar1/unity/fix-839472 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 2305
Proposed branch: lp:~azzar1/unity/fix-839472
Merge into: lp:unity
Diff against target: 125 lines (+67/-1)
4 files modified
plugins/unityshell/src/DashStyle.cpp (+10/-0)
plugins/unityshell/src/DashStyle.h (+3/-0)
plugins/unityshell/src/DashView.cpp (+14/-1)
tests/autopilot/autopilot/tests/test_dash.py (+40/-0)
To merge this branch: bzr merge lp:~azzar1/unity/fix-839472
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Review via email: mp+102247@code.launchpad.net

Commit message

Don't close the dash if the click is inside the desktop dash border.

Description of the change

== Problem ==
Dash - Clicking on the desktop dash border should do nothing, *NOT* close the dash.

== Test ==
AP test added.

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

We shouldn't silently pass the tests if not in desktop form factor, but instead use:
  self.skip("Not in desktop form-factor.")

Also, instead of:
  sleep(1);
  self.assertTrue(self.dash.visible)

you can now use Thomi's

  self.assertThat(self.dash.visible, Eventually(Equals(True)))

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

> We shouldn't silently pass the tests if not in desktop form factor, but
> instead use:
> self.skip("Not in desktop form-factor.")
>
> Also, instead of:
> sleep(1);
> self.assertTrue(self.dash.visible)
>
> you can now use Thomi's
>
> self.assertThat(self.dash.visible, Eventually(Equals(True)))

Done.

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

Thanks.

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/DashStyle.cpp'
2--- plugins/unityshell/src/DashStyle.cpp 2012-04-05 14:44:57 +0000
3+++ plugins/unityshell/src/DashStyle.cpp 2012-04-18 08:26:19 +0000
4@@ -2185,6 +2185,16 @@
5 return pimpl->dash_shine_.texture();
6 }
7
8+int Style::GetDashBottomTileHeight() const
9+{
10+ return 30;
11+}
12+
13+int Style::GetDashRightTileWidth() const
14+{
15+ return 30;
16+}
17+
18 int Style::GetVSeparatorSize() const
19 {
20 return 1;
21
22=== modified file 'plugins/unityshell/src/DashStyle.h'
23--- plugins/unityshell/src/DashStyle.h 2012-04-05 23:07:43 +0000
24+++ plugins/unityshell/src/DashStyle.h 2012-04-18 08:26:19 +0000
25@@ -180,6 +180,9 @@
26 nux::BaseTexture* GetDashTopCornerMask();
27 nux::BaseTexture* GetDashTopTile();
28
29+ int GetDashBottomTileHeight() const;
30+ int GetDashRightTileWidth() const;
31+
32 nux::BaseTexture* GetDashShine();
33
34 nux::BaseTexture* GetSearchMagnifyIcon();
35
36=== modified file 'plugins/unityshell/src/DashView.cpp'
37--- plugins/unityshell/src/DashView.cpp 2012-04-12 12:00:53 +0000
38+++ plugins/unityshell/src/DashView.cpp 2012-04-18 08:26:19 +0000
39@@ -315,7 +315,16 @@
40
41 void DashView::OnMouseButtonDown(int x, int y, unsigned long button, unsigned long key)
42 {
43- if (!content_geo_.IsPointInside(x, y))
44+ dash::Style& style = dash::Style::Instance();
45+ nux::Geometry geo(content_geo_);
46+
47+ if (Settings::Instance().GetFormFactor() == FormFactor::DESKTOP)
48+ {
49+ geo.width += style.GetDashRightTileWidth();
50+ geo.height += style.GetDashBottomTileHeight();
51+ }
52+
53+ if (!geo.IsPointInside(x, y))
54 {
55 ubus_manager_.SendMessage(UBUS_PLACE_VIEW_CLOSE_REQUEST);
56 }
57@@ -737,6 +746,7 @@
58
59 void DashView::AddProperties(GVariantBuilder* builder)
60 {
61+ dash::Style& style = dash::Style::Instance();
62 int num_rows = 1; // The search bar
63
64 if (active_lens_view_)
65@@ -750,8 +760,11 @@
66 form_factor = "desktop";
67
68 unity::variant::BuilderWrapper wrapper(builder);
69+ wrapper.add(nux::Geometry(GetAbsoluteX(), GetAbsoluteY(), content_geo_.width, content_geo_.height));
70 wrapper.add("num_rows", num_rows);
71 wrapper.add("form_factor", form_factor);
72+ wrapper.add("right-border-width", style.GetDashRightTileWidth());
73+ wrapper.add("bottom-border-height", style.GetDashBottomTileHeight());
74 }
75
76 nux::Area* DashView::KeyNavIteration(nux::KeyNavDirection direction)
77
78=== modified file 'tests/autopilot/autopilot/tests/test_dash.py'
79--- tests/autopilot/autopilot/tests/test_dash.py 2012-04-17 21:49:58 +0000
80+++ tests/autopilot/autopilot/tests/test_dash.py 2012-04-18 08:26:19 +0000
81@@ -447,4 +447,44 @@
82 self.mouse.move(app_icon.x + (app_icon.width / 2),
83 app_icon.y + (app_icon.height / 2))
84 self.mouse.click()
85+
86 self.assertThat(self.lensbar.active_lens, Eventually(Equals('applications.lens')))
87+
88+
89+class DashBorderTests(DashTestCase):
90+ """Tests that the dash border works well.
91+ """
92+ def setUp(self):
93+ super(DashBorderTests, self).setUp()
94+ self.dash.ensure_visible()
95+
96+ def test_click_right_border(self):
97+ """Clicking on the right dash border should do nothing,
98+ *NOT* close the dash.
99+ """
100+ if (self.dash.view.form_factor != "desktop"):
101+ self.skip("Not in desktop form-factor.")
102+
103+ x = self.dash.view.x + self.dash.view.width + self.dash.view.right_border_width / 2;
104+ y = self.dash.view.y + self.dash.view.height / 2;
105+
106+ self.mouse.move(x, y)
107+ self.mouse.click()
108+
109+ self.assertThat(self.dash.visible, Eventually(Equals(True)))
110+
111+ def test_click_bottom_border(self):
112+ """Clicking on the bottom dash border should do nothing,
113+ *NOT* close the dash.
114+ """
115+ if (self.dash.view.form_factor != "desktop"):
116+ self.skip("Not in desktop form-factor.")
117+
118+ x = self.dash.view.x + self.dash.view.width / 2;
119+ y = self.dash.view.y + self.dash.view.height + self.dash.view.bottom_border_height / 2;
120+
121+ self.mouse.move(x, y)
122+ self.mouse.click()
123+
124+ self.assertThat(self.dash.visible, Eventually(Equals(True)))
125+