Merge lp:~veebers/unity/merge_updated_autopilot_tests_for_1.3 into lp:~unity-team/unity/libunity-7.0-breakage
- merge_updated_autopilot_tests_for_1.3
- Merge into libunity-7.0-breakage
Status: | Merged |
---|---|
Approved by: | Paweł Stołowski |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3144 |
Proposed branch: | lp:~veebers/unity/merge_updated_autopilot_tests_for_1.3 |
Merge into: | lp:~unity-team/unity/libunity-7.0-breakage |
Diff against target: |
2293 lines (+523/-290) 30 files modified
plugins/unityshell/src/unityshell.cpp (+1/-1) tests/autopilot/unity/emulators/X11.py (+115/-0) tests/autopilot/unity/emulators/__init__.py (+3/-0) tests/autopilot/unity/emulators/compiz.py (+63/-0) tests/autopilot/unity/emulators/dash.py (+37/-43) tests/autopilot/unity/emulators/hud.py (+2/-2) tests/autopilot/unity/emulators/launcher.py (+13/-12) tests/autopilot/unity/emulators/panel.py (+4/-4) tests/autopilot/unity/emulators/quicklist.py (+3/-7) tests/autopilot/unity/emulators/switcher.py (+2/-2) tests/autopilot/unity/emulators/workspace.py (+6/-9) tests/autopilot/unity/tests/__init__.py (+73/-11) tests/autopilot/unity/tests/launcher/__init__.py (+7/-8) tests/autopilot/unity/tests/launcher/test_capture.py (+8/-11) tests/autopilot/unity/tests/launcher/test_icon_behavior.py (+27/-27) tests/autopilot/unity/tests/launcher/test_keynav.py (+4/-4) tests/autopilot/unity/tests/launcher/test_reveal.py (+7/-6) tests/autopilot/unity/tests/launcher/test_scroll.py (+1/-1) tests/autopilot/unity/tests/launcher/test_switcher.py (+4/-4) tests/autopilot/unity/tests/test_command_lens.py (+4/-4) tests/autopilot/unity/tests/test_dash.py (+17/-16) tests/autopilot/unity/tests/test_home_lens.py (+4/-4) tests/autopilot/unity/tests/test_hud.py (+41/-41) tests/autopilot/unity/tests/test_ibus.py (+1/-1) tests/autopilot/unity/tests/test_panel.py (+26/-24) tests/autopilot/unity/tests/test_quicklist.py (+20/-19) tests/autopilot/unity/tests/test_shortcut_hint.py (+3/-3) tests/autopilot/unity/tests/test_showdesktop.py (+2/-2) tests/autopilot/unity/tests/test_spread.py (+4/-4) tests/autopilot/unity/tests/test_switcher.py (+21/-20) |
To merge this branch: | bzr merge lp:~veebers/unity/merge_updated_autopilot_tests_for_1.3 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Paweł Stołowski (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+163261@code.launchpad.net |
Commit message
Resolve conflicts in merging updated autopilot tests.
Description of the change
As requested by Michal (mhr3), merging in the conflicted parts of the autopilot tests update autopilot ver. 1.3.
Christopher Lee (veebers) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3140
http://
Executed test runs:
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3141
http://
Executed test runs:
SUCCESS: http://
Click here to trigger a rebuild:
http://
Christopher Lee (veebers) wrote : | # |
2nd test suite ran through fine as expected (again there were failures, but none were obviously due to the merge/conflict resolution).
Paweł Stołowski (stolowski) : | # |
Preview Diff
1 | === modified file 'plugins/unityshell/src/unityshell.cpp' | |||
2 | --- plugins/unityshell/src/unityshell.cpp 2013-05-09 16:26:04 +0000 | |||
3 | +++ plugins/unityshell/src/unityshell.cpp 2013-05-15 16:01:29 +0000 | |||
4 | @@ -2505,7 +2505,7 @@ | |||
5 | 2505 | uScreen->windows_for_monitor_[monitor] = 1; | 2505 | uScreen->windows_for_monitor_[monitor] = 1; |
6 | 2506 | 2506 | ||
7 | 2507 | if (!(mask & nonOcclusionBits) && | 2507 | if (!(mask & nonOcclusionBits) && |
9 | 2508 | (window->state() & CompWindowStateFullscreenMask) && | 2508 | (window->state() & CompWindowStateFullscreenMask && !window->minimized()) && |
10 | 2509 | uScreen->windows_for_monitor_[monitor] == 1) | 2509 | uScreen->windows_for_monitor_[monitor] == 1) |
11 | 2510 | // And I've been advised to test other things, but they don't work: | 2510 | // And I've been advised to test other things, but they don't work: |
12 | 2511 | // && (attrib.opacity == OPAQUE)) <-- Doesn't work; Only set in glDraw | 2511 | // && (attrib.opacity == OPAQUE)) <-- Doesn't work; Only set in glDraw |
13 | 2512 | 2512 | ||
14 | === added file 'tests/autopilot/unity/emulators/X11.py' | |||
15 | --- tests/autopilot/unity/emulators/X11.py 1970-01-01 00:00:00 +0000 | |||
16 | +++ tests/autopilot/unity/emulators/X11.py 2013-05-15 16:01:29 +0000 | |||
17 | @@ -0,0 +1,115 @@ | |||
18 | 1 | from __future__ import absolute_import | ||
19 | 2 | |||
20 | 3 | from autopilot.utilities import Silence | ||
21 | 4 | from autopilot.display import Display | ||
22 | 5 | from autopilot.input import Mouse, Keyboard | ||
23 | 6 | from autopilot.process import Window | ||
24 | 7 | |||
25 | 8 | import logging | ||
26 | 9 | import subprocess | ||
27 | 10 | from Xlib import X, display, protocol | ||
28 | 11 | |||
29 | 12 | |||
30 | 13 | logger = logging.getLogger(__name__) | ||
31 | 14 | |||
32 | 15 | _display = None | ||
33 | 16 | |||
34 | 17 | _blacklisted_drivers = ["NVIDIA"] | ||
35 | 18 | |||
36 | 19 | def _get_display(): | ||
37 | 20 | """Get a Xlib display object. Creating the display prints garbage to stdout.""" | ||
38 | 21 | global _display | ||
39 | 22 | if _display is None: | ||
40 | 23 | with Silence(): | ||
41 | 24 | _display = display.Display() | ||
42 | 25 | return _display | ||
43 | 26 | |||
44 | 27 | def _getProperty(_type, win=None): | ||
45 | 28 | if not win: | ||
46 | 29 | win = _get_display().screen().root | ||
47 | 30 | atom = win.get_full_property(_get_display().get_atom(_type), X.AnyPropertyType) | ||
48 | 31 | if atom: return atom.value | ||
49 | 32 | |||
50 | 33 | def get_desktop_viewport(): | ||
51 | 34 | """Get the x,y coordinates for the current desktop viewport top-left corner.""" | ||
52 | 35 | return _getProperty('_NET_DESKTOP_VIEWPORT') | ||
53 | 36 | |||
54 | 37 | |||
55 | 38 | # Note: this use to exist within autopilot, moved here due to Autopilot 1.3 | ||
56 | 39 | # upgrade. | ||
57 | 40 | def drag_window_to_screen(window, screen): | ||
58 | 41 | """Drags *window* to *screen* | ||
59 | 42 | |||
60 | 43 | :param autopilot.process.Window window: The window to drag | ||
61 | 44 | :param integer screen: The screen to drag the *window* to | ||
62 | 45 | :raises: **TypeError** if *window* is not a autopilot.process.Window | ||
63 | 46 | |||
64 | 47 | """ | ||
65 | 48 | if not isinstance(window, Window): | ||
66 | 49 | raise TypeError("Window must be a autopilot.process.Window") | ||
67 | 50 | |||
68 | 51 | if window.monitor == screen: | ||
69 | 52 | logger.debug("Window %r is already on screen %d." % (window.x_id, screen)) | ||
70 | 53 | return | ||
71 | 54 | |||
72 | 55 | assert(not window.is_maximized) | ||
73 | 56 | (win_x, win_y, win_w, win_h) = window.geometry | ||
74 | 57 | (mx, my, mw, mh) = Display.create().get_screen_geometry(screen) | ||
75 | 58 | |||
76 | 59 | logger.debug("Dragging window %r to screen %d." % (window.x_id, screen)) | ||
77 | 60 | |||
78 | 61 | mouse = Mouse.create() | ||
79 | 62 | keyboard = Keyboard.create() | ||
80 | 63 | mouse.move(win_x + win_w/2, win_y + win_h/2) | ||
81 | 64 | keyboard.press("Alt") | ||
82 | 65 | mouse.press() | ||
83 | 66 | keyboard.release("Alt") | ||
84 | 67 | |||
85 | 68 | # We do the movements in two steps, to reduce the risk of being | ||
86 | 69 | # blocked by the pointer barrier | ||
87 | 70 | target_x = mx + mw/2 | ||
88 | 71 | target_y = my + mh/2 | ||
89 | 72 | mouse.move(win_x, target_y, rate=20, time_between_events=0.005) | ||
90 | 73 | mouse.move(target_x, target_y, rate=20, time_between_events=0.005) | ||
91 | 74 | mouse.release() | ||
92 | 75 | |||
93 | 76 | |||
94 | 77 | # Note: this use to exist within autopilot, moved here due to Autopilot 1.3 | ||
95 | 78 | # upgrade. | ||
96 | 79 | def set_primary_monitor(monitor): | ||
97 | 80 | """Set *monitor* to be the primary monitor. | ||
98 | 81 | |||
99 | 82 | :param int monitor: Must be between 0 and the number of configured | ||
100 | 83 | monitors. | ||
101 | 84 | :raises: **ValueError** if an invalid monitor is specified. | ||
102 | 85 | :raises: **BlacklistedDriverError** if your video driver does not | ||
103 | 86 | support this. | ||
104 | 87 | |||
105 | 88 | """ | ||
106 | 89 | try: | ||
107 | 90 | glxinfo_out = subprocess.check_output("glxinfo") | ||
108 | 91 | except OSError, e: | ||
109 | 92 | raise OSError("Failed to run glxinfo: %s. (do you have mesa-utils installed?)" % e) | ||
110 | 93 | |||
111 | 94 | for dri in _blacklisted_drivers: | ||
112 | 95 | if dri in glxinfo_out: | ||
113 | 96 | raise Display.BlacklistedDriverError('Impossible change the primary monitor for the given driver') | ||
114 | 97 | |||
115 | 98 | num_monitors = Display.create().get_num_screens() | ||
116 | 99 | if monitor < 0 or monitor >= num_monitors: | ||
117 | 100 | raise ValueError('Monitor %d is not in valid range of 0 <= monitor < %d.' % (num_monitors)) | ||
118 | 101 | |||
119 | 102 | default_screen = Gdk.Screen.get_default() | ||
120 | 103 | monitor_name = default_screen.get_monitor_plug_name(monitor) | ||
121 | 104 | |||
122 | 105 | if not monitor_name: | ||
123 | 106 | raise ValueError('Could not get monitor name from monitor number %d.' % (monitor)) | ||
124 | 107 | |||
125 | 108 | ret = os.spawnlp(os.P_WAIT, "xrandr", "xrandr", "--output", monitor_name, "--primary") | ||
126 | 109 | |||
127 | 110 | if ret != 0: | ||
128 | 111 | raise RuntimeError('Xrandr can\'t set the primary monitor. error code: %d' % (ret)) | ||
129 | 112 | |||
130 | 113 | def reset_display(): | ||
131 | 114 | from autopilot.input._X11 import reset_display | ||
132 | 115 | reset_display() | ||
133 | 0 | 116 | ||
134 | === modified file 'tests/autopilot/unity/emulators/__init__.py' | |||
135 | --- tests/autopilot/unity/emulators/__init__.py 2012-09-24 02:59:48 +0000 | |||
136 | +++ tests/autopilot/unity/emulators/__init__.py 2013-05-15 16:01:29 +0000 | |||
137 | @@ -12,6 +12,7 @@ | |||
138 | 12 | from time import sleep | 12 | from time import sleep |
139 | 13 | 13 | ||
140 | 14 | from autopilot.introspection.dbus import DBusIntrospectionObject | 14 | from autopilot.introspection.dbus import DBusIntrospectionObject |
141 | 15 | from autopilot.introspection.backends import DBusAddress | ||
142 | 15 | 16 | ||
143 | 16 | 17 | ||
144 | 17 | class UnityIntrospectionObject(DBusIntrospectionObject): | 18 | class UnityIntrospectionObject(DBusIntrospectionObject): |
145 | @@ -19,6 +20,8 @@ | |||
146 | 19 | DBUS_SERVICE = "com.canonical.Unity" | 20 | DBUS_SERVICE = "com.canonical.Unity" |
147 | 20 | DBUS_OBJECT = "/com/canonical/Unity/Debug" | 21 | DBUS_OBJECT = "/com/canonical/Unity/Debug" |
148 | 21 | 22 | ||
149 | 23 | _Backend = DBusAddress.SessionBus(DBUS_SERVICE, DBUS_OBJECT) | ||
150 | 24 | |||
151 | 22 | 25 | ||
152 | 23 | def ensure_unity_is_running(timeout=300): | 26 | def ensure_unity_is_running(timeout=300): |
153 | 24 | """Poll the unity debug interface, and return when it's ready for use. | 27 | """Poll the unity debug interface, and return when it's ready for use. |
154 | 25 | 28 | ||
155 | === added file 'tests/autopilot/unity/emulators/compiz.py' | |||
156 | --- tests/autopilot/unity/emulators/compiz.py 1970-01-01 00:00:00 +0000 | |||
157 | +++ tests/autopilot/unity/emulators/compiz.py 2013-05-15 16:01:29 +0000 | |||
158 | @@ -0,0 +1,63 @@ | |||
159 | 1 | from __future__ import absolute_import | ||
160 | 2 | |||
161 | 3 | """Functions that wrap compizconfig to avoid some unpleasantness in that module.""" | ||
162 | 4 | |||
163 | 5 | from __future__ import absolute_import | ||
164 | 6 | |||
165 | 7 | from autopilot.utilities import Silence | ||
166 | 8 | |||
167 | 9 | _global_context = None | ||
168 | 10 | |||
169 | 11 | def get_global_context(): | ||
170 | 12 | """Get the compizconfig global context object.""" | ||
171 | 13 | global _global_context | ||
172 | 14 | if _global_context is None: | ||
173 | 15 | with Silence(): | ||
174 | 16 | from compizconfig import Context | ||
175 | 17 | _global_context = Context() | ||
176 | 18 | return _global_context | ||
177 | 19 | |||
178 | 20 | |||
179 | 21 | def _get_plugin(plugin_name): | ||
180 | 22 | """Get a compizconfig plugin with the specified name. | ||
181 | 23 | |||
182 | 24 | Raises KeyError of the plugin named does not exist. | ||
183 | 25 | |||
184 | 26 | """ | ||
185 | 27 | ctx = get_global_context() | ||
186 | 28 | with Silence(): | ||
187 | 29 | try: | ||
188 | 30 | return ctx.Plugins[plugin_name] | ||
189 | 31 | except KeyError: | ||
190 | 32 | raise KeyError("Compiz plugin '%s' does not exist." % (plugin_name)) | ||
191 | 33 | |||
192 | 34 | |||
193 | 35 | def get_compiz_setting(plugin_name, setting_name): | ||
194 | 36 | """Get a compiz setting object. | ||
195 | 37 | |||
196 | 38 | *plugin_name* is the name of the plugin (e.g. 'core' or 'unityshell') | ||
197 | 39 | *setting_name* is the name of the setting (e.g. 'alt_tab_timeout') | ||
198 | 40 | |||
199 | 41 | :raises: KeyError if the plugin or setting named does not exist. | ||
200 | 42 | |||
201 | 43 | :returns: a compiz setting object. | ||
202 | 44 | |||
203 | 45 | """ | ||
204 | 46 | plugin = _get_plugin(plugin_name) | ||
205 | 47 | with Silence(): | ||
206 | 48 | try: | ||
207 | 49 | return plugin.Screen[setting_name] | ||
208 | 50 | except KeyError: | ||
209 | 51 | raise KeyError("Compiz setting '%s' does not exist in plugin '%s'." % (setting_name, plugin_name)) | ||
210 | 52 | |||
211 | 53 | |||
212 | 54 | def get_compiz_option(plugin_name, setting_name): | ||
213 | 55 | """Get a compiz setting value. | ||
214 | 56 | |||
215 | 57 | This is the same as calling: | ||
216 | 58 | |||
217 | 59 | >>> get_compiz_setting(plugin_name, setting_name).Value | ||
218 | 60 | |||
219 | 61 | """ | ||
220 | 62 | return get_compiz_setting(plugin_name, setting_name).Value | ||
221 | 63 | |||
222 | 0 | 64 | ||
223 | === modified file 'tests/autopilot/unity/emulators/dash.py' | |||
224 | --- tests/autopilot/unity/emulators/dash.py 2013-05-01 22:40:19 +0000 | |||
225 | +++ tests/autopilot/unity/emulators/dash.py 2013-05-15 16:01:29 +0000 | |||
226 | @@ -9,8 +9,8 @@ | |||
227 | 9 | 9 | ||
228 | 10 | from __future__ import absolute_import | 10 | from __future__ import absolute_import |
229 | 11 | 11 | ||
230 | 12 | from autopilot.input import Keyboard, Mouse | ||
231 | 12 | 13 | ||
232 | 13 | from autopilot.emulators.input import get_keyboard, get_mouse | ||
233 | 14 | from autopilot.keybindings import KeybindingsHelper | 14 | from autopilot.keybindings import KeybindingsHelper |
234 | 15 | from testtools.matchers import GreaterThan | 15 | from testtools.matchers import GreaterThan |
235 | 16 | 16 | ||
236 | @@ -28,8 +28,8 @@ | |||
237 | 28 | 28 | ||
238 | 29 | def __init__(self, *args, **kwargs): | 29 | def __init__(self, *args, **kwargs): |
239 | 30 | super(DashController, self).__init__(*args, **kwargs) | 30 | super(DashController, self).__init__(*args, **kwargs) |
242 | 31 | self.keyboard = get_keyboard() | 31 | self.keyboard = Keyboard.create() |
243 | 32 | self.mouse = get_mouse() | 32 | self.mouse = Mouse.create() |
244 | 33 | 33 | ||
245 | 34 | def get_dash_view(self): | 34 | def get_dash_view(self): |
246 | 35 | """Get the dash view that's attached to this controller.""" | 35 | """Get the dash view that's attached to this controller.""" |
247 | @@ -91,7 +91,7 @@ | |||
248 | 91 | def preview_animation(self): | 91 | def preview_animation(self): |
249 | 92 | """Returns the average progress of dash slip and animating a preview. | 92 | """Returns the average progress of dash slip and animating a preview. |
250 | 93 | Between 0.0 and 1.0. | 93 | Between 0.0 and 1.0. |
252 | 94 | 94 | ||
253 | 95 | """ | 95 | """ |
254 | 96 | return self.view.preview_animation; | 96 | return self.view.preview_animation; |
255 | 97 | 97 | ||
256 | @@ -278,38 +278,33 @@ | |||
257 | 278 | class Result(UnityIntrospectionObject): | 278 | class Result(UnityIntrospectionObject): |
258 | 279 | """A single result in the dash.""" | 279 | """A single result in the dash.""" |
259 | 280 | 280 | ||
260 | 281 | def __init__(self, *args, **kwargs): | ||
261 | 282 | super(Result, self).__init__(*args, **kwargs) | ||
262 | 283 | self.mouse = get_mouse() | ||
263 | 284 | self.keyboard = get_keyboard() | ||
264 | 285 | |||
265 | 286 | def activate(self, double_click=True): | 281 | def activate(self, double_click=True): |
266 | 287 | tx = self.x + (self.width / 2) | 282 | tx = self.x + (self.width / 2) |
267 | 288 | ty = self.y + (self.height / 2) | 283 | ty = self.y + (self.height / 2) |
270 | 289 | self.mouse.move(tx, ty) | 284 | m = Mouse.create() |
271 | 290 | self.mouse.click(1) | 285 | m.move(tx, ty) |
272 | 286 | m.click(1) | ||
273 | 291 | if double_click: | 287 | if double_click: |
275 | 292 | self.mouse.click(1) | 288 | m.click(1) |
276 | 293 | 289 | ||
277 | 294 | def preview(self, button=1): | 290 | def preview(self, button=1): |
278 | 295 | tx = self.x + (self.width / 2) | 291 | tx = self.x + (self.width / 2) |
279 | 296 | ty = self.y + (self.height / 2) | 292 | ty = self.y + (self.height / 2) |
282 | 297 | self.mouse.move(tx, ty) | 293 | m = Mouse.create() |
283 | 298 | self.mouse.click(button) | 294 | m.move(tx, ty) |
284 | 295 | m.click(button) | ||
285 | 299 | 296 | ||
286 | 300 | def preview_key(self): | 297 | def preview_key(self): |
287 | 301 | tx = self.x + (self.width / 2) | 298 | tx = self.x + (self.width / 2) |
288 | 302 | ty = self.y + (self.height / 2) | 299 | ty = self.y + (self.height / 2) |
290 | 303 | self.mouse.move(tx, ty) | 300 | m = Mouse.create() |
291 | 301 | m.move(tx, ty) | ||
292 | 304 | 302 | ||
294 | 305 | self.keyboard.press_and_release('Menu') | 303 | k = Keyboard.create() |
295 | 304 | k.press_and_release('Menu') | ||
296 | 306 | 305 | ||
297 | 307 | class FilterBar(UnityIntrospectionObject): | 306 | class FilterBar(UnityIntrospectionObject): |
303 | 308 | """A filterbar, as shown inside a scope.""" | 307 | """A filterbar, as shown inside a lens.""" |
299 | 309 | |||
300 | 310 | def __init__(self, *args, **kwargs): | ||
301 | 311 | super(FilterBar, self).__init__(*args, **kwargs) | ||
302 | 312 | self.mouse = get_mouse() | ||
304 | 313 | 308 | ||
305 | 314 | def get_num_filters(self): | 309 | def get_num_filters(self): |
306 | 315 | """Get the number of filters in this filter bar.""" | 310 | """Get the number of filters in this filter bar.""" |
307 | @@ -337,8 +332,9 @@ | |||
308 | 337 | searchbar = self._get_searchbar() | 332 | searchbar = self._get_searchbar() |
309 | 338 | tx = searchbar.filter_label_x + (searchbar.filter_label_width / 2) | 333 | tx = searchbar.filter_label_x + (searchbar.filter_label_width / 2) |
310 | 339 | ty = searchbar.filter_label_y + (searchbar.filter_label_height / 2) | 334 | ty = searchbar.filter_label_y + (searchbar.filter_label_height / 2) |
313 | 340 | self.mouse.move(tx, ty) | 335 | m = Mouse.create() |
314 | 341 | self.mouse.click() | 336 | m.move(tx, ty) |
315 | 337 | m.click() | ||
316 | 342 | self.expanded.wait_for(True) | 338 | self.expanded.wait_for(True) |
317 | 343 | 339 | ||
318 | 344 | def ensure_collapsed(self): | 340 | def ensure_collapsed(self): |
319 | @@ -347,8 +343,9 @@ | |||
320 | 347 | searchbar = self._get_searchbar() | 343 | searchbar = self._get_searchbar() |
321 | 348 | tx = searchbar.filter_label_x + (searchbar.filter_label_width / 2) | 344 | tx = searchbar.filter_label_x + (searchbar.filter_label_width / 2) |
322 | 349 | ty = searchbar.filter_label_y + (searchbar.filter_label_height / 2) | 345 | ty = searchbar.filter_label_y + (searchbar.filter_label_height / 2) |
325 | 350 | self.mouse.move(tx, ty) | 346 | m = Mouse.create() |
326 | 351 | self.mouse.click() | 347 | m.move(tx, ty) |
327 | 348 | m.click() | ||
328 | 352 | self.expanded.wait_for(False) | 349 | self.expanded.wait_for(False) |
329 | 353 | 350 | ||
330 | 354 | def _get_searchbar(self): | 351 | def _get_searchbar(self): |
331 | @@ -366,17 +363,14 @@ | |||
332 | 366 | class FilterExpanderLabel(UnityIntrospectionObject): | 363 | class FilterExpanderLabel(UnityIntrospectionObject): |
333 | 367 | """A label that expands into a filter within a filter bar.""" | 364 | """A label that expands into a filter within a filter bar.""" |
334 | 368 | 365 | ||
335 | 369 | def __init__(self, *args, **kwargs): | ||
336 | 370 | super(FilterExpanderLabel, self).__init__(*args, **kwargs) | ||
337 | 371 | self.mouse = get_mouse() | ||
338 | 372 | |||
339 | 373 | def ensure_expanded(self): | 366 | def ensure_expanded(self): |
340 | 374 | """Expand the filter expander label, if it's not already""" | 367 | """Expand the filter expander label, if it's not already""" |
341 | 375 | if not self.expanded: | 368 | if not self.expanded: |
342 | 376 | tx = self.x + self.width / 2 | 369 | tx = self.x + self.width / 2 |
343 | 377 | ty = self.y + self.height / 2 | 370 | ty = self.y + self.height / 2 |
346 | 378 | self.mouse.move(tx, ty) | 371 | m = Mouse.create() |
347 | 379 | self.mouse.click() | 372 | m.move(tx, ty) |
348 | 373 | m.click() | ||
349 | 380 | self.expanded.wait_for(True) | 374 | self.expanded.wait_for(True) |
350 | 381 | 375 | ||
351 | 382 | def ensure_collapsed(self): | 376 | def ensure_collapsed(self): |
352 | @@ -384,8 +378,9 @@ | |||
353 | 384 | if self.expanded: | 378 | if self.expanded: |
354 | 385 | tx = self.x + self.width / 2 | 379 | tx = self.x + self.width / 2 |
355 | 386 | ty = self.y + self.height / 2 | 380 | ty = self.y + self.height / 2 |
358 | 387 | self.mouse.move(tx, ty) | 381 | m = Mouse.create() |
359 | 388 | self.mouse.click() | 382 | m.move(tx, ty) |
360 | 383 | m.click() | ||
361 | 389 | self.expanded.wait_for(False) | 384 | self.expanded.wait_for(False) |
362 | 390 | 385 | ||
363 | 391 | 386 | ||
364 | @@ -419,8 +414,9 @@ | |||
365 | 419 | if action: | 414 | if action: |
366 | 420 | tx = action.x + (searchbar.width / 2) | 415 | tx = action.x + (searchbar.width / 2) |
367 | 421 | ty = action.y + (searchbar.height / 2) | 416 | ty = action.y + (searchbar.height / 2) |
370 | 422 | self.mouse.move(tx, ty) | 417 | m = Mouse.create() |
371 | 423 | self.mouse.click() | 418 | m.move(tx, ty) |
372 | 419 | m.click() | ||
373 | 424 | 420 | ||
374 | 425 | @property | 421 | @property |
375 | 426 | def cover_art(self): | 422 | def cover_art(self): |
376 | @@ -468,10 +464,6 @@ | |||
377 | 468 | class PreviewContainer(UnityIntrospectionObject): | 464 | class PreviewContainer(UnityIntrospectionObject): |
378 | 469 | """A container view for the main dash preview widget.""" | 465 | """A container view for the main dash preview widget.""" |
379 | 470 | 466 | ||
380 | 471 | def __init__(self, *args, **kwargs): | ||
381 | 472 | super(PreviewContainer, self).__init__(*args, **kwargs) | ||
382 | 473 | self.mouse = get_mouse() | ||
383 | 474 | |||
384 | 475 | @property | 467 | @property |
385 | 476 | def content(self): | 468 | def content(self): |
386 | 477 | return self.get_content() | 469 | return self.get_content() |
387 | @@ -507,13 +499,14 @@ | |||
388 | 507 | 499 | ||
389 | 508 | tx = navigator.button_x + (navigator.button_width / 2) | 500 | tx = navigator.button_x + (navigator.button_width / 2) |
390 | 509 | ty = navigator.button_y + (navigator.button_height / 2) | 501 | ty = navigator.button_y + (navigator.button_height / 2) |
392 | 510 | self.mouse.move(tx, ty) | 502 | m = Mouse.create() |
393 | 503 | m.move(tx, ty) | ||
394 | 511 | 504 | ||
395 | 512 | old_preview_initiate_count = self.preview_initiate_count | 505 | old_preview_initiate_count = self.preview_initiate_count |
396 | 513 | 506 | ||
397 | 514 | for i in range(count): | 507 | for i in range(count): |
398 | 515 | self.navigate_left_enabled.wait_for(True) | 508 | self.navigate_left_enabled.wait_for(True) |
400 | 516 | self.mouse.click() | 509 | m.click() |
401 | 517 | self.preview_initiate_count.wait_for(GreaterThan(old_preview_initiate_count)) | 510 | self.preview_initiate_count.wait_for(GreaterThan(old_preview_initiate_count)) |
402 | 518 | old_preview_initiate_count = self.preview_initiate_count | 511 | old_preview_initiate_count = self.preview_initiate_count |
403 | 519 | 512 | ||
404 | @@ -523,13 +516,14 @@ | |||
405 | 523 | 516 | ||
406 | 524 | tx = navigator.button_x + (navigator.button_width / 2) | 517 | tx = navigator.button_x + (navigator.button_width / 2) |
407 | 525 | ty = navigator.button_y + (navigator.button_height / 2) | 518 | ty = navigator.button_y + (navigator.button_height / 2) |
409 | 526 | self.mouse.move(tx, ty) | 519 | m = Mouse.create() |
410 | 520 | m.move(tx, ty) | ||
411 | 527 | 521 | ||
412 | 528 | old_preview_initiate_count = self.preview_initiate_count | 522 | old_preview_initiate_count = self.preview_initiate_count |
413 | 529 | 523 | ||
414 | 530 | for i in range(count): | 524 | for i in range(count): |
415 | 531 | self.navigate_right_enabled.wait_for(True) | 525 | self.navigate_right_enabled.wait_for(True) |
417 | 532 | self.mouse.click() | 526 | m.click() |
418 | 533 | self.preview_initiate_count.wait_for(GreaterThan(old_preview_initiate_count)) | 527 | self.preview_initiate_count.wait_for(GreaterThan(old_preview_initiate_count)) |
419 | 534 | old_preview_initiate_count = self.preview_initiate_count | 528 | old_preview_initiate_count = self.preview_initiate_count |
420 | 535 | 529 | ||
421 | 536 | 530 | ||
422 | === modified file 'tests/autopilot/unity/emulators/hud.py' | |||
423 | --- tests/autopilot/unity/emulators/hud.py 2013-03-20 15:21:51 +0000 | |||
424 | +++ tests/autopilot/unity/emulators/hud.py 2013-05-15 16:01:29 +0000 | |||
425 | @@ -9,7 +9,7 @@ | |||
426 | 9 | 9 | ||
427 | 10 | from __future__ import absolute_import | 10 | from __future__ import absolute_import |
428 | 11 | 11 | ||
430 | 12 | from autopilot.emulators.input import get_keyboard | 12 | from autopilot.input import Keyboard |
431 | 13 | from autopilot.keybindings import KeybindingsHelper | 13 | from autopilot.keybindings import KeybindingsHelper |
432 | 14 | from HTMLParser import HTMLParser | 14 | from HTMLParser import HTMLParser |
433 | 15 | import re | 15 | import re |
434 | @@ -24,7 +24,7 @@ | |||
435 | 24 | 24 | ||
436 | 25 | def __init__(self, *args, **kwargs): | 25 | def __init__(self, *args, **kwargs): |
437 | 26 | super(HudController, self).__init__(*args, **kwargs) | 26 | super(HudController, self).__init__(*args, **kwargs) |
439 | 27 | self.keyboard = get_keyboard() | 27 | self.keyboard = Keyboard.create() |
440 | 28 | 28 | ||
441 | 29 | def get_hud_view(self): | 29 | def get_hud_view(self): |
442 | 30 | views = self.get_children_by_type(HudView) | 30 | views = self.get_children_by_type(HudView) |
443 | 31 | 31 | ||
444 | === modified file 'tests/autopilot/unity/emulators/launcher.py' | |||
445 | --- tests/autopilot/unity/emulators/launcher.py 2013-03-21 11:36:49 +0000 | |||
446 | +++ tests/autopilot/unity/emulators/launcher.py 2013-05-15 16:01:29 +0000 | |||
447 | @@ -9,10 +9,9 @@ | |||
448 | 9 | 9 | ||
449 | 10 | from __future__ import absolute_import | 10 | from __future__ import absolute_import |
450 | 11 | 11 | ||
453 | 12 | from autopilot.emulators.input import get_mouse | 12 | from autopilot.input import Mouse |
454 | 13 | from autopilot.emulators.X11 import ScreenGeometry | 13 | from autopilot.display import Display, move_mouse_to_screen |
455 | 14 | from autopilot.keybindings import KeybindingsHelper | 14 | from autopilot.keybindings import KeybindingsHelper |
456 | 15 | from autopilot.utilities import get_compiz_option | ||
457 | 16 | import logging | 15 | import logging |
458 | 17 | from testtools.matchers import NotEquals | 16 | from testtools.matchers import NotEquals |
459 | 18 | from time import sleep | 17 | from time import sleep |
460 | @@ -26,6 +25,8 @@ | |||
461 | 26 | TrashLauncherIcon, | 25 | TrashLauncherIcon, |
462 | 27 | ) | 26 | ) |
463 | 28 | 27 | ||
464 | 28 | from unity.emulators.compiz import get_compiz_option | ||
465 | 29 | |||
466 | 29 | logger = logging.getLogger(__name__) | 30 | logger = logging.getLogger(__name__) |
467 | 30 | 31 | ||
468 | 31 | 32 | ||
469 | @@ -68,8 +69,8 @@ | |||
470 | 68 | self.in_keynav_mode = False | 69 | self.in_keynav_mode = False |
471 | 69 | self.in_switcher_mode = False | 70 | self.in_switcher_mode = False |
472 | 70 | 71 | ||
475 | 71 | self._mouse = get_mouse() | 72 | self._mouse = Mouse.create() |
476 | 72 | self._screen = ScreenGeometry() | 73 | self._display = Display.create() |
477 | 73 | 74 | ||
478 | 74 | def _perform_key_nav_binding(self, keybinding): | 75 | def _perform_key_nav_binding(self, keybinding): |
479 | 75 | if not self.in_keynav_mode: | 76 | if not self.in_keynav_mode: |
480 | @@ -101,7 +102,7 @@ | |||
481 | 101 | 102 | ||
482 | 102 | def move_mouse_to_right_of_launcher(self): | 103 | def move_mouse_to_right_of_launcher(self): |
483 | 103 | """Places the mouse to the right of this launcher.""" | 104 | """Places the mouse to the right of this launcher.""" |
485 | 104 | self._screen.move_mouse_to_monitor(self.monitor) | 105 | move_mouse_to_screen(self.monitor) |
486 | 105 | (x, y, w, h) = self.geometry | 106 | (x, y, w, h) = self.geometry |
487 | 106 | target_x = x + w + 10 | 107 | target_x = x + w + 10 |
488 | 107 | target_y = y + h / 2 | 108 | target_y = y + h / 2 |
489 | @@ -112,7 +113,7 @@ | |||
490 | 112 | 113 | ||
491 | 113 | def move_mouse_over_launcher(self): | 114 | def move_mouse_over_launcher(self): |
492 | 114 | """Move the mouse over this launcher.""" | 115 | """Move the mouse over this launcher.""" |
494 | 115 | self._screen.move_mouse_to_monitor(self.monitor) | 116 | move_mouse_to_screen(self.monitor) |
495 | 116 | (x, y, w, h) = self.geometry | 117 | (x, y, w, h) = self.geometry |
496 | 117 | target_x = x + w / 2 | 118 | target_x = x + w / 2 |
497 | 118 | target_y = y + h / 2 | 119 | target_y = y + h / 2 |
498 | @@ -137,7 +138,7 @@ | |||
499 | 137 | """ | 138 | """ |
500 | 138 | if self.is_showing: | 139 | if self.is_showing: |
501 | 139 | return | 140 | return |
503 | 140 | self._screen.move_mouse_to_monitor(self.monitor) | 141 | move_mouse_to_screen(self.monitor) |
504 | 141 | (x, y, w, h) = self.geometry | 142 | (x, y, w, h) = self.geometry |
505 | 142 | 143 | ||
506 | 143 | target_x = x - 920 # this is the pressure we need to reveal the launcher. | 144 | target_x = x - 920 # this is the pressure we need to reveal the launcher. |
507 | @@ -148,14 +149,14 @@ | |||
508 | 148 | 149 | ||
509 | 149 | def keyboard_reveal_launcher(self): | 150 | def keyboard_reveal_launcher(self): |
510 | 150 | """Reveal this launcher using the keyboard.""" | 151 | """Reveal this launcher using the keyboard.""" |
512 | 151 | self._screen.move_mouse_to_monitor(self.monitor) | 152 | move_mouse_to_screen(self.monitor) |
513 | 152 | logger.debug("Revealing launcher with keyboard.") | 153 | logger.debug("Revealing launcher with keyboard.") |
514 | 153 | self.keybinding_hold("launcher/reveal") | 154 | self.keybinding_hold("launcher/reveal") |
515 | 154 | self.is_showing.wait_for(True) | 155 | self.is_showing.wait_for(True) |
516 | 155 | 156 | ||
517 | 156 | def keyboard_unreveal_launcher(self): | 157 | def keyboard_unreveal_launcher(self): |
518 | 157 | """Un-reveal this launcher using the keyboard.""" | 158 | """Un-reveal this launcher using the keyboard.""" |
520 | 158 | self._screen.move_mouse_to_monitor(self.monitor) | 159 | move_mouse_to_screen(self.monitor) |
521 | 159 | logger.debug("Un-revealing launcher with keyboard.") | 160 | logger.debug("Un-revealing launcher with keyboard.") |
522 | 160 | self.keybinding_release("launcher/reveal") | 161 | self.keybinding_release("launcher/reveal") |
523 | 161 | # only wait if the launcher is set to autohide | 162 | # only wait if the launcher is set to autohide |
524 | @@ -210,7 +211,7 @@ | |||
525 | 210 | 211 | ||
526 | 211 | def key_nav_start(self): | 212 | def key_nav_start(self): |
527 | 212 | """Start keyboard navigation mode by pressing Alt+F1.""" | 213 | """Start keyboard navigation mode by pressing Alt+F1.""" |
529 | 213 | self._screen.move_mouse_to_monitor(self.monitor) | 214 | move_mouse_to_screen(self.monitor) |
530 | 214 | logger.debug("Initiating launcher keyboard navigation with Alt+F1.") | 215 | logger.debug("Initiating launcher keyboard navigation with Alt+F1.") |
531 | 215 | self.keybinding("launcher/keynav") | 216 | self.keybinding("launcher/keynav") |
532 | 216 | self._get_controller().key_nav_is_active.wait_for(True) | 217 | self._get_controller().key_nav_is_active.wait_for(True) |
533 | @@ -255,7 +256,7 @@ | |||
534 | 255 | 256 | ||
535 | 256 | def switcher_start(self): | 257 | def switcher_start(self): |
536 | 257 | """Start the super+Tab switcher on this launcher.""" | 258 | """Start the super+Tab switcher on this launcher.""" |
538 | 258 | self._screen.move_mouse_to_monitor(self.monitor) | 259 | move_mouse_to_screen(self.monitor) |
539 | 259 | logger.debug("Starting Super+Tab switcher.") | 260 | logger.debug("Starting Super+Tab switcher.") |
540 | 260 | self.keybinding_hold_part_then_tap("launcher/switcher") | 261 | self.keybinding_hold_part_then_tap("launcher/switcher") |
541 | 261 | self._get_controller().key_nav_is_active.wait_for(True) | 262 | self._get_controller().key_nav_is_active.wait_for(True) |
542 | 262 | 263 | ||
543 | === modified file 'tests/autopilot/unity/emulators/panel.py' | |||
544 | --- tests/autopilot/unity/emulators/panel.py 2013-03-20 15:21:51 +0000 | |||
545 | +++ tests/autopilot/unity/emulators/panel.py 2013-05-15 16:01:29 +0000 | |||
546 | @@ -12,7 +12,7 @@ | |||
547 | 12 | import logging | 12 | import logging |
548 | 13 | from time import sleep | 13 | from time import sleep |
549 | 14 | 14 | ||
551 | 15 | from autopilot.emulators.input import get_mouse | 15 | from autopilot.input import Mouse |
552 | 16 | from autopilot.keybindings import KeybindingsHelper | 16 | from autopilot.keybindings import KeybindingsHelper |
553 | 17 | 17 | ||
554 | 18 | from unity.emulators import UnityIntrospectionObject | 18 | from unity.emulators import UnityIntrospectionObject |
555 | @@ -53,7 +53,7 @@ | |||
556 | 53 | 53 | ||
557 | 54 | def __init__(self, *args, **kwargs): | 54 | def __init__(self, *args, **kwargs): |
558 | 55 | super(UnityPanel, self).__init__(*args, **kwargs) | 55 | super(UnityPanel, self).__init__(*args, **kwargs) |
560 | 56 | self._mouse = get_mouse() | 56 | self._mouse = Mouse.create() |
561 | 57 | 57 | ||
562 | 58 | def __get_menu_view(self): | 58 | def __get_menu_view(self): |
563 | 59 | """Return the menu view.""" | 59 | """Return the menu view.""" |
564 | @@ -261,7 +261,7 @@ | |||
565 | 261 | 261 | ||
566 | 262 | def __init__(self, *args, **kwargs): | 262 | def __init__(self, *args, **kwargs): |
567 | 263 | super(WindowButton, self).__init__(*args, **kwargs) | 263 | super(WindowButton, self).__init__(*args, **kwargs) |
569 | 264 | self._mouse = get_mouse() | 264 | self._mouse = Mouse.create() |
570 | 265 | 265 | ||
571 | 266 | def mouse_move_to(self): | 266 | def mouse_move_to(self): |
572 | 267 | target_x = self.x + self.width / 2 | 267 | target_x = self.x + self.width / 2 |
573 | @@ -319,7 +319,7 @@ | |||
574 | 319 | 319 | ||
575 | 320 | def __init__(self, *args, **kwargs): | 320 | def __init__(self, *args, **kwargs): |
576 | 321 | super(IndicatorEntry, self).__init__(*args, **kwargs) | 321 | super(IndicatorEntry, self).__init__(*args, **kwargs) |
578 | 322 | self._mouse = get_mouse() | 322 | self._mouse = Mouse.create() |
579 | 323 | 323 | ||
580 | 324 | def mouse_move_to(self): | 324 | def mouse_move_to(self): |
581 | 325 | target_x = self.x + self.width / 2 | 325 | target_x = self.x + self.width / 2 |
582 | 326 | 326 | ||
583 | === modified file 'tests/autopilot/unity/emulators/quicklist.py' | |||
584 | --- tests/autopilot/unity/emulators/quicklist.py 2013-03-20 15:21:51 +0000 | |||
585 | +++ tests/autopilot/unity/emulators/quicklist.py 2013-05-15 16:01:29 +0000 | |||
586 | @@ -11,7 +11,7 @@ | |||
587 | 11 | 11 | ||
588 | 12 | import logging | 12 | import logging |
589 | 13 | 13 | ||
591 | 14 | from autopilot.emulators.input import get_mouse | 14 | from autopilot.input import Mouse |
592 | 15 | 15 | ||
593 | 16 | from unity.emulators import UnityIntrospectionObject | 16 | from unity.emulators import UnityIntrospectionObject |
594 | 17 | 17 | ||
595 | @@ -21,10 +21,6 @@ | |||
596 | 21 | class Quicklist(UnityIntrospectionObject): | 21 | class Quicklist(UnityIntrospectionObject): |
597 | 22 | """Represents a quicklist.""" | 22 | """Represents a quicklist.""" |
598 | 23 | 23 | ||
599 | 24 | def __init__(self, *args, **kwargs): | ||
600 | 25 | super(Quicklist, self).__init__(*args, **kwargs) | ||
601 | 26 | self._mouse = get_mouse() | ||
602 | 27 | |||
603 | 28 | @property | 24 | @property |
604 | 29 | def items(self): | 25 | def items(self): |
605 | 30 | """Individual items in the quicklist.""" | 26 | """Individual items in the quicklist.""" |
606 | @@ -60,7 +56,7 @@ | |||
607 | 60 | logger.debug("Moving mouse outside the quicklist %r", self) | 56 | logger.debug("Moving mouse outside the quicklist %r", self) |
608 | 61 | target_x = self.x + self.width + 10 | 57 | target_x = self.x + self.width + 10 |
609 | 62 | target_y = self.y + self.height / 2 | 58 | target_y = self.y + self.height / 2 |
611 | 63 | self._mouse.move(target_x, target_y, animate=False) | 59 | Mouse.create().move(target_x, target_y, animate=False) |
612 | 64 | 60 | ||
613 | 65 | @property | 61 | @property |
614 | 66 | def selected_item(self): | 62 | def selected_item(self): |
615 | @@ -79,7 +75,7 @@ | |||
616 | 79 | 75 | ||
617 | 80 | def __init__(self, *args, **kwargs): | 76 | def __init__(self, *args, **kwargs): |
618 | 81 | super(QuicklistMenuItem, self).__init__(*args, **kwargs) | 77 | super(QuicklistMenuItem, self).__init__(*args, **kwargs) |
620 | 82 | self._mouse = get_mouse() | 78 | self._mouse = Mouse.create() |
621 | 83 | 79 | ||
622 | 84 | @property | 80 | @property |
623 | 85 | def geometry(self): | 81 | def geometry(self): |
624 | 86 | 82 | ||
625 | === modified file 'tests/autopilot/unity/emulators/switcher.py' | |||
626 | --- tests/autopilot/unity/emulators/switcher.py 2013-03-20 15:21:51 +0000 | |||
627 | +++ tests/autopilot/unity/emulators/switcher.py 2013-05-15 16:01:29 +0000 | |||
628 | @@ -11,7 +11,7 @@ | |||
629 | 11 | 11 | ||
630 | 12 | import logging | 12 | import logging |
631 | 13 | 13 | ||
633 | 14 | from autopilot.emulators.input import get_mouse | 14 | from autopilot.input import Mouse |
634 | 15 | from autopilot.keybindings import KeybindingsHelper | 15 | from autopilot.keybindings import KeybindingsHelper |
635 | 16 | 16 | ||
636 | 17 | from unity.emulators import UnityIntrospectionObject | 17 | from unity.emulators import UnityIntrospectionObject |
637 | @@ -45,7 +45,7 @@ | |||
638 | 45 | 45 | ||
639 | 46 | def __init__(self, *args, **kwargs): | 46 | def __init__(self, *args, **kwargs): |
640 | 47 | super(SwitcherController, self).__init__(*args, **kwargs) | 47 | super(SwitcherController, self).__init__(*args, **kwargs) |
642 | 48 | self._mouse = get_mouse() | 48 | self._mouse = Mouse.create() |
643 | 49 | 49 | ||
644 | 50 | def get_switcher_view(self): | 50 | def get_switcher_view(self): |
645 | 51 | views = self.get_children_by_type(SwitcherView) | 51 | views = self.get_children_by_type(SwitcherView) |
646 | 52 | 52 | ||
647 | === modified file 'tests/autopilot/unity/emulators/workspace.py' | |||
648 | --- tests/autopilot/unity/emulators/workspace.py 2012-08-29 04:27:50 +0000 | |||
649 | +++ tests/autopilot/unity/emulators/workspace.py 2013-05-15 16:01:29 +0000 | |||
650 | @@ -9,13 +9,11 @@ | |||
651 | 9 | 9 | ||
652 | 10 | from __future__ import absolute_import | 10 | from __future__ import absolute_import |
653 | 11 | 11 | ||
654 | 12 | |||
655 | 13 | from autopilot.keybindings import KeybindingsHelper | 12 | from autopilot.keybindings import KeybindingsHelper |
661 | 14 | from autopilot.utilities import ( | 13 | from autopilot.display import Display |
662 | 15 | get_compiz_option, | 14 | |
663 | 16 | get_desktop_geometry, | 15 | from unity.emulators.compiz import get_compiz_option |
664 | 17 | get_desktop_viewport, | 16 | from unity.emulators.X11 import get_desktop_viewport |
660 | 18 | ) | ||
665 | 19 | 17 | ||
666 | 20 | 18 | ||
667 | 21 | class WorkspaceManager(KeybindingsHelper): | 19 | class WorkspaceManager(KeybindingsHelper): |
668 | @@ -40,9 +38,8 @@ | |||
669 | 40 | """Re-read information about available workspaces from compiz and X11.""" | 38 | """Re-read information about available workspaces from compiz and X11.""" |
670 | 41 | self._workspaces_wide = get_compiz_option("core", "hsize") | 39 | self._workspaces_wide = get_compiz_option("core", "hsize") |
671 | 42 | self._workspaces_high = get_compiz_option("core", "vsize") | 40 | self._workspaces_high = get_compiz_option("core", "vsize") |
675 | 43 | self._desktop_width, self.desktop_height = get_desktop_geometry() | 41 | # Note: only gets the viewport for the first monitor. |
676 | 44 | self._viewport_width = self._desktop_width / self._workspaces_wide | 42 | _, _, self._viewport_width, self._viewport_height = Display.create().get_screen_geometry(0) |
674 | 45 | self._viewport_height = self.desktop_height / self._workspaces_high | ||
677 | 46 | 43 | ||
678 | 47 | def switch_to(self, workspace_num): | 44 | def switch_to(self, workspace_num): |
679 | 48 | """Switch to the workspace specified. | 45 | """Switch to the workspace specified. |
680 | 49 | 46 | ||
681 | === modified file 'tests/autopilot/unity/tests/__init__.py' | |||
682 | --- tests/autopilot/unity/tests/__init__.py 2013-04-17 12:41:39 +0000 | |||
683 | +++ tests/autopilot/unity/tests/__init__.py 2013-05-15 16:01:29 +0000 | |||
684 | @@ -26,6 +26,8 @@ | |||
685 | 26 | HAVE_WINDOWMOCKER=True | 26 | HAVE_WINDOWMOCKER=True |
686 | 27 | except ImportError: | 27 | except ImportError: |
687 | 28 | HAVE_WINDOWMOCKER=False | 28 | HAVE_WINDOWMOCKER=False |
688 | 29 | from subprocess import check_output | ||
689 | 30 | import time | ||
690 | 29 | import tempfile | 31 | import tempfile |
691 | 30 | from testtools.content import text_content | 32 | from testtools.content import text_content |
692 | 31 | from testtools.matchers import Equals | 33 | from testtools.matchers import Equals |
693 | @@ -33,12 +35,14 @@ | |||
694 | 33 | 35 | ||
695 | 34 | from unity.emulators import ensure_unity_is_running | 36 | from unity.emulators import ensure_unity_is_running |
696 | 35 | from unity.emulators.workspace import WorkspaceManager | 37 | from unity.emulators.workspace import WorkspaceManager |
697 | 38 | from unity.emulators.compiz import get_compiz_setting, get_global_context | ||
698 | 36 | from unity.emulators.unity import ( | 39 | from unity.emulators.unity import ( |
699 | 37 | set_log_severity, | 40 | set_log_severity, |
700 | 38 | start_log_to_file, | 41 | start_log_to_file, |
701 | 39 | reset_logging, | 42 | reset_logging, |
702 | 40 | Unity | 43 | Unity |
703 | 41 | ) | 44 | ) |
704 | 45 | from unity.emulators.X11 import reset_display | ||
705 | 42 | 46 | ||
706 | 43 | from Xlib import display | 47 | from Xlib import display |
707 | 44 | from Xlib import Xutil | 48 | from Xlib import Xutil |
708 | @@ -115,7 +119,7 @@ | |||
709 | 115 | # | 119 | # |
710 | 116 | # In the event that this doesn't work, wait_for will throw an | 120 | # In the event that this doesn't work, wait_for will throw an |
711 | 117 | # exception. | 121 | # exception. |
713 | 118 | win = self.start_app_window('Calculator', locale='C') | 122 | win = self.process_manager.start_app_window('Calculator', locale='C') |
714 | 119 | count = 1 | 123 | count = 1 |
715 | 120 | while self.unity.window_manager.showdesktop_active: | 124 | while self.unity.window_manager.showdesktop_active: |
716 | 121 | self.keybinding("window/show_desktop") | 125 | self.keybinding("window/show_desktop") |
717 | @@ -204,8 +208,8 @@ | |||
718 | 204 | 208 | ||
719 | 205 | This uses the 'window-mocker' application, which is not part of the | 209 | This uses the 'window-mocker' application, which is not part of the |
720 | 206 | python-autopilot or unity-autopilot packages. To use this method, you | 210 | python-autopilot or unity-autopilot packages. To use this method, you |
723 | 207 | must have python-windowmocker installed. If the package is not installed, | 211 | must have python-windowmocker installed. If the package is not installed, |
724 | 208 | this method will raise a SkipTest exception, causing the calling test | 212 | this method will raise a SkipTest exception, causing the calling test |
725 | 209 | to be silently skipped. | 213 | to be silently skipped. |
726 | 210 | 214 | ||
727 | 211 | window_spec is a list or dictionary that conforms to the window-mocker | 215 | window_spec is a list or dictionary that conforms to the window-mocker |
728 | @@ -215,8 +219,8 @@ | |||
729 | 215 | if not HAVE_WINDOWMOCKER: | 219 | if not HAVE_WINDOWMOCKER: |
730 | 216 | raise SkipTest("The python-windowmocker package is required to run this test.") | 220 | raise SkipTest("The python-windowmocker package is required to run this test.") |
731 | 217 | 221 | ||
734 | 218 | if 'Window Mocker' not in self.KNOWN_APPS: | 222 | if 'Window Mocker' not in self.process_manager.KNOWN_APPS: |
735 | 219 | self.register_known_application( | 223 | self.process_manager.register_known_application( |
736 | 220 | 'Window Mocker', | 224 | 'Window Mocker', |
737 | 221 | 'window-mocker.desktop', | 225 | 'window-mocker.desktop', |
738 | 222 | 'window-mocker' | 226 | 'window-mocker' |
739 | @@ -225,21 +229,79 @@ | |||
740 | 225 | file_path = tempfile.mktemp() | 229 | file_path = tempfile.mktemp() |
741 | 226 | json.dump(window_spec, open(file_path, 'w')) | 230 | json.dump(window_spec, open(file_path, 'w')) |
742 | 227 | self.addCleanup(os.remove, file_path) | 231 | self.addCleanup(os.remove, file_path) |
744 | 228 | return self.start_app_window('Window Mocker', [file_path]) | 232 | return self.process_manager.start_app_window('Window Mocker', [file_path]) |
745 | 229 | else: | 233 | else: |
747 | 230 | return self.start_app_window('Window Mocker') | 234 | return self.process_manager.start_app_window('Window Mocker') |
748 | 231 | 235 | ||
749 | 232 | def close_all_windows(self, application_name): | 236 | def close_all_windows(self, application_name): |
751 | 233 | for w in self.get_open_windows_by_application(application_name): | 237 | for w in self.process_manager.get_open_windows_by_application(application_name): |
752 | 234 | w.close() | 238 | w.close() |
753 | 235 | 239 | ||
755 | 236 | self.assertThat(lambda: len(self.get_open_windows_by_application(application_name)), Eventually(Equals(0))) | 240 | self.assertThat(lambda: len(self.process_manager.get_open_windows_by_application(application_name)), Eventually(Equals(0))) |
756 | 237 | 241 | ||
757 | 238 | def register_nautilus(self): | 242 | def register_nautilus(self): |
760 | 239 | self.addCleanup(self.unregister_known_application, "Nautilus") | 243 | self.addCleanup(self.process_manager.unregister_known_application, "Nautilus") |
761 | 240 | self.register_known_application("Nautilus", "nautilus.desktop", "nautilus") | 244 | self.process_manager.register_known_application("Nautilus", "nautilus.desktop", "nautilus") |
762 | 241 | 245 | ||
763 | 242 | def get_startup_notification_timestamp(self, bamf_window): | 246 | def get_startup_notification_timestamp(self, bamf_window): |
764 | 243 | atom = display.Display().intern_atom('_NET_WM_USER_TIME') | 247 | atom = display.Display().intern_atom('_NET_WM_USER_TIME') |
765 | 244 | atom_type = display.Display().intern_atom('CARDINAL') | 248 | atom_type = display.Display().intern_atom('CARDINAL') |
766 | 245 | return bamf_window.x_win.get_property(atom, atom_type, 0, 1024).value[0] | 249 | return bamf_window.x_win.get_property(atom, atom_type, 0, 1024).value[0] |
767 | 250 | |||
768 | 251 | def call_gsettings_cmd(self, command, schema, *args): | ||
769 | 252 | """Set a desktop wide gsettings option | ||
770 | 253 | |||
771 | 254 | Using the gsettings command because there is a bug with importing | ||
772 | 255 | from gobject introspection and pygtk2 simultaneously, and the Xlib | ||
773 | 256 | keyboard layout bits are very unwieldy. This seems like the best | ||
774 | 257 | solution, even a little bit brutish. | ||
775 | 258 | """ | ||
776 | 259 | cmd = ['gsettings', command, schema] + list(args) | ||
777 | 260 | # strip to remove the trailing \n. | ||
778 | 261 | ret = check_output(cmd).strip() | ||
779 | 262 | time.sleep(5) | ||
780 | 263 | reset_display() | ||
781 | 264 | return ret | ||
782 | 265 | |||
783 | 266 | def set_unity_option(self, option_name, option_value): | ||
784 | 267 | """Set an option in the unity compiz plugin options. | ||
785 | 268 | |||
786 | 269 | .. note:: The value will be set for the current test only, and | ||
787 | 270 | automatically undone when the test ends. | ||
788 | 271 | |||
789 | 272 | :param option_name: The name of the unity option. | ||
790 | 273 | :param option_value: The value you want to set. | ||
791 | 274 | :raises: **KeyError** if the option named does not exist. | ||
792 | 275 | |||
793 | 276 | """ | ||
794 | 277 | self.set_compiz_option("unityshell", option_name, option_value) | ||
795 | 278 | |||
796 | 279 | def set_compiz_option(self, plugin_name, option_name, option_value): | ||
797 | 280 | """Set a compiz option for the duration of this test only. | ||
798 | 281 | |||
799 | 282 | .. note:: The value will be set for the current test only, and | ||
800 | 283 | automatically undone when the test ends. | ||
801 | 284 | |||
802 | 285 | :param plugin_name: The name of the compiz plugin where the option is | ||
803 | 286 | registered. If the option is not in a plugin, the string "core" should | ||
804 | 287 | be used as the plugin name. | ||
805 | 288 | :param option_name: The name of the unity option. | ||
806 | 289 | :param option_value: The value you want to set. | ||
807 | 290 | :raises: **KeyError** if the option named does not exist. | ||
808 | 291 | |||
809 | 292 | """ | ||
810 | 293 | old_value = self._set_compiz_option(plugin_name, option_name, option_value) | ||
811 | 294 | # Cleanup is LIFO, during clean-up also allow unity to respond | ||
812 | 295 | self.addCleanup(time.sleep, 0.5) | ||
813 | 296 | self.addCleanup(self._set_compiz_option, plugin_name, option_name, old_value) | ||
814 | 297 | # Allow unity time to respond to the new setting. | ||
815 | 298 | time.sleep(0.5) | ||
816 | 299 | |||
817 | 300 | def _set_compiz_option(self, plugin_name, option_name, option_value): | ||
818 | 301 | log.info("Setting compiz option '%s' in plugin '%s' to %r", | ||
819 | 302 | option_name, plugin_name, option_value) | ||
820 | 303 | setting = get_compiz_setting(plugin_name, option_name) | ||
821 | 304 | old_value = setting.Value | ||
822 | 305 | setting.Value = option_value | ||
823 | 306 | get_global_context().Write() | ||
824 | 307 | return old_value | ||
825 | 246 | 308 | ||
826 | === modified file 'tests/autopilot/unity/tests/launcher/__init__.py' | |||
827 | --- tests/autopilot/unity/tests/launcher/__init__.py 2013-02-04 21:03:37 +0000 | |||
828 | +++ tests/autopilot/unity/tests/launcher/__init__.py 2013-05-15 16:01:29 +0000 | |||
829 | @@ -8,18 +8,18 @@ | |||
830 | 8 | 8 | ||
831 | 9 | """Autopilot test case class for all Launcher tests""" | 9 | """Autopilot test case class for all Launcher tests""" |
832 | 10 | 10 | ||
834 | 11 | from autopilot.emulators.X11 import ScreenGeometry | 11 | from autopilot.display import Display |
835 | 12 | from autopilot.testcase import multiply_scenarios | 12 | from autopilot.testcase import multiply_scenarios |
836 | 13 | 13 | ||
837 | 14 | from unity.tests import UnityTestCase | 14 | from unity.tests import UnityTestCase |
838 | 15 | from unity.emulators.X11 import set_primary_monitor | ||
839 | 15 | 16 | ||
840 | 16 | 17 | ||
841 | 17 | def _make_scenarios(): | 18 | def _make_scenarios(): |
842 | 18 | """Make scenarios for launcher test cases based on the number of configured | 19 | """Make scenarios for launcher test cases based on the number of configured |
843 | 19 | monitors. | 20 | monitors. |
844 | 20 | """ | 21 | """ |
847 | 21 | screen_geometry = ScreenGeometry() | 22 | num_monitors = Display.create().get_num_screens() |
846 | 22 | num_monitors = screen_geometry.get_num_monitors() | ||
848 | 23 | 23 | ||
849 | 24 | # it doesn't make sense to set only_primary when we're running in a single-monitor setup. | 24 | # it doesn't make sense to set only_primary when we're running in a single-monitor setup. |
850 | 25 | if num_monitors == 1: | 25 | if num_monitors == 1: |
851 | @@ -39,7 +39,6 @@ | |||
852 | 39 | 39 | ||
853 | 40 | def setUp(self): | 40 | def setUp(self): |
854 | 41 | super(LauncherTestCase, self).setUp() | 41 | super(LauncherTestCase, self).setUp() |
855 | 42 | self.screen_geo = ScreenGeometry() | ||
856 | 43 | self.set_unity_log_level("unity.launcher", "DEBUG") | 42 | self.set_unity_log_level("unity.launcher", "DEBUG") |
857 | 44 | self.addCleanup(self.set_unity_log_level, "unity.launcher", "INFO") | 43 | self.addCleanup(self.set_unity_log_level, "unity.launcher", "INFO") |
858 | 45 | 44 | ||
859 | @@ -48,10 +47,10 @@ | |||
860 | 48 | 47 | ||
861 | 49 | if self.only_primary: | 48 | if self.only_primary: |
862 | 50 | try: | 49 | try: |
867 | 51 | old_primary_screen = self.screen_geo.get_primary_monitor() | 50 | old_primary_screen = self.display.get_primary_screen() |
868 | 52 | self.screen_geo.set_primary_monitor(self.launcher_monitor) | 51 | set_primary_monitor(self.launcher_monitor) |
869 | 53 | self.addCleanup(self.screen_geo.set_primary_monitor, old_primary_screen) | 52 | self.addCleanup(set_primary_monitor, old_primary_screen) |
870 | 54 | except ScreenGeometry.BlacklistedDriverError: | 53 | except autopilot.display.BlacklistedDriverError: |
871 | 55 | self.skipTest("Impossible to set the monitor %d as primary" % self.launcher_monitor) | 54 | self.skipTest("Impossible to set the monitor %d as primary" % self.launcher_monitor) |
872 | 56 | 55 | ||
873 | 57 | def get_launcher(self): | 56 | def get_launcher(self): |
874 | 58 | 57 | ||
875 | === modified file 'tests/autopilot/unity/tests/launcher/test_capture.py' | |||
876 | --- tests/autopilot/unity/tests/launcher/test_capture.py 2013-02-04 21:03:37 +0000 | |||
877 | +++ tests/autopilot/unity/tests/launcher/test_capture.py 2013-05-15 16:01:29 +0000 | |||
878 | @@ -9,7 +9,6 @@ | |||
879 | 9 | 9 | ||
880 | 10 | from __future__ import absolute_import | 10 | from __future__ import absolute_import |
881 | 11 | 11 | ||
882 | 12 | from autopilot.emulators.X11 import ScreenGeometry | ||
883 | 13 | from autopilot.matchers import Eventually | 12 | from autopilot.matchers import Eventually |
884 | 14 | import logging | 13 | import logging |
885 | 15 | from testtools.matchers import Equals, LessThan, GreaterThan | 14 | from testtools.matchers import Equals, LessThan, GreaterThan |
886 | @@ -23,12 +22,10 @@ | |||
887 | 23 | class LauncherCaptureTests(UnityTestCase): | 22 | class LauncherCaptureTests(UnityTestCase): |
888 | 24 | """Test the launchers ability to capture/not capture the mouse.""" | 23 | """Test the launchers ability to capture/not capture the mouse.""" |
889 | 25 | 24 | ||
890 | 26 | screen_geo = ScreenGeometry() | ||
891 | 27 | |||
892 | 28 | def setUp(self): | 25 | def setUp(self): |
893 | 29 | super(LauncherCaptureTests, self).setUp() | 26 | super(LauncherCaptureTests, self).setUp() |
894 | 30 | 27 | ||
896 | 31 | if self.screen_geo.get_num_monitors() <= 1: | 28 | if self.display.get_num_screens() <= 1: |
897 | 32 | self.skipTest("This test requires two or more monitors.") | 29 | self.skipTest("This test requires two or more monitors.") |
898 | 33 | 30 | ||
899 | 34 | self.set_unity_option('launcher_capture_mouse', True) | 31 | self.set_unity_option('launcher_capture_mouse', True) |
900 | @@ -41,8 +38,8 @@ | |||
901 | 41 | self.assertThat(launcher.hidemode, Eventually(Equals(mode))) | 38 | self.assertThat(launcher.hidemode, Eventually(Equals(mode))) |
902 | 42 | 39 | ||
903 | 43 | def leftMostMonitor(self): | 40 | def leftMostMonitor(self): |
906 | 44 | x1, y1, width, height = self.screen_geo.get_monitor_geometry(0) | 41 | x1, y1, width, height = self.display.get_screen_geometry(0) |
907 | 45 | x2, y2, width, height = self.screen_geo.get_monitor_geometry(1) | 42 | x2, y2, width, height = self.display.get_screen_geometry(1) |
908 | 46 | 43 | ||
909 | 47 | if x1 < x2: | 44 | if x1 < x2: |
910 | 48 | return 0 | 45 | return 0 |
911 | @@ -57,7 +54,7 @@ | |||
912 | 57 | """Tests that the launcher captures the mouse when moving between monitors | 54 | """Tests that the launcher captures the mouse when moving between monitors |
913 | 58 | while revealed. | 55 | while revealed. |
914 | 59 | """ | 56 | """ |
916 | 60 | x, y, width, height = self.screen_geo.get_monitor_geometry(self.rightMostMonitor()) | 57 | x, y, width, height = self.display.get_screen_geometry(self.rightMostMonitor()) |
917 | 61 | self.mouse.move(x + width / 2, y + height / 2, False) | 58 | self.mouse.move(x + width / 2, y + height / 2, False) |
918 | 62 | self.mouse.move(x - width / 2, y + height / 2, True, 5, .002) | 59 | self.mouse.move(x - width / 2, y + height / 2, True, 5, .002) |
919 | 63 | 60 | ||
920 | @@ -72,7 +69,7 @@ | |||
921 | 72 | 69 | ||
922 | 73 | self.set_unity_option('launcher_capture_mouse', False) | 70 | self.set_unity_option('launcher_capture_mouse', False) |
923 | 74 | 71 | ||
925 | 75 | x, y, width, height = self.screen_geo.get_monitor_geometry(self.rightMostMonitor()) | 72 | x, y, width, height = self.display.get_screen_geometry(self.rightMostMonitor()) |
926 | 76 | self.mouse.move(x + width / 2, y + height / 2, False) | 73 | self.mouse.move(x + width / 2, y + height / 2, False) |
927 | 77 | self.mouse.move(x - width / 2, y + height / 2, True, 5, .002) | 74 | self.mouse.move(x - width / 2, y + height / 2, True, 5, .002) |
928 | 78 | 75 | ||
929 | @@ -88,7 +85,7 @@ | |||
930 | 88 | self.set_unity_option('launcher_capture_mouse', False) | 85 | self.set_unity_option('launcher_capture_mouse', False) |
931 | 89 | self.setHideMode(1) | 86 | self.setHideMode(1) |
932 | 90 | 87 | ||
934 | 91 | x, y, width, height = self.screen_geo.get_monitor_geometry(self.rightMostMonitor()) | 88 | x, y, width, height = self.display.get_screen_geometry(self.rightMostMonitor()) |
935 | 92 | self.mouse.move(x + width / 2, y + height / 2, False) | 89 | self.mouse.move(x + width / 2, y + height / 2, False) |
936 | 93 | self.mouse.move(x - width / 2, y + height / 2, True, 5, .002) | 90 | self.mouse.move(x - width / 2, y + height / 2, True, 5, .002) |
937 | 94 | 91 | ||
938 | @@ -104,7 +101,7 @@ | |||
939 | 104 | self.set_unity_option('launcher_capture_mouse', False) | 101 | self.set_unity_option('launcher_capture_mouse', False) |
940 | 105 | self.setHideMode(1) | 102 | self.setHideMode(1) |
941 | 106 | 103 | ||
943 | 107 | x, y, width, height = self.screen_geo.get_monitor_geometry(self.leftMostMonitor()) | 104 | x, y, width, height = self.display.get_screen_geometry(self.leftMostMonitor()) |
944 | 108 | self.mouse.move(x + width / 2, y + height / 2, False) | 105 | self.mouse.move(x + width / 2, y + height / 2, False) |
945 | 109 | sleep(1.5) | 106 | sleep(1.5) |
946 | 110 | self.mouse.move(x + width * 1.5, y + height / 2, True, 5, .002) | 107 | self.mouse.move(x + width * 1.5, y + height / 2, True, 5, .002) |
947 | @@ -119,7 +116,7 @@ | |||
948 | 119 | """ | 116 | """ |
949 | 120 | self.setHideMode(1) | 117 | self.setHideMode(1) |
950 | 121 | 118 | ||
952 | 122 | x, y, width, height = self.screen_geo.get_monitor_geometry(self.leftMostMonitor()) | 119 | x, y, width, height = self.display.get_screen_geometry(self.leftMostMonitor()) |
953 | 123 | self.mouse.move(x + width / 2, y + height / 2, False) | 120 | self.mouse.move(x + width / 2, y + height / 2, False) |
954 | 124 | sleep(1.5) | 121 | sleep(1.5) |
955 | 125 | self.mouse.move(x + width * 1.5, y + height / 2, True, 5, .002) | 122 | self.mouse.move(x + width * 1.5, y + height / 2, True, 5, .002) |
956 | 126 | 123 | ||
957 | === modified file 'tests/autopilot/unity/tests/launcher/test_icon_behavior.py' | |||
958 | --- tests/autopilot/unity/tests/launcher/test_icon_behavior.py 2013-04-09 18:37:33 +0000 | |||
959 | +++ tests/autopilot/unity/tests/launcher/test_icon_behavior.py 2013-05-15 16:01:29 +0000 | |||
960 | @@ -51,12 +51,12 @@ | |||
961 | 51 | return icon | 51 | return icon |
962 | 52 | 52 | ||
963 | 53 | def ensure_calculator_in_launcher_and_not_running(self): | 53 | def ensure_calculator_in_launcher_and_not_running(self): |
965 | 54 | calc = self.start_app("Calculator") | 54 | calc = self.process_manager.start_app("Calculator") |
966 | 55 | calc_icon = self.unity.launcher.model.get_icon(desktop_id=calc.desktop_file) | 55 | calc_icon = self.unity.launcher.model.get_icon(desktop_id=calc.desktop_file) |
967 | 56 | self.addCleanup(self.launcher_instance.unlock_from_launcher, calc_icon) | 56 | self.addCleanup(self.launcher_instance.unlock_from_launcher, calc_icon) |
968 | 57 | self.launcher_instance.lock_to_launcher(calc_icon) | 57 | self.launcher_instance.lock_to_launcher(calc_icon) |
971 | 58 | self.close_all_app("Calculator") | 58 | self.process_manager.close_all_app("Calculator") |
972 | 59 | self.assertThat(lambda: self.app_is_running("Calculator"), Eventually(Equals(False))) | 59 | self.assertThat(lambda: self.process_manager.app_is_running("Calculator"), Eventually(Equals(False))) |
973 | 60 | return calc_icon | 60 | return calc_icon |
974 | 61 | 61 | ||
975 | 62 | def test_bfb_tooltip_disappear_when_dash_is_opened(self): | 62 | def test_bfb_tooltip_disappear_when_dash_is_opened(self): |
976 | @@ -88,7 +88,7 @@ | |||
977 | 88 | 88 | ||
978 | 89 | def test_shift_click_opens_new_application_instance(self): | 89 | def test_shift_click_opens_new_application_instance(self): |
979 | 90 | """Shift+Clicking MUST open a new instance of an already-running application.""" | 90 | """Shift+Clicking MUST open a new instance of an already-running application.""" |
981 | 91 | app = self.start_app("Calculator") | 91 | app = self.process_manager.start_app("Calculator") |
982 | 92 | icon = self.unity.launcher.model.get_icon(desktop_id=app.desktop_file) | 92 | icon = self.unity.launcher.model.get_icon(desktop_id=app.desktop_file) |
983 | 93 | launcher_instance = self.unity.launcher.get_launcher_for_monitor(0) | 93 | launcher_instance = self.unity.launcher.get_launcher_for_monitor(0) |
984 | 94 | 94 | ||
985 | @@ -103,9 +103,9 @@ | |||
986 | 103 | of that application. | 103 | of that application. |
987 | 104 | 104 | ||
988 | 105 | """ | 105 | """ |
992 | 106 | char_win1 = self.start_app_window("Character Map") | 106 | char_win1 = self.process_manager.start_app_window("Character Map") |
993 | 107 | calc_win = self.start_app_window("Calculator") | 107 | calc_win = self.process_manager.start_app_window("Calculator") |
994 | 108 | char_win2 = self.start_app_window("Character Map") | 108 | char_win2 = self.process_manager.start_app_window("Character Map") |
995 | 109 | 109 | ||
996 | 110 | self.assertVisibleWindowStack([char_win2, calc_win, char_win1]) | 110 | self.assertVisibleWindowStack([char_win2, calc_win, char_win1]) |
997 | 111 | 111 | ||
998 | @@ -136,10 +136,10 @@ | |||
999 | 136 | def test_launcher_uses_startup_notification(self): | 136 | def test_launcher_uses_startup_notification(self): |
1000 | 137 | """Tests that unity uses startup notification protocol.""" | 137 | """Tests that unity uses startup notification protocol.""" |
1001 | 138 | calc_icon = self.ensure_calculator_in_launcher_and_not_running() | 138 | calc_icon = self.ensure_calculator_in_launcher_and_not_running() |
1003 | 139 | self.addCleanup(self.close_all_app, "Calculator") | 139 | self.addCleanup(self.process_manager.close_all_app, "Calculator") |
1004 | 140 | self.launcher_instance.click_launcher_icon(calc_icon) | 140 | self.launcher_instance.click_launcher_icon(calc_icon) |
1005 | 141 | 141 | ||
1007 | 142 | calc_app = self.bamf.get_running_applications_by_desktop_file(calc_icon.desktop_id)[0] | 142 | calc_app = self.process_manager.get_running_applications_by_desktop_file(calc_icon.desktop_id)[0] |
1008 | 143 | calc_window = calc_app.get_windows()[0] | 143 | calc_window = calc_app.get_windows()[0] |
1009 | 144 | 144 | ||
1010 | 145 | self.assertThat(lambda: self.get_startup_notification_timestamp(calc_window), Eventually(Equals(calc_icon.startup_notification_timestamp))) | 145 | self.assertThat(lambda: self.get_startup_notification_timestamp(calc_window), Eventually(Equals(calc_icon.startup_notification_timestamp))) |
1011 | @@ -148,16 +148,16 @@ | |||
1012 | 148 | """Tests that when the trash is opened, clicking on the icon re-focus the trash again""" | 148 | """Tests that when the trash is opened, clicking on the icon re-focus the trash again""" |
1013 | 149 | self.register_nautilus() | 149 | self.register_nautilus() |
1014 | 150 | self.addCleanup(self.close_all_windows, "Nautilus") | 150 | self.addCleanup(self.close_all_windows, "Nautilus") |
1016 | 151 | self.addCleanup(self.close_all_app, "Calculator") | 151 | self.addCleanup(self.process_manager.close_all_app, "Calculator") |
1017 | 152 | self.close_all_windows("Nautilus") | 152 | self.close_all_windows("Nautilus") |
1018 | 153 | 153 | ||
1019 | 154 | trash_icon = self.unity.launcher.model.get_trash_icon() | 154 | trash_icon = self.unity.launcher.model.get_trash_icon() |
1020 | 155 | self.launcher_instance.click_launcher_icon(trash_icon) | 155 | self.launcher_instance.click_launcher_icon(trash_icon) |
1023 | 156 | self.assertThat(lambda: len(self.get_open_windows_by_application("Nautilus")), Eventually(Equals(1))) | 156 | self.assertThat(lambda: len(self.process_manager.get_open_windows_by_application("Nautilus")), Eventually(Equals(1))) |
1024 | 157 | [trash_window] = self.get_open_windows_by_application("Nautilus") | 157 | [trash_window] = self.process_manager.get_open_windows_by_application("Nautilus") |
1025 | 158 | self.assertThat(lambda: trash_window.is_focused, Eventually(Equals(True))) | 158 | self.assertThat(lambda: trash_window.is_focused, Eventually(Equals(True))) |
1026 | 159 | 159 | ||
1028 | 160 | calc_win = self.start_app_window("Calculator") | 160 | calc_win = self.process_manager.start_app_window("Calculator") |
1029 | 161 | self.assertThat(lambda: calc_win.is_focused, Eventually(Equals(True))) | 161 | self.assertThat(lambda: calc_win.is_focused, Eventually(Equals(True))) |
1030 | 162 | self.assertThat(lambda: trash_window.is_focused, Eventually(Equals(False))) | 162 | self.assertThat(lambda: trash_window.is_focused, Eventually(Equals(False))) |
1031 | 163 | 163 | ||
1032 | @@ -172,12 +172,12 @@ | |||
1033 | 172 | 172 | ||
1034 | 173 | trash_icon = self.unity.launcher.model.get_trash_icon() | 173 | trash_icon = self.unity.launcher.model.get_trash_icon() |
1035 | 174 | self.launcher_instance.click_launcher_icon(trash_icon) | 174 | self.launcher_instance.click_launcher_icon(trash_icon) |
1037 | 175 | self.assertThat(lambda: len(self.get_open_windows_by_application("Nautilus")), Eventually(Equals(1))) | 175 | self.assertThat(lambda: len(self.process_manager.get_open_windows_by_application("Nautilus")), Eventually(Equals(1))) |
1038 | 176 | 176 | ||
1040 | 177 | nautilus_app = self.get_app_instances("Nautilus") | 177 | nautilus_app = self.process_manager.get_app_instances("Nautilus") |
1041 | 178 | nautilus_icon = self.unity.launcher.model.get_icon(desktop_id="nautilus.desktop") | 178 | nautilus_icon = self.unity.launcher.model.get_icon(desktop_id="nautilus.desktop") |
1042 | 179 | self.launcher_instance.click_launcher_icon(nautilus_icon) | 179 | self.launcher_instance.click_launcher_icon(nautilus_icon) |
1044 | 180 | self.assertThat(lambda: len(self.get_open_windows_by_application("Nautilus")), Eventually(Equals(2))) | 180 | self.assertThat(lambda: len(self.process_manager.get_open_windows_by_application("Nautilus")), Eventually(Equals(2))) |
1045 | 181 | 181 | ||
1046 | 182 | def test_super_number_shortcut_focuses_new_windows(self): | 182 | def test_super_number_shortcut_focuses_new_windows(self): |
1047 | 183 | """Windows launched using super+number must have | 183 | """Windows launched using super+number must have |
1048 | @@ -186,7 +186,7 @@ | |||
1049 | 186 | """ | 186 | """ |
1050 | 187 | bfb_icon = self.unity.launcher.model.get_bfb_icon() | 187 | bfb_icon = self.unity.launcher.model.get_bfb_icon() |
1051 | 188 | calc_icon = self.ensure_calculator_in_launcher_and_not_running() | 188 | calc_icon = self.ensure_calculator_in_launcher_and_not_running() |
1053 | 189 | self.addCleanup(self.close_all_app, "Calculator") | 189 | self.addCleanup(self.process_manager.close_all_app, "Calculator") |
1054 | 190 | 190 | ||
1055 | 191 | self.launcher_instance.drag_icon_to_position( | 191 | self.launcher_instance.drag_icon_to_position( |
1056 | 192 | calc_icon, | 192 | calc_icon, |
1057 | @@ -197,7 +197,7 @@ | |||
1058 | 197 | self.addCleanup(self.launcher_instance.keyboard_unreveal_launcher) | 197 | self.addCleanup(self.launcher_instance.keyboard_unreveal_launcher) |
1059 | 198 | self.keyboard.press_and_release("1"); | 198 | self.keyboard.press_and_release("1"); |
1060 | 199 | 199 | ||
1062 | 200 | calc_app = self.bamf.get_running_applications_by_desktop_file(calc_icon.desktop_id)[0] | 200 | calc_app = self.process_manager.get_running_applications_by_desktop_file(calc_icon.desktop_id)[0] |
1063 | 201 | calc_window = calc_app.get_windows()[0] | 201 | calc_window = calc_app.get_windows()[0] |
1064 | 202 | 202 | ||
1065 | 203 | self.assertThat(lambda: calc_window.is_focused, Eventually(Equals(True))) | 203 | self.assertThat(lambda: calc_window.is_focused, Eventually(Equals(True))) |
1066 | @@ -206,8 +206,8 @@ | |||
1067 | 206 | """This tests shows that when you click on a launcher icon twice, | 206 | """This tests shows that when you click on a launcher icon twice, |
1068 | 207 | when an application window is focused, the spread is initiated. | 207 | when an application window is focused, the spread is initiated. |
1069 | 208 | """ | 208 | """ |
1072 | 209 | char_win1 = self.start_app_window("Character Map") | 209 | char_win1 = self.process_manager.start_app_window("Character Map") |
1073 | 210 | char_win2 = self.start_app_window("Character Map") | 210 | char_win2 = self.process_manager.start_app_window("Character Map") |
1074 | 211 | char_app = char_win1.application | 211 | char_app = char_win1.application |
1075 | 212 | 212 | ||
1076 | 213 | self.assertVisibleWindowStack([char_win2, char_win1]) | 213 | self.assertVisibleWindowStack([char_win2, char_win1]) |
1077 | @@ -224,8 +224,8 @@ | |||
1078 | 224 | """If scale is initiated through the laucher pressing super must close | 224 | """If scale is initiated through the laucher pressing super must close |
1079 | 225 | scale and open the dash. | 225 | scale and open the dash. |
1080 | 226 | """ | 226 | """ |
1083 | 227 | char_win1 = self.start_app_window("Character Map") | 227 | char_win1 = self.process_manager.start_app_window("Character Map") |
1084 | 228 | char_win2 = self.start_app_window("Character Map") | 228 | char_win2 = self.process_manager.start_app_window("Character Map") |
1085 | 229 | char_app = char_win1.application | 229 | char_app = char_win1.application |
1086 | 230 | 230 | ||
1087 | 231 | self.assertVisibleWindowStack([char_win2, char_win1]) | 231 | self.assertVisibleWindowStack([char_win2, char_win1]) |
1088 | @@ -243,13 +243,13 @@ | |||
1089 | 243 | 243 | ||
1090 | 244 | def test_icon_shows_on_quick_application_reopen(self): | 244 | def test_icon_shows_on_quick_application_reopen(self): |
1091 | 245 | """Icons must stay on launcher when an application is quickly closed/reopened.""" | 245 | """Icons must stay on launcher when an application is quickly closed/reopened.""" |
1093 | 246 | calc = self.start_app("Calculator") | 246 | calc = self.process_manager.start_app("Calculator") |
1094 | 247 | desktop_file = calc.desktop_file | 247 | desktop_file = calc.desktop_file |
1095 | 248 | calc_icon = self.unity.launcher.model.get_icon(desktop_id=desktop_file) | 248 | calc_icon = self.unity.launcher.model.get_icon(desktop_id=desktop_file) |
1096 | 249 | self.assertThat(calc_icon.visible, Eventually(Equals(True))) | 249 | self.assertThat(calc_icon.visible, Eventually(Equals(True))) |
1097 | 250 | 250 | ||
1100 | 251 | self.close_all_app("Calculator") | 251 | self.process_manager.close_all_app("Calculator") |
1101 | 252 | calc = self.start_app("Calculator") | 252 | calc = self.process_manager.start_app("Calculator") |
1102 | 253 | sleep(2) | 253 | sleep(2) |
1103 | 254 | 254 | ||
1104 | 255 | calc_icon = self.unity.launcher.model.get_icon(desktop_id=desktop_file) | 255 | calc_icon = self.unity.launcher.model.get_icon(desktop_id=desktop_file) |
1105 | @@ -356,7 +356,7 @@ | |||
1106 | 356 | """Application icons must be draggable to below the BFB.""" | 356 | """Application icons must be draggable to below the BFB.""" |
1107 | 357 | 357 | ||
1108 | 358 | self.ensure_calc_icon_not_in_launcher() | 358 | self.ensure_calc_icon_not_in_launcher() |
1110 | 359 | calc = self.start_app("Calculator") | 359 | calc = self.process_manager.start_app("Calculator") |
1111 | 360 | calc_icon = self.unity.launcher.model.get_icon(desktop_id=calc.desktop_file) | 360 | calc_icon = self.unity.launcher.model.get_icon(desktop_id=calc.desktop_file) |
1112 | 361 | bfb_icon = self.unity.launcher.model.get_bfb_icon() | 361 | bfb_icon = self.unity.launcher.model.get_bfb_icon() |
1113 | 362 | 362 | ||
1114 | @@ -373,7 +373,7 @@ | |||
1115 | 373 | """Application icons must be dragable to below the workspace switcher icon.""" | 373 | """Application icons must be dragable to below the workspace switcher icon.""" |
1116 | 374 | 374 | ||
1117 | 375 | self.ensure_calc_icon_not_in_launcher() | 375 | self.ensure_calc_icon_not_in_launcher() |
1119 | 376 | calc = self.start_app("Calculator") | 376 | calc = self.process_manager.start_app("Calculator") |
1120 | 377 | calc_icon = self.unity.launcher.model.get_icon(desktop_id=calc.desktop_file) | 377 | calc_icon = self.unity.launcher.model.get_icon(desktop_id=calc.desktop_file) |
1121 | 378 | bfb_icon = self.unity.launcher.model.get_bfb_icon() | 378 | bfb_icon = self.unity.launcher.model.get_bfb_icon() |
1122 | 379 | trash_icon = self.unity.launcher.model.get_trash_icon() | 379 | trash_icon = self.unity.launcher.model.get_trash_icon() |
1123 | 380 | 380 | ||
1124 | === modified file 'tests/autopilot/unity/tests/launcher/test_keynav.py' | |||
1125 | --- tests/autopilot/unity/tests/launcher/test_keynav.py 2013-02-04 22:31:47 +0000 | |||
1126 | +++ tests/autopilot/unity/tests/launcher/test_keynav.py 2013-05-15 16:01:29 +0000 | |||
1127 | @@ -51,7 +51,7 @@ | |||
1128 | 51 | 51 | ||
1129 | 52 | def test_launcher_keynav_cancel_resume_focus(self): | 52 | def test_launcher_keynav_cancel_resume_focus(self): |
1130 | 53 | """Test that ending the launcher keynav resume the focus.""" | 53 | """Test that ending the launcher keynav resume the focus.""" |
1132 | 54 | calc = self.start_app("Calculator") | 54 | calc = self.process_manager.start_app("Calculator") |
1133 | 55 | self.assertTrue(calc.is_active) | 55 | self.assertTrue(calc.is_active) |
1134 | 56 | 56 | ||
1135 | 57 | self.start_keynav_with_cleanup_cancel() | 57 | self.start_keynav_with_cleanup_cancel() |
1136 | @@ -127,8 +127,8 @@ | |||
1137 | 127 | 127 | ||
1138 | 128 | def test_launcher_keynav_activate_keep_focus(self): | 128 | def test_launcher_keynav_activate_keep_focus(self): |
1139 | 129 | """Activating a running launcher icon must focus it.""" | 129 | """Activating a running launcher icon must focus it.""" |
1142 | 130 | calc = self.start_app("Calculator") | 130 | calc = self.process_manager.start_app("Calculator") |
1143 | 131 | mahjongg = self.start_app("Mahjongg") | 131 | mahjongg = self.process_manager.start_app("Mahjongg") |
1144 | 132 | self.assertTrue(mahjongg.is_active) | 132 | self.assertTrue(mahjongg.is_active) |
1145 | 133 | self.assertFalse(calc.is_active) | 133 | self.assertFalse(calc.is_active) |
1146 | 134 | 134 | ||
1147 | @@ -215,7 +215,7 @@ | |||
1148 | 215 | 215 | ||
1149 | 216 | def test_launcher_keynav_cancel_on_click_icon(self): | 216 | def test_launcher_keynav_cancel_on_click_icon(self): |
1150 | 217 | """A single click on a launcher icon must cancel keynav.""" | 217 | """A single click on a launcher icon must cancel keynav.""" |
1152 | 218 | calc_win = self.start_app_window('Calculator', locale = 'C') | 218 | calc_win = self.process_manager.start_app_window('Calculator', locale = 'C') |
1153 | 219 | calc_app = calc_win.application | 219 | calc_app = calc_win.application |
1154 | 220 | calc_icon = self.unity.launcher.model.get_icon(desktop_id=calc_app.desktop_file) | 220 | calc_icon = self.unity.launcher.model.get_icon(desktop_id=calc_app.desktop_file) |
1155 | 221 | 221 | ||
1156 | 222 | 222 | ||
1157 | === modified file 'tests/autopilot/unity/tests/launcher/test_reveal.py' | |||
1158 | --- tests/autopilot/unity/tests/launcher/test_reveal.py 2013-02-04 19:54:47 +0000 | |||
1159 | +++ tests/autopilot/unity/tests/launcher/test_reveal.py 2013-05-15 16:01:29 +0000 | |||
1160 | @@ -9,6 +9,7 @@ | |||
1161 | 9 | 9 | ||
1162 | 10 | from __future__ import absolute_import | 10 | from __future__ import absolute_import |
1163 | 11 | 11 | ||
1164 | 12 | from autopilot.display import move_mouse_to_screen | ||
1165 | 12 | from autopilot.matchers import Eventually | 13 | from autopilot.matchers import Eventually |
1166 | 13 | import logging | 14 | import logging |
1167 | 14 | from testtools.matchers import Equals, GreaterThan | 15 | from testtools.matchers import Equals, GreaterThan |
1168 | @@ -63,7 +64,7 @@ | |||
1169 | 63 | 64 | ||
1170 | 64 | def test_launcher_does_not_reveal_with_mouse_down(self): | 65 | def test_launcher_does_not_reveal_with_mouse_down(self): |
1171 | 65 | """Launcher must not reveal if have mouse button 1 down.""" | 66 | """Launcher must not reveal if have mouse button 1 down.""" |
1173 | 66 | self.screen_geo.move_mouse_to_monitor(self.launcher_instance.monitor) | 67 | move_mouse_to_screen(self.launcher_instance.monitor) |
1174 | 67 | self.mouse.press(1) | 68 | self.mouse.press(1) |
1175 | 68 | self.addCleanup(self.mouse.release, 1) | 69 | self.addCleanup(self.mouse.release, 1) |
1176 | 69 | #FIXME: This is really bad API. it says reveal but it's expected to fail. bad bad bad!! | 70 | #FIXME: This is really bad API. it says reveal but it's expected to fail. bad bad bad!! |
1177 | @@ -75,8 +76,8 @@ | |||
1178 | 75 | 76 | ||
1179 | 76 | def test_launcher_stays_open_after_spread(self): | 77 | def test_launcher_stays_open_after_spread(self): |
1180 | 77 | """Clicking on the launcher to close an active spread must not hide the launcher.""" | 78 | """Clicking on the launcher to close an active spread must not hide the launcher.""" |
1183 | 78 | char_win1 = self.start_app_window("Character Map") | 79 | char_win1 = self.process_manager.start_app_window("Character Map") |
1184 | 79 | char_win2 = self.start_app_window("Character Map") | 80 | char_win2 = self.process_manager.start_app_window("Character Map") |
1185 | 80 | char_app = char_win1.application | 81 | char_app = char_win1.application |
1186 | 81 | 82 | ||
1187 | 82 | char_icon = self.unity.launcher.model.get_icon(desktop_id=char_app.desktop_file) | 83 | char_icon = self.unity.launcher.model.get_icon(desktop_id=char_app.desktop_file) |
1188 | @@ -90,7 +91,7 @@ | |||
1189 | 90 | 91 | ||
1190 | 91 | def test_launcher_stays_open_after_icon_click(self): | 92 | def test_launcher_stays_open_after_icon_click(self): |
1191 | 92 | """Clicking on a launcher icon must not hide the launcher.""" | 93 | """Clicking on a launcher icon must not hide the launcher.""" |
1193 | 93 | char_win = self.start_app_window("Character Map") | 94 | char_win = self.process_manager.start_app_window("Character Map") |
1194 | 94 | char_app = char_win.application | 95 | char_app = char_win.application |
1195 | 95 | 96 | ||
1196 | 96 | char_icon = self.unity.launcher.model.get_icon(desktop_id=char_app.desktop_file) | 97 | char_icon = self.unity.launcher.model.get_icon(desktop_id=char_app.desktop_file) |
1197 | @@ -106,10 +107,10 @@ | |||
1198 | 106 | if self.unity.launcher.model.num_bamf_launcher_icons() >= 10: | 107 | if self.unity.launcher.model.num_bamf_launcher_icons() >= 10: |
1199 | 107 | self.skip("There are already more than 9 icons in the launcher") | 108 | self.skip("There are already more than 9 icons in the launcher") |
1200 | 108 | 109 | ||
1202 | 109 | desktop_file = self.KNOWN_APPS['Calculator']['desktop-file'] | 110 | desktop_file = self.process_manager.KNOWN_APPS['Calculator']['desktop-file'] |
1203 | 110 | if self.unity.launcher.model.get_icon(desktop_id=desktop_file) != None: | 111 | if self.unity.launcher.model.get_icon(desktop_id=desktop_file) != None: |
1204 | 111 | self.skip("Calculator icon is already on the launcher.") | 112 | self.skip("Calculator icon is already on the launcher.") |
1205 | 112 | 113 | ||
1207 | 113 | self.start_app('Calculator') | 114 | self.process_manager.start_app('Calculator') |
1208 | 114 | icon = self.unity.launcher.model.get_icon(desktop_id=desktop_file) | 115 | icon = self.unity.launcher.model.get_icon(desktop_id=desktop_file) |
1209 | 115 | self.assertThat(icon.shortcut, GreaterThan(0)) | 116 | self.assertThat(icon.shortcut, GreaterThan(0)) |
1210 | 116 | 117 | ||
1211 | === modified file 'tests/autopilot/unity/tests/launcher/test_scroll.py' | |||
1212 | --- tests/autopilot/unity/tests/launcher/test_scroll.py 2013-03-13 18:07:17 +0000 | |||
1213 | +++ tests/autopilot/unity/tests/launcher/test_scroll.py 2013-05-15 16:01:29 +0000 | |||
1214 | @@ -25,7 +25,7 @@ | |||
1215 | 25 | apps = ("Calculator", "Mahjongg", "Text Editor", "Character Map", "Terminal", "Remmina") | 25 | apps = ("Calculator", "Mahjongg", "Text Editor", "Character Map", "Terminal", "Remmina") |
1216 | 26 | 26 | ||
1217 | 27 | for app in apps: | 27 | for app in apps: |
1219 | 28 | self.start_app_window(app) | 28 | self.process_manager.start_app_window(app) |
1220 | 29 | 29 | ||
1221 | 30 | def test_autoscrolling_from_bottom(self): | 30 | def test_autoscrolling_from_bottom(self): |
1222 | 31 | """Tests the autoscrolling from the bottom of the Launcher""" | 31 | """Tests the autoscrolling from the bottom of the Launcher""" |
1223 | 32 | 32 | ||
1224 | === modified file 'tests/autopilot/unity/tests/launcher/test_switcher.py' | |||
1225 | --- tests/autopilot/unity/tests/launcher/test_switcher.py 2013-02-04 19:54:47 +0000 | |||
1226 | +++ tests/autopilot/unity/tests/launcher/test_switcher.py 2013-05-15 16:01:29 +0000 | |||
1227 | @@ -47,8 +47,8 @@ | |||
1228 | 47 | 47 | ||
1229 | 48 | def test_launcher_switcher_cancel_resume_focus(self): | 48 | def test_launcher_switcher_cancel_resume_focus(self): |
1230 | 49 | """Test that ending the launcher switcher resume the focus.""" | 49 | """Test that ending the launcher switcher resume the focus.""" |
1233 | 50 | self.close_all_app("Calculator") | 50 | self.process_manager.close_all_app("Calculator") |
1234 | 51 | calc = self.start_app("Calculator") | 51 | calc = self.process_manager.start_app("Calculator") |
1235 | 52 | self.assertTrue(calc.is_active) | 52 | self.assertTrue(calc.is_active) |
1236 | 53 | 53 | ||
1237 | 54 | self.start_switcher_with_cleanup_cancel() | 54 | self.start_switcher_with_cleanup_cancel() |
1238 | @@ -145,8 +145,8 @@ | |||
1239 | 145 | 145 | ||
1240 | 146 | def test_launcher_switcher_activate_keep_focus(self): | 146 | def test_launcher_switcher_activate_keep_focus(self): |
1241 | 147 | """Activating a running launcher icon should focus the application.""" | 147 | """Activating a running launcher icon should focus the application.""" |
1244 | 148 | calc = self.start_app("Calculator") | 148 | calc = self.process_manager.start_app("Calculator") |
1245 | 149 | mahjongg = self.start_app("Mahjongg") | 149 | mahjongg = self.process_manager.start_app("Mahjongg") |
1246 | 150 | self.assertTrue(mahjongg.is_active) | 150 | self.assertTrue(mahjongg.is_active) |
1247 | 151 | self.assertFalse(calc.is_active) | 151 | self.assertFalse(calc.is_active) |
1248 | 152 | 152 | ||
1249 | 153 | 153 | ||
1250 | === modified file 'tests/autopilot/unity/tests/test_command_lens.py' | |||
1251 | --- tests/autopilot/unity/tests/test_command_lens.py 2013-04-24 19:43:55 +0000 | |||
1252 | +++ tests/autopilot/unity/tests/test_command_lens.py 2013-05-15 16:01:29 +0000 | |||
1253 | @@ -70,8 +70,8 @@ | |||
1254 | 70 | 70 | ||
1255 | 71 | def test_run_before_refresh(self): | 71 | def test_run_before_refresh(self): |
1256 | 72 | """Hitting enter before view has updated results must run the correct command.""" | 72 | """Hitting enter before view has updated results must run the correct command.""" |
1259 | 73 | if self.app_is_running("Text Editor"): | 73 | if self.process_manager.app_is_running("Text Editor"): |
1260 | 74 | self.close_all_app("Text Editor") | 74 | self.process_manager.close_all_app("Text Editor") |
1261 | 75 | sleep(1) | 75 | sleep(1) |
1262 | 76 | 76 | ||
1263 | 77 | self.unity.dash.reveal_command_scope() | 77 | self.unity.dash.reveal_command_scope() |
1264 | @@ -79,8 +79,8 @@ | |||
1265 | 79 | sleep(1) | 79 | sleep(1) |
1266 | 80 | self.keyboard.type("edit", 0.1) | 80 | self.keyboard.type("edit", 0.1) |
1267 | 81 | self.keyboard.press_and_release("Enter", 0.1) | 81 | self.keyboard.press_and_release("Enter", 0.1) |
1270 | 82 | self.addCleanup(self.close_all_app, "Text Editor") | 82 | self.addCleanup(self.process_manager.close_all_app, "Text Editor") |
1271 | 83 | app_found = self.bamf.wait_until_application_is_running("gedit.desktop", 5) | 83 | app_found = self.process_manager.wait_until_application_is_running("gedit.desktop", 5) |
1272 | 84 | self.assertTrue(app_found) | 84 | self.assertTrue(app_found) |
1273 | 85 | 85 | ||
1274 | 86 | def test_ctrl_tab_switching(self): | 86 | def test_ctrl_tab_switching(self): |
1275 | 87 | 87 | ||
1276 | === modified file 'tests/autopilot/unity/tests/test_dash.py' | |||
1277 | --- tests/autopilot/unity/tests/test_dash.py 2013-04-26 14:08:38 +0000 | |||
1278 | +++ tests/autopilot/unity/tests/test_dash.py 2013-05-15 16:01:29 +0000 | |||
1279 | @@ -8,7 +8,8 @@ | |||
1280 | 8 | 8 | ||
1281 | 9 | from __future__ import absolute_import | 9 | from __future__ import absolute_import |
1282 | 10 | 10 | ||
1284 | 11 | from autopilot.emulators.clipboard import get_clipboard_contents | 11 | from autopilot.clipboard import get_clipboard_contents |
1285 | 12 | from autopilot.display import move_mouse_to_screen | ||
1286 | 12 | from autopilot.matchers import Eventually | 13 | from autopilot.matchers import Eventually |
1287 | 13 | from testtools.matchers import Equals, NotEquals, GreaterThan | 14 | from testtools.matchers import Equals, NotEquals, GreaterThan |
1288 | 14 | from time import sleep | 15 | from time import sleep |
1289 | @@ -123,7 +124,7 @@ | |||
1290 | 123 | current_monitor = self.unity.dash.monitor | 124 | current_monitor = self.unity.dash.monitor |
1291 | 124 | 125 | ||
1292 | 125 | (x,y,w,h) = self.unity.dash.geometry | 126 | (x,y,w,h) = self.unity.dash.geometry |
1294 | 126 | (screen_x,screen_y,screen_w,screen_h) = self.screen_geo.get_monitor_geometry(current_monitor) | 127 | (screen_x,screen_y,screen_w,screen_h) = self.display.get_screen_geometry(current_monitor) |
1295 | 127 | 128 | ||
1296 | 128 | self.mouse.move(x + w + (screen_w-((screen_x-x)+w))/2, y + h + (screen_h-((screen_y-y)+h))/2) | 129 | self.mouse.move(x + w + (screen_w-((screen_x-x)+w))/2, y + h + (screen_h-((screen_y-y)+h))/2) |
1297 | 129 | self.mouse.click() | 130 | self.mouse.click() |
1298 | @@ -135,15 +136,15 @@ | |||
1299 | 135 | focused. Then from the Dash clicking on the maximized window | 136 | focused. Then from the Dash clicking on the maximized window |
1300 | 136 | must focus that window and close the dash. | 137 | must focus that window and close the dash. |
1301 | 137 | """ | 138 | """ |
1303 | 138 | char_win = self.start_app("Character Map") | 139 | char_win = self.process_manager.start_app("Character Map") |
1304 | 139 | self.keybinding("window/maximize") | 140 | self.keybinding("window/maximize") |
1306 | 140 | self.start_app("Calculator") | 141 | self.process_manager.start_app("Calculator") |
1307 | 141 | 142 | ||
1308 | 142 | self.unity.dash.ensure_visible() | 143 | self.unity.dash.ensure_visible() |
1309 | 143 | 144 | ||
1310 | 144 | #Click bottom right of the screen | 145 | #Click bottom right of the screen |
1313 | 145 | w = self.screen_geo.get_screen_width() | 146 | w = self.display.get_screen_width() |
1314 | 146 | h = self.screen_geo.get_screen_height() | 147 | h = self.display.get_screen_height() |
1315 | 147 | self.mouse.move(w,h) | 148 | self.mouse.move(w,h) |
1316 | 148 | self.mouse.click() | 149 | self.mouse.click() |
1317 | 149 | 150 | ||
1318 | @@ -506,7 +507,7 @@ | |||
1319 | 506 | def test_middle_click_paste(self): | 507 | def test_middle_click_paste(self): |
1320 | 507 | """Tests if Middle mouse button pastes into searchbar""" | 508 | """Tests if Middle mouse button pastes into searchbar""" |
1321 | 508 | 509 | ||
1323 | 509 | self.start_app_window("Calculator", locale='C') | 510 | self.process_manager.start_app_window("Calculator", locale='C') |
1324 | 510 | 511 | ||
1325 | 511 | self.keyboard.type("ThirdButtonPaste") | 512 | self.keyboard.type("ThirdButtonPaste") |
1326 | 512 | self.keyboard.press_and_release("Ctrl+a") | 513 | self.keyboard.press_and_release("Ctrl+a") |
1327 | @@ -547,7 +548,7 @@ | |||
1328 | 547 | self.unity.dash.ensure_visible() | 548 | self.unity.dash.ensure_visible() |
1329 | 548 | self.addCleanup(self.unity.hud.ensure_hidden) | 549 | self.addCleanup(self.unity.hud.ensure_hidden) |
1330 | 549 | 550 | ||
1332 | 550 | self.start_app_window("Calculator") | 551 | self.process_manager.start_app_window("Calculator") |
1333 | 551 | sleep(1) | 552 | sleep(1) |
1334 | 552 | 553 | ||
1335 | 553 | self.keyboard.type("HasFocus") | 554 | self.keyboard.type("HasFocus") |
1336 | @@ -648,8 +649,9 @@ | |||
1337 | 648 | self.assertThat(scope.visible, Eventually(Equals(False))) | 649 | self.assertThat(scope.visible, Eventually(Equals(False))) |
1338 | 649 | 650 | ||
1339 | 650 | def test_dash_position_with_non_default_launcher_width(self): | 651 | def test_dash_position_with_non_default_launcher_width(self): |
1341 | 651 | """"There should be no empty space between launcher and dash when the launcher | 652 | """There should be no empty space between launcher and dash when the launcher |
1342 | 652 | has a non-default width. | 653 | has a non-default width. |
1343 | 654 | |||
1344 | 653 | """ | 655 | """ |
1345 | 654 | monitor = self.unity.dash.monitor | 656 | monitor = self.unity.dash.monitor |
1346 | 655 | launcher = self.unity.launcher.get_launcher_for_monitor(monitor) | 657 | launcher = self.unity.launcher.get_launcher_for_monitor(monitor) |
1347 | @@ -804,8 +806,7 @@ | |||
1348 | 804 | # make sure the scope result is non-empty | 806 | # make sure the scope result is non-empty |
1349 | 805 | (file_handle, file_path) = mkstemp() | 807 | (file_handle, file_path) = mkstemp() |
1350 | 806 | self.addCleanup(remove, file_path) | 808 | self.addCleanup(remove, file_path) |
1353 | 807 | gedit_win = self.start_app_window('Text Editor', files=[file_path], locale='C') | 809 | gedit_win = self.process_manager.start_app_window('Text Editor', files=[file_path], locale='C') |
1352 | 808 | self.addCleanup(self.close_all_app, 'Text Editor') | ||
1354 | 809 | self.assertProperty(gedit_win, is_focused=True) | 810 | self.assertProperty(gedit_win, is_focused=True) |
1355 | 810 | 811 | ||
1356 | 811 | scope = self.unity.dash.reveal_file_scope() | 812 | scope = self.unity.dash.reveal_file_scope() |
1357 | @@ -1263,7 +1264,7 @@ | |||
1358 | 1263 | 1264 | ||
1359 | 1264 | def setUp(self): | 1265 | def setUp(self): |
1360 | 1265 | super(DashCrossMonitorsTests, self).setUp() | 1266 | super(DashCrossMonitorsTests, self).setUp() |
1362 | 1266 | if self.screen_geo.get_num_monitors() < 2: | 1267 | if self.display.get_num_screens() < 2: |
1363 | 1267 | self.skipTest("This test requires more than 1 monitor.") | 1268 | self.skipTest("This test requires more than 1 monitor.") |
1364 | 1268 | 1269 | ||
1365 | 1269 | def test_dash_stays_on_same_monitor(self): | 1270 | def test_dash_stays_on_same_monitor(self): |
1366 | @@ -1275,7 +1276,7 @@ | |||
1367 | 1275 | self.unity.dash.ensure_visible() | 1276 | self.unity.dash.ensure_visible() |
1368 | 1276 | self.addCleanup(self.unity.dash.ensure_hidden) | 1277 | self.addCleanup(self.unity.dash.ensure_hidden) |
1369 | 1277 | 1278 | ||
1371 | 1278 | self.screen_geo.move_mouse_to_monitor((current_monitor + 1) % self.screen_geo.get_num_monitors()) | 1279 | move_mouse_to_screen((current_monitor + 1) % self.display.get_num_screens()) |
1372 | 1279 | self.keyboard.type("abc") | 1280 | self.keyboard.type("abc") |
1373 | 1280 | 1281 | ||
1374 | 1281 | self.assertThat(self.unity.dash.ideal_monitor, Eventually(Equals(current_monitor))) | 1282 | self.assertThat(self.unity.dash.ideal_monitor, Eventually(Equals(current_monitor))) |
1375 | @@ -1285,11 +1286,11 @@ | |||
1376 | 1285 | 1286 | ||
1377 | 1286 | self.addCleanup(self.unity.dash.ensure_hidden) | 1287 | self.addCleanup(self.unity.dash.ensure_hidden) |
1378 | 1287 | 1288 | ||
1381 | 1288 | for monitor in range(self.screen_geo.get_num_monitors()-1): | 1289 | for monitor in range(self.display.get_num_screens()-1): |
1382 | 1289 | self.screen_geo.move_mouse_to_monitor(monitor) | 1290 | move_mouse_to_screen(monitor) |
1383 | 1290 | self.unity.dash.ensure_visible() | 1291 | self.unity.dash.ensure_visible() |
1384 | 1291 | 1292 | ||
1386 | 1292 | self.screen_geo.move_mouse_to_monitor(monitor+1) | 1293 | move_mouse_to_screen(monitor+1) |
1387 | 1293 | sleep(.5) | 1294 | sleep(.5) |
1388 | 1294 | self.mouse.click() | 1295 | self.mouse.click() |
1389 | 1295 | 1296 | ||
1390 | 1296 | 1297 | ||
1391 | === modified file 'tests/autopilot/unity/tests/test_home_lens.py' | |||
1392 | --- tests/autopilot/unity/tests/test_home_lens.py 2013-02-21 10:47:14 +0000 | |||
1393 | +++ tests/autopilot/unity/tests/test_home_lens.py 2013-05-15 16:01:29 +0000 | |||
1394 | @@ -30,8 +30,8 @@ | |||
1395 | 30 | finished yet. | 30 | finished yet. |
1396 | 31 | 31 | ||
1397 | 32 | """ | 32 | """ |
1400 | 33 | if self.app_is_running("Text Editor"): | 33 | if self.process_manager.app_is_running("Text Editor"): |
1401 | 34 | self.close_all_app("Text Editor") | 34 | self.process_manager.close_all_app("Text Editor") |
1402 | 35 | sleep(1) | 35 | sleep(1) |
1403 | 36 | 36 | ||
1404 | 37 | kb = self.keyboard | 37 | kb = self.keyboard |
1405 | @@ -40,6 +40,6 @@ | |||
1406 | 40 | self.assertThat(self.unity.dash.search_string, Eventually(Equals("g"))) | 40 | self.assertThat(self.unity.dash.search_string, Eventually(Equals("g"))) |
1407 | 41 | kb.type("edit", 0.1) | 41 | kb.type("edit", 0.1) |
1408 | 42 | kb.press_and_release("Enter", 0.1) | 42 | kb.press_and_release("Enter", 0.1) |
1411 | 43 | self.addCleanup(self.close_all_app, "Text Editor") | 43 | self.addCleanup(self.process_manager.close_all_app, "Text Editor") |
1412 | 44 | app_found = self.bamf.wait_until_application_is_running("gedit.desktop", 5) | 44 | app_found = self.process_manager.wait_until_application_is_running("gedit.desktop", 5) |
1413 | 45 | self.assertTrue(app_found) | 45 | self.assertTrue(app_found) |
1414 | 46 | 46 | ||
1415 | === modified file 'tests/autopilot/unity/tests/test_hud.py' | |||
1416 | --- tests/autopilot/unity/tests/test_hud.py 2013-04-24 15:25:08 +0000 | |||
1417 | +++ tests/autopilot/unity/tests/test_hud.py 2013-05-15 16:01:29 +0000 | |||
1418 | @@ -10,7 +10,7 @@ | |||
1419 | 10 | from __future__ import absolute_import | 10 | from __future__ import absolute_import |
1420 | 11 | 11 | ||
1421 | 12 | from autopilot.matchers import Eventually | 12 | from autopilot.matchers import Eventually |
1423 | 13 | from autopilot.emulators.X11 import ScreenGeometry | 13 | from autopilot.display import Display, move_mouse_to_screen, is_rect_on_screen |
1424 | 14 | from autopilot.testcase import multiply_scenarios | 14 | from autopilot.testcase import multiply_scenarios |
1425 | 15 | from os import remove, environ | 15 | from os import remove, environ |
1426 | 16 | from os.path import exists | 16 | from os.path import exists |
1427 | @@ -30,7 +30,7 @@ | |||
1428 | 30 | 30 | ||
1429 | 31 | 31 | ||
1430 | 32 | def _make_monitor_scenarios(): | 32 | def _make_monitor_scenarios(): |
1432 | 33 | num_monitors = ScreenGeometry().get_num_monitors() | 33 | num_monitors = Display.create().get_num_screens() |
1433 | 34 | scenarios = [] | 34 | scenarios = [] |
1434 | 35 | 35 | ||
1435 | 36 | if num_monitors == 1: | 36 | if num_monitors == 1: |
1436 | @@ -82,8 +82,8 @@ | |||
1437 | 82 | 82 | ||
1438 | 83 | if not environ.get('UBUNTU_MENUPROXY', ''): | 83 | if not environ.get('UBUNTU_MENUPROXY', ''): |
1439 | 84 | self.patch_environment('UBUNTU_MENUPROXY', 'libappmenu.so') | 84 | self.patch_environment('UBUNTU_MENUPROXY', 'libappmenu.so') |
1442 | 85 | self.hud_monitor = self.screen_geo.get_primary_monitor() | 85 | self.hud_monitor = self.display.get_primary_screen() |
1443 | 86 | self.screen_geo.move_mouse_to_monitor(self.hud_monitor) | 86 | move_mouse_to_screen(self.hud_monitor) |
1444 | 87 | 87 | ||
1445 | 88 | def test_no_initial_values(self): | 88 | def test_no_initial_values(self): |
1446 | 89 | self.unity.hud.ensure_visible() | 89 | self.unity.hud.ensure_visible() |
1447 | @@ -152,7 +152,7 @@ | |||
1448 | 152 | self.assertThat(self.unity.hud.visible, Equals(False)) | 152 | self.assertThat(self.unity.hud.visible, Equals(False)) |
1449 | 153 | 153 | ||
1450 | 154 | def test_alt_f4_doesnt_show_hud(self): | 154 | def test_alt_f4_doesnt_show_hud(self): |
1452 | 155 | self.start_app('Calculator') | 155 | self.process_manager.start_app('Calculator') |
1453 | 156 | sleep(1) | 156 | sleep(1) |
1454 | 157 | # Do a very fast Alt+F4 | 157 | # Do a very fast Alt+F4 |
1455 | 158 | self.keyboard.press_and_release("Alt+F4", 0.05) | 158 | self.keyboard.press_and_release("Alt+F4", 0.05) |
1456 | @@ -176,7 +176,7 @@ | |||
1457 | 176 | """Ensures that once the hud is dismissed, the same application | 176 | """Ensures that once the hud is dismissed, the same application |
1458 | 177 | that was focused before hud invocation is refocused. | 177 | that was focused before hud invocation is refocused. |
1459 | 178 | """ | 178 | """ |
1461 | 179 | calc = self.start_app("Calculator") | 179 | calc = self.process_manager.start_app("Calculator") |
1462 | 180 | 180 | ||
1463 | 181 | # first ensure that the application has started and is focused | 181 | # first ensure that the application has started and is focused |
1464 | 182 | self.assertEqual(calc.is_active, True) | 182 | self.assertEqual(calc.is_active, True) |
1465 | @@ -200,8 +200,8 @@ | |||
1466 | 200 | 200 | ||
1467 | 201 | file_path = mktemp() | 201 | file_path = mktemp() |
1468 | 202 | self.addCleanup(remove, file_path) | 202 | self.addCleanup(remove, file_path) |
1471 | 203 | gedit_win = self.start_app_window('Text Editor', files=[file_path], locale='C') | 203 | gedit_win = self.process_manager.start_app_window('Text Editor', files=[file_path], locale='C') |
1472 | 204 | self.addCleanup(self.close_all_app, 'Text Editor') | 204 | self.addCleanup(self.process_manager.close_all_app, 'Text Editor') |
1473 | 205 | self.assertProperty(gedit_win, is_focused=True) | 205 | self.assertProperty(gedit_win, is_focused=True) |
1474 | 206 | 206 | ||
1475 | 207 | self.keyboard.type("0") | 207 | self.keyboard.type("0") |
1476 | @@ -254,7 +254,7 @@ | |||
1477 | 254 | def test_hud_closes_on_spread(self): | 254 | def test_hud_closes_on_spread(self): |
1478 | 255 | """This test shows that when the spread is initiated, the hud closes.""" | 255 | """This test shows that when the spread is initiated, the hud closes.""" |
1479 | 256 | # Need at least one application open for the spread to work. | 256 | # Need at least one application open for the spread to work. |
1481 | 257 | self.start_app_window("Calculator") | 257 | self.process_manager.start_app_window("Calculator") |
1482 | 258 | self.unity.hud.ensure_visible() | 258 | self.unity.hud.ensure_visible() |
1483 | 259 | self.addCleanup(self.keybinding, "spread/cancel") | 259 | self.addCleanup(self.keybinding, "spread/cancel") |
1484 | 260 | self.keybinding("spread/start") | 260 | self.keybinding("spread/start") |
1485 | @@ -317,8 +317,8 @@ | |||
1486 | 317 | 317 | ||
1487 | 318 | def test_app_activate_on_enter(self): | 318 | def test_app_activate_on_enter(self): |
1488 | 319 | """Hud must close after activating a search item with Enter.""" | 319 | """Hud must close after activating a search item with Enter.""" |
1491 | 320 | self.start_app('Text Editor', locale='C') | 320 | self.process_manager.start_app('Text Editor', locale='C') |
1492 | 321 | self.addCleanup(self.close_all_app, "Text Editor") | 321 | self.addCleanup(self.process_manager.close_all_app, "Text Editor") |
1493 | 322 | 322 | ||
1494 | 323 | self.unity.hud.ensure_visible() | 323 | self.unity.hud.ensure_visible() |
1495 | 324 | 324 | ||
1496 | @@ -330,7 +330,7 @@ | |||
1497 | 330 | 330 | ||
1498 | 331 | self.keyboard.press_and_release("Enter") | 331 | self.keyboard.press_and_release("Enter") |
1499 | 332 | 332 | ||
1501 | 333 | self.assertFalse(self.app_is_running("Text Editor")) | 333 | self.assertFalse(self.process_manager.app_is_running("Text Editor")) |
1502 | 334 | 334 | ||
1503 | 335 | self.assertThat(self.unity.hud.visible, Eventually(Equals(False))) | 335 | self.assertThat(self.unity.hud.visible, Eventually(Equals(False))) |
1504 | 336 | 336 | ||
1505 | @@ -355,7 +355,7 @@ | |||
1506 | 355 | """Tests that Alt+ArrowKey events are correctly passed to the | 355 | """Tests that Alt+ArrowKey events are correctly passed to the |
1507 | 356 | active window when Unity is not responding to them.""" | 356 | active window when Unity is not responding to them.""" |
1508 | 357 | 357 | ||
1510 | 358 | term_win = self.start_app_window("Terminal") | 358 | term_win = self.process_manager.start_app_window("Terminal") |
1511 | 359 | self.assertProperty(term_win, is_focused=True) | 359 | self.assertProperty(term_win, is_focused=True) |
1512 | 360 | 360 | ||
1513 | 361 | # Here we anyway need a sleep, since even though the terminal can have | 361 | # Here we anyway need a sleep, since even though the terminal can have |
1514 | @@ -427,7 +427,7 @@ | |||
1515 | 427 | self.unity.hud.ensure_visible() | 427 | self.unity.hud.ensure_visible() |
1516 | 428 | self.addCleanup(self.unity.hud.ensure_hidden) | 428 | self.addCleanup(self.unity.hud.ensure_hidden) |
1517 | 429 | 429 | ||
1519 | 430 | self.start_app_window("Calculator") | 430 | self.process_manager.start_app_window("Calculator") |
1520 | 431 | sleep(1) | 431 | sleep(1) |
1521 | 432 | 432 | ||
1522 | 433 | self.keyboard.type("HasFocus") | 433 | self.keyboard.type("HasFocus") |
1523 | @@ -440,7 +440,7 @@ | |||
1524 | 440 | current_monitor = self.unity.hud.monitor | 440 | current_monitor = self.unity.hud.monitor |
1525 | 441 | 441 | ||
1526 | 442 | (x,y,w,h) = self.unity.hud.geometry | 442 | (x,y,w,h) = self.unity.hud.geometry |
1528 | 443 | (screen_x,screen_y,screen_w,screen_h) = self.screen_geo.get_monitor_geometry(current_monitor) | 443 | (screen_x,screen_y,screen_w,screen_h) = self.display.get_screen_geometry(current_monitor) |
1529 | 444 | 444 | ||
1530 | 445 | self.mouse.move(x + w + (screen_w-((screen_x-x)+w))/2, y + h + (screen_h-((screen_y-y)+h))/2) | 445 | self.mouse.move(x + w + (screen_w-((screen_x-x)+w))/2, y + h + (screen_h-((screen_y-y)+h))/2) |
1531 | 446 | self.mouse.click() | 446 | self.mouse.click() |
1532 | @@ -452,16 +452,16 @@ | |||
1533 | 452 | focused. Then from the Hud clicking on the maximized window | 452 | focused. Then from the Hud clicking on the maximized window |
1534 | 453 | must focus that window and close the hud. | 453 | must focus that window and close the hud. |
1535 | 454 | """ | 454 | """ |
1537 | 455 | char_win = self.start_app("Character Map") | 455 | char_win = self.process_manager.start_app("Character Map") |
1538 | 456 | self.assertProperty(char_win, is_active=True) | 456 | self.assertProperty(char_win, is_active=True) |
1539 | 457 | self.keybinding("window/maximize") | 457 | self.keybinding("window/maximize") |
1541 | 458 | self.start_app("Calculator") | 458 | self.process_manager.start_app("Calculator") |
1542 | 459 | 459 | ||
1543 | 460 | self.unity.hud.ensure_visible() | 460 | self.unity.hud.ensure_visible() |
1544 | 461 | 461 | ||
1545 | 462 | #Click bottom right of the screen | 462 | #Click bottom right of the screen |
1548 | 463 | w = self.screen_geo.get_screen_width() | 463 | w = self.display.get_screen_width() |
1549 | 464 | h = self.screen_geo.get_screen_height() | 464 | h = self.display.get_screen_height() |
1550 | 465 | self.mouse.move(w,h) | 465 | self.mouse.move(w,h) |
1551 | 466 | self.mouse.click() | 466 | self.mouse.click() |
1552 | 467 | 467 | ||
1553 | @@ -470,8 +470,8 @@ | |||
1554 | 470 | def test_hud_does_not_focus_wrong_window_after_alt_tab(self): | 470 | def test_hud_does_not_focus_wrong_window_after_alt_tab(self): |
1555 | 471 | """Test the Hud focuses the correct window after an Alt+Tab.""" | 471 | """Test the Hud focuses the correct window after an Alt+Tab.""" |
1556 | 472 | 472 | ||
1559 | 473 | char_win = self.start_app('Character Map') | 473 | char_win = self.process_manager.start_app('Character Map') |
1560 | 474 | self.start_app('Calculator') | 474 | self.process_manager.start_app('Calculator') |
1561 | 475 | 475 | ||
1562 | 476 | self.keybinding("switcher/reveal_normal") | 476 | self.keybinding("switcher/reveal_normal") |
1563 | 477 | self.assertProperty(char_win, is_active=True) | 477 | self.assertProperty(char_win, is_active=True) |
1564 | @@ -506,7 +506,7 @@ | |||
1565 | 506 | self.set_unity_option('num_launchers', 0) | 506 | self.set_unity_option('num_launchers', 0) |
1566 | 507 | self.set_unity_option('launcher_hide_mode', int(self.launcher_autohide)) | 507 | self.set_unity_option('launcher_hide_mode', int(self.launcher_autohide)) |
1567 | 508 | 508 | ||
1569 | 509 | self.screen_geo.move_mouse_to_monitor(self.hud_monitor) | 509 | move_mouse_to_screen(self.hud_monitor) |
1570 | 510 | sleep(0.5) | 510 | sleep(0.5) |
1571 | 511 | 511 | ||
1572 | 512 | def test_multiple_hud_reveal_does_not_break_launcher(self): | 512 | def test_multiple_hud_reveal_does_not_break_launcher(self): |
1573 | @@ -517,9 +517,9 @@ | |||
1574 | 517 | launcher = self.unity.launcher.get_launcher_for_monitor(self.hud_monitor) | 517 | launcher = self.unity.launcher.get_launcher_for_monitor(self.hud_monitor) |
1575 | 518 | 518 | ||
1576 | 519 | # We need an app to switch to: | 519 | # We need an app to switch to: |
1578 | 520 | self.start_app('Character Map') | 520 | self.process_manager.start_app('Character Map') |
1579 | 521 | # We need an application to play with - I'll use the calculator. | 521 | # We need an application to play with - I'll use the calculator. |
1581 | 522 | self.start_app('Calculator') | 522 | self.process_manager.start_app('Calculator') |
1582 | 523 | sleep(1) | 523 | sleep(1) |
1583 | 524 | 524 | ||
1584 | 525 | # before we start, make sure there's zero or one active icon: | 525 | # before we start, make sure there's zero or one active icon: |
1585 | @@ -560,7 +560,7 @@ | |||
1586 | 560 | self.set_unity_option('num_launchers', 0) | 560 | self.set_unity_option('num_launchers', 0) |
1587 | 561 | self.set_unity_option('launcher_hide_mode', 0) | 561 | self.set_unity_option('launcher_hide_mode', 0) |
1588 | 562 | 562 | ||
1590 | 563 | self.screen_geo.move_mouse_to_monitor(self.hud_monitor) | 563 | move_mouse_to_screen(self.hud_monitor) |
1591 | 564 | sleep(0.5) | 564 | sleep(0.5) |
1592 | 565 | 565 | ||
1593 | 566 | def test_hud_launcher_icon_hides_bfb(self): | 566 | def test_hud_launcher_icon_hides_bfb(self): |
1594 | @@ -616,10 +616,10 @@ | |||
1595 | 616 | 616 | ||
1596 | 617 | def setUp(self): | 617 | def setUp(self): |
1597 | 618 | super(HudVisualTests, self).setUp() | 618 | super(HudVisualTests, self).setUp() |
1599 | 619 | self.screen_geo.move_mouse_to_monitor(self.hud_monitor) | 619 | move_mouse_to_screen(self.hud_monitor) |
1600 | 620 | self.set_unity_option('launcher_hide_mode', int(self.launcher_autohide)) | 620 | self.set_unity_option('launcher_hide_mode', int(self.launcher_autohide)) |
1601 | 621 | self.set_unity_option('num_launchers', int(self.launcher_primary_only)) | 621 | self.set_unity_option('num_launchers', int(self.launcher_primary_only)) |
1603 | 622 | self.hud_monitor_is_primary = (self.screen_geo.get_primary_monitor() == self.hud_monitor) | 622 | self.hud_monitor_is_primary = (self.display.get_primary_screen() == self.hud_monitor) |
1604 | 623 | self.hud_locked = (not self.launcher_autohide and (not self.launcher_primary_only or self.hud_monitor_is_primary)) | 623 | self.hud_locked = (not self.launcher_autohide and (not self.launcher_primary_only or self.hud_monitor_is_primary)) |
1605 | 624 | sleep(0.5) | 624 | sleep(0.5) |
1606 | 625 | 625 | ||
1607 | @@ -630,12 +630,12 @@ | |||
1608 | 630 | """HUD must be drawn on the monitor where the mouse is.""" | 630 | """HUD must be drawn on the monitor where the mouse is.""" |
1609 | 631 | self.unity.hud.ensure_visible() | 631 | self.unity.hud.ensure_visible() |
1610 | 632 | self.assertThat(self.unity.hud.monitor, Eventually(Equals(self.hud_monitor))) | 632 | self.assertThat(self.unity.hud.monitor, Eventually(Equals(self.hud_monitor))) |
1612 | 633 | self.assertTrue(self.screen_geo.is_rect_on_monitor(self.unity.hud.monitor, self.unity.hud.geometry)) | 633 | self.assertTrue(is_rect_on_screen(self.unity.hud.monitor, self.unity.hud.geometry)) |
1613 | 634 | 634 | ||
1614 | 635 | def test_hud_geometries(self): | 635 | def test_hud_geometries(self): |
1615 | 636 | """Tests the HUD geometries for the given monitor and status.""" | 636 | """Tests the HUD geometries for the given monitor and status.""" |
1616 | 637 | self.unity.hud.ensure_visible() | 637 | self.unity.hud.ensure_visible() |
1618 | 638 | monitor_geo = self.screen_geo.get_monitor_geometry(self.hud_monitor) | 638 | monitor_geo = self.display.get_screen_geometry(self.hud_monitor) |
1619 | 639 | monitor_x = monitor_geo[0] | 639 | monitor_x = monitor_geo[0] |
1620 | 640 | monitor_w = monitor_geo[2] | 640 | monitor_w = monitor_geo[2] |
1621 | 641 | hud_x = self.unity.hud.geometry[0] | 641 | hud_x = self.unity.hud.geometry[0] |
1622 | @@ -675,8 +675,8 @@ | |||
1623 | 675 | 675 | ||
1624 | 676 | def test_hud_icon_shows_the_focused_application_emblem(self): | 676 | def test_hud_icon_shows_the_focused_application_emblem(self): |
1625 | 677 | """Tests that the correct HUD icon is shown.""" | 677 | """Tests that the correct HUD icon is shown.""" |
1628 | 678 | self.close_all_app("Calculator") | 678 | self.process_manager.close_all_app("Calculator") |
1629 | 679 | calc = self.start_app("Calculator") | 679 | calc = self.process_manager.start_app("Calculator") |
1630 | 680 | self.assertTrue(calc.is_active) | 680 | self.assertTrue(calc.is_active) |
1631 | 681 | self.unity.hud.ensure_visible() | 681 | self.unity.hud.ensure_visible() |
1632 | 682 | 682 | ||
1633 | @@ -693,8 +693,8 @@ | |||
1634 | 693 | 693 | ||
1635 | 694 | def test_switch_dash_hud_does_not_break_the_focused_application_emblem(self): | 694 | def test_switch_dash_hud_does_not_break_the_focused_application_emblem(self): |
1636 | 695 | """Switching from Dash to HUD must still show the correct HUD icon.""" | 695 | """Switching from Dash to HUD must still show the correct HUD icon.""" |
1639 | 696 | self.close_all_app("Calculator") | 696 | self.process_manager.close_all_app("Calculator") |
1640 | 697 | calc = self.start_app("Calculator") | 697 | calc = self.process_manager.start_app("Calculator") |
1641 | 698 | self.assertTrue(calc.is_active) | 698 | self.assertTrue(calc.is_active) |
1642 | 699 | 699 | ||
1643 | 700 | self.unity.dash.ensure_visible() | 700 | self.unity.dash.ensure_visible() |
1644 | @@ -704,8 +704,8 @@ | |||
1645 | 704 | 704 | ||
1646 | 705 | def test_switch_hud_dash_does_not_break_the_focused_application_emblem(self): | 705 | def test_switch_hud_dash_does_not_break_the_focused_application_emblem(self): |
1647 | 706 | """Switching from HUD to Dash and back must still show the correct HUD icon.""" | 706 | """Switching from HUD to Dash and back must still show the correct HUD icon.""" |
1650 | 707 | self.close_all_app("Calculator") | 707 | self.process_manager.close_all_app("Calculator") |
1651 | 708 | calc = self.start_app("Calculator") | 708 | calc = self.process_manager.start_app("Calculator") |
1652 | 709 | self.assertTrue(calc.is_active) | 709 | self.assertTrue(calc.is_active) |
1653 | 710 | 710 | ||
1654 | 711 | self.unity.hud.ensure_visible() | 711 | self.unity.hud.ensure_visible() |
1655 | @@ -727,7 +727,7 @@ | |||
1656 | 727 | self.unity.window_manager.enter_show_desktop() | 727 | self.unity.window_manager.enter_show_desktop() |
1657 | 728 | self.addCleanup(self.unity.window_manager.leave_show_desktop) | 728 | self.addCleanup(self.unity.window_manager.leave_show_desktop) |
1658 | 729 | 729 | ||
1660 | 730 | calc = self.start_app("Calculator") | 730 | calc = self.process_manager.start_app("Calculator") |
1661 | 731 | self.assertTrue(calc.is_active) | 731 | self.assertTrue(calc.is_active) |
1662 | 732 | self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces) | 732 | self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces) |
1663 | 733 | self.unity.dash.ensure_visible() | 733 | self.unity.dash.ensure_visible() |
1664 | @@ -776,7 +776,7 @@ | |||
1665 | 776 | 776 | ||
1666 | 777 | def setUp(self): | 777 | def setUp(self): |
1667 | 778 | super(HudCrossMonitorsTests, self).setUp() | 778 | super(HudCrossMonitorsTests, self).setUp() |
1669 | 779 | if self.screen_geo.get_num_monitors() < 2: | 779 | if self.display.get_num_screens() < 2: |
1670 | 780 | self.skipTest("This test requires more than 1 monitor.") | 780 | self.skipTest("This test requires more than 1 monitor.") |
1671 | 781 | 781 | ||
1672 | 782 | def test_hud_stays_on_same_monitor(self): | 782 | def test_hud_stays_on_same_monitor(self): |
1673 | @@ -789,7 +789,7 @@ | |||
1674 | 789 | self.unity.hud.ensure_visible() | 789 | self.unity.hud.ensure_visible() |
1675 | 790 | self.addCleanup(self.unity.hud.ensure_hidden) | 790 | self.addCleanup(self.unity.hud.ensure_hidden) |
1676 | 791 | 791 | ||
1678 | 792 | self.screen_geo.move_mouse_to_monitor((current_monitor + 1) % self.screen_geo.get_num_monitors()) | 792 | move_mouse_to_screen((current_monitor + 1) % self.display.get_num_screens()) |
1679 | 793 | self.keyboard.type("abc") | 793 | self.keyboard.type("abc") |
1680 | 794 | 794 | ||
1681 | 795 | self.assertThat(self.unity.hud.ideal_monitor, Eventually(Equals(current_monitor))) | 795 | self.assertThat(self.unity.hud.ideal_monitor, Eventually(Equals(current_monitor))) |
1682 | @@ -799,11 +799,11 @@ | |||
1683 | 799 | 799 | ||
1684 | 800 | self.addCleanup(self.unity.hud.ensure_hidden) | 800 | self.addCleanup(self.unity.hud.ensure_hidden) |
1685 | 801 | 801 | ||
1688 | 802 | for monitor in range(self.screen_geo.get_num_monitors()-1): | 802 | for monitor in range(self.display.get_num_screens()-1): |
1689 | 803 | self.screen_geo.move_mouse_to_monitor(monitor) | 803 | move_mouse_to_screen(monitor) |
1690 | 804 | self.unity.hud.ensure_visible() | 804 | self.unity.hud.ensure_visible() |
1691 | 805 | 805 | ||
1693 | 806 | self.screen_geo.move_mouse_to_monitor(monitor+1) | 806 | move_mouse_to_screen(monitor+1) |
1694 | 807 | sleep(.5) | 807 | sleep(.5) |
1695 | 808 | self.mouse.click() | 808 | self.mouse.click() |
1696 | 809 | 809 | ||
1697 | 810 | 810 | ||
1698 | === modified file 'tests/autopilot/unity/tests/test_ibus.py' | |||
1699 | --- tests/autopilot/unity/tests/test_ibus.py 2013-02-28 12:39:52 +0000 | |||
1700 | +++ tests/autopilot/unity/tests/test_ibus.py 2013-05-15 16:01:29 +0000 | |||
1701 | @@ -10,7 +10,7 @@ | |||
1702 | 10 | 10 | ||
1703 | 11 | from __future__ import absolute_import | 11 | from __future__ import absolute_import |
1704 | 12 | 12 | ||
1706 | 13 | from autopilot.emulators.ibus import ( | 13 | from autopilot.ibus import ( |
1707 | 14 | get_active_input_engines, | 14 | get_active_input_engines, |
1708 | 15 | set_active_engines, | 15 | set_active_engines, |
1709 | 16 | get_available_input_engines, | 16 | get_available_input_engines, |
1710 | 17 | 17 | ||
1711 | === modified file 'tests/autopilot/unity/tests/test_panel.py' | |||
1712 | --- tests/autopilot/unity/tests/test_panel.py 2013-04-17 15:10:39 +0000 | |||
1713 | +++ tests/autopilot/unity/tests/test_panel.py 2013-05-15 16:01:29 +0000 | |||
1714 | @@ -8,8 +8,9 @@ | |||
1715 | 8 | 8 | ||
1716 | 9 | from __future__ import absolute_import | 9 | from __future__ import absolute_import |
1717 | 10 | 10 | ||
1720 | 11 | from autopilot.emulators.X11 import ScreenGeometry | 11 | from autopilot.display import Display |
1721 | 12 | from autopilot.emulators.bamf import BamfWindow | 12 | #from autopilot.emulators.bamf import BamfWindow |
1722 | 13 | from autopilot.process import Window | ||
1723 | 13 | from autopilot.matchers import Eventually | 14 | from autopilot.matchers import Eventually |
1724 | 14 | import logging | 15 | import logging |
1725 | 15 | import os | 16 | import os |
1726 | @@ -17,6 +18,7 @@ | |||
1727 | 17 | from time import sleep | 18 | from time import sleep |
1728 | 18 | 19 | ||
1729 | 19 | from unity.emulators.panel import IndicatorEntry | 20 | from unity.emulators.panel import IndicatorEntry |
1730 | 21 | from unity.emulators.X11 import drag_window_to_screen | ||
1731 | 20 | from unity.tests import UnityTestCase | 22 | from unity.tests import UnityTestCase |
1732 | 21 | 23 | ||
1733 | 22 | import gettext | 24 | import gettext |
1734 | @@ -25,7 +27,7 @@ | |||
1735 | 25 | 27 | ||
1736 | 26 | 28 | ||
1737 | 27 | def _make_monitor_scenarios(): | 29 | def _make_monitor_scenarios(): |
1739 | 28 | num_monitors = ScreenGeometry().get_num_monitors() | 30 | num_monitors = Display.create().get_num_screens() |
1740 | 29 | scenarios = [] | 31 | scenarios = [] |
1741 | 30 | 32 | ||
1742 | 31 | if num_monitors == 1: | 33 | if num_monitors == 1: |
1743 | @@ -54,8 +56,8 @@ | |||
1744 | 54 | Returns the opened BamfWindow | 56 | Returns the opened BamfWindow |
1745 | 55 | 57 | ||
1746 | 56 | """ | 58 | """ |
1749 | 57 | self.close_all_app(app_name) | 59 | self.process_manager.close_all_app(app_name) |
1750 | 58 | app_win = self.start_app_window(app_name, locale="C") | 60 | app_win = self.process_manager.start_app_window(app_name, locale="C") |
1751 | 59 | app = app_win.application | 61 | app = app_win.application |
1752 | 60 | 62 | ||
1753 | 61 | app_win.set_focus() | 63 | app_win.set_focus() |
1754 | @@ -82,8 +84,8 @@ | |||
1755 | 82 | 84 | ||
1756 | 83 | def move_window_to_panel_monitor(self, window, restore_position=False): | 85 | def move_window_to_panel_monitor(self, window, restore_position=False): |
1757 | 84 | """Drags a window to another monitor, eventually restoring it before""" | 86 | """Drags a window to another monitor, eventually restoring it before""" |
1760 | 85 | if not isinstance(window, BamfWindow): | 87 | if not isinstance(window, Window): |
1761 | 86 | raise TypeError("Window must be a BamfWindow") | 88 | raise TypeError("Window must be a autopilot.process.Window") |
1762 | 87 | 89 | ||
1763 | 88 | if window.monitor == self.panel_monitor: | 90 | if window.monitor == self.panel_monitor: |
1764 | 89 | return | 91 | return |
1765 | @@ -94,9 +96,9 @@ | |||
1766 | 94 | sleep(.1) | 96 | sleep(.1) |
1767 | 95 | 97 | ||
1768 | 96 | if restore_position: | 98 | if restore_position: |
1770 | 97 | self.addCleanup(self.screen_geo.drag_window_to_monitor, window, window.monitor) | 99 | self.addCleanup(drag_window_to_screen, window, window.monitor) |
1771 | 98 | 100 | ||
1773 | 99 | self.screen_geo.drag_window_to_monitor(window, self.panel_monitor) | 101 | drag_window_to_screen(window, self.panel_monitor) |
1774 | 100 | sleep(.25) | 102 | sleep(.25) |
1775 | 101 | self.assertThat(window.monitor, Equals(self.panel_monitor)) | 103 | self.assertThat(window.monitor, Equals(self.panel_monitor)) |
1776 | 102 | 104 | ||
1777 | @@ -130,7 +132,7 @@ | |||
1778 | 130 | """Assert that Bamf doesn't know of any open windows with the given xid.""" | 132 | """Assert that Bamf doesn't know of any open windows with the given xid.""" |
1779 | 131 | # We can't check text_win.closed since we've just destroyed the window. | 133 | # We can't check text_win.closed since we've just destroyed the window. |
1780 | 132 | # Instead we make sure no window with it's x_id exists. | 134 | # Instead we make sure no window with it's x_id exists. |
1782 | 133 | refresh_fn = lambda: [w for w in self.bamf.get_open_windows() if w.x_id == x_id] | 135 | refresh_fn = lambda: [w for w in self.process_manager.get_open_windows() if w.x_id == x_id] |
1783 | 134 | self.assertThat(refresh_fn, Eventually(Equals([]))) | 136 | self.assertThat(refresh_fn, Eventually(Equals([]))) |
1784 | 135 | 137 | ||
1785 | 136 | def sleep_menu_settle_period(self): | 138 | def sleep_menu_settle_period(self): |
1786 | @@ -372,7 +374,7 @@ | |||
1787 | 372 | win_xid = text_win.x_id | 374 | win_xid = text_win.x_id |
1788 | 373 | 375 | ||
1789 | 374 | self.panel.move_mouse_over_window_buttons() | 376 | self.panel.move_mouse_over_window_buttons() |
1791 | 375 | screen_x, screen_y = self.screen_geo.get_monitor_geometry(self.panel_monitor)[:2] | 377 | screen_x, screen_y = self.display.get_screen_geometry(self.panel_monitor)[:2] |
1792 | 376 | self.mouse.move(screen_x, screen_y) | 378 | self.mouse.move(screen_x, screen_y) |
1793 | 377 | self.mouse.click() | 379 | self.mouse.click() |
1794 | 378 | 380 | ||
1795 | @@ -400,7 +402,7 @@ | |||
1796 | 400 | self.panel.move_mouse_over_window_buttons() | 402 | self.panel.move_mouse_over_window_buttons() |
1797 | 401 | button = self.panel.window_buttons.minimize | 403 | button = self.panel.window_buttons.minimize |
1798 | 402 | target_x = button.x + button.width / 2 | 404 | target_x = button.x + button.width / 2 |
1800 | 403 | target_y = self.screen_geo.get_monitor_geometry(self.panel_monitor)[1] | 405 | target_y = self.display.get_screen_geometry(self.panel_monitor)[1] |
1801 | 404 | self.mouse.move(target_x, target_y) | 406 | self.mouse.move(target_x, target_y) |
1802 | 405 | self.mouse.click() | 407 | self.mouse.click() |
1803 | 406 | 408 | ||
1804 | @@ -429,7 +431,7 @@ | |||
1805 | 429 | button = self.panel.window_buttons.unmaximize | 431 | button = self.panel.window_buttons.unmaximize |
1806 | 430 | button.mouse_move_to() | 432 | button.mouse_move_to() |
1807 | 431 | target_x = button.x + button.width / 2 | 433 | target_x = button.x + button.width / 2 |
1809 | 432 | target_y = self.screen_geo.get_monitor_geometry(self.panel_monitor)[1] | 434 | target_y = self.display.get_screen_geometry(self.panel_monitor)[1] |
1810 | 433 | self.mouse.move(target_x, target_y) | 435 | self.mouse.move(target_x, target_y) |
1811 | 434 | sleep(1) | 436 | sleep(1) |
1812 | 435 | self.mouse.click() | 437 | self.mouse.click() |
1813 | @@ -865,7 +867,7 @@ | |||
1814 | 865 | self.open_new_application_window("Character Map") | 867 | self.open_new_application_window("Character Map") |
1815 | 866 | self.sleep_menu_settle_period() | 868 | self.sleep_menu_settle_period() |
1816 | 867 | 869 | ||
1818 | 868 | self.start_app("Character Map") | 870 | self.process_manager.start_app("Character Map") |
1819 | 869 | sleep(self.panel.menus.fadein_duration / 1000.0) | 871 | sleep(self.panel.menus.fadein_duration / 1000.0) |
1820 | 870 | # Not using Eventually here since this is time-critical. Need to work | 872 | # Not using Eventually here since this is time-critical. Need to work |
1821 | 871 | # out a better way to do this. | 873 | # out a better way to do this. |
1822 | @@ -1145,7 +1147,7 @@ | |||
1823 | 1145 | 1147 | ||
1824 | 1146 | def setUp(self): | 1148 | def setUp(self): |
1825 | 1147 | super(PanelCrossMonitorsTests, self).setUp() | 1149 | super(PanelCrossMonitorsTests, self).setUp() |
1827 | 1148 | if self.screen_geo.get_num_monitors() < 2: | 1150 | if self.display.get_num_screens() < 2: |
1828 | 1149 | self.skipTest("This test requires a multimonitor setup") | 1151 | self.skipTest("This test requires a multimonitor setup") |
1829 | 1150 | 1152 | ||
1830 | 1151 | def test_panel_title_updates_moving_window(self): | 1153 | def test_panel_title_updates_moving_window(self): |
1831 | @@ -1153,9 +1155,9 @@ | |||
1832 | 1153 | calc_win = self.open_new_application_window("Calculator") | 1155 | calc_win = self.open_new_application_window("Calculator") |
1833 | 1154 | 1156 | ||
1834 | 1155 | prev_monitor = None | 1157 | prev_monitor = None |
1836 | 1156 | for monitor in range(0, self.screen_geo.get_num_monitors()): | 1158 | for monitor in range(0, self.display.get_num_screens()): |
1837 | 1157 | if calc_win.monitor != monitor: | 1159 | if calc_win.monitor != monitor: |
1839 | 1158 | self.screen_geo.drag_window_to_monitor(calc_win, monitor) | 1160 | drag_window_to_screen(calc_win, monitor) |
1840 | 1159 | 1161 | ||
1841 | 1160 | if prev_monitor: | 1162 | if prev_monitor: |
1842 | 1161 | prev_panel = self.unity.panels.get_panel_for_monitor(prev_monitor) | 1163 | prev_panel = self.unity.panels.get_panel_for_monitor(prev_monitor) |
1843 | @@ -1174,7 +1176,7 @@ | |||
1844 | 1174 | self.open_new_application_window("Text Editor", maximized=True) | 1176 | self.open_new_application_window("Text Editor", maximized=True) |
1845 | 1175 | self.sleep_menu_settle_period() | 1177 | self.sleep_menu_settle_period() |
1846 | 1176 | 1178 | ||
1848 | 1177 | for monitor in range(0, self.screen_geo.get_num_monitors()): | 1179 | for monitor in range(0, self.display.get_num_screens()): |
1849 | 1178 | panel = self.unity.panels.get_panel_for_monitor(monitor) | 1180 | panel = self.unity.panels.get_panel_for_monitor(monitor) |
1850 | 1179 | panel.move_mouse_over_window_buttons() | 1181 | panel.move_mouse_over_window_buttons() |
1851 | 1180 | 1182 | ||
1852 | @@ -1192,7 +1194,7 @@ | |||
1853 | 1192 | self.unity.dash.ensure_visible() | 1194 | self.unity.dash.ensure_visible() |
1854 | 1193 | self.addCleanup(self.unity.dash.ensure_hidden) | 1195 | self.addCleanup(self.unity.dash.ensure_hidden) |
1855 | 1194 | 1196 | ||
1857 | 1195 | for monitor in range(0, self.screen_geo.get_num_monitors()): | 1197 | for monitor in range(0, self.display.get_num_screens()): |
1858 | 1196 | panel = self.unity.panels.get_panel_for_monitor(monitor) | 1198 | panel = self.unity.panels.get_panel_for_monitor(monitor) |
1859 | 1197 | 1199 | ||
1860 | 1198 | if self.unity.dash.monitor == monitor: | 1200 | if self.unity.dash.monitor == monitor: |
1861 | @@ -1207,7 +1209,7 @@ | |||
1862 | 1207 | self.unity.hud.ensure_visible() | 1209 | self.unity.hud.ensure_visible() |
1863 | 1208 | self.addCleanup(self.unity.hud.ensure_hidden) | 1210 | self.addCleanup(self.unity.hud.ensure_hidden) |
1864 | 1209 | 1211 | ||
1866 | 1210 | for monitor in range(0, self.screen_geo.get_num_monitors()): | 1212 | for monitor in range(0, self.display.get_num_screens()): |
1867 | 1211 | panel = self.unity.panels.get_panel_for_monitor(monitor) | 1213 | panel = self.unity.panels.get_panel_for_monitor(monitor) |
1868 | 1212 | 1214 | ||
1869 | 1213 | if self.unity.hud.monitor == monitor: | 1215 | if self.unity.hud.monitor == monitor: |
1870 | @@ -1223,7 +1225,7 @@ | |||
1871 | 1223 | """ | 1225 | """ |
1872 | 1224 | text_win = self.open_new_application_window("Text Editor", maximized=True) | 1226 | text_win = self.open_new_application_window("Text Editor", maximized=True) |
1873 | 1225 | 1227 | ||
1875 | 1226 | for monitor in range(self.screen_geo.get_num_monitors()): | 1228 | for monitor in range(self.display.get_num_screens()): |
1876 | 1227 | panel = self.unity.panels.get_panel_for_monitor(monitor) | 1229 | panel = self.unity.panels.get_panel_for_monitor(monitor) |
1877 | 1228 | 1230 | ||
1878 | 1229 | if monitor != text_win.monitor: | 1231 | if monitor != text_win.monitor: |
1879 | @@ -1239,7 +1241,7 @@ | |||
1880 | 1239 | """ | 1241 | """ |
1881 | 1240 | text_win = self.open_new_application_window("Text Editor", maximized=True) | 1242 | text_win = self.open_new_application_window("Text Editor", maximized=True) |
1882 | 1241 | 1243 | ||
1884 | 1242 | for monitor in range(self.screen_geo.get_num_monitors()): | 1244 | for monitor in range(self.display.get_num_screens()): |
1885 | 1243 | panel = self.unity.panels.get_panel_for_monitor(monitor) | 1245 | panel = self.unity.panels.get_panel_for_monitor(monitor) |
1886 | 1244 | 1246 | ||
1887 | 1245 | if monitor != text_win.monitor: | 1247 | if monitor != text_win.monitor: |
1888 | @@ -1254,7 +1256,7 @@ | |||
1889 | 1254 | """ | 1256 | """ |
1890 | 1255 | text_win = self.open_new_application_window("Text Editor", maximized=True) | 1257 | text_win = self.open_new_application_window("Text Editor", maximized=True) |
1891 | 1256 | 1258 | ||
1893 | 1257 | for monitor in range(0, self.screen_geo.get_num_monitors()): | 1259 | for monitor in range(0, self.display.get_num_screens()): |
1894 | 1258 | panel = self.unity.panels.get_panel_for_monitor(monitor) | 1260 | panel = self.unity.panels.get_panel_for_monitor(monitor) |
1895 | 1259 | 1261 | ||
1896 | 1260 | if monitor != text_win.monitor: | 1262 | if monitor != text_win.monitor: |
1897 | @@ -1268,7 +1270,7 @@ | |||
1898 | 1268 | indicator = panel.indicators.get_indicator_by_name_hint("indicator-session") | 1270 | indicator = panel.indicators.get_indicator_by_name_hint("indicator-session") |
1899 | 1269 | self.mouse_open_indicator(indicator) | 1271 | self.mouse_open_indicator(indicator) |
1900 | 1270 | 1272 | ||
1902 | 1271 | for monitor in range(0, self.screen_geo.get_num_monitors()): | 1273 | for monitor in range(0, self.display.get_num_screens()): |
1903 | 1272 | panel = self.unity.panels.get_panel_for_monitor(monitor) | 1274 | panel = self.unity.panels.get_panel_for_monitor(monitor) |
1904 | 1273 | 1275 | ||
1905 | 1274 | entries = panel.get_indicator_entries(include_hidden_menus=True) | 1276 | entries = panel.get_indicator_entries(include_hidden_menus=True) |
1906 | 1275 | 1277 | ||
1907 | === modified file 'tests/autopilot/unity/tests/test_quicklist.py' | |||
1908 | --- tests/autopilot/unity/tests/test_quicklist.py 2013-04-09 18:39:09 +0000 | |||
1909 | +++ tests/autopilot/unity/tests/test_quicklist.py 2013-05-15 16:01:29 +0000 | |||
1910 | @@ -9,6 +9,7 @@ | |||
1911 | 9 | 9 | ||
1912 | 10 | from __future__ import absolute_import | 10 | from __future__ import absolute_import |
1913 | 11 | 11 | ||
1914 | 12 | from autopilot.display import move_mouse_to_screen | ||
1915 | 12 | from autopilot.matchers import Eventually | 13 | from autopilot.matchers import Eventually |
1916 | 13 | import os.path | 14 | import os.path |
1917 | 14 | from testtools.matchers import Contains, Equals, NotEquals | 15 | from testtools.matchers import Contains, Equals, NotEquals |
1918 | @@ -40,13 +41,13 @@ | |||
1919 | 40 | 41 | ||
1920 | 41 | def get_desktop_entry(self, application): | 42 | def get_desktop_entry(self, application): |
1921 | 42 | # load the desktop file from disk: | 43 | # load the desktop file from disk: |
1923 | 43 | desktop_id = self.KNOWN_APPS[application]['desktop-file'] | 44 | desktop_id = self.process_manager.KNOWN_APPS[application]['desktop-file'] |
1924 | 44 | desktop_file = os.path.join('/usr/share/applications', desktop_id) | 45 | desktop_file = os.path.join('/usr/share/applications', desktop_id) |
1925 | 45 | return DesktopEntry(desktop_file) | 46 | return DesktopEntry(desktop_file) |
1926 | 46 | 47 | ||
1927 | 47 | def test_quicklist_actions(self): | 48 | def test_quicklist_actions(self): |
1928 | 48 | """Test that all actions present in the destop file are shown in the quicklist.""" | 49 | """Test that all actions present in the destop file are shown in the quicklist.""" |
1930 | 49 | app = self.start_app(self.app_name) | 50 | app = self.process_manager.start_app(self.app_name) |
1931 | 50 | 51 | ||
1932 | 51 | # get the launcher icon from the launcher: | 52 | # get the launcher icon from the launcher: |
1933 | 52 | launcher_icon = self.unity.launcher.model.get_icon(desktop_id=app.desktop_file) | 53 | launcher_icon = self.unity.launcher.model.get_icon(desktop_id=app.desktop_file) |
1934 | @@ -70,8 +71,8 @@ | |||
1935 | 70 | self.register_nautilus() | 71 | self.register_nautilus() |
1936 | 71 | self.addCleanup(self.close_all_windows, "Nautilus") | 72 | self.addCleanup(self.close_all_windows, "Nautilus") |
1937 | 72 | 73 | ||
1940 | 73 | self.start_app_window("Calculator") | 74 | self.process_manager.start_app_window("Calculator") |
1941 | 74 | self.start_app(self.app_name) | 75 | self.process_manager.start_app(self.app_name) |
1942 | 75 | 76 | ||
1943 | 76 | nautilus_icon = self.unity.launcher.model.get_icon(desktop_id="nautilus.desktop") | 77 | nautilus_icon = self.unity.launcher.model.get_icon(desktop_id="nautilus.desktop") |
1944 | 77 | ql = self.open_quicklist_for_icon(nautilus_icon) | 78 | ql = self.open_quicklist_for_icon(nautilus_icon) |
1945 | @@ -85,7 +86,7 @@ | |||
1946 | 85 | 86 | ||
1947 | 86 | ql.click_item(new_win_ql_item) | 87 | ql.click_item(new_win_ql_item) |
1948 | 87 | 88 | ||
1950 | 88 | nautilus_windows_fn = lambda: self.get_open_windows_by_application("Nautilus") | 89 | nautilus_windows_fn = lambda: self.process_manager.get_open_windows_by_application("Nautilus") |
1951 | 89 | self.assertThat(lambda: len(nautilus_windows_fn()), Eventually(Equals(1))) | 90 | self.assertThat(lambda: len(nautilus_windows_fn()), Eventually(Equals(1))) |
1952 | 90 | [nautilus_window] = nautilus_windows_fn() | 91 | [nautilus_window] = nautilus_windows_fn() |
1953 | 91 | 92 | ||
1954 | @@ -100,9 +101,9 @@ | |||
1955 | 100 | Then we activate the Calculator quicklist item. | 101 | Then we activate the Calculator quicklist item. |
1956 | 101 | Then we actiavte the Mahjongg launcher icon. | 102 | Then we actiavte the Mahjongg launcher icon. |
1957 | 102 | """ | 103 | """ |
1961 | 103 | char_win1 = self.start_app_window("Character Map") | 104 | char_win1 = self.process_manager.start_app_window("Character Map") |
1962 | 104 | calc_win = self.start_app_window("Calculator") | 105 | calc_win = self.process_manager.start_app_window("Calculator") |
1963 | 105 | char_win2 = self.start_app_window("Character Map") | 106 | char_win2 = self.process_manager.start_app_window("Character Map") |
1964 | 106 | 107 | ||
1965 | 107 | self.assertVisibleWindowStack([char_win2, calc_win, char_win1]) | 108 | self.assertVisibleWindowStack([char_win2, calc_win, char_win1]) |
1966 | 108 | 109 | ||
1967 | @@ -127,8 +128,8 @@ | |||
1968 | 127 | """This tests shows that when you activate a quicklist application item | 128 | """This tests shows that when you activate a quicklist application item |
1969 | 128 | when an application window is focused, the spread is initiated. | 129 | when an application window is focused, the spread is initiated. |
1970 | 129 | """ | 130 | """ |
1973 | 130 | char_win1 = self.start_app_window("Character Map") | 131 | char_win1 = self.process_manager.start_app_window("Character Map") |
1974 | 131 | char_win2 = self.start_app_window("Character Map") | 132 | char_win2 = self.process_manager.start_app_window("Character Map") |
1975 | 132 | char_app = char_win1.application | 133 | char_app = char_win1.application |
1976 | 133 | 134 | ||
1977 | 134 | self.assertVisibleWindowStack([char_win2, char_win1]) | 135 | self.assertVisibleWindowStack([char_win2, char_win1]) |
1978 | @@ -147,7 +148,7 @@ | |||
1979 | 147 | def test_quicklist_item_triggered_closes_dash(self): | 148 | def test_quicklist_item_triggered_closes_dash(self): |
1980 | 148 | """When any quicklist item is triggered it must close the dash.""" | 149 | """When any quicklist item is triggered it must close the dash.""" |
1981 | 149 | 150 | ||
1983 | 150 | calc_win = self.start_app_window("Calculator") | 151 | calc_win = self.process_manager.start_app_window("Calculator") |
1984 | 151 | self.assertProperty(calc_win, is_focused=True) | 152 | self.assertProperty(calc_win, is_focused=True) |
1985 | 152 | 153 | ||
1986 | 153 | self.unity.dash.ensure_visible() | 154 | self.unity.dash.ensure_visible() |
1987 | @@ -163,7 +164,7 @@ | |||
1988 | 163 | 164 | ||
1989 | 164 | def test_quicklist_closes_when_hud_opens(self): | 165 | def test_quicklist_closes_when_hud_opens(self): |
1990 | 165 | """When a quicklist is open you must still be able to open the Hud.""" | 166 | """When a quicklist is open you must still be able to open the Hud.""" |
1992 | 166 | calc = self.start_app("Calculator") | 167 | calc = self.process_manager.start_app("Calculator") |
1993 | 167 | 168 | ||
1994 | 168 | calc_icon = self.unity.launcher.model.get_icon(desktop_id=calc.desktop_file) | 169 | calc_icon = self.unity.launcher.model.get_icon(desktop_id=calc.desktop_file) |
1995 | 169 | self.open_quicklist_for_icon(calc_icon) | 170 | self.open_quicklist_for_icon(calc_icon) |
1996 | @@ -174,7 +175,7 @@ | |||
1997 | 174 | 175 | ||
1998 | 175 | def test_quicklist_closes_when_dash_opens(self): | 176 | def test_quicklist_closes_when_dash_opens(self): |
1999 | 176 | """When the quicklist is open you must still be able to open the dash.""" | 177 | """When the quicklist is open you must still be able to open the dash.""" |
2001 | 177 | calc = self.start_app("Calculator") | 178 | calc = self.process_manager.start_app("Calculator") |
2002 | 178 | 179 | ||
2003 | 179 | calc_icon = self.unity.launcher.model.get_icon(desktop_id=calc.desktop_file) | 180 | calc_icon = self.unity.launcher.model.get_icon(desktop_id=calc.desktop_file) |
2004 | 180 | self.open_quicklist_for_icon(calc_icon) | 181 | self.open_quicklist_for_icon(calc_icon) |
2005 | @@ -190,8 +191,8 @@ | |||
2006 | 190 | lp:890991 | 191 | lp:890991 |
2007 | 191 | """ | 192 | """ |
2008 | 192 | 193 | ||
2011 | 193 | calc_win = self.start_app_window("Calculator") | 194 | calc_win = self.process_manager.start_app_window("Calculator") |
2012 | 194 | mahj_win = self.start_app_window("Mahjongg") | 195 | mahj_win = self.process_manager.start_app_window("Mahjongg") |
2013 | 195 | 196 | ||
2014 | 196 | calc_icon = self.unity.launcher.model.get_icon( | 197 | calc_icon = self.unity.launcher.model.get_icon( |
2015 | 197 | desktop_id=calc_win.application.desktop_file) | 198 | desktop_id=calc_win.application.desktop_file) |
2016 | @@ -210,7 +211,7 @@ | |||
2017 | 210 | not re-open the quicklist if already open. It must hide. | 211 | not re-open the quicklist if already open. It must hide. |
2018 | 211 | """ | 212 | """ |
2019 | 212 | 213 | ||
2021 | 213 | calc_win = self.start_app_window("Calculator") | 214 | calc_win = self.process_manager.start_app_window("Calculator") |
2022 | 214 | 215 | ||
2023 | 215 | calc_icon = self.unity.launcher.model.get_icon( | 216 | calc_icon = self.unity.launcher.model.get_icon( |
2024 | 216 | desktop_id=calc_win.application.desktop_file) | 217 | desktop_id=calc_win.application.desktop_file) |
2025 | @@ -228,12 +229,12 @@ | |||
2026 | 228 | def setUp(self): | 229 | def setUp(self): |
2027 | 229 | super(QuicklistKeyNavigationTests, self).setUp() | 230 | super(QuicklistKeyNavigationTests, self).setUp() |
2028 | 230 | 231 | ||
2030 | 231 | desktop_file = self.KNOWN_APPS["Text Editor"]["desktop-file"] | 232 | desktop_file = self.process_manager.KNOWN_APPS["Text Editor"]["desktop-file"] |
2031 | 232 | icon_refresh_fn = lambda : self.unity.launcher.model.get_icon( | 233 | icon_refresh_fn = lambda : self.unity.launcher.model.get_icon( |
2032 | 233 | desktop_id=desktop_file) | 234 | desktop_id=desktop_file) |
2033 | 234 | 235 | ||
2034 | 235 | self.assertThat(icon_refresh_fn, Eventually(Equals(None))) | 236 | self.assertThat(icon_refresh_fn, Eventually(Equals(None))) |
2036 | 236 | self.ql_app = self.start_app("Text Editor") | 237 | self.ql_app = self.process_manager.start_app("Text Editor") |
2037 | 237 | 238 | ||
2038 | 238 | self.assertThat(icon_refresh_fn, Eventually(NotEquals(None))) | 239 | self.assertThat(icon_refresh_fn, Eventually(NotEquals(None))) |
2039 | 239 | self.ql_launcher_icon = icon_refresh_fn() | 240 | self.ql_launcher_icon = icon_refresh_fn() |
2040 | @@ -253,7 +254,7 @@ | |||
2041 | 253 | 254 | ||
2042 | 254 | def open_quicklist_with_keyboard(self): | 255 | def open_quicklist_with_keyboard(self): |
2043 | 255 | """Opens a quicklist using the keyboard.""" | 256 | """Opens a quicklist using the keyboard.""" |
2045 | 256 | self.screen_geo.move_mouse_to_monitor(0) | 257 | move_mouse_to_screen(0) |
2046 | 257 | self.ql_launcher.key_nav_start() | 258 | self.ql_launcher.key_nav_start() |
2047 | 258 | self.addCleanup(self.ql_launcher.key_nav_cancel) | 259 | self.addCleanup(self.ql_launcher.key_nav_cancel) |
2048 | 259 | 260 | ||
2049 | 260 | 261 | ||
2050 | === modified file 'tests/autopilot/unity/tests/test_shortcut_hint.py' | |||
2051 | --- tests/autopilot/unity/tests/test_shortcut_hint.py 2013-02-04 19:54:47 +0000 | |||
2052 | +++ tests/autopilot/unity/tests/test_shortcut_hint.py 2013-05-15 16:01:29 +0000 | |||
2053 | @@ -32,8 +32,8 @@ | |||
2054 | 32 | sleep(1) | 32 | sleep(1) |
2055 | 33 | 33 | ||
2056 | 34 | def skip_if_monitor_too_small(self): | 34 | def skip_if_monitor_too_small(self): |
2059 | 35 | monitor = self.screen_geo.get_primary_monitor() | 35 | monitor = self.display.get_primary_screen() |
2060 | 36 | monitor_geo = self.screen_geo.get_monitor_geometry(monitor) | 36 | monitor_geo = self.display.get_screen_geometry(monitor) |
2061 | 37 | monitor_w = monitor_geo[2] | 37 | monitor_w = monitor_geo[2] |
2062 | 38 | monitor_h = monitor_geo[3] | 38 | monitor_h = monitor_geo[3] |
2063 | 39 | launcher_width = self.unity.launcher.get_launcher_for_monitor(monitor).geometry[2] | 39 | launcher_width = self.unity.launcher.get_launcher_for_monitor(monitor).geometry[2] |
2064 | @@ -51,7 +51,7 @@ | |||
2065 | 51 | def get_launcher(self): | 51 | def get_launcher(self): |
2066 | 52 | # We could parameterise this so all tests run on both monitors (if MM is | 52 | # We could parameterise this so all tests run on both monitors (if MM is |
2067 | 53 | # set up), but I think it's fine to just always use monitor primary monitor: | 53 | # set up), but I think it's fine to just always use monitor primary monitor: |
2069 | 54 | monitor = self.screen_geo.get_primary_monitor() | 54 | monitor = self.display.get_primary_screen() |
2070 | 55 | return self.unity.launcher.get_launcher_for_monitor(monitor) | 55 | return self.unity.launcher.get_launcher_for_monitor(monitor) |
2071 | 56 | 56 | ||
2072 | 57 | 57 | ||
2073 | 58 | 58 | ||
2074 | === modified file 'tests/autopilot/unity/tests/test_showdesktop.py' | |||
2075 | --- tests/autopilot/unity/tests/test_showdesktop.py 2013-02-04 19:54:47 +0000 | |||
2076 | +++ tests/autopilot/unity/tests/test_showdesktop.py 2013-05-15 16:01:29 +0000 | |||
2077 | @@ -27,8 +27,8 @@ | |||
2078 | 27 | 27 | ||
2079 | 28 | def launch_test_apps(self): | 28 | def launch_test_apps(self): |
2080 | 29 | """Launch character map and calculator apps, and return their windows.""" | 29 | """Launch character map and calculator apps, and return their windows.""" |
2083 | 30 | char_win = self.start_app_window('Character Map', locale='C') | 30 | char_win = self.process_manager.start_app_window('Character Map', locale='C') |
2084 | 31 | calc_win = self.start_app_window('Calculator', locale='C') | 31 | calc_win = self.process_manager.start_app_window('Calculator', locale='C') |
2085 | 32 | return (char_win, calc_win) | 32 | return (char_win, calc_win) |
2086 | 33 | 33 | ||
2087 | 34 | def test_showdesktop_hides_apps(self): | 34 | def test_showdesktop_hides_apps(self): |
2088 | 35 | 35 | ||
2089 | === modified file 'tests/autopilot/unity/tests/test_spread.py' | |||
2090 | --- tests/autopilot/unity/tests/test_spread.py 2013-02-04 19:54:47 +0000 | |||
2091 | +++ tests/autopilot/unity/tests/test_spread.py 2013-05-15 16:01:29 +0000 | |||
2092 | @@ -20,11 +20,11 @@ | |||
2093 | 20 | 20 | ||
2094 | 21 | def start_test_application_windows(self, app_name, num_windows=2): | 21 | def start_test_application_windows(self, app_name, num_windows=2): |
2095 | 22 | """Start a given number of windows of the requested application""" | 22 | """Start a given number of windows of the requested application""" |
2097 | 23 | self.close_all_app(app_name) | 23 | self.process_manager.close_all_app(app_name) |
2098 | 24 | windows = [] | 24 | windows = [] |
2099 | 25 | 25 | ||
2100 | 26 | for i in range(num_windows): | 26 | for i in range(num_windows): |
2102 | 27 | win = self.start_app_window(app_name) | 27 | win = self.process_manager.start_app_window(app_name) |
2103 | 28 | if windows: | 28 | if windows: |
2104 | 29 | self.assertThat(win.application, Equals(windows[-1].application)) | 29 | self.assertThat(win.application, Equals(windows[-1].application)) |
2105 | 30 | 30 | ||
2106 | @@ -44,7 +44,7 @@ | |||
2107 | 44 | """Initiate the Spread for windows of the given app""" | 44 | """Initiate the Spread for windows of the given app""" |
2108 | 45 | icon = self.unity.launcher.model.get_icon(desktop_id=desktop_id) | 45 | icon = self.unity.launcher.model.get_icon(desktop_id=desktop_id) |
2109 | 46 | self.assertThat(icon, NotEquals(None)) | 46 | self.assertThat(icon, NotEquals(None)) |
2111 | 47 | launcher = self.unity.launcher.get_launcher_for_monitor(self.screen_geo.get_primary_monitor()) | 47 | launcher = self.unity.launcher.get_launcher_for_monitor(self.display.get_primary_screen()) |
2112 | 48 | 48 | ||
2113 | 49 | self.addCleanup(self.keybinding, "spread/cancel") | 49 | self.addCleanup(self.keybinding, "spread/cancel") |
2114 | 50 | launcher.click_launcher_icon(icon) | 50 | launcher.click_launcher_icon(icon) |
2115 | @@ -57,7 +57,7 @@ | |||
2116 | 57 | 57 | ||
2117 | 58 | def assertWindowIsClosed(self, xid): | 58 | def assertWindowIsClosed(self, xid): |
2118 | 59 | """Assert that a window is not in the list of the open windows""" | 59 | """Assert that a window is not in the list of the open windows""" |
2120 | 60 | refresh_fn = lambda: xid in [w.x_id for w in self.bamf.get_open_windows()] | 60 | refresh_fn = lambda: xid in [w.x_id for w in self.process_manager.get_open_windows()] |
2121 | 61 | self.assertThat(refresh_fn, Eventually(Equals(False))) | 61 | self.assertThat(refresh_fn, Eventually(Equals(False))) |
2122 | 62 | 62 | ||
2123 | 63 | def test_scale_application_windows(self): | 63 | def test_scale_application_windows(self): |
2124 | 64 | 64 | ||
2125 | === modified file 'tests/autopilot/unity/tests/test_switcher.py' | |||
2126 | --- tests/autopilot/unity/tests/test_switcher.py 2013-02-04 19:54:47 +0000 | |||
2127 | +++ tests/autopilot/unity/tests/test_switcher.py 2013-05-15 16:01:29 +0000 | |||
2128 | @@ -8,6 +8,7 @@ | |||
2129 | 8 | 8 | ||
2130 | 9 | from __future__ import absolute_import | 9 | from __future__ import absolute_import |
2131 | 10 | 10 | ||
2132 | 11 | from autopilot.display import move_mouse_to_screen | ||
2133 | 11 | from autopilot.matchers import Eventually | 12 | from autopilot.matchers import Eventually |
2134 | 12 | from autopilot.testcase import multiply_scenarios | 13 | from autopilot.testcase import multiply_scenarios |
2135 | 13 | import logging | 14 | import logging |
2136 | @@ -60,7 +61,7 @@ | |||
2137 | 60 | args = ('Calculator', 'Character Map', 'Character Map') | 61 | args = ('Calculator', 'Character Map', 'Character Map') |
2138 | 61 | windows = [] | 62 | windows = [] |
2139 | 62 | for app in args: | 63 | for app in args: |
2141 | 63 | windows.append(self.start_app_window(app)) | 64 | windows.append(self.process_manager.start_app_window(app)) |
2142 | 64 | 65 | ||
2143 | 65 | return windows | 66 | return windows |
2144 | 66 | 67 | ||
2145 | @@ -77,7 +78,7 @@ | |||
2146 | 77 | 78 | ||
2147 | 78 | def test_switcher_starts_in_normal_mode(self): | 79 | def test_switcher_starts_in_normal_mode(self): |
2148 | 79 | """Switcher must start in normal (i.e.- not details) mode.""" | 80 | """Switcher must start in normal (i.e.- not details) mode.""" |
2150 | 80 | self.start_app("Character Map") | 81 | self.process_manager.start_app("Character Map") |
2151 | 81 | 82 | ||
2152 | 82 | self.unity.switcher.initiate() | 83 | self.unity.switcher.initiate() |
2153 | 83 | self.addCleanup(self.unity.switcher.terminate) | 84 | self.addCleanup(self.unity.switcher.terminate) |
2154 | @@ -97,7 +98,7 @@ | |||
2155 | 97 | 98 | ||
2156 | 98 | def test_application_window_is_fake_decorated(self): | 99 | def test_application_window_is_fake_decorated(self): |
2157 | 99 | """When the switcher is in details mode must not show the focused window title.""" | 100 | """When the switcher is in details mode must not show the focused window title.""" |
2159 | 100 | window = self.start_app_window("Text Editor") | 101 | window = self.process_manager.start_app_window("Text Editor") |
2160 | 101 | self.unity.switcher.initiate() | 102 | self.unity.switcher.initiate() |
2161 | 102 | self.addCleanup(self.unity.switcher.terminate) | 103 | self.addCleanup(self.unity.switcher.terminate) |
2162 | 103 | 104 | ||
2163 | @@ -109,7 +110,7 @@ | |||
2164 | 109 | 110 | ||
2165 | 110 | def test_application_window_is_fake_decorated_in_detail_mode(self): | 111 | def test_application_window_is_fake_decorated_in_detail_mode(self): |
2166 | 111 | """Starting switcher in details mode must not show the focused window title.""" | 112 | """Starting switcher in details mode must not show the focused window title.""" |
2168 | 112 | window = self.start_app_window("Text Editor") | 113 | window = self.process_manager.start_app_window("Text Editor") |
2169 | 113 | self.unity.switcher.initiate(SwitcherMode.DETAIL) | 114 | self.unity.switcher.initiate(SwitcherMode.DETAIL) |
2170 | 114 | self.addCleanup(self.unity.switcher.terminate) | 115 | self.addCleanup(self.unity.switcher.terminate) |
2171 | 115 | 116 | ||
2172 | @@ -178,7 +179,7 @@ | |||
2173 | 178 | open the switcher. | 179 | open the switcher. |
2174 | 179 | 180 | ||
2175 | 180 | """ | 181 | """ |
2177 | 181 | self.start_app("Character Map") | 182 | self.process_manager.start_app("Character Map") |
2178 | 182 | 183 | ||
2179 | 183 | self.keybinding_hold("switcher/reveal_normal") | 184 | self.keybinding_hold("switcher/reveal_normal") |
2180 | 184 | self.addCleanup(self.keybinding_release, "switcher/reveal_normal") | 185 | self.addCleanup(self.keybinding_release, "switcher/reveal_normal") |
2181 | @@ -190,7 +191,7 @@ | |||
2182 | 190 | 191 | ||
2183 | 191 | def test_switcher_cancel(self): | 192 | def test_switcher_cancel(self): |
2184 | 192 | """Pressing the switcher cancel keystroke must cancel the switcher.""" | 193 | """Pressing the switcher cancel keystroke must cancel the switcher.""" |
2186 | 193 | self.start_app("Character Map") | 194 | self.process_manager.start_app("Character Map") |
2187 | 194 | 195 | ||
2188 | 195 | self.unity.switcher.initiate() | 196 | self.unity.switcher.initiate() |
2189 | 196 | self.addCleanup(self.unity.switcher.terminate) | 197 | self.addCleanup(self.unity.switcher.terminate) |
2190 | @@ -201,7 +202,7 @@ | |||
2191 | 201 | 202 | ||
2192 | 202 | def test_lazy_switcher_cancel(self): | 203 | def test_lazy_switcher_cancel(self): |
2193 | 203 | """Must be able to cancel the switcher after a 'lazy' initiation.""" | 204 | """Must be able to cancel the switcher after a 'lazy' initiation.""" |
2195 | 204 | self.start_app("Character Map") | 205 | self.process_manager.start_app("Character Map") |
2196 | 205 | 206 | ||
2197 | 206 | self.keybinding_hold("switcher/reveal_normal") | 207 | self.keybinding_hold("switcher/reveal_normal") |
2198 | 207 | self.addCleanup(self.keybinding_release, "switcher/reveal_normal") | 208 | self.addCleanup(self.keybinding_release, "switcher/reveal_normal") |
2199 | @@ -221,14 +222,14 @@ | |||
2200 | 221 | # TODO - this test fails in multi-monitor setups. You can't use addCleanup | 222 | # TODO - this test fails in multi-monitor setups. You can't use addCleanup |
2201 | 222 | # a better way would be to have a scenario'd class for multi-monitor | 223 | # a better way would be to have a scenario'd class for multi-monitor |
2202 | 223 | # switcher tests. | 224 | # switcher tests. |
2204 | 224 | num_monitors = self.screen_geo.get_num_monitors() | 225 | num_monitors = self.display.get_num_screens() |
2205 | 225 | if num_monitors == 1: | 226 | if num_monitors == 1: |
2206 | 226 | self.skip("No point testing this on one monitor") | 227 | self.skip("No point testing this on one monitor") |
2207 | 227 | 228 | ||
2208 | 228 | charmap, calc, mahjongg = self.start_applications() | 229 | charmap, calc, mahjongg = self.start_applications() |
2209 | 229 | 230 | ||
2210 | 230 | for monitor in range(num_monitors): | 231 | for monitor in range(num_monitors): |
2212 | 231 | self.screen_geo.move_mouse_to_monitor(monitor) | 232 | move_mouse_to_screen(monitor) |
2213 | 232 | self.unity.switcher.initiate() | 233 | self.unity.switcher.initiate() |
2214 | 233 | self.addCleanup(self.unity.switcher.terminate) | 234 | self.addCleanup(self.unity.switcher.terminate) |
2215 | 234 | self.assertThat(self.unity.switcher.monitor, Eventually(Equals(monitor))) | 235 | self.assertThat(self.unity.switcher.monitor, Eventually(Equals(monitor))) |
2216 | @@ -236,7 +237,7 @@ | |||
2217 | 236 | def test_switcher_alt_f4_is_disabled(self): | 237 | def test_switcher_alt_f4_is_disabled(self): |
2218 | 237 | """Tests that alt+f4 does not work while switcher is active.""" | 238 | """Tests that alt+f4 does not work while switcher is active.""" |
2219 | 238 | 239 | ||
2221 | 239 | win = self.start_app_window("Text Editor") | 240 | win = self.process_manager.start_app_window("Text Editor") |
2222 | 240 | 241 | ||
2223 | 241 | self.unity.switcher.initiate() | 242 | self.unity.switcher.initiate() |
2224 | 242 | self.addCleanup(self.unity.switcher.terminate) | 243 | self.addCleanup(self.unity.switcher.terminate) |
2225 | @@ -333,7 +334,7 @@ | |||
2226 | 333 | self.skipTest("This test requires enabled more than one workspace.") | 334 | self.skipTest("This test requires enabled more than one workspace.") |
2227 | 334 | initial_workspace = self.workspace.current_workspace | 335 | initial_workspace = self.workspace.current_workspace |
2228 | 335 | self.addCleanup(self.workspace.switch_to, initial_workspace) | 336 | self.addCleanup(self.workspace.switch_to, initial_workspace) |
2230 | 336 | self.start_app_window("Character Map") | 337 | self.process_manager.start_app_window("Character Map") |
2231 | 337 | self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces) | 338 | self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces) |
2232 | 338 | self.start_applications("Character Map", "Mahjongg") | 339 | self.start_applications("Character Map", "Mahjongg") |
2233 | 339 | 340 | ||
2234 | @@ -366,7 +367,7 @@ | |||
2235 | 366 | """Must be able to switch to details mode using selected scenario keycode. | 367 | """Must be able to switch to details mode using selected scenario keycode. |
2236 | 367 | 368 | ||
2237 | 368 | """ | 369 | """ |
2239 | 369 | self.start_app_window("Character Map") | 370 | self.process_manager.start_app_window("Character Map") |
2240 | 370 | self.unity.switcher.initiate() | 371 | self.unity.switcher.initiate() |
2241 | 371 | self.addCleanup(self.unity.switcher.terminate) | 372 | self.addCleanup(self.unity.switcher.terminate) |
2242 | 372 | 373 | ||
2243 | @@ -379,7 +380,7 @@ | |||
2244 | 379 | must select first item in the model in non-details mode. | 380 | must select first item in the model in non-details mode. |
2245 | 380 | 381 | ||
2246 | 381 | """ | 382 | """ |
2248 | 382 | self.start_app("Character Map") | 383 | self.process_manager.start_app("Character Map") |
2249 | 383 | self.unity.switcher.initiate() | 384 | self.unity.switcher.initiate() |
2250 | 384 | self.addCleanup(self.unity.switcher.terminate) | 385 | self.addCleanup(self.unity.switcher.terminate) |
2251 | 385 | while self.unity.switcher.selection_index < len(self.unity.switcher.icons) - 1: | 386 | while self.unity.switcher.selection_index < len(self.unity.switcher.icons) - 1: |
2252 | @@ -437,9 +438,9 @@ | |||
2253 | 437 | initial_workspace = self.workspace.current_workspace | 438 | initial_workspace = self.workspace.current_workspace |
2254 | 438 | self.addCleanup(self.workspace.switch_to, initial_workspace) | 439 | self.addCleanup(self.workspace.switch_to, initial_workspace) |
2255 | 439 | 440 | ||
2257 | 440 | calc = self.start_app("Calculator") | 441 | calc = self.process_manager.start_app("Calculator") |
2258 | 441 | self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces) | 442 | self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces) |
2260 | 442 | char_map = self.start_app("Character Map") | 443 | char_map = self.process_manager.start_app("Character Map") |
2261 | 443 | 444 | ||
2262 | 444 | self.unity.switcher.initiate() | 445 | self.unity.switcher.initiate() |
2263 | 445 | self.addCleanup(self.unity.switcher.terminate) | 446 | self.addCleanup(self.unity.switcher.terminate) |
2264 | @@ -453,9 +454,9 @@ | |||
2265 | 453 | initial_workspace = self.workspace.current_workspace | 454 | initial_workspace = self.workspace.current_workspace |
2266 | 454 | self.addCleanup(self.workspace.switch_to, initial_workspace) | 455 | self.addCleanup(self.workspace.switch_to, initial_workspace) |
2267 | 455 | 456 | ||
2269 | 456 | calc = self.start_app("Calculator") | 457 | calc = self.process_manager.start_app("Calculator") |
2270 | 457 | self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces) | 458 | self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces) |
2272 | 458 | char_map = self.start_app("Character Map") | 459 | char_map = self.process_manager.start_app("Character Map") |
2273 | 459 | 460 | ||
2274 | 460 | self.unity.switcher.initiate(SwitcherMode.ALL) | 461 | self.unity.switcher.initiate(SwitcherMode.ALL) |
2275 | 461 | self.addCleanup(self.unity.switcher.terminate) | 462 | self.addCleanup(self.unity.switcher.terminate) |
2276 | @@ -477,14 +478,14 @@ | |||
2277 | 477 | # it harder to write the tests. | 478 | # it harder to write the tests. |
2278 | 478 | self.set_unity_option("alt_tab_timeout", False) | 479 | self.set_unity_option("alt_tab_timeout", False) |
2279 | 479 | 480 | ||
2281 | 480 | self.start_app("Character Map") | 481 | self.process_manager.start_app("Character Map") |
2282 | 481 | 482 | ||
2283 | 482 | self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces) | 483 | self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces) |
2285 | 483 | char_win2 = self.start_app_window("Character Map") | 484 | char_win2 = self.process_manager.start_app_window("Character Map") |
2286 | 484 | self.keybinding("window/minimize") | 485 | self.keybinding("window/minimize") |
2287 | 485 | self.assertProperty(char_win2, is_hidden=True) | 486 | self.assertProperty(char_win2, is_hidden=True) |
2288 | 486 | 487 | ||
2290 | 487 | self.start_app("Calculator") | 488 | self.process_manager.start_app("Calculator") |
2291 | 488 | 489 | ||
2292 | 489 | self.unity.switcher.initiate() | 490 | self.unity.switcher.initiate() |
2293 | 490 | while self.unity.switcher.current_icon.tooltip_text != char_win2.application.name: | 491 | while self.unity.switcher.current_icon.tooltip_text != char_win2.application.name: |
I have built this branch in a VM and run the Unity Autopilot tests to make sure I didn't miss anything.
(pass rate wasn't 100% but I expected that (in a VM) and none of the errors are due to this update).