Merge lp:~3v1n0/unity/ap-spread-close-race-fix into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 3560
Proposed branch: lp:~3v1n0/unity/ap-spread-close-race-fix
Merge into: lp:unity
Diff against target: 63 lines (+8/-5)
3 files modified
tests/autopilot/unity/emulators/screen.py (+3/-0)
tests/autopilot/unity/tests/test_spread.py (+4/-4)
tests/autopilot/unity/tests/test_wm_keybindings.py (+1/-1)
To merge this branch: bzr merge lp:~3v1n0/unity/ap-spread-close-race-fix
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Christopher Townsend Approve
Review via email: mp+189859@code.launchpad.net

Commit message

AP, TestSpread: assertWindowIsNotScaled may fail when getting the Xid

Description of the change

Fix a race that causes w.xid to fire an error because the parent w is not available anymore. Comparing IDs works better.

To post a comment you must log in.
Revision history for this message
Christopher Townsend (townsend) 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/emulators/screen.py'
2--- tests/autopilot/unity/emulators/screen.py 2012-11-12 17:27:48 +0000
3+++ tests/autopilot/unity/emulators/screen.py 2013-10-08 14:20:37 +0000
4@@ -11,6 +11,7 @@
5
6 import logging
7 from unity.emulators import UnityIntrospectionObject
8+from testtools.matchers import GreaterThan
9 logger = logging.getLogger(__name__)
10
11
12@@ -47,4 +48,6 @@
13 @property
14 def scale_close_geometry(self):
15 """Returns a tuple of (x,y,w,h) for the scale close button."""
16+ self.scaled_close_width.wait_for(GreaterThan(0))
17+ self.scaled_close_height.wait_for(GreaterThan(0))
18 return (self.scaled_close_x, self.scaled_close_y, self.scaled_close_width, self.scaled_close_height)
19
20=== modified file 'tests/autopilot/unity/tests/test_spread.py'
21--- tests/autopilot/unity/tests/test_spread.py 2013-10-02 23:33:55 +0000
22+++ tests/autopilot/unity/tests/test_spread.py 2013-10-08 14:20:37 +0000
23@@ -50,9 +50,9 @@
24 launcher.click_launcher_icon(icon)
25 self.assertThat(self.unity.window_manager.scale_active_for_group, Eventually(Equals(True)))
26
27- def assertWindowIsNotScaled(self, xid):
28+ def assertWindowIsNotScaled(self, window):
29 """Assert that a window is not scaled"""
30- refresh_fn = lambda: xid in [w.xid for w in self.unity.screen.scaled_windows]
31+ refresh_fn = lambda: window.id in [w.id for w in self.unity.screen.scaled_windows]
32 self.assertThat(refresh_fn, Eventually(Equals(False)))
33
34 def assertWindowIsClosed(self, xid):
35@@ -102,7 +102,7 @@
36 sleep(.5)
37 self.mouse.click(button=2)
38
39- self.assertWindowIsNotScaled(target_xid)
40+ self.assertWindowIsNotScaled(target_win)
41 self.assertWindowIsClosed(target_xid)
42
43 def test_scaled_window_closes_on_close_button_click(self):
44@@ -118,5 +118,5 @@
45 sleep(.5)
46 self.mouse.click()
47
48- self.assertWindowIsNotScaled(target_xid)
49+ self.assertWindowIsNotScaled(target_win)
50 self.assertWindowIsClosed(target_xid)
51
52=== modified file 'tests/autopilot/unity/tests/test_wm_keybindings.py'
53--- tests/autopilot/unity/tests/test_wm_keybindings.py 2013-10-03 00:56:15 +0000
54+++ tests/autopilot/unity/tests/test_wm_keybindings.py 2013-10-08 14:20:37 +0000
55@@ -65,7 +65,7 @@
56 self.assertThat(self.unity.panels.get_active_indicator, Eventually(Equals(None)))
57
58
59-class WindowManagerKeybindingsForWindowHandling(WindowManagerKeybindings):
60+class WindowManagerKeybindingsForWindowHandling(UnityTestCase):
61 """Window Manager keybindings tests for handling a window"""
62
63 scenarios = [('Restored Window', {'start_restored': True}),