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

Proposed by Christopher Townsend
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
Merged at revision: 3690
Proposed branch: lp:~townsend/unity/fix-lp1285758
Merge into: lp:unity
Diff against target: 24 lines (+7/-0)
1 file modified
tests/autopilot/unity/tests/test_spread.py (+7/-0)
To merge this branch: bzr merge lp:~townsend/unity/fix-lp1285758
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Brandon Schaefer (community) Approve
Review via email: mp+208643@code.launchpad.net

Commit message

Fix a few randomly failing Spread Autopilot tests.

Description of the change

A few Spread AP tests fail randomly.

Any test that calls assertWindowIsScaledEquals() may fail since the Spread may not be completed before this is called. Fix is to add a short delay to ensure the Spread finishes.

Also, test_scaled_window_closes_on_close_button_click may fail if the system under test has an extra window open such as a terminal. If the mouse is not over the test window, then the test fails. Fix is to move the mouse over the test window.

To post a comment you must log in.
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

LGTM

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/unity/tests/test_spread.py'
2--- tests/autopilot/unity/tests/test_spread.py 2014-02-19 02:16:22 +0000
3+++ tests/autopilot/unity/tests/test_spread.py 2014-02-27 16:41:03 +0000
4@@ -61,6 +61,9 @@
5
6 def assertWindowIsScaledEquals(self, xid, scaled):
7 """Assert weather a window is scaled"""
8+ # Add a short delay to ensure the Spread has finished.
9+ sleep(0.5)
10+
11 refresh_fn = lambda: xid in [w.xid for w in self.unity.screen.scaled_windows]
12 self.assertThat(refresh_fn, Eventually(Equals(scaled)))
13
14@@ -133,6 +136,10 @@
15 target_xid = win.x_id
16 [target_win] = [w for w in self.unity.screen.scaled_windows if w.xid == target_xid]
17
18+ # Make sure mouse is over the test window
19+ (x1, y1, w1, h1) = target_win.geometry
20+ self.mouse.move(x1 + w1 / 2, y1 + h1 / 2)
21+
22 (x, y, w, h) = target_win.scale_close_geometry
23 self.mouse.move(x + w / 2, y + h / 2)
24 sleep(.5)