Merge lp:~townsend/unity/fix-lp1436095-trusty into lp:unity/7.2

Proposed by Christopher Townsend
Status: Merged
Approved by: Stephen M. Webb
Approved revision: no longer in the source branch.
Merged at revision: 3829
Proposed branch: lp:~townsend/unity/fix-lp1436095-trusty
Merge into: lp:unity/7.2
Diff against target: 32 lines (+15/-6)
1 file modified
tests/autopilot/unity/tests/test_spread.py (+15/-6)
To merge this branch: bzr merge lp:~townsend/unity/fix-lp1436095-trusty
Reviewer Review Type Date Requested Status
Stephen M. Webb (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+259292@code.launchpad.net

Commit message

AP tests: accounted for arbitrarily-raised exceptions in checking scaled windows

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
Stephen M. Webb (bregma) :
review: Approve

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-03-05 22:14:16 +0000
3+++ tests/autopilot/unity/tests/test_spread.py 2015-05-15 19:56:54 +0000
4@@ -59,13 +59,22 @@
5 self.assertThat(lambda: self.unity.screen.spread_filter, Eventually(NotEquals(None)))
6 return self.unity.screen.spread_filter
7
8- def assertWindowIsScaledEquals(self, xid, scaled):
9+ def assertWindowIsScaledEquals(self, xid, is_scaled):
10 """Assert weather a window is scaled"""
11- # Add a short delay to ensure the Spread has finished.
12- sleep(0.5)
13-
14- refresh_fn = lambda: xid in [w.xid for w in self.unity.screen.scaled_windows]
15- self.assertThat(refresh_fn, Eventually(Equals(scaled)))
16+ def scaled_windows_for_screen_contains_xid():
17+ """Predicates the window is in the list of scaled windows for the screen.
18+ The DBus introspection object actually raises an exception if you try to look
19+ at a window in the scaled_windows list and it's not a scaled window. Buggzorz.
20+ """
21+ scaled_windows = self.unity.screen.scaled_windows
22+ for w in scaled_windows:
23+ try:
24+ if xid == w.xid:
25+ return True
26+ except:
27+ pass
28+ return False
29+ self.assertThat(scaled_windows_for_screen_contains_xid, Eventually(Equals(is_scaled)))
30
31 def assertWindowIsClosed(self, xid):
32 """Assert that a window is not in the list of the open windows"""

Subscribers

People subscribed via source and target branches

to status/vote changes: