Merge lp:~townsend/unity/fix-lp1286143 into lp:unity

Proposed by Christopher Townsend
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
Merged at revision: 3691
Proposed branch: lp:~townsend/unity/fix-lp1286143
Merge into: lp:unity
Diff against target: 54 lines (+20/-4)
2 files modified
tests/autopilot/unity/tests/test_dash.py (+10/-2)
tests/autopilot/unity/tests/test_hud.py (+10/-2)
To merge this branch: bzr merge lp:~townsend/unity/fix-lp1286143
Reviewer Review Type Date Requested Status
Brandon Schaefer (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+208813@code.launchpad.net

Commit message

Fix corner case depending on where a test window opens, a Dash and Hud Autopilot test failure can occur.

Description of the change

Depending on where a test window opens, it can cause both a Dash and Hud Autopilot test to fail. This is because the mouse may move to where the unmaximized window is opened when clicking to close the Dash/Hud which focuses it. However, the test is checking that the maximized window is focused which causes the test to fail since the unmaximized window is focused.

The tests are:
unity.tests.test_hud.HudBehaviorTests.test_closes_then_focuses_window_on_mouse_down
unity.tests.test_dash.DashRevealTests.test_closes_then_focuses_window_on_mouse_down

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/autopilot/unity/tests/test_dash.py'
--- tests/autopilot/unity/tests/test_dash.py 2014-02-11 21:47:29 +0000
+++ tests/autopilot/unity/tests/test_dash.py 2014-02-28 14:27:31 +0000
@@ -144,13 +144,21 @@
144144
145 char_win = self.process_manager.start_app("Character Map")145 char_win = self.process_manager.start_app("Character Map")
146 self.keybinding("window/maximize")146 self.keybinding("window/maximize")
147 self.process_manager.start_app("Calculator")147 calc_win = self.process_manager.start_app("Calculator")
148148
149 self.unity.dash.ensure_visible()149 self.unity.dash.ensure_visible()
150150
151 #Click bottom right of the screen151 # Click bottom right of the screen, but take into account the non-maximized window -
152 # we do not want to click on it as it focuses the wrong window
152 w = self.display.get_screen_width() - 1153 w = self.display.get_screen_width() - 1
153 h = self.display.get_screen_height() - 1154 h = self.display.get_screen_height() - 1
155
156 # If the mouse is over the non-maximized window, move it away from it.
157 (calc_x, calc_y, calc_w, calc_h) = calc_win.get_windows()[0].geometry
158 if calc_x <= w <= calc_x+calc_w:
159 grab_padding = 15
160 w = w - (calc_w + grab_padding)
161
154 self.mouse.move(w,h)162 self.mouse.move(w,h)
155 self.mouse.click()163 self.mouse.click()
156164
157165
=== modified file 'tests/autopilot/unity/tests/test_hud.py'
--- tests/autopilot/unity/tests/test_hud.py 2014-02-14 16:40:28 +0000
+++ tests/autopilot/unity/tests/test_hud.py 2014-02-28 14:27:31 +0000
@@ -467,13 +467,21 @@
467 char_win = self.process_manager.start_app("Character Map")467 char_win = self.process_manager.start_app("Character Map")
468 self.assertProperty(char_win, is_active=True)468 self.assertProperty(char_win, is_active=True)
469 self.keybinding("window/maximize")469 self.keybinding("window/maximize")
470 self.process_manager.start_app("Calculator")470 calc_win = self.process_manager.start_app("Calculator")
471471
472 self.unity.hud.ensure_visible()472 self.unity.hud.ensure_visible()
473473
474 #Click bottom right of the screen474 # Click bottom right of the screen, but take into account the non-maximized window -
475 # we do not want to click on it as it focuses the wrong window
475 w = self.display.get_screen_width() - 1476 w = self.display.get_screen_width() - 1
476 h = self.display.get_screen_height() - 1477 h = self.display.get_screen_height() - 1
478
479 # If the mouse is over the non-maximized window, move it away from it.
480 (calc_x, calc_y, calc_w, calc_h) = calc_win.get_windows()[0].geometry
481 if calc_x <= w <= calc_x+calc_w:
482 grab_padding = 15
483 w = w - (calc_w + grab_padding)
484
477 self.mouse.move(w,h)485 self.mouse.move(w,h)
478 self.mouse.click()486 self.mouse.click()
479487