Merge lp:~veebers/unity/merge_updated_autopilot_tests_for_1.3 into lp:~unity-team/unity/libunity-7.0-breakage

Proposed by Christopher Lee
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
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.

To post a comment you must log in.
Revision history for this message
Christopher Lee (veebers) wrote :

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).

Revision history for this message
Paweł Stołowski (stolowski) wrote :

Looks good.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
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).

Revision history for this message
Paweł Stołowski (stolowski) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2013-05-09 16:26:04 +0000
+++ plugins/unityshell/src/unityshell.cpp 2013-05-15 16:01:29 +0000
@@ -2505,7 +2505,7 @@
2505 uScreen->windows_for_monitor_[monitor] = 1;2505 uScreen->windows_for_monitor_[monitor] = 1;
25062506
2507 if (!(mask & nonOcclusionBits) &&2507 if (!(mask & nonOcclusionBits) &&
2508 (window->state() & CompWindowStateFullscreenMask) &&2508 (window->state() & CompWindowStateFullscreenMask && !window->minimized()) &&
2509 uScreen->windows_for_monitor_[monitor] == 1)2509 uScreen->windows_for_monitor_[monitor] == 1)
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:
2511 // && (attrib.opacity == OPAQUE)) <-- Doesn't work; Only set in glDraw2511 // && (attrib.opacity == OPAQUE)) <-- Doesn't work; Only set in glDraw
25122512
=== added file 'tests/autopilot/unity/emulators/X11.py'
--- tests/autopilot/unity/emulators/X11.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/unity/emulators/X11.py 2013-05-15 16:01:29 +0000
@@ -0,0 +1,115 @@
1from __future__ import absolute_import
2
3from autopilot.utilities import Silence
4from autopilot.display import Display
5from autopilot.input import Mouse, Keyboard
6from autopilot.process import Window
7
8import logging
9import subprocess
10from Xlib import X, display, protocol
11
12
13logger = logging.getLogger(__name__)
14
15_display = None
16
17_blacklisted_drivers = ["NVIDIA"]
18
19def _get_display():
20 """Get a Xlib display object. Creating the display prints garbage to stdout."""
21 global _display
22 if _display is None:
23 with Silence():
24 _display = display.Display()
25 return _display
26
27def _getProperty(_type, win=None):
28 if not win:
29 win = _get_display().screen().root
30 atom = win.get_full_property(_get_display().get_atom(_type), X.AnyPropertyType)
31 if atom: return atom.value
32
33def get_desktop_viewport():
34 """Get the x,y coordinates for the current desktop viewport top-left corner."""
35 return _getProperty('_NET_DESKTOP_VIEWPORT')
36
37
38# Note: this use to exist within autopilot, moved here due to Autopilot 1.3
39# upgrade.
40def drag_window_to_screen(window, screen):
41 """Drags *window* to *screen*
42
43 :param autopilot.process.Window window: The window to drag
44 :param integer screen: The screen to drag the *window* to
45 :raises: **TypeError** if *window* is not a autopilot.process.Window
46
47 """
48 if not isinstance(window, Window):
49 raise TypeError("Window must be a autopilot.process.Window")
50
51 if window.monitor == screen:
52 logger.debug("Window %r is already on screen %d." % (window.x_id, screen))
53 return
54
55 assert(not window.is_maximized)
56 (win_x, win_y, win_w, win_h) = window.geometry
57 (mx, my, mw, mh) = Display.create().get_screen_geometry(screen)
58
59 logger.debug("Dragging window %r to screen %d." % (window.x_id, screen))
60
61 mouse = Mouse.create()
62 keyboard = Keyboard.create()
63 mouse.move(win_x + win_w/2, win_y + win_h/2)
64 keyboard.press("Alt")
65 mouse.press()
66 keyboard.release("Alt")
67
68 # We do the movements in two steps, to reduce the risk of being
69 # blocked by the pointer barrier
70 target_x = mx + mw/2
71 target_y = my + mh/2
72 mouse.move(win_x, target_y, rate=20, time_between_events=0.005)
73 mouse.move(target_x, target_y, rate=20, time_between_events=0.005)
74 mouse.release()
75
76
77# Note: this use to exist within autopilot, moved here due to Autopilot 1.3
78# upgrade.
79def set_primary_monitor(monitor):
80 """Set *monitor* to be the primary monitor.
81
82 :param int monitor: Must be between 0 and the number of configured
83 monitors.
84 :raises: **ValueError** if an invalid monitor is specified.
85 :raises: **BlacklistedDriverError** if your video driver does not
86 support this.
87
88 """
89 try:
90 glxinfo_out = subprocess.check_output("glxinfo")
91 except OSError, e:
92 raise OSError("Failed to run glxinfo: %s. (do you have mesa-utils installed?)" % e)
93
94 for dri in _blacklisted_drivers:
95 if dri in glxinfo_out:
96 raise Display.BlacklistedDriverError('Impossible change the primary monitor for the given driver')
97
98 num_monitors = Display.create().get_num_screens()
99 if monitor < 0 or monitor >= num_monitors:
100 raise ValueError('Monitor %d is not in valid range of 0 <= monitor < %d.' % (num_monitors))
101
102 default_screen = Gdk.Screen.get_default()
103 monitor_name = default_screen.get_monitor_plug_name(monitor)
104
105 if not monitor_name:
106 raise ValueError('Could not get monitor name from monitor number %d.' % (monitor))
107
108 ret = os.spawnlp(os.P_WAIT, "xrandr", "xrandr", "--output", monitor_name, "--primary")
109
110 if ret != 0:
111 raise RuntimeError('Xrandr can\'t set the primary monitor. error code: %d' % (ret))
112
113def reset_display():
114 from autopilot.input._X11 import reset_display
115 reset_display()
0116
=== modified file 'tests/autopilot/unity/emulators/__init__.py'
--- tests/autopilot/unity/emulators/__init__.py 2012-09-24 02:59:48 +0000
+++ tests/autopilot/unity/emulators/__init__.py 2013-05-15 16:01:29 +0000
@@ -12,6 +12,7 @@
12from time import sleep12from time import sleep
1313
14from autopilot.introspection.dbus import DBusIntrospectionObject14from autopilot.introspection.dbus import DBusIntrospectionObject
15from autopilot.introspection.backends import DBusAddress
1516
1617
17class UnityIntrospectionObject(DBusIntrospectionObject):18class UnityIntrospectionObject(DBusIntrospectionObject):
@@ -19,6 +20,8 @@
19 DBUS_SERVICE = "com.canonical.Unity"20 DBUS_SERVICE = "com.canonical.Unity"
20 DBUS_OBJECT = "/com/canonical/Unity/Debug"21 DBUS_OBJECT = "/com/canonical/Unity/Debug"
2122
23 _Backend = DBusAddress.SessionBus(DBUS_SERVICE, DBUS_OBJECT)
24
2225
23def ensure_unity_is_running(timeout=300):26def ensure_unity_is_running(timeout=300):
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.
2528
=== added file 'tests/autopilot/unity/emulators/compiz.py'
--- tests/autopilot/unity/emulators/compiz.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/unity/emulators/compiz.py 2013-05-15 16:01:29 +0000
@@ -0,0 +1,63 @@
1from __future__ import absolute_import
2
3"""Functions that wrap compizconfig to avoid some unpleasantness in that module."""
4
5from __future__ import absolute_import
6
7from autopilot.utilities import Silence
8
9_global_context = None
10
11def get_global_context():
12 """Get the compizconfig global context object."""
13 global _global_context
14 if _global_context is None:
15 with Silence():
16 from compizconfig import Context
17 _global_context = Context()
18 return _global_context
19
20
21def _get_plugin(plugin_name):
22 """Get a compizconfig plugin with the specified name.
23
24 Raises KeyError of the plugin named does not exist.
25
26 """
27 ctx = get_global_context()
28 with Silence():
29 try:
30 return ctx.Plugins[plugin_name]
31 except KeyError:
32 raise KeyError("Compiz plugin '%s' does not exist." % (plugin_name))
33
34
35def get_compiz_setting(plugin_name, setting_name):
36 """Get a compiz setting object.
37
38 *plugin_name* is the name of the plugin (e.g. 'core' or 'unityshell')
39 *setting_name* is the name of the setting (e.g. 'alt_tab_timeout')
40
41 :raises: KeyError if the plugin or setting named does not exist.
42
43 :returns: a compiz setting object.
44
45 """
46 plugin = _get_plugin(plugin_name)
47 with Silence():
48 try:
49 return plugin.Screen[setting_name]
50 except KeyError:
51 raise KeyError("Compiz setting '%s' does not exist in plugin '%s'." % (setting_name, plugin_name))
52
53
54def get_compiz_option(plugin_name, setting_name):
55 """Get a compiz setting value.
56
57 This is the same as calling:
58
59 >>> get_compiz_setting(plugin_name, setting_name).Value
60
61 """
62 return get_compiz_setting(plugin_name, setting_name).Value
63
064
=== modified file 'tests/autopilot/unity/emulators/dash.py'
--- tests/autopilot/unity/emulators/dash.py 2013-05-01 22:40:19 +0000
+++ tests/autopilot/unity/emulators/dash.py 2013-05-15 16:01:29 +0000
@@ -9,8 +9,8 @@
99
10from __future__ import absolute_import10from __future__ import absolute_import
1111
12from autopilot.input import Keyboard, Mouse
1213
13from autopilot.emulators.input import get_keyboard, get_mouse
14from autopilot.keybindings import KeybindingsHelper14from autopilot.keybindings import KeybindingsHelper
15from testtools.matchers import GreaterThan15from testtools.matchers import GreaterThan
1616
@@ -28,8 +28,8 @@
2828
29 def __init__(self, *args, **kwargs):29 def __init__(self, *args, **kwargs):
30 super(DashController, self).__init__(*args, **kwargs)30 super(DashController, self).__init__(*args, **kwargs)
31 self.keyboard = get_keyboard()31 self.keyboard = Keyboard.create()
32 self.mouse = get_mouse()32 self.mouse = Mouse.create()
3333
34 def get_dash_view(self):34 def get_dash_view(self):
35 """Get the dash view that's attached to this controller."""35 """Get the dash view that's attached to this controller."""
@@ -91,7 +91,7 @@
91 def preview_animation(self):91 def preview_animation(self):
92 """Returns the average progress of dash slip and animating a preview.92 """Returns the average progress of dash slip and animating a preview.
93 Between 0.0 and 1.0.93 Between 0.0 and 1.0.
94 94
95 """95 """
96 return self.view.preview_animation;96 return self.view.preview_animation;
9797
@@ -278,38 +278,33 @@
278class Result(UnityIntrospectionObject):278class Result(UnityIntrospectionObject):
279 """A single result in the dash."""279 """A single result in the dash."""
280280
281 def __init__(self, *args, **kwargs):
282 super(Result, self).__init__(*args, **kwargs)
283 self.mouse = get_mouse()
284 self.keyboard = get_keyboard()
285
286 def activate(self, double_click=True):281 def activate(self, double_click=True):
287 tx = self.x + (self.width / 2)282 tx = self.x + (self.width / 2)
288 ty = self.y + (self.height / 2)283 ty = self.y + (self.height / 2)
289 self.mouse.move(tx, ty)284 m = Mouse.create()
290 self.mouse.click(1)285 m.move(tx, ty)
286 m.click(1)
291 if double_click:287 if double_click:
292 self.mouse.click(1)288 m.click(1)
293289
294 def preview(self, button=1):290 def preview(self, button=1):
295 tx = self.x + (self.width / 2)291 tx = self.x + (self.width / 2)
296 ty = self.y + (self.height / 2)292 ty = self.y + (self.height / 2)
297 self.mouse.move(tx, ty)293 m = Mouse.create()
298 self.mouse.click(button)294 m.move(tx, ty)
295 m.click(button)
299296
300 def preview_key(self):297 def preview_key(self):
301 tx = self.x + (self.width / 2)298 tx = self.x + (self.width / 2)
302 ty = self.y + (self.height / 2)299 ty = self.y + (self.height / 2)
303 self.mouse.move(tx, ty)300 m = Mouse.create()
301 m.move(tx, ty)
304302
305 self.keyboard.press_and_release('Menu')303 k = Keyboard.create()
304 k.press_and_release('Menu')
306305
307class FilterBar(UnityIntrospectionObject):306class FilterBar(UnityIntrospectionObject):
308 """A filterbar, as shown inside a scope."""307 """A filterbar, as shown inside a lens."""
309
310 def __init__(self, *args, **kwargs):
311 super(FilterBar, self).__init__(*args, **kwargs)
312 self.mouse = get_mouse()
313308
314 def get_num_filters(self):309 def get_num_filters(self):
315 """Get the number of filters in this filter bar."""310 """Get the number of filters in this filter bar."""
@@ -337,8 +332,9 @@
337 searchbar = self._get_searchbar()332 searchbar = self._get_searchbar()
338 tx = searchbar.filter_label_x + (searchbar.filter_label_width / 2)333 tx = searchbar.filter_label_x + (searchbar.filter_label_width / 2)
339 ty = searchbar.filter_label_y + (searchbar.filter_label_height / 2)334 ty = searchbar.filter_label_y + (searchbar.filter_label_height / 2)
340 self.mouse.move(tx, ty)335 m = Mouse.create()
341 self.mouse.click()336 m.move(tx, ty)
337 m.click()
342 self.expanded.wait_for(True)338 self.expanded.wait_for(True)
343339
344 def ensure_collapsed(self):340 def ensure_collapsed(self):
@@ -347,8 +343,9 @@
347 searchbar = self._get_searchbar()343 searchbar = self._get_searchbar()
348 tx = searchbar.filter_label_x + (searchbar.filter_label_width / 2)344 tx = searchbar.filter_label_x + (searchbar.filter_label_width / 2)
349 ty = searchbar.filter_label_y + (searchbar.filter_label_height / 2)345 ty = searchbar.filter_label_y + (searchbar.filter_label_height / 2)
350 self.mouse.move(tx, ty)346 m = Mouse.create()
351 self.mouse.click()347 m.move(tx, ty)
348 m.click()
352 self.expanded.wait_for(False)349 self.expanded.wait_for(False)
353350
354 def _get_searchbar(self):351 def _get_searchbar(self):
@@ -366,17 +363,14 @@
366class FilterExpanderLabel(UnityIntrospectionObject):363class FilterExpanderLabel(UnityIntrospectionObject):
367 """A label that expands into a filter within a filter bar."""364 """A label that expands into a filter within a filter bar."""
368365
369 def __init__(self, *args, **kwargs):
370 super(FilterExpanderLabel, self).__init__(*args, **kwargs)
371 self.mouse = get_mouse()
372
373 def ensure_expanded(self):366 def ensure_expanded(self):
374 """Expand the filter expander label, if it's not already"""367 """Expand the filter expander label, if it's not already"""
375 if not self.expanded:368 if not self.expanded:
376 tx = self.x + self.width / 2369 tx = self.x + self.width / 2
377 ty = self.y + self.height / 2370 ty = self.y + self.height / 2
378 self.mouse.move(tx, ty)371 m = Mouse.create()
379 self.mouse.click()372 m.move(tx, ty)
373 m.click()
380 self.expanded.wait_for(True)374 self.expanded.wait_for(True)
381375
382 def ensure_collapsed(self):376 def ensure_collapsed(self):
@@ -384,8 +378,9 @@
384 if self.expanded:378 if self.expanded:
385 tx = self.x + self.width / 2379 tx = self.x + self.width / 2
386 ty = self.y + self.height / 2380 ty = self.y + self.height / 2
387 self.mouse.move(tx, ty)381 m = Mouse.create()
388 self.mouse.click()382 m.move(tx, ty)
383 m.click()
389 self.expanded.wait_for(False)384 self.expanded.wait_for(False)
390385
391386
@@ -419,8 +414,9 @@
419 if action:414 if action:
420 tx = action.x + (searchbar.width / 2)415 tx = action.x + (searchbar.width / 2)
421 ty = action.y + (searchbar.height / 2)416 ty = action.y + (searchbar.height / 2)
422 self.mouse.move(tx, ty)417 m = Mouse.create()
423 self.mouse.click()418 m.move(tx, ty)
419 m.click()
424420
425 @property421 @property
426 def cover_art(self):422 def cover_art(self):
@@ -468,10 +464,6 @@
468class PreviewContainer(UnityIntrospectionObject):464class PreviewContainer(UnityIntrospectionObject):
469 """A container view for the main dash preview widget."""465 """A container view for the main dash preview widget."""
470466
471 def __init__(self, *args, **kwargs):
472 super(PreviewContainer, self).__init__(*args, **kwargs)
473 self.mouse = get_mouse()
474
475 @property467 @property
476 def content(self):468 def content(self):
477 return self.get_content()469 return self.get_content()
@@ -507,13 +499,14 @@
507499
508 tx = navigator.button_x + (navigator.button_width / 2)500 tx = navigator.button_x + (navigator.button_width / 2)
509 ty = navigator.button_y + (navigator.button_height / 2)501 ty = navigator.button_y + (navigator.button_height / 2)
510 self.mouse.move(tx, ty)502 m = Mouse.create()
503 m.move(tx, ty)
511504
512 old_preview_initiate_count = self.preview_initiate_count505 old_preview_initiate_count = self.preview_initiate_count
513506
514 for i in range(count):507 for i in range(count):
515 self.navigate_left_enabled.wait_for(True)508 self.navigate_left_enabled.wait_for(True)
516 self.mouse.click()509 m.click()
517 self.preview_initiate_count.wait_for(GreaterThan(old_preview_initiate_count))510 self.preview_initiate_count.wait_for(GreaterThan(old_preview_initiate_count))
518 old_preview_initiate_count = self.preview_initiate_count511 old_preview_initiate_count = self.preview_initiate_count
519512
@@ -523,13 +516,14 @@
523516
524 tx = navigator.button_x + (navigator.button_width / 2)517 tx = navigator.button_x + (navigator.button_width / 2)
525 ty = navigator.button_y + (navigator.button_height / 2)518 ty = navigator.button_y + (navigator.button_height / 2)
526 self.mouse.move(tx, ty)519 m = Mouse.create()
520 m.move(tx, ty)
527521
528 old_preview_initiate_count = self.preview_initiate_count522 old_preview_initiate_count = self.preview_initiate_count
529523
530 for i in range(count):524 for i in range(count):
531 self.navigate_right_enabled.wait_for(True)525 self.navigate_right_enabled.wait_for(True)
532 self.mouse.click()526 m.click()
533 self.preview_initiate_count.wait_for(GreaterThan(old_preview_initiate_count))527 self.preview_initiate_count.wait_for(GreaterThan(old_preview_initiate_count))
534 old_preview_initiate_count = self.preview_initiate_count528 old_preview_initiate_count = self.preview_initiate_count
535529
536530
=== modified file 'tests/autopilot/unity/emulators/hud.py'
--- tests/autopilot/unity/emulators/hud.py 2013-03-20 15:21:51 +0000
+++ tests/autopilot/unity/emulators/hud.py 2013-05-15 16:01:29 +0000
@@ -9,7 +9,7 @@
99
10from __future__ import absolute_import10from __future__ import absolute_import
1111
12from autopilot.emulators.input import get_keyboard12from autopilot.input import Keyboard
13from autopilot.keybindings import KeybindingsHelper13from autopilot.keybindings import KeybindingsHelper
14from HTMLParser import HTMLParser14from HTMLParser import HTMLParser
15import re15import re
@@ -24,7 +24,7 @@
2424
25 def __init__(self, *args, **kwargs):25 def __init__(self, *args, **kwargs):
26 super(HudController, self).__init__(*args, **kwargs)26 super(HudController, self).__init__(*args, **kwargs)
27 self.keyboard = get_keyboard()27 self.keyboard = Keyboard.create()
2828
29 def get_hud_view(self):29 def get_hud_view(self):
30 views = self.get_children_by_type(HudView)30 views = self.get_children_by_type(HudView)
3131
=== modified file 'tests/autopilot/unity/emulators/launcher.py'
--- tests/autopilot/unity/emulators/launcher.py 2013-03-21 11:36:49 +0000
+++ tests/autopilot/unity/emulators/launcher.py 2013-05-15 16:01:29 +0000
@@ -9,10 +9,9 @@
99
10from __future__ import absolute_import10from __future__ import absolute_import
1111
12from autopilot.emulators.input import get_mouse12from autopilot.input import Mouse
13from autopilot.emulators.X11 import ScreenGeometry13from autopilot.display import Display, move_mouse_to_screen
14from autopilot.keybindings import KeybindingsHelper14from autopilot.keybindings import KeybindingsHelper
15from autopilot.utilities import get_compiz_option
16import logging15import logging
17from testtools.matchers import NotEquals16from testtools.matchers import NotEquals
18from time import sleep17from time import sleep
@@ -26,6 +25,8 @@
26 TrashLauncherIcon,25 TrashLauncherIcon,
27 )26 )
2827
28from unity.emulators.compiz import get_compiz_option
29
29logger = logging.getLogger(__name__)30logger = logging.getLogger(__name__)
3031
3132
@@ -68,8 +69,8 @@
68 self.in_keynav_mode = False69 self.in_keynav_mode = False
69 self.in_switcher_mode = False70 self.in_switcher_mode = False
7071
71 self._mouse = get_mouse()72 self._mouse = Mouse.create()
72 self._screen = ScreenGeometry()73 self._display = Display.create()
7374
74 def _perform_key_nav_binding(self, keybinding):75 def _perform_key_nav_binding(self, keybinding):
75 if not self.in_keynav_mode:76 if not self.in_keynav_mode:
@@ -101,7 +102,7 @@
101102
102 def move_mouse_to_right_of_launcher(self):103 def move_mouse_to_right_of_launcher(self):
103 """Places the mouse to the right of this launcher."""104 """Places the mouse to the right of this launcher."""
104 self._screen.move_mouse_to_monitor(self.monitor)105 move_mouse_to_screen(self.monitor)
105 (x, y, w, h) = self.geometry106 (x, y, w, h) = self.geometry
106 target_x = x + w + 10107 target_x = x + w + 10
107 target_y = y + h / 2108 target_y = y + h / 2
@@ -112,7 +113,7 @@
112113
113 def move_mouse_over_launcher(self):114 def move_mouse_over_launcher(self):
114 """Move the mouse over this launcher."""115 """Move the mouse over this launcher."""
115 self._screen.move_mouse_to_monitor(self.monitor)116 move_mouse_to_screen(self.monitor)
116 (x, y, w, h) = self.geometry117 (x, y, w, h) = self.geometry
117 target_x = x + w / 2118 target_x = x + w / 2
118 target_y = y + h / 2119 target_y = y + h / 2
@@ -137,7 +138,7 @@
137 """138 """
138 if self.is_showing:139 if self.is_showing:
139 return140 return
140 self._screen.move_mouse_to_monitor(self.monitor)141 move_mouse_to_screen(self.monitor)
141 (x, y, w, h) = self.geometry142 (x, y, w, h) = self.geometry
142143
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.
@@ -148,14 +149,14 @@
148149
149 def keyboard_reveal_launcher(self):150 def keyboard_reveal_launcher(self):
150 """Reveal this launcher using the keyboard."""151 """Reveal this launcher using the keyboard."""
151 self._screen.move_mouse_to_monitor(self.monitor)152 move_mouse_to_screen(self.monitor)
152 logger.debug("Revealing launcher with keyboard.")153 logger.debug("Revealing launcher with keyboard.")
153 self.keybinding_hold("launcher/reveal")154 self.keybinding_hold("launcher/reveal")
154 self.is_showing.wait_for(True)155 self.is_showing.wait_for(True)
155156
156 def keyboard_unreveal_launcher(self):157 def keyboard_unreveal_launcher(self):
157 """Un-reveal this launcher using the keyboard."""158 """Un-reveal this launcher using the keyboard."""
158 self._screen.move_mouse_to_monitor(self.monitor)159 move_mouse_to_screen(self.monitor)
159 logger.debug("Un-revealing launcher with keyboard.")160 logger.debug("Un-revealing launcher with keyboard.")
160 self.keybinding_release("launcher/reveal")161 self.keybinding_release("launcher/reveal")
161 # only wait if the launcher is set to autohide162 # only wait if the launcher is set to autohide
@@ -210,7 +211,7 @@
210211
211 def key_nav_start(self):212 def key_nav_start(self):
212 """Start keyboard navigation mode by pressing Alt+F1."""213 """Start keyboard navigation mode by pressing Alt+F1."""
213 self._screen.move_mouse_to_monitor(self.monitor)214 move_mouse_to_screen(self.monitor)
214 logger.debug("Initiating launcher keyboard navigation with Alt+F1.")215 logger.debug("Initiating launcher keyboard navigation with Alt+F1.")
215 self.keybinding("launcher/keynav")216 self.keybinding("launcher/keynav")
216 self._get_controller().key_nav_is_active.wait_for(True)217 self._get_controller().key_nav_is_active.wait_for(True)
@@ -255,7 +256,7 @@
255256
256 def switcher_start(self):257 def switcher_start(self):
257 """Start the super+Tab switcher on this launcher."""258 """Start the super+Tab switcher on this launcher."""
258 self._screen.move_mouse_to_monitor(self.monitor)259 move_mouse_to_screen(self.monitor)
259 logger.debug("Starting Super+Tab switcher.")260 logger.debug("Starting Super+Tab switcher.")
260 self.keybinding_hold_part_then_tap("launcher/switcher")261 self.keybinding_hold_part_then_tap("launcher/switcher")
261 self._get_controller().key_nav_is_active.wait_for(True)262 self._get_controller().key_nav_is_active.wait_for(True)
262263
=== modified file 'tests/autopilot/unity/emulators/panel.py'
--- tests/autopilot/unity/emulators/panel.py 2013-03-20 15:21:51 +0000
+++ tests/autopilot/unity/emulators/panel.py 2013-05-15 16:01:29 +0000
@@ -12,7 +12,7 @@
12import logging12import logging
13from time import sleep13from time import sleep
1414
15from autopilot.emulators.input import get_mouse15from autopilot.input import Mouse
16from autopilot.keybindings import KeybindingsHelper16from autopilot.keybindings import KeybindingsHelper
1717
18from unity.emulators import UnityIntrospectionObject18from unity.emulators import UnityIntrospectionObject
@@ -53,7 +53,7 @@
5353
54 def __init__(self, *args, **kwargs):54 def __init__(self, *args, **kwargs):
55 super(UnityPanel, self).__init__(*args, **kwargs)55 super(UnityPanel, self).__init__(*args, **kwargs)
56 self._mouse = get_mouse()56 self._mouse = Mouse.create()
5757
58 def __get_menu_view(self):58 def __get_menu_view(self):
59 """Return the menu view."""59 """Return the menu view."""
@@ -261,7 +261,7 @@
261261
262 def __init__(self, *args, **kwargs):262 def __init__(self, *args, **kwargs):
263 super(WindowButton, self).__init__(*args, **kwargs)263 super(WindowButton, self).__init__(*args, **kwargs)
264 self._mouse = get_mouse()264 self._mouse = Mouse.create()
265265
266 def mouse_move_to(self):266 def mouse_move_to(self):
267 target_x = self.x + self.width / 2267 target_x = self.x + self.width / 2
@@ -319,7 +319,7 @@
319319
320 def __init__(self, *args, **kwargs):320 def __init__(self, *args, **kwargs):
321 super(IndicatorEntry, self).__init__(*args, **kwargs)321 super(IndicatorEntry, self).__init__(*args, **kwargs)
322 self._mouse = get_mouse()322 self._mouse = Mouse.create()
323323
324 def mouse_move_to(self):324 def mouse_move_to(self):
325 target_x = self.x + self.width / 2325 target_x = self.x + self.width / 2
326326
=== modified file 'tests/autopilot/unity/emulators/quicklist.py'
--- tests/autopilot/unity/emulators/quicklist.py 2013-03-20 15:21:51 +0000
+++ tests/autopilot/unity/emulators/quicklist.py 2013-05-15 16:01:29 +0000
@@ -11,7 +11,7 @@
1111
12import logging12import logging
1313
14from autopilot.emulators.input import get_mouse14from autopilot.input import Mouse
1515
16from unity.emulators import UnityIntrospectionObject16from unity.emulators import UnityIntrospectionObject
1717
@@ -21,10 +21,6 @@
21class Quicklist(UnityIntrospectionObject):21class Quicklist(UnityIntrospectionObject):
22 """Represents a quicklist."""22 """Represents a quicklist."""
2323
24 def __init__(self, *args, **kwargs):
25 super(Quicklist, self).__init__(*args, **kwargs)
26 self._mouse = get_mouse()
27
28 @property24 @property
29 def items(self):25 def items(self):
30 """Individual items in the quicklist."""26 """Individual items in the quicklist."""
@@ -60,7 +56,7 @@
60 logger.debug("Moving mouse outside the quicklist %r", self)56 logger.debug("Moving mouse outside the quicklist %r", self)
61 target_x = self.x + self.width + 1057 target_x = self.x + self.width + 10
62 target_y = self.y + self.height / 258 target_y = self.y + self.height / 2
63 self._mouse.move(target_x, target_y, animate=False)59 Mouse.create().move(target_x, target_y, animate=False)
6460
65 @property61 @property
66 def selected_item(self):62 def selected_item(self):
@@ -79,7 +75,7 @@
7975
80 def __init__(self, *args, **kwargs):76 def __init__(self, *args, **kwargs):
81 super(QuicklistMenuItem, self).__init__(*args, **kwargs)77 super(QuicklistMenuItem, self).__init__(*args, **kwargs)
82 self._mouse = get_mouse()78 self._mouse = Mouse.create()
8379
84 @property80 @property
85 def geometry(self):81 def geometry(self):
8682
=== modified file 'tests/autopilot/unity/emulators/switcher.py'
--- tests/autopilot/unity/emulators/switcher.py 2013-03-20 15:21:51 +0000
+++ tests/autopilot/unity/emulators/switcher.py 2013-05-15 16:01:29 +0000
@@ -11,7 +11,7 @@
1111
12import logging12import logging
1313
14from autopilot.emulators.input import get_mouse14from autopilot.input import Mouse
15from autopilot.keybindings import KeybindingsHelper15from autopilot.keybindings import KeybindingsHelper
1616
17from unity.emulators import UnityIntrospectionObject17from unity.emulators import UnityIntrospectionObject
@@ -45,7 +45,7 @@
4545
46 def __init__(self, *args, **kwargs):46 def __init__(self, *args, **kwargs):
47 super(SwitcherController, self).__init__(*args, **kwargs)47 super(SwitcherController, self).__init__(*args, **kwargs)
48 self._mouse = get_mouse()48 self._mouse = Mouse.create()
4949
50 def get_switcher_view(self):50 def get_switcher_view(self):
51 views = self.get_children_by_type(SwitcherView)51 views = self.get_children_by_type(SwitcherView)
5252
=== modified file 'tests/autopilot/unity/emulators/workspace.py'
--- tests/autopilot/unity/emulators/workspace.py 2012-08-29 04:27:50 +0000
+++ tests/autopilot/unity/emulators/workspace.py 2013-05-15 16:01:29 +0000
@@ -9,13 +9,11 @@
99
10from __future__ import absolute_import10from __future__ import absolute_import
1111
12
13from autopilot.keybindings import KeybindingsHelper12from autopilot.keybindings import KeybindingsHelper
14from autopilot.utilities import (13from autopilot.display import Display
15 get_compiz_option,14
16 get_desktop_geometry,15from unity.emulators.compiz import get_compiz_option
17 get_desktop_viewport,16from unity.emulators.X11 import get_desktop_viewport
18 )
1917
2018
21class WorkspaceManager(KeybindingsHelper):19class WorkspaceManager(KeybindingsHelper):
@@ -40,9 +38,8 @@
40 """Re-read information about available workspaces from compiz and X11."""38 """Re-read information about available workspaces from compiz and X11."""
41 self._workspaces_wide = get_compiz_option("core", "hsize")39 self._workspaces_wide = get_compiz_option("core", "hsize")
42 self._workspaces_high = get_compiz_option("core", "vsize")40 self._workspaces_high = get_compiz_option("core", "vsize")
43 self._desktop_width, self.desktop_height = get_desktop_geometry()41 # Note: only gets the viewport for the first monitor.
44 self._viewport_width = self._desktop_width / self._workspaces_wide42 _, _, self._viewport_width, self._viewport_height = Display.create().get_screen_geometry(0)
45 self._viewport_height = self.desktop_height / self._workspaces_high
4643
47 def switch_to(self, workspace_num):44 def switch_to(self, workspace_num):
48 """Switch to the workspace specified.45 """Switch to the workspace specified.
4946
=== modified file 'tests/autopilot/unity/tests/__init__.py'
--- tests/autopilot/unity/tests/__init__.py 2013-04-17 12:41:39 +0000
+++ tests/autopilot/unity/tests/__init__.py 2013-05-15 16:01:29 +0000
@@ -26,6 +26,8 @@
26 HAVE_WINDOWMOCKER=True26 HAVE_WINDOWMOCKER=True
27except ImportError:27except ImportError:
28 HAVE_WINDOWMOCKER=False28 HAVE_WINDOWMOCKER=False
29from subprocess import check_output
30import time
29import tempfile31import tempfile
30from testtools.content import text_content32from testtools.content import text_content
31from testtools.matchers import Equals33from testtools.matchers import Equals
@@ -33,12 +35,14 @@
3335
34from unity.emulators import ensure_unity_is_running36from unity.emulators import ensure_unity_is_running
35from unity.emulators.workspace import WorkspaceManager37from unity.emulators.workspace import WorkspaceManager
38from unity.emulators.compiz import get_compiz_setting, get_global_context
36from unity.emulators.unity import (39from unity.emulators.unity import (
37 set_log_severity,40 set_log_severity,
38 start_log_to_file,41 start_log_to_file,
39 reset_logging,42 reset_logging,
40 Unity43 Unity
41 )44 )
45from unity.emulators.X11 import reset_display
4246
43from Xlib import display47from Xlib import display
44from Xlib import Xutil48from Xlib import Xutil
@@ -115,7 +119,7 @@
115 #119 #
116 # In the event that this doesn't work, wait_for will throw an120 # In the event that this doesn't work, wait_for will throw an
117 # exception.121 # exception.
118 win = self.start_app_window('Calculator', locale='C')122 win = self.process_manager.start_app_window('Calculator', locale='C')
119 count = 1123 count = 1
120 while self.unity.window_manager.showdesktop_active:124 while self.unity.window_manager.showdesktop_active:
121 self.keybinding("window/show_desktop")125 self.keybinding("window/show_desktop")
@@ -204,8 +208,8 @@
204208
205 This uses the 'window-mocker' application, which is not part of the209 This uses the 'window-mocker' application, which is not part of the
206 python-autopilot or unity-autopilot packages. To use this method, you210 python-autopilot or unity-autopilot packages. To use this method, you
207 must have python-windowmocker installed. If the package is not installed, 211 must have python-windowmocker installed. If the package is not installed,
208 this method will raise a SkipTest exception, causing the calling test 212 this method will raise a SkipTest exception, causing the calling test
209 to be silently skipped.213 to be silently skipped.
210214
211 window_spec is a list or dictionary that conforms to the window-mocker215 window_spec is a list or dictionary that conforms to the window-mocker
@@ -215,8 +219,8 @@
215 if not HAVE_WINDOWMOCKER:219 if not HAVE_WINDOWMOCKER:
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.")
217221
218 if 'Window Mocker' not in self.KNOWN_APPS:222 if 'Window Mocker' not in self.process_manager.KNOWN_APPS:
219 self.register_known_application(223 self.process_manager.register_known_application(
220 'Window Mocker',224 'Window Mocker',
221 'window-mocker.desktop',225 'window-mocker.desktop',
222 'window-mocker'226 'window-mocker'
@@ -225,21 +229,79 @@
225 file_path = tempfile.mktemp()229 file_path = tempfile.mktemp()
226 json.dump(window_spec, open(file_path, 'w'))230 json.dump(window_spec, open(file_path, 'w'))
227 self.addCleanup(os.remove, file_path)231 self.addCleanup(os.remove, file_path)
228 return self.start_app_window('Window Mocker', [file_path])232 return self.process_manager.start_app_window('Window Mocker', [file_path])
229 else:233 else:
230 return self.start_app_window('Window Mocker')234 return self.process_manager.start_app_window('Window Mocker')
231235
232 def close_all_windows(self, application_name):236 def close_all_windows(self, application_name):
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):
234 w.close()238 w.close()
235239
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)))
237241
238 def register_nautilus(self):242 def register_nautilus(self):
239 self.addCleanup(self.unregister_known_application, "Nautilus")243 self.addCleanup(self.process_manager.unregister_known_application, "Nautilus")
240 self.register_known_application("Nautilus", "nautilus.desktop", "nautilus")244 self.process_manager.register_known_application("Nautilus", "nautilus.desktop", "nautilus")
241245
242 def get_startup_notification_timestamp(self, bamf_window):246 def get_startup_notification_timestamp(self, bamf_window):
243 atom = display.Display().intern_atom('_NET_WM_USER_TIME')247 atom = display.Display().intern_atom('_NET_WM_USER_TIME')
244 atom_type = display.Display().intern_atom('CARDINAL')248 atom_type = display.Display().intern_atom('CARDINAL')
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]
250
251 def call_gsettings_cmd(self, command, schema, *args):
252 """Set a desktop wide gsettings option
253
254 Using the gsettings command because there is a bug with importing
255 from gobject introspection and pygtk2 simultaneously, and the Xlib
256 keyboard layout bits are very unwieldy. This seems like the best
257 solution, even a little bit brutish.
258 """
259 cmd = ['gsettings', command, schema] + list(args)
260 # strip to remove the trailing \n.
261 ret = check_output(cmd).strip()
262 time.sleep(5)
263 reset_display()
264 return ret
265
266 def set_unity_option(self, option_name, option_value):
267 """Set an option in the unity compiz plugin options.
268
269 .. note:: The value will be set for the current test only, and
270 automatically undone when the test ends.
271
272 :param option_name: The name of the unity option.
273 :param option_value: The value you want to set.
274 :raises: **KeyError** if the option named does not exist.
275
276 """
277 self.set_compiz_option("unityshell", option_name, option_value)
278
279 def set_compiz_option(self, plugin_name, option_name, option_value):
280 """Set a compiz option for the duration of this test only.
281
282 .. note:: The value will be set for the current test only, and
283 automatically undone when the test ends.
284
285 :param plugin_name: The name of the compiz plugin where the option is
286 registered. If the option is not in a plugin, the string "core" should
287 be used as the plugin name.
288 :param option_name: The name of the unity option.
289 :param option_value: The value you want to set.
290 :raises: **KeyError** if the option named does not exist.
291
292 """
293 old_value = self._set_compiz_option(plugin_name, option_name, option_value)
294 # Cleanup is LIFO, during clean-up also allow unity to respond
295 self.addCleanup(time.sleep, 0.5)
296 self.addCleanup(self._set_compiz_option, plugin_name, option_name, old_value)
297 # Allow unity time to respond to the new setting.
298 time.sleep(0.5)
299
300 def _set_compiz_option(self, plugin_name, option_name, option_value):
301 log.info("Setting compiz option '%s' in plugin '%s' to %r",
302 option_name, plugin_name, option_value)
303 setting = get_compiz_setting(plugin_name, option_name)
304 old_value = setting.Value
305 setting.Value = option_value
306 get_global_context().Write()
307 return old_value
246308
=== modified file 'tests/autopilot/unity/tests/launcher/__init__.py'
--- tests/autopilot/unity/tests/launcher/__init__.py 2013-02-04 21:03:37 +0000
+++ tests/autopilot/unity/tests/launcher/__init__.py 2013-05-15 16:01:29 +0000
@@ -8,18 +8,18 @@
88
9"""Autopilot test case class for all Launcher tests"""9"""Autopilot test case class for all Launcher tests"""
1010
11from autopilot.emulators.X11 import ScreenGeometry11from autopilot.display import Display
12from autopilot.testcase import multiply_scenarios12from autopilot.testcase import multiply_scenarios
1313
14from unity.tests import UnityTestCase14from unity.tests import UnityTestCase
15from unity.emulators.X11 import set_primary_monitor
1516
1617
17def _make_scenarios():18def _make_scenarios():
18 """Make scenarios for launcher test cases based on the number of configured19 """Make scenarios for launcher test cases based on the number of configured
19 monitors.20 monitors.
20 """21 """
21 screen_geometry = ScreenGeometry()22 num_monitors = Display.create().get_num_screens()
22 num_monitors = screen_geometry.get_num_monitors()
2323
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.
25 if num_monitors == 1:25 if num_monitors == 1:
@@ -39,7 +39,6 @@
3939
40 def setUp(self):40 def setUp(self):
41 super(LauncherTestCase, self).setUp()41 super(LauncherTestCase, self).setUp()
42 self.screen_geo = ScreenGeometry()
43 self.set_unity_log_level("unity.launcher", "DEBUG")42 self.set_unity_log_level("unity.launcher", "DEBUG")
44 self.addCleanup(self.set_unity_log_level, "unity.launcher", "INFO")43 self.addCleanup(self.set_unity_log_level, "unity.launcher", "INFO")
4544
@@ -48,10 +47,10 @@
4847
49 if self.only_primary:48 if self.only_primary:
50 try:49 try:
51 old_primary_screen = self.screen_geo.get_primary_monitor()50 old_primary_screen = self.display.get_primary_screen()
52 self.screen_geo.set_primary_monitor(self.launcher_monitor)51 set_primary_monitor(self.launcher_monitor)
53 self.addCleanup(self.screen_geo.set_primary_monitor, old_primary_screen)52 self.addCleanup(set_primary_monitor, old_primary_screen)
54 except ScreenGeometry.BlacklistedDriverError:53 except autopilot.display.BlacklistedDriverError:
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)
5655
57 def get_launcher(self):56 def get_launcher(self):
5857
=== modified file 'tests/autopilot/unity/tests/launcher/test_capture.py'
--- tests/autopilot/unity/tests/launcher/test_capture.py 2013-02-04 21:03:37 +0000
+++ tests/autopilot/unity/tests/launcher/test_capture.py 2013-05-15 16:01:29 +0000
@@ -9,7 +9,6 @@
99
10from __future__ import absolute_import10from __future__ import absolute_import
1111
12from autopilot.emulators.X11 import ScreenGeometry
13from autopilot.matchers import Eventually12from autopilot.matchers import Eventually
14import logging13import logging
15from testtools.matchers import Equals, LessThan, GreaterThan14from testtools.matchers import Equals, LessThan, GreaterThan
@@ -23,12 +22,10 @@
23class LauncherCaptureTests(UnityTestCase):22class LauncherCaptureTests(UnityTestCase):
24 """Test the launchers ability to capture/not capture the mouse."""23 """Test the launchers ability to capture/not capture the mouse."""
2524
26 screen_geo = ScreenGeometry()
27
28 def setUp(self):25 def setUp(self):
29 super(LauncherCaptureTests, self).setUp()26 super(LauncherCaptureTests, self).setUp()
3027
31 if self.screen_geo.get_num_monitors() <= 1:28 if self.display.get_num_screens() <= 1:
32 self.skipTest("This test requires two or more monitors.")29 self.skipTest("This test requires two or more monitors.")
3330
34 self.set_unity_option('launcher_capture_mouse', True)31 self.set_unity_option('launcher_capture_mouse', True)
@@ -41,8 +38,8 @@
41 self.assertThat(launcher.hidemode, Eventually(Equals(mode)))38 self.assertThat(launcher.hidemode, Eventually(Equals(mode)))
4239
43 def leftMostMonitor(self):40 def leftMostMonitor(self):
44 x1, y1, width, height = self.screen_geo.get_monitor_geometry(0)41 x1, y1, width, height = self.display.get_screen_geometry(0)
45 x2, y2, width, height = self.screen_geo.get_monitor_geometry(1)42 x2, y2, width, height = self.display.get_screen_geometry(1)
4643
47 if x1 < x2:44 if x1 < x2:
48 return 045 return 0
@@ -57,7 +54,7 @@
57 """Tests that the launcher captures the mouse when moving between monitors54 """Tests that the launcher captures the mouse when moving between monitors
58 while revealed.55 while revealed.
59 """56 """
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())
61 self.mouse.move(x + width / 2, y + height / 2, False)58 self.mouse.move(x + width / 2, y + height / 2, False)
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)
6360
@@ -72,7 +69,7 @@
7269
73 self.set_unity_option('launcher_capture_mouse', False)70 self.set_unity_option('launcher_capture_mouse', False)
7471
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())
76 self.mouse.move(x + width / 2, y + height / 2, False)73 self.mouse.move(x + width / 2, y + height / 2, False)
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)
7875
@@ -88,7 +85,7 @@
88 self.set_unity_option('launcher_capture_mouse', False)85 self.set_unity_option('launcher_capture_mouse', False)
89 self.setHideMode(1)86 self.setHideMode(1)
9087
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())
92 self.mouse.move(x + width / 2, y + height / 2, False)89 self.mouse.move(x + width / 2, y + height / 2, False)
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)
9491
@@ -104,7 +101,7 @@
104 self.set_unity_option('launcher_capture_mouse', False)101 self.set_unity_option('launcher_capture_mouse', False)
105 self.setHideMode(1)102 self.setHideMode(1)
106103
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())
108 self.mouse.move(x + width / 2, y + height / 2, False)105 self.mouse.move(x + width / 2, y + height / 2, False)
109 sleep(1.5)106 sleep(1.5)
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)
@@ -119,7 +116,7 @@
119 """116 """
120 self.setHideMode(1)117 self.setHideMode(1)
121118
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())
123 self.mouse.move(x + width / 2, y + height / 2, False)120 self.mouse.move(x + width / 2, y + height / 2, False)
124 sleep(1.5)121 sleep(1.5)
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)
126123
=== modified file 'tests/autopilot/unity/tests/launcher/test_icon_behavior.py'
--- tests/autopilot/unity/tests/launcher/test_icon_behavior.py 2013-04-09 18:37:33 +0000
+++ tests/autopilot/unity/tests/launcher/test_icon_behavior.py 2013-05-15 16:01:29 +0000
@@ -51,12 +51,12 @@
51 return icon51 return icon
5252
53 def ensure_calculator_in_launcher_and_not_running(self):53 def ensure_calculator_in_launcher_and_not_running(self):
54 calc = self.start_app("Calculator")54 calc = self.process_manager.start_app("Calculator")
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)
56 self.addCleanup(self.launcher_instance.unlock_from_launcher, calc_icon)56 self.addCleanup(self.launcher_instance.unlock_from_launcher, calc_icon)
57 self.launcher_instance.lock_to_launcher(calc_icon)57 self.launcher_instance.lock_to_launcher(calc_icon)
58 self.close_all_app("Calculator")58 self.process_manager.close_all_app("Calculator")
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)))
60 return calc_icon60 return calc_icon
6161
62 def test_bfb_tooltip_disappear_when_dash_is_opened(self):62 def test_bfb_tooltip_disappear_when_dash_is_opened(self):
@@ -88,7 +88,7 @@
8888
89 def test_shift_click_opens_new_application_instance(self):89 def test_shift_click_opens_new_application_instance(self):
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."""
91 app = self.start_app("Calculator")91 app = self.process_manager.start_app("Calculator")
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)
93 launcher_instance = self.unity.launcher.get_launcher_for_monitor(0)93 launcher_instance = self.unity.launcher.get_launcher_for_monitor(0)
9494
@@ -103,9 +103,9 @@
103 of that application.103 of that application.
104104
105 """105 """
106 char_win1 = self.start_app_window("Character Map")106 char_win1 = self.process_manager.start_app_window("Character Map")
107 calc_win = self.start_app_window("Calculator")107 calc_win = self.process_manager.start_app_window("Calculator")
108 char_win2 = self.start_app_window("Character Map")108 char_win2 = self.process_manager.start_app_window("Character Map")
109109
110 self.assertVisibleWindowStack([char_win2, calc_win, char_win1])110 self.assertVisibleWindowStack([char_win2, calc_win, char_win1])
111111
@@ -136,10 +136,10 @@
136 def test_launcher_uses_startup_notification(self):136 def test_launcher_uses_startup_notification(self):
137 """Tests that unity uses startup notification protocol."""137 """Tests that unity uses startup notification protocol."""
138 calc_icon = self.ensure_calculator_in_launcher_and_not_running()138 calc_icon = self.ensure_calculator_in_launcher_and_not_running()
139 self.addCleanup(self.close_all_app, "Calculator")139 self.addCleanup(self.process_manager.close_all_app, "Calculator")
140 self.launcher_instance.click_launcher_icon(calc_icon)140 self.launcher_instance.click_launcher_icon(calc_icon)
141141
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]
143 calc_window = calc_app.get_windows()[0]143 calc_window = calc_app.get_windows()[0]
144144
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)))
@@ -148,16 +148,16 @@
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"""
149 self.register_nautilus()149 self.register_nautilus()
150 self.addCleanup(self.close_all_windows, "Nautilus")150 self.addCleanup(self.close_all_windows, "Nautilus")
151 self.addCleanup(self.close_all_app, "Calculator")151 self.addCleanup(self.process_manager.close_all_app, "Calculator")
152 self.close_all_windows("Nautilus")152 self.close_all_windows("Nautilus")
153153
154 trash_icon = self.unity.launcher.model.get_trash_icon()154 trash_icon = self.unity.launcher.model.get_trash_icon()
155 self.launcher_instance.click_launcher_icon(trash_icon)155 self.launcher_instance.click_launcher_icon(trash_icon)
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)))
157 [trash_window] = self.get_open_windows_by_application("Nautilus")157 [trash_window] = self.process_manager.get_open_windows_by_application("Nautilus")
158 self.assertThat(lambda: trash_window.is_focused, Eventually(Equals(True)))158 self.assertThat(lambda: trash_window.is_focused, Eventually(Equals(True)))
159159
160 calc_win = self.start_app_window("Calculator")160 calc_win = self.process_manager.start_app_window("Calculator")
161 self.assertThat(lambda: calc_win.is_focused, Eventually(Equals(True)))161 self.assertThat(lambda: calc_win.is_focused, Eventually(Equals(True)))
162 self.assertThat(lambda: trash_window.is_focused, Eventually(Equals(False)))162 self.assertThat(lambda: trash_window.is_focused, Eventually(Equals(False)))
163163
@@ -172,12 +172,12 @@
172172
173 trash_icon = self.unity.launcher.model.get_trash_icon()173 trash_icon = self.unity.launcher.model.get_trash_icon()
174 self.launcher_instance.click_launcher_icon(trash_icon)174 self.launcher_instance.click_launcher_icon(trash_icon)
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)))
176176
177 nautilus_app = self.get_app_instances("Nautilus")177 nautilus_app = self.process_manager.get_app_instances("Nautilus")
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")
179 self.launcher_instance.click_launcher_icon(nautilus_icon)179 self.launcher_instance.click_launcher_icon(nautilus_icon)
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)))
181181
182 def test_super_number_shortcut_focuses_new_windows(self):182 def test_super_number_shortcut_focuses_new_windows(self):
183 """Windows launched using super+number must have183 """Windows launched using super+number must have
@@ -186,7 +186,7 @@
186 """186 """
187 bfb_icon = self.unity.launcher.model.get_bfb_icon()187 bfb_icon = self.unity.launcher.model.get_bfb_icon()
188 calc_icon = self.ensure_calculator_in_launcher_and_not_running()188 calc_icon = self.ensure_calculator_in_launcher_and_not_running()
189 self.addCleanup(self.close_all_app, "Calculator")189 self.addCleanup(self.process_manager.close_all_app, "Calculator")
190190
191 self.launcher_instance.drag_icon_to_position(191 self.launcher_instance.drag_icon_to_position(
192 calc_icon,192 calc_icon,
@@ -197,7 +197,7 @@
197 self.addCleanup(self.launcher_instance.keyboard_unreveal_launcher)197 self.addCleanup(self.launcher_instance.keyboard_unreveal_launcher)
198 self.keyboard.press_and_release("1");198 self.keyboard.press_and_release("1");
199199
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]
201 calc_window = calc_app.get_windows()[0]201 calc_window = calc_app.get_windows()[0]
202202
203 self.assertThat(lambda: calc_window.is_focused, Eventually(Equals(True)))203 self.assertThat(lambda: calc_window.is_focused, Eventually(Equals(True)))
@@ -206,8 +206,8 @@
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,
207 when an application window is focused, the spread is initiated.207 when an application window is focused, the spread is initiated.
208 """208 """
209 char_win1 = self.start_app_window("Character Map")209 char_win1 = self.process_manager.start_app_window("Character Map")
210 char_win2 = self.start_app_window("Character Map")210 char_win2 = self.process_manager.start_app_window("Character Map")
211 char_app = char_win1.application211 char_app = char_win1.application
212212
213 self.assertVisibleWindowStack([char_win2, char_win1])213 self.assertVisibleWindowStack([char_win2, char_win1])
@@ -224,8 +224,8 @@
224 """If scale is initiated through the laucher pressing super must close224 """If scale is initiated through the laucher pressing super must close
225 scale and open the dash.225 scale and open the dash.
226 """226 """
227 char_win1 = self.start_app_window("Character Map")227 char_win1 = self.process_manager.start_app_window("Character Map")
228 char_win2 = self.start_app_window("Character Map")228 char_win2 = self.process_manager.start_app_window("Character Map")
229 char_app = char_win1.application229 char_app = char_win1.application
230230
231 self.assertVisibleWindowStack([char_win2, char_win1])231 self.assertVisibleWindowStack([char_win2, char_win1])
@@ -243,13 +243,13 @@
243243
244 def test_icon_shows_on_quick_application_reopen(self):244 def test_icon_shows_on_quick_application_reopen(self):
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."""
246 calc = self.start_app("Calculator")246 calc = self.process_manager.start_app("Calculator")
247 desktop_file = calc.desktop_file247 desktop_file = calc.desktop_file
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)
249 self.assertThat(calc_icon.visible, Eventually(Equals(True)))249 self.assertThat(calc_icon.visible, Eventually(Equals(True)))
250250
251 self.close_all_app("Calculator")251 self.process_manager.close_all_app("Calculator")
252 calc = self.start_app("Calculator")252 calc = self.process_manager.start_app("Calculator")
253 sleep(2)253 sleep(2)
254254
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)
@@ -356,7 +356,7 @@
356 """Application icons must be draggable to below the BFB."""356 """Application icons must be draggable to below the BFB."""
357357
358 self.ensure_calc_icon_not_in_launcher()358 self.ensure_calc_icon_not_in_launcher()
359 calc = self.start_app("Calculator")359 calc = self.process_manager.start_app("Calculator")
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)
361 bfb_icon = self.unity.launcher.model.get_bfb_icon()361 bfb_icon = self.unity.launcher.model.get_bfb_icon()
362362
@@ -373,7 +373,7 @@
373 """Application icons must be dragable to below the workspace switcher icon."""373 """Application icons must be dragable to below the workspace switcher icon."""
374374
375 self.ensure_calc_icon_not_in_launcher()375 self.ensure_calc_icon_not_in_launcher()
376 calc = self.start_app("Calculator")376 calc = self.process_manager.start_app("Calculator")
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)
378 bfb_icon = self.unity.launcher.model.get_bfb_icon()378 bfb_icon = self.unity.launcher.model.get_bfb_icon()
379 trash_icon = self.unity.launcher.model.get_trash_icon()379 trash_icon = self.unity.launcher.model.get_trash_icon()
380380
=== modified file 'tests/autopilot/unity/tests/launcher/test_keynav.py'
--- tests/autopilot/unity/tests/launcher/test_keynav.py 2013-02-04 22:31:47 +0000
+++ tests/autopilot/unity/tests/launcher/test_keynav.py 2013-05-15 16:01:29 +0000
@@ -51,7 +51,7 @@
5151
52 def test_launcher_keynav_cancel_resume_focus(self):52 def test_launcher_keynav_cancel_resume_focus(self):
53 """Test that ending the launcher keynav resume the focus."""53 """Test that ending the launcher keynav resume the focus."""
54 calc = self.start_app("Calculator")54 calc = self.process_manager.start_app("Calculator")
55 self.assertTrue(calc.is_active)55 self.assertTrue(calc.is_active)
5656
57 self.start_keynav_with_cleanup_cancel()57 self.start_keynav_with_cleanup_cancel()
@@ -127,8 +127,8 @@
127127
128 def test_launcher_keynav_activate_keep_focus(self):128 def test_launcher_keynav_activate_keep_focus(self):
129 """Activating a running launcher icon must focus it."""129 """Activating a running launcher icon must focus it."""
130 calc = self.start_app("Calculator")130 calc = self.process_manager.start_app("Calculator")
131 mahjongg = self.start_app("Mahjongg")131 mahjongg = self.process_manager.start_app("Mahjongg")
132 self.assertTrue(mahjongg.is_active)132 self.assertTrue(mahjongg.is_active)
133 self.assertFalse(calc.is_active)133 self.assertFalse(calc.is_active)
134134
@@ -215,7 +215,7 @@
215215
216 def test_launcher_keynav_cancel_on_click_icon(self):216 def test_launcher_keynav_cancel_on_click_icon(self):
217 """A single click on a launcher icon must cancel keynav."""217 """A single click on a launcher icon must cancel keynav."""
218 calc_win = self.start_app_window('Calculator', locale = 'C')218 calc_win = self.process_manager.start_app_window('Calculator', locale = 'C')
219 calc_app = calc_win.application219 calc_app = calc_win.application
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)
221221
222222
=== modified file 'tests/autopilot/unity/tests/launcher/test_reveal.py'
--- tests/autopilot/unity/tests/launcher/test_reveal.py 2013-02-04 19:54:47 +0000
+++ tests/autopilot/unity/tests/launcher/test_reveal.py 2013-05-15 16:01:29 +0000
@@ -9,6 +9,7 @@
99
10from __future__ import absolute_import10from __future__ import absolute_import
1111
12from autopilot.display import move_mouse_to_screen
12from autopilot.matchers import Eventually13from autopilot.matchers import Eventually
13import logging14import logging
14from testtools.matchers import Equals, GreaterThan15from testtools.matchers import Equals, GreaterThan
@@ -63,7 +64,7 @@
6364
64 def test_launcher_does_not_reveal_with_mouse_down(self):65 def test_launcher_does_not_reveal_with_mouse_down(self):
65 """Launcher must not reveal if have mouse button 1 down."""66 """Launcher must not reveal if have mouse button 1 down."""
66 self.screen_geo.move_mouse_to_monitor(self.launcher_instance.monitor)67 move_mouse_to_screen(self.launcher_instance.monitor)
67 self.mouse.press(1)68 self.mouse.press(1)
68 self.addCleanup(self.mouse.release, 1)69 self.addCleanup(self.mouse.release, 1)
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!!
@@ -75,8 +76,8 @@
7576
76 def test_launcher_stays_open_after_spread(self):77 def test_launcher_stays_open_after_spread(self):
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."""
78 char_win1 = self.start_app_window("Character Map")79 char_win1 = self.process_manager.start_app_window("Character Map")
79 char_win2 = self.start_app_window("Character Map")80 char_win2 = self.process_manager.start_app_window("Character Map")
80 char_app = char_win1.application81 char_app = char_win1.application
8182
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)
@@ -90,7 +91,7 @@
9091
91 def test_launcher_stays_open_after_icon_click(self):92 def test_launcher_stays_open_after_icon_click(self):
92 """Clicking on a launcher icon must not hide the launcher."""93 """Clicking on a launcher icon must not hide the launcher."""
93 char_win = self.start_app_window("Character Map")94 char_win = self.process_manager.start_app_window("Character Map")
94 char_app = char_win.application95 char_app = char_win.application
9596
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)
@@ -106,10 +107,10 @@
106 if self.unity.launcher.model.num_bamf_launcher_icons() >= 10:107 if self.unity.launcher.model.num_bamf_launcher_icons() >= 10:
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")
108109
109 desktop_file = self.KNOWN_APPS['Calculator']['desktop-file']110 desktop_file = self.process_manager.KNOWN_APPS['Calculator']['desktop-file']
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:
111 self.skip("Calculator icon is already on the launcher.")112 self.skip("Calculator icon is already on the launcher.")
112113
113 self.start_app('Calculator')114 self.process_manager.start_app('Calculator')
114 icon = self.unity.launcher.model.get_icon(desktop_id=desktop_file)115 icon = self.unity.launcher.model.get_icon(desktop_id=desktop_file)
115 self.assertThat(icon.shortcut, GreaterThan(0))116 self.assertThat(icon.shortcut, GreaterThan(0))
116117
=== modified file 'tests/autopilot/unity/tests/launcher/test_scroll.py'
--- tests/autopilot/unity/tests/launcher/test_scroll.py 2013-03-13 18:07:17 +0000
+++ tests/autopilot/unity/tests/launcher/test_scroll.py 2013-05-15 16:01:29 +0000
@@ -25,7 +25,7 @@
25 apps = ("Calculator", "Mahjongg", "Text Editor", "Character Map", "Terminal", "Remmina")25 apps = ("Calculator", "Mahjongg", "Text Editor", "Character Map", "Terminal", "Remmina")
26 26
27 for app in apps:27 for app in apps:
28 self.start_app_window(app)28 self.process_manager.start_app_window(app)
29 29
30 def test_autoscrolling_from_bottom(self):30 def test_autoscrolling_from_bottom(self):
31 """Tests the autoscrolling from the bottom of the Launcher"""31 """Tests the autoscrolling from the bottom of the Launcher"""
3232
=== modified file 'tests/autopilot/unity/tests/launcher/test_switcher.py'
--- tests/autopilot/unity/tests/launcher/test_switcher.py 2013-02-04 19:54:47 +0000
+++ tests/autopilot/unity/tests/launcher/test_switcher.py 2013-05-15 16:01:29 +0000
@@ -47,8 +47,8 @@
4747
48 def test_launcher_switcher_cancel_resume_focus(self):48 def test_launcher_switcher_cancel_resume_focus(self):
49 """Test that ending the launcher switcher resume the focus."""49 """Test that ending the launcher switcher resume the focus."""
50 self.close_all_app("Calculator")50 self.process_manager.close_all_app("Calculator")
51 calc = self.start_app("Calculator")51 calc = self.process_manager.start_app("Calculator")
52 self.assertTrue(calc.is_active)52 self.assertTrue(calc.is_active)
5353
54 self.start_switcher_with_cleanup_cancel()54 self.start_switcher_with_cleanup_cancel()
@@ -145,8 +145,8 @@
145145
146 def test_launcher_switcher_activate_keep_focus(self):146 def test_launcher_switcher_activate_keep_focus(self):
147 """Activating a running launcher icon should focus the application."""147 """Activating a running launcher icon should focus the application."""
148 calc = self.start_app("Calculator")148 calc = self.process_manager.start_app("Calculator")
149 mahjongg = self.start_app("Mahjongg")149 mahjongg = self.process_manager.start_app("Mahjongg")
150 self.assertTrue(mahjongg.is_active)150 self.assertTrue(mahjongg.is_active)
151 self.assertFalse(calc.is_active)151 self.assertFalse(calc.is_active)
152152
153153
=== modified file 'tests/autopilot/unity/tests/test_command_lens.py'
--- tests/autopilot/unity/tests/test_command_lens.py 2013-04-24 19:43:55 +0000
+++ tests/autopilot/unity/tests/test_command_lens.py 2013-05-15 16:01:29 +0000
@@ -70,8 +70,8 @@
7070
71 def test_run_before_refresh(self):71 def test_run_before_refresh(self):
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."""
73 if self.app_is_running("Text Editor"):73 if self.process_manager.app_is_running("Text Editor"):
74 self.close_all_app("Text Editor")74 self.process_manager.close_all_app("Text Editor")
75 sleep(1)75 sleep(1)
7676
77 self.unity.dash.reveal_command_scope()77 self.unity.dash.reveal_command_scope()
@@ -79,8 +79,8 @@
79 sleep(1)79 sleep(1)
80 self.keyboard.type("edit", 0.1)80 self.keyboard.type("edit", 0.1)
81 self.keyboard.press_and_release("Enter", 0.1)81 self.keyboard.press_and_release("Enter", 0.1)
82 self.addCleanup(self.close_all_app, "Text Editor")82 self.addCleanup(self.process_manager.close_all_app, "Text Editor")
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)
84 self.assertTrue(app_found)84 self.assertTrue(app_found)
8585
86 def test_ctrl_tab_switching(self):86 def test_ctrl_tab_switching(self):
8787
=== modified file 'tests/autopilot/unity/tests/test_dash.py'
--- tests/autopilot/unity/tests/test_dash.py 2013-04-26 14:08:38 +0000
+++ tests/autopilot/unity/tests/test_dash.py 2013-05-15 16:01:29 +0000
@@ -8,7 +8,8 @@
88
9from __future__ import absolute_import9from __future__ import absolute_import
1010
11from autopilot.emulators.clipboard import get_clipboard_contents11from autopilot.clipboard import get_clipboard_contents
12from autopilot.display import move_mouse_to_screen
12from autopilot.matchers import Eventually13from autopilot.matchers import Eventually
13from testtools.matchers import Equals, NotEquals, GreaterThan14from testtools.matchers import Equals, NotEquals, GreaterThan
14from time import sleep15from time import sleep
@@ -123,7 +124,7 @@
123 current_monitor = self.unity.dash.monitor124 current_monitor = self.unity.dash.monitor
124125
125 (x,y,w,h) = self.unity.dash.geometry126 (x,y,w,h) = self.unity.dash.geometry
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)
127128
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)
129 self.mouse.click()130 self.mouse.click()
@@ -135,15 +136,15 @@
135 focused. Then from the Dash clicking on the maximized window136 focused. Then from the Dash clicking on the maximized window
136 must focus that window and close the dash.137 must focus that window and close the dash.
137 """138 """
138 char_win = self.start_app("Character Map")139 char_win = self.process_manager.start_app("Character Map")
139 self.keybinding("window/maximize")140 self.keybinding("window/maximize")
140 self.start_app("Calculator")141 self.process_manager.start_app("Calculator")
141142
142 self.unity.dash.ensure_visible()143 self.unity.dash.ensure_visible()
143144
144 #Click bottom right of the screen145 #Click bottom right of the screen
145 w = self.screen_geo.get_screen_width()146 w = self.display.get_screen_width()
146 h = self.screen_geo.get_screen_height()147 h = self.display.get_screen_height()
147 self.mouse.move(w,h)148 self.mouse.move(w,h)
148 self.mouse.click()149 self.mouse.click()
149150
@@ -506,7 +507,7 @@
506 def test_middle_click_paste(self):507 def test_middle_click_paste(self):
507 """Tests if Middle mouse button pastes into searchbar"""508 """Tests if Middle mouse button pastes into searchbar"""
508509
509 self.start_app_window("Calculator", locale='C')510 self.process_manager.start_app_window("Calculator", locale='C')
510511
511 self.keyboard.type("ThirdButtonPaste")512 self.keyboard.type("ThirdButtonPaste")
512 self.keyboard.press_and_release("Ctrl+a")513 self.keyboard.press_and_release("Ctrl+a")
@@ -547,7 +548,7 @@
547 self.unity.dash.ensure_visible()548 self.unity.dash.ensure_visible()
548 self.addCleanup(self.unity.hud.ensure_hidden)549 self.addCleanup(self.unity.hud.ensure_hidden)
549550
550 self.start_app_window("Calculator")551 self.process_manager.start_app_window("Calculator")
551 sleep(1)552 sleep(1)
552553
553 self.keyboard.type("HasFocus")554 self.keyboard.type("HasFocus")
@@ -648,8 +649,9 @@
648 self.assertThat(scope.visible, Eventually(Equals(False)))649 self.assertThat(scope.visible, Eventually(Equals(False)))
649650
650 def test_dash_position_with_non_default_launcher_width(self):651 def test_dash_position_with_non_default_launcher_width(self):
651 """"There should be no empty space between launcher and dash when the launcher652 """There should be no empty space between launcher and dash when the launcher
652 has a non-default width.653 has a non-default width.
654
653 """655 """
654 monitor = self.unity.dash.monitor656 monitor = self.unity.dash.monitor
655 launcher = self.unity.launcher.get_launcher_for_monitor(monitor)657 launcher = self.unity.launcher.get_launcher_for_monitor(monitor)
@@ -804,8 +806,7 @@
804 # make sure the scope result is non-empty806 # make sure the scope result is non-empty
805 (file_handle, file_path) = mkstemp()807 (file_handle, file_path) = mkstemp()
806 self.addCleanup(remove, file_path)808 self.addCleanup(remove, file_path)
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')
808 self.addCleanup(self.close_all_app, 'Text Editor')
809 self.assertProperty(gedit_win, is_focused=True)810 self.assertProperty(gedit_win, is_focused=True)
810811
811 scope = self.unity.dash.reveal_file_scope()812 scope = self.unity.dash.reveal_file_scope()
@@ -1263,7 +1264,7 @@
12631264
1264 def setUp(self):1265 def setUp(self):
1265 super(DashCrossMonitorsTests, self).setUp()1266 super(DashCrossMonitorsTests, self).setUp()
1266 if self.screen_geo.get_num_monitors() < 2:1267 if self.display.get_num_screens() < 2:
1267 self.skipTest("This test requires more than 1 monitor.")1268 self.skipTest("This test requires more than 1 monitor.")
12681269
1269 def test_dash_stays_on_same_monitor(self):1270 def test_dash_stays_on_same_monitor(self):
@@ -1275,7 +1276,7 @@
1275 self.unity.dash.ensure_visible()1276 self.unity.dash.ensure_visible()
1276 self.addCleanup(self.unity.dash.ensure_hidden)1277 self.addCleanup(self.unity.dash.ensure_hidden)
12771278
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())
1279 self.keyboard.type("abc")1280 self.keyboard.type("abc")
12801281
1281 self.assertThat(self.unity.dash.ideal_monitor, Eventually(Equals(current_monitor)))1282 self.assertThat(self.unity.dash.ideal_monitor, Eventually(Equals(current_monitor)))
@@ -1285,11 +1286,11 @@
12851286
1286 self.addCleanup(self.unity.dash.ensure_hidden)1287 self.addCleanup(self.unity.dash.ensure_hidden)
12871288
1288 for monitor in range(self.screen_geo.get_num_monitors()-1):1289 for monitor in range(self.display.get_num_screens()-1):
1289 self.screen_geo.move_mouse_to_monitor(monitor)1290 move_mouse_to_screen(monitor)
1290 self.unity.dash.ensure_visible()1291 self.unity.dash.ensure_visible()
12911292
1292 self.screen_geo.move_mouse_to_monitor(monitor+1)1293 move_mouse_to_screen(monitor+1)
1293 sleep(.5)1294 sleep(.5)
1294 self.mouse.click()1295 self.mouse.click()
12951296
12961297
=== modified file 'tests/autopilot/unity/tests/test_home_lens.py'
--- tests/autopilot/unity/tests/test_home_lens.py 2013-02-21 10:47:14 +0000
+++ tests/autopilot/unity/tests/test_home_lens.py 2013-05-15 16:01:29 +0000
@@ -30,8 +30,8 @@
30 finished yet.30 finished yet.
3131
32 """32 """
33 if self.app_is_running("Text Editor"):33 if self.process_manager.app_is_running("Text Editor"):
34 self.close_all_app("Text Editor")34 self.process_manager.close_all_app("Text Editor")
35 sleep(1)35 sleep(1)
3636
37 kb = self.keyboard37 kb = self.keyboard
@@ -40,6 +40,6 @@
40 self.assertThat(self.unity.dash.search_string, Eventually(Equals("g")))40 self.assertThat(self.unity.dash.search_string, Eventually(Equals("g")))
41 kb.type("edit", 0.1)41 kb.type("edit", 0.1)
42 kb.press_and_release("Enter", 0.1)42 kb.press_and_release("Enter", 0.1)
43 self.addCleanup(self.close_all_app, "Text Editor")43 self.addCleanup(self.process_manager.close_all_app, "Text Editor")
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)
45 self.assertTrue(app_found)45 self.assertTrue(app_found)
4646
=== modified file 'tests/autopilot/unity/tests/test_hud.py'
--- tests/autopilot/unity/tests/test_hud.py 2013-04-24 15:25:08 +0000
+++ tests/autopilot/unity/tests/test_hud.py 2013-05-15 16:01:29 +0000
@@ -10,7 +10,7 @@
10from __future__ import absolute_import10from __future__ import absolute_import
1111
12from autopilot.matchers import Eventually12from autopilot.matchers import Eventually
13from autopilot.emulators.X11 import ScreenGeometry13from autopilot.display import Display, move_mouse_to_screen, is_rect_on_screen
14from autopilot.testcase import multiply_scenarios14from autopilot.testcase import multiply_scenarios
15from os import remove, environ15from os import remove, environ
16from os.path import exists16from os.path import exists
@@ -30,7 +30,7 @@
3030
3131
32def _make_monitor_scenarios():32def _make_monitor_scenarios():
33 num_monitors = ScreenGeometry().get_num_monitors()33 num_monitors = Display.create().get_num_screens()
34 scenarios = []34 scenarios = []
3535
36 if num_monitors == 1:36 if num_monitors == 1:
@@ -82,8 +82,8 @@
8282
83 if not environ.get('UBUNTU_MENUPROXY', ''):83 if not environ.get('UBUNTU_MENUPROXY', ''):
84 self.patch_environment('UBUNTU_MENUPROXY', 'libappmenu.so')84 self.patch_environment('UBUNTU_MENUPROXY', 'libappmenu.so')
85 self.hud_monitor = self.screen_geo.get_primary_monitor()85 self.hud_monitor = self.display.get_primary_screen()
86 self.screen_geo.move_mouse_to_monitor(self.hud_monitor)86 move_mouse_to_screen(self.hud_monitor)
8787
88 def test_no_initial_values(self):88 def test_no_initial_values(self):
89 self.unity.hud.ensure_visible()89 self.unity.hud.ensure_visible()
@@ -152,7 +152,7 @@
152 self.assertThat(self.unity.hud.visible, Equals(False))152 self.assertThat(self.unity.hud.visible, Equals(False))
153153
154 def test_alt_f4_doesnt_show_hud(self):154 def test_alt_f4_doesnt_show_hud(self):
155 self.start_app('Calculator')155 self.process_manager.start_app('Calculator')
156 sleep(1)156 sleep(1)
157 # Do a very fast Alt+F4157 # Do a very fast Alt+F4
158 self.keyboard.press_and_release("Alt+F4", 0.05)158 self.keyboard.press_and_release("Alt+F4", 0.05)
@@ -176,7 +176,7 @@
176 """Ensures that once the hud is dismissed, the same application176 """Ensures that once the hud is dismissed, the same application
177 that was focused before hud invocation is refocused.177 that was focused before hud invocation is refocused.
178 """178 """
179 calc = self.start_app("Calculator")179 calc = self.process_manager.start_app("Calculator")
180180
181 # first ensure that the application has started and is focused181 # first ensure that the application has started and is focused
182 self.assertEqual(calc.is_active, True)182 self.assertEqual(calc.is_active, True)
@@ -200,8 +200,8 @@
200200
201 file_path = mktemp()201 file_path = mktemp()
202 self.addCleanup(remove, file_path)202 self.addCleanup(remove, file_path)
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')
204 self.addCleanup(self.close_all_app, 'Text Editor')204 self.addCleanup(self.process_manager.close_all_app, 'Text Editor')
205 self.assertProperty(gedit_win, is_focused=True)205 self.assertProperty(gedit_win, is_focused=True)
206206
207 self.keyboard.type("0")207 self.keyboard.type("0")
@@ -254,7 +254,7 @@
254 def test_hud_closes_on_spread(self):254 def test_hud_closes_on_spread(self):
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."""
256 # Need at least one application open for the spread to work.256 # Need at least one application open for the spread to work.
257 self.start_app_window("Calculator")257 self.process_manager.start_app_window("Calculator")
258 self.unity.hud.ensure_visible()258 self.unity.hud.ensure_visible()
259 self.addCleanup(self.keybinding, "spread/cancel")259 self.addCleanup(self.keybinding, "spread/cancel")
260 self.keybinding("spread/start")260 self.keybinding("spread/start")
@@ -317,8 +317,8 @@
317317
318 def test_app_activate_on_enter(self):318 def test_app_activate_on_enter(self):
319 """Hud must close after activating a search item with Enter."""319 """Hud must close after activating a search item with Enter."""
320 self.start_app('Text Editor', locale='C')320 self.process_manager.start_app('Text Editor', locale='C')
321 self.addCleanup(self.close_all_app, "Text Editor")321 self.addCleanup(self.process_manager.close_all_app, "Text Editor")
322322
323 self.unity.hud.ensure_visible()323 self.unity.hud.ensure_visible()
324324
@@ -330,7 +330,7 @@
330330
331 self.keyboard.press_and_release("Enter")331 self.keyboard.press_and_release("Enter")
332332
333 self.assertFalse(self.app_is_running("Text Editor"))333 self.assertFalse(self.process_manager.app_is_running("Text Editor"))
334334
335 self.assertThat(self.unity.hud.visible, Eventually(Equals(False)))335 self.assertThat(self.unity.hud.visible, Eventually(Equals(False)))
336336
@@ -355,7 +355,7 @@
355 """Tests that Alt+ArrowKey events are correctly passed to the355 """Tests that Alt+ArrowKey events are correctly passed to the
356 active window when Unity is not responding to them."""356 active window when Unity is not responding to them."""
357357
358 term_win = self.start_app_window("Terminal")358 term_win = self.process_manager.start_app_window("Terminal")
359 self.assertProperty(term_win, is_focused=True)359 self.assertProperty(term_win, is_focused=True)
360360
361 # Here we anyway need a sleep, since even though the terminal can have361 # Here we anyway need a sleep, since even though the terminal can have
@@ -427,7 +427,7 @@
427 self.unity.hud.ensure_visible()427 self.unity.hud.ensure_visible()
428 self.addCleanup(self.unity.hud.ensure_hidden)428 self.addCleanup(self.unity.hud.ensure_hidden)
429429
430 self.start_app_window("Calculator")430 self.process_manager.start_app_window("Calculator")
431 sleep(1)431 sleep(1)
432432
433 self.keyboard.type("HasFocus")433 self.keyboard.type("HasFocus")
@@ -440,7 +440,7 @@
440 current_monitor = self.unity.hud.monitor440 current_monitor = self.unity.hud.monitor
441441
442 (x,y,w,h) = self.unity.hud.geometry442 (x,y,w,h) = self.unity.hud.geometry
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)
444444
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)
446 self.mouse.click()446 self.mouse.click()
@@ -452,16 +452,16 @@
452 focused. Then from the Hud clicking on the maximized window452 focused. Then from the Hud clicking on the maximized window
453 must focus that window and close the hud.453 must focus that window and close the hud.
454 """454 """
455 char_win = self.start_app("Character Map")455 char_win = self.process_manager.start_app("Character Map")
456 self.assertProperty(char_win, is_active=True)456 self.assertProperty(char_win, is_active=True)
457 self.keybinding("window/maximize")457 self.keybinding("window/maximize")
458 self.start_app("Calculator")458 self.process_manager.start_app("Calculator")
459459
460 self.unity.hud.ensure_visible()460 self.unity.hud.ensure_visible()
461461
462 #Click bottom right of the screen462 #Click bottom right of the screen
463 w = self.screen_geo.get_screen_width()463 w = self.display.get_screen_width()
464 h = self.screen_geo.get_screen_height()464 h = self.display.get_screen_height()
465 self.mouse.move(w,h)465 self.mouse.move(w,h)
466 self.mouse.click()466 self.mouse.click()
467467
@@ -470,8 +470,8 @@
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):
471 """Test the Hud focuses the correct window after an Alt+Tab."""471 """Test the Hud focuses the correct window after an Alt+Tab."""
472472
473 char_win = self.start_app('Character Map')473 char_win = self.process_manager.start_app('Character Map')
474 self.start_app('Calculator')474 self.process_manager.start_app('Calculator')
475475
476 self.keybinding("switcher/reveal_normal")476 self.keybinding("switcher/reveal_normal")
477 self.assertProperty(char_win, is_active=True)477 self.assertProperty(char_win, is_active=True)
@@ -506,7 +506,7 @@
506 self.set_unity_option('num_launchers', 0)506 self.set_unity_option('num_launchers', 0)
507 self.set_unity_option('launcher_hide_mode', int(self.launcher_autohide))507 self.set_unity_option('launcher_hide_mode', int(self.launcher_autohide))
508508
509 self.screen_geo.move_mouse_to_monitor(self.hud_monitor)509 move_mouse_to_screen(self.hud_monitor)
510 sleep(0.5)510 sleep(0.5)
511511
512 def test_multiple_hud_reveal_does_not_break_launcher(self):512 def test_multiple_hud_reveal_does_not_break_launcher(self):
@@ -517,9 +517,9 @@
517 launcher = self.unity.launcher.get_launcher_for_monitor(self.hud_monitor)517 launcher = self.unity.launcher.get_launcher_for_monitor(self.hud_monitor)
518518
519 # We need an app to switch to:519 # We need an app to switch to:
520 self.start_app('Character Map')520 self.process_manager.start_app('Character Map')
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.
522 self.start_app('Calculator')522 self.process_manager.start_app('Calculator')
523 sleep(1)523 sleep(1)
524524
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:
@@ -560,7 +560,7 @@
560 self.set_unity_option('num_launchers', 0)560 self.set_unity_option('num_launchers', 0)
561 self.set_unity_option('launcher_hide_mode', 0)561 self.set_unity_option('launcher_hide_mode', 0)
562562
563 self.screen_geo.move_mouse_to_monitor(self.hud_monitor)563 move_mouse_to_screen(self.hud_monitor)
564 sleep(0.5)564 sleep(0.5)
565565
566 def test_hud_launcher_icon_hides_bfb(self):566 def test_hud_launcher_icon_hides_bfb(self):
@@ -616,10 +616,10 @@
616616
617 def setUp(self):617 def setUp(self):
618 super(HudVisualTests, self).setUp()618 super(HudVisualTests, self).setUp()
619 self.screen_geo.move_mouse_to_monitor(self.hud_monitor)619 move_mouse_to_screen(self.hud_monitor)
620 self.set_unity_option('launcher_hide_mode', int(self.launcher_autohide))620 self.set_unity_option('launcher_hide_mode', int(self.launcher_autohide))
621 self.set_unity_option('num_launchers', int(self.launcher_primary_only))621 self.set_unity_option('num_launchers', int(self.launcher_primary_only))
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)
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))
624 sleep(0.5)624 sleep(0.5)
625625
@@ -630,12 +630,12 @@
630 """HUD must be drawn on the monitor where the mouse is."""630 """HUD must be drawn on the monitor where the mouse is."""
631 self.unity.hud.ensure_visible()631 self.unity.hud.ensure_visible()
632 self.assertThat(self.unity.hud.monitor, Eventually(Equals(self.hud_monitor)))632 self.assertThat(self.unity.hud.monitor, Eventually(Equals(self.hud_monitor)))
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))
634634
635 def test_hud_geometries(self):635 def test_hud_geometries(self):
636 """Tests the HUD geometries for the given monitor and status."""636 """Tests the HUD geometries for the given monitor and status."""
637 self.unity.hud.ensure_visible()637 self.unity.hud.ensure_visible()
638 monitor_geo = self.screen_geo.get_monitor_geometry(self.hud_monitor)638 monitor_geo = self.display.get_screen_geometry(self.hud_monitor)
639 monitor_x = monitor_geo[0]639 monitor_x = monitor_geo[0]
640 monitor_w = monitor_geo[2]640 monitor_w = monitor_geo[2]
641 hud_x = self.unity.hud.geometry[0]641 hud_x = self.unity.hud.geometry[0]
@@ -675,8 +675,8 @@
675675
676 def test_hud_icon_shows_the_focused_application_emblem(self):676 def test_hud_icon_shows_the_focused_application_emblem(self):
677 """Tests that the correct HUD icon is shown."""677 """Tests that the correct HUD icon is shown."""
678 self.close_all_app("Calculator")678 self.process_manager.close_all_app("Calculator")
679 calc = self.start_app("Calculator")679 calc = self.process_manager.start_app("Calculator")
680 self.assertTrue(calc.is_active)680 self.assertTrue(calc.is_active)
681 self.unity.hud.ensure_visible()681 self.unity.hud.ensure_visible()
682682
@@ -693,8 +693,8 @@
693693
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):
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."""
696 self.close_all_app("Calculator")696 self.process_manager.close_all_app("Calculator")
697 calc = self.start_app("Calculator")697 calc = self.process_manager.start_app("Calculator")
698 self.assertTrue(calc.is_active)698 self.assertTrue(calc.is_active)
699699
700 self.unity.dash.ensure_visible()700 self.unity.dash.ensure_visible()
@@ -704,8 +704,8 @@
704704
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):
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."""
707 self.close_all_app("Calculator")707 self.process_manager.close_all_app("Calculator")
708 calc = self.start_app("Calculator")708 calc = self.process_manager.start_app("Calculator")
709 self.assertTrue(calc.is_active)709 self.assertTrue(calc.is_active)
710710
711 self.unity.hud.ensure_visible()711 self.unity.hud.ensure_visible()
@@ -727,7 +727,7 @@
727 self.unity.window_manager.enter_show_desktop()727 self.unity.window_manager.enter_show_desktop()
728 self.addCleanup(self.unity.window_manager.leave_show_desktop)728 self.addCleanup(self.unity.window_manager.leave_show_desktop)
729729
730 calc = self.start_app("Calculator")730 calc = self.process_manager.start_app("Calculator")
731 self.assertTrue(calc.is_active)731 self.assertTrue(calc.is_active)
732 self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces)732 self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces)
733 self.unity.dash.ensure_visible()733 self.unity.dash.ensure_visible()
@@ -776,7 +776,7 @@
776776
777 def setUp(self):777 def setUp(self):
778 super(HudCrossMonitorsTests, self).setUp()778 super(HudCrossMonitorsTests, self).setUp()
779 if self.screen_geo.get_num_monitors() < 2:779 if self.display.get_num_screens() < 2:
780 self.skipTest("This test requires more than 1 monitor.")780 self.skipTest("This test requires more than 1 monitor.")
781781
782 def test_hud_stays_on_same_monitor(self):782 def test_hud_stays_on_same_monitor(self):
@@ -789,7 +789,7 @@
789 self.unity.hud.ensure_visible()789 self.unity.hud.ensure_visible()
790 self.addCleanup(self.unity.hud.ensure_hidden)790 self.addCleanup(self.unity.hud.ensure_hidden)
791791
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())
793 self.keyboard.type("abc")793 self.keyboard.type("abc")
794794
795 self.assertThat(self.unity.hud.ideal_monitor, Eventually(Equals(current_monitor)))795 self.assertThat(self.unity.hud.ideal_monitor, Eventually(Equals(current_monitor)))
@@ -799,11 +799,11 @@
799799
800 self.addCleanup(self.unity.hud.ensure_hidden)800 self.addCleanup(self.unity.hud.ensure_hidden)
801801
802 for monitor in range(self.screen_geo.get_num_monitors()-1):802 for monitor in range(self.display.get_num_screens()-1):
803 self.screen_geo.move_mouse_to_monitor(monitor)803 move_mouse_to_screen(monitor)
804 self.unity.hud.ensure_visible()804 self.unity.hud.ensure_visible()
805805
806 self.screen_geo.move_mouse_to_monitor(monitor+1)806 move_mouse_to_screen(monitor+1)
807 sleep(.5)807 sleep(.5)
808 self.mouse.click()808 self.mouse.click()
809809
810810
=== modified file 'tests/autopilot/unity/tests/test_ibus.py'
--- tests/autopilot/unity/tests/test_ibus.py 2013-02-28 12:39:52 +0000
+++ tests/autopilot/unity/tests/test_ibus.py 2013-05-15 16:01:29 +0000
@@ -10,7 +10,7 @@
1010
11from __future__ import absolute_import11from __future__ import absolute_import
1212
13from autopilot.emulators.ibus import (13from autopilot.ibus import (
14 get_active_input_engines,14 get_active_input_engines,
15 set_active_engines,15 set_active_engines,
16 get_available_input_engines,16 get_available_input_engines,
1717
=== modified file 'tests/autopilot/unity/tests/test_panel.py'
--- tests/autopilot/unity/tests/test_panel.py 2013-04-17 15:10:39 +0000
+++ tests/autopilot/unity/tests/test_panel.py 2013-05-15 16:01:29 +0000
@@ -8,8 +8,9 @@
88
9from __future__ import absolute_import9from __future__ import absolute_import
1010
11from autopilot.emulators.X11 import ScreenGeometry11from autopilot.display import Display
12from autopilot.emulators.bamf import BamfWindow12#from autopilot.emulators.bamf import BamfWindow
13from autopilot.process import Window
13from autopilot.matchers import Eventually14from autopilot.matchers import Eventually
14import logging15import logging
15import os16import os
@@ -17,6 +18,7 @@
17from time import sleep18from time import sleep
1819
19from unity.emulators.panel import IndicatorEntry20from unity.emulators.panel import IndicatorEntry
21from unity.emulators.X11 import drag_window_to_screen
20from unity.tests import UnityTestCase22from unity.tests import UnityTestCase
2123
22import gettext24import gettext
@@ -25,7 +27,7 @@
2527
2628
27def _make_monitor_scenarios():29def _make_monitor_scenarios():
28 num_monitors = ScreenGeometry().get_num_monitors()30 num_monitors = Display.create().get_num_screens()
29 scenarios = []31 scenarios = []
3032
31 if num_monitors == 1:33 if num_monitors == 1:
@@ -54,8 +56,8 @@
54 Returns the opened BamfWindow56 Returns the opened BamfWindow
5557
56 """58 """
57 self.close_all_app(app_name)59 self.process_manager.close_all_app(app_name)
58 app_win = self.start_app_window(app_name, locale="C")60 app_win = self.process_manager.start_app_window(app_name, locale="C")
59 app = app_win.application61 app = app_win.application
6062
61 app_win.set_focus()63 app_win.set_focus()
@@ -82,8 +84,8 @@
8284
83 def move_window_to_panel_monitor(self, window, restore_position=False):85 def move_window_to_panel_monitor(self, window, restore_position=False):
84 """Drags a window to another monitor, eventually restoring it before"""86 """Drags a window to another monitor, eventually restoring it before"""
85 if not isinstance(window, BamfWindow):87 if not isinstance(window, Window):
86 raise TypeError("Window must be a BamfWindow")88 raise TypeError("Window must be a autopilot.process.Window")
8789
88 if window.monitor == self.panel_monitor:90 if window.monitor == self.panel_monitor:
89 return91 return
@@ -94,9 +96,9 @@
94 sleep(.1)96 sleep(.1)
9597
96 if restore_position:98 if restore_position:
97 self.addCleanup(self.screen_geo.drag_window_to_monitor, window, window.monitor)99 self.addCleanup(drag_window_to_screen, window, window.monitor)
98100
99 self.screen_geo.drag_window_to_monitor(window, self.panel_monitor)101 drag_window_to_screen(window, self.panel_monitor)
100 sleep(.25)102 sleep(.25)
101 self.assertThat(window.monitor, Equals(self.panel_monitor))103 self.assertThat(window.monitor, Equals(self.panel_monitor))
102104
@@ -130,7 +132,7 @@
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."""
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.
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.
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]
134 self.assertThat(refresh_fn, Eventually(Equals([])))136 self.assertThat(refresh_fn, Eventually(Equals([])))
135137
136 def sleep_menu_settle_period(self):138 def sleep_menu_settle_period(self):
@@ -372,7 +374,7 @@
372 win_xid = text_win.x_id374 win_xid = text_win.x_id
373375
374 self.panel.move_mouse_over_window_buttons()376 self.panel.move_mouse_over_window_buttons()
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]
376 self.mouse.move(screen_x, screen_y)378 self.mouse.move(screen_x, screen_y)
377 self.mouse.click()379 self.mouse.click()
378380
@@ -400,7 +402,7 @@
400 self.panel.move_mouse_over_window_buttons()402 self.panel.move_mouse_over_window_buttons()
401 button = self.panel.window_buttons.minimize403 button = self.panel.window_buttons.minimize
402 target_x = button.x + button.width / 2404 target_x = button.x + button.width / 2
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]
404 self.mouse.move(target_x, target_y)406 self.mouse.move(target_x, target_y)
405 self.mouse.click()407 self.mouse.click()
406408
@@ -429,7 +431,7 @@
429 button = self.panel.window_buttons.unmaximize431 button = self.panel.window_buttons.unmaximize
430 button.mouse_move_to()432 button.mouse_move_to()
431 target_x = button.x + button.width / 2433 target_x = button.x + button.width / 2
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]
433 self.mouse.move(target_x, target_y)435 self.mouse.move(target_x, target_y)
434 sleep(1)436 sleep(1)
435 self.mouse.click()437 self.mouse.click()
@@ -865,7 +867,7 @@
865 self.open_new_application_window("Character Map")867 self.open_new_application_window("Character Map")
866 self.sleep_menu_settle_period()868 self.sleep_menu_settle_period()
867869
868 self.start_app("Character Map")870 self.process_manager.start_app("Character Map")
869 sleep(self.panel.menus.fadein_duration / 1000.0)871 sleep(self.panel.menus.fadein_duration / 1000.0)
870 # Not using Eventually here since this is time-critical. Need to work872 # Not using Eventually here since this is time-critical. Need to work
871 # out a better way to do this.873 # out a better way to do this.
@@ -1145,7 +1147,7 @@
11451147
1146 def setUp(self):1148 def setUp(self):
1147 super(PanelCrossMonitorsTests, self).setUp()1149 super(PanelCrossMonitorsTests, self).setUp()
1148 if self.screen_geo.get_num_monitors() < 2:1150 if self.display.get_num_screens() < 2:
1149 self.skipTest("This test requires a multimonitor setup")1151 self.skipTest("This test requires a multimonitor setup")
11501152
1151 def test_panel_title_updates_moving_window(self):1153 def test_panel_title_updates_moving_window(self):
@@ -1153,9 +1155,9 @@
1153 calc_win = self.open_new_application_window("Calculator")1155 calc_win = self.open_new_application_window("Calculator")
11541156
1155 prev_monitor = None1157 prev_monitor = None
1156 for monitor in range(0, self.screen_geo.get_num_monitors()):1158 for monitor in range(0, self.display.get_num_screens()):
1157 if calc_win.monitor != monitor:1159 if calc_win.monitor != monitor:
1158 self.screen_geo.drag_window_to_monitor(calc_win, monitor)1160 drag_window_to_screen(calc_win, monitor)
11591161
1160 if prev_monitor:1162 if prev_monitor:
1161 prev_panel = self.unity.panels.get_panel_for_monitor(prev_monitor)1163 prev_panel = self.unity.panels.get_panel_for_monitor(prev_monitor)
@@ -1174,7 +1176,7 @@
1174 self.open_new_application_window("Text Editor", maximized=True)1176 self.open_new_application_window("Text Editor", maximized=True)
1175 self.sleep_menu_settle_period()1177 self.sleep_menu_settle_period()
11761178
1177 for monitor in range(0, self.screen_geo.get_num_monitors()):1179 for monitor in range(0, self.display.get_num_screens()):
1178 panel = self.unity.panels.get_panel_for_monitor(monitor)1180 panel = self.unity.panels.get_panel_for_monitor(monitor)
1179 panel.move_mouse_over_window_buttons()1181 panel.move_mouse_over_window_buttons()
11801182
@@ -1192,7 +1194,7 @@
1192 self.unity.dash.ensure_visible()1194 self.unity.dash.ensure_visible()
1193 self.addCleanup(self.unity.dash.ensure_hidden)1195 self.addCleanup(self.unity.dash.ensure_hidden)
11941196
1195 for monitor in range(0, self.screen_geo.get_num_monitors()):1197 for monitor in range(0, self.display.get_num_screens()):
1196 panel = self.unity.panels.get_panel_for_monitor(monitor)1198 panel = self.unity.panels.get_panel_for_monitor(monitor)
11971199
1198 if self.unity.dash.monitor == monitor:1200 if self.unity.dash.monitor == monitor:
@@ -1207,7 +1209,7 @@
1207 self.unity.hud.ensure_visible()1209 self.unity.hud.ensure_visible()
1208 self.addCleanup(self.unity.hud.ensure_hidden)1210 self.addCleanup(self.unity.hud.ensure_hidden)
12091211
1210 for monitor in range(0, self.screen_geo.get_num_monitors()):1212 for monitor in range(0, self.display.get_num_screens()):
1211 panel = self.unity.panels.get_panel_for_monitor(monitor)1213 panel = self.unity.panels.get_panel_for_monitor(monitor)
12121214
1213 if self.unity.hud.monitor == monitor:1215 if self.unity.hud.monitor == monitor:
@@ -1223,7 +1225,7 @@
1223 """1225 """
1224 text_win = self.open_new_application_window("Text Editor", maximized=True)1226 text_win = self.open_new_application_window("Text Editor", maximized=True)
12251227
1226 for monitor in range(self.screen_geo.get_num_monitors()):1228 for monitor in range(self.display.get_num_screens()):
1227 panel = self.unity.panels.get_panel_for_monitor(monitor)1229 panel = self.unity.panels.get_panel_for_monitor(monitor)
12281230
1229 if monitor != text_win.monitor:1231 if monitor != text_win.monitor:
@@ -1239,7 +1241,7 @@
1239 """1241 """
1240 text_win = self.open_new_application_window("Text Editor", maximized=True)1242 text_win = self.open_new_application_window("Text Editor", maximized=True)
12411243
1242 for monitor in range(self.screen_geo.get_num_monitors()):1244 for monitor in range(self.display.get_num_screens()):
1243 panel = self.unity.panels.get_panel_for_monitor(monitor)1245 panel = self.unity.panels.get_panel_for_monitor(monitor)
12441246
1245 if monitor != text_win.monitor:1247 if monitor != text_win.monitor:
@@ -1254,7 +1256,7 @@
1254 """1256 """
1255 text_win = self.open_new_application_window("Text Editor", maximized=True)1257 text_win = self.open_new_application_window("Text Editor", maximized=True)
12561258
1257 for monitor in range(0, self.screen_geo.get_num_monitors()):1259 for monitor in range(0, self.display.get_num_screens()):
1258 panel = self.unity.panels.get_panel_for_monitor(monitor)1260 panel = self.unity.panels.get_panel_for_monitor(monitor)
12591261
1260 if monitor != text_win.monitor:1262 if monitor != text_win.monitor:
@@ -1268,7 +1270,7 @@
1268 indicator = panel.indicators.get_indicator_by_name_hint("indicator-session")1270 indicator = panel.indicators.get_indicator_by_name_hint("indicator-session")
1269 self.mouse_open_indicator(indicator)1271 self.mouse_open_indicator(indicator)
12701272
1271 for monitor in range(0, self.screen_geo.get_num_monitors()):1273 for monitor in range(0, self.display.get_num_screens()):
1272 panel = self.unity.panels.get_panel_for_monitor(monitor)1274 panel = self.unity.panels.get_panel_for_monitor(monitor)
12731275
1274 entries = panel.get_indicator_entries(include_hidden_menus=True)1276 entries = panel.get_indicator_entries(include_hidden_menus=True)
12751277
=== modified file 'tests/autopilot/unity/tests/test_quicklist.py'
--- tests/autopilot/unity/tests/test_quicklist.py 2013-04-09 18:39:09 +0000
+++ tests/autopilot/unity/tests/test_quicklist.py 2013-05-15 16:01:29 +0000
@@ -9,6 +9,7 @@
99
10from __future__ import absolute_import10from __future__ import absolute_import
1111
12from autopilot.display import move_mouse_to_screen
12from autopilot.matchers import Eventually13from autopilot.matchers import Eventually
13import os.path14import os.path
14from testtools.matchers import Contains, Equals, NotEquals15from testtools.matchers import Contains, Equals, NotEquals
@@ -40,13 +41,13 @@
4041
41 def get_desktop_entry(self, application):42 def get_desktop_entry(self, application):
42 # load the desktop file from disk:43 # load the desktop file from disk:
43 desktop_id = self.KNOWN_APPS[application]['desktop-file']44 desktop_id = self.process_manager.KNOWN_APPS[application]['desktop-file']
44 desktop_file = os.path.join('/usr/share/applications', desktop_id)45 desktop_file = os.path.join('/usr/share/applications', desktop_id)
45 return DesktopEntry(desktop_file)46 return DesktopEntry(desktop_file)
4647
47 def test_quicklist_actions(self):48 def test_quicklist_actions(self):
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."""
49 app = self.start_app(self.app_name)50 app = self.process_manager.start_app(self.app_name)
5051
51 # get the launcher icon from the launcher:52 # get the launcher icon from the launcher:
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)
@@ -70,8 +71,8 @@
70 self.register_nautilus()71 self.register_nautilus()
71 self.addCleanup(self.close_all_windows, "Nautilus")72 self.addCleanup(self.close_all_windows, "Nautilus")
7273
73 self.start_app_window("Calculator")74 self.process_manager.start_app_window("Calculator")
74 self.start_app(self.app_name)75 self.process_manager.start_app(self.app_name)
7576
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")
77 ql = self.open_quicklist_for_icon(nautilus_icon)78 ql = self.open_quicklist_for_icon(nautilus_icon)
@@ -85,7 +86,7 @@
8586
86 ql.click_item(new_win_ql_item)87 ql.click_item(new_win_ql_item)
8788
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")
89 self.assertThat(lambda: len(nautilus_windows_fn()), Eventually(Equals(1)))90 self.assertThat(lambda: len(nautilus_windows_fn()), Eventually(Equals(1)))
90 [nautilus_window] = nautilus_windows_fn()91 [nautilus_window] = nautilus_windows_fn()
9192
@@ -100,9 +101,9 @@
100 Then we activate the Calculator quicklist item.101 Then we activate the Calculator quicklist item.
101 Then we actiavte the Mahjongg launcher icon.102 Then we actiavte the Mahjongg launcher icon.
102 """103 """
103 char_win1 = self.start_app_window("Character Map")104 char_win1 = self.process_manager.start_app_window("Character Map")
104 calc_win = self.start_app_window("Calculator")105 calc_win = self.process_manager.start_app_window("Calculator")
105 char_win2 = self.start_app_window("Character Map")106 char_win2 = self.process_manager.start_app_window("Character Map")
106107
107 self.assertVisibleWindowStack([char_win2, calc_win, char_win1])108 self.assertVisibleWindowStack([char_win2, calc_win, char_win1])
108109
@@ -127,8 +128,8 @@
127 """This tests shows that when you activate a quicklist application item128 """This tests shows that when you activate a quicklist application item
128 when an application window is focused, the spread is initiated.129 when an application window is focused, the spread is initiated.
129 """130 """
130 char_win1 = self.start_app_window("Character Map")131 char_win1 = self.process_manager.start_app_window("Character Map")
131 char_win2 = self.start_app_window("Character Map")132 char_win2 = self.process_manager.start_app_window("Character Map")
132 char_app = char_win1.application133 char_app = char_win1.application
133134
134 self.assertVisibleWindowStack([char_win2, char_win1])135 self.assertVisibleWindowStack([char_win2, char_win1])
@@ -147,7 +148,7 @@
147 def test_quicklist_item_triggered_closes_dash(self):148 def test_quicklist_item_triggered_closes_dash(self):
148 """When any quicklist item is triggered it must close the dash."""149 """When any quicklist item is triggered it must close the dash."""
149150
150 calc_win = self.start_app_window("Calculator")151 calc_win = self.process_manager.start_app_window("Calculator")
151 self.assertProperty(calc_win, is_focused=True)152 self.assertProperty(calc_win, is_focused=True)
152153
153 self.unity.dash.ensure_visible()154 self.unity.dash.ensure_visible()
@@ -163,7 +164,7 @@
163164
164 def test_quicklist_closes_when_hud_opens(self):165 def test_quicklist_closes_when_hud_opens(self):
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."""
166 calc = self.start_app("Calculator")167 calc = self.process_manager.start_app("Calculator")
167168
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)
169 self.open_quicklist_for_icon(calc_icon)170 self.open_quicklist_for_icon(calc_icon)
@@ -174,7 +175,7 @@
174175
175 def test_quicklist_closes_when_dash_opens(self):176 def test_quicklist_closes_when_dash_opens(self):
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."""
177 calc = self.start_app("Calculator")178 calc = self.process_manager.start_app("Calculator")
178179
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)
180 self.open_quicklist_for_icon(calc_icon)181 self.open_quicklist_for_icon(calc_icon)
@@ -190,8 +191,8 @@
190 lp:890991191 lp:890991
191 """192 """
192193
193 calc_win = self.start_app_window("Calculator")194 calc_win = self.process_manager.start_app_window("Calculator")
194 mahj_win = self.start_app_window("Mahjongg")195 mahj_win = self.process_manager.start_app_window("Mahjongg")
195196
196 calc_icon = self.unity.launcher.model.get_icon(197 calc_icon = self.unity.launcher.model.get_icon(
197 desktop_id=calc_win.application.desktop_file)198 desktop_id=calc_win.application.desktop_file)
@@ -210,7 +211,7 @@
210 not re-open the quicklist if already open. It must hide.211 not re-open the quicklist if already open. It must hide.
211 """212 """
212213
213 calc_win = self.start_app_window("Calculator")214 calc_win = self.process_manager.start_app_window("Calculator")
214215
215 calc_icon = self.unity.launcher.model.get_icon(216 calc_icon = self.unity.launcher.model.get_icon(
216 desktop_id=calc_win.application.desktop_file)217 desktop_id=calc_win.application.desktop_file)
@@ -228,12 +229,12 @@
228 def setUp(self):229 def setUp(self):
229 super(QuicklistKeyNavigationTests, self).setUp()230 super(QuicklistKeyNavigationTests, self).setUp()
230231
231 desktop_file = self.KNOWN_APPS["Text Editor"]["desktop-file"]232 desktop_file = self.process_manager.KNOWN_APPS["Text Editor"]["desktop-file"]
232 icon_refresh_fn = lambda : self.unity.launcher.model.get_icon(233 icon_refresh_fn = lambda : self.unity.launcher.model.get_icon(
233 desktop_id=desktop_file)234 desktop_id=desktop_file)
234235
235 self.assertThat(icon_refresh_fn, Eventually(Equals(None)))236 self.assertThat(icon_refresh_fn, Eventually(Equals(None)))
236 self.ql_app = self.start_app("Text Editor")237 self.ql_app = self.process_manager.start_app("Text Editor")
237238
238 self.assertThat(icon_refresh_fn, Eventually(NotEquals(None)))239 self.assertThat(icon_refresh_fn, Eventually(NotEquals(None)))
239 self.ql_launcher_icon = icon_refresh_fn()240 self.ql_launcher_icon = icon_refresh_fn()
@@ -253,7 +254,7 @@
253254
254 def open_quicklist_with_keyboard(self):255 def open_quicklist_with_keyboard(self):
255 """Opens a quicklist using the keyboard."""256 """Opens a quicklist using the keyboard."""
256 self.screen_geo.move_mouse_to_monitor(0)257 move_mouse_to_screen(0)
257 self.ql_launcher.key_nav_start()258 self.ql_launcher.key_nav_start()
258 self.addCleanup(self.ql_launcher.key_nav_cancel)259 self.addCleanup(self.ql_launcher.key_nav_cancel)
259260
260261
=== modified file 'tests/autopilot/unity/tests/test_shortcut_hint.py'
--- tests/autopilot/unity/tests/test_shortcut_hint.py 2013-02-04 19:54:47 +0000
+++ tests/autopilot/unity/tests/test_shortcut_hint.py 2013-05-15 16:01:29 +0000
@@ -32,8 +32,8 @@
32 sleep(1)32 sleep(1)
3333
34 def skip_if_monitor_too_small(self):34 def skip_if_monitor_too_small(self):
35 monitor = self.screen_geo.get_primary_monitor()35 monitor = self.display.get_primary_screen()
36 monitor_geo = self.screen_geo.get_monitor_geometry(monitor)36 monitor_geo = self.display.get_screen_geometry(monitor)
37 monitor_w = monitor_geo[2]37 monitor_w = monitor_geo[2]
38 monitor_h = monitor_geo[3]38 monitor_h = monitor_geo[3]
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]
@@ -51,7 +51,7 @@
51 def get_launcher(self):51 def get_launcher(self):
52 # We could parameterise this so all tests run on both monitors (if MM is52 # We could parameterise this so all tests run on both monitors (if MM is
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:
54 monitor = self.screen_geo.get_primary_monitor()54 monitor = self.display.get_primary_screen()
55 return self.unity.launcher.get_launcher_for_monitor(monitor)55 return self.unity.launcher.get_launcher_for_monitor(monitor)
5656
5757
5858
=== modified file 'tests/autopilot/unity/tests/test_showdesktop.py'
--- tests/autopilot/unity/tests/test_showdesktop.py 2013-02-04 19:54:47 +0000
+++ tests/autopilot/unity/tests/test_showdesktop.py 2013-05-15 16:01:29 +0000
@@ -27,8 +27,8 @@
2727
28 def launch_test_apps(self):28 def launch_test_apps(self):
29 """Launch character map and calculator apps, and return their windows."""29 """Launch character map and calculator apps, and return their windows."""
30 char_win = self.start_app_window('Character Map', locale='C')30 char_win = self.process_manager.start_app_window('Character Map', locale='C')
31 calc_win = self.start_app_window('Calculator', locale='C')31 calc_win = self.process_manager.start_app_window('Calculator', locale='C')
32 return (char_win, calc_win)32 return (char_win, calc_win)
3333
34 def test_showdesktop_hides_apps(self):34 def test_showdesktop_hides_apps(self):
3535
=== modified file 'tests/autopilot/unity/tests/test_spread.py'
--- tests/autopilot/unity/tests/test_spread.py 2013-02-04 19:54:47 +0000
+++ tests/autopilot/unity/tests/test_spread.py 2013-05-15 16:01:29 +0000
@@ -20,11 +20,11 @@
2020
21 def start_test_application_windows(self, app_name, num_windows=2):21 def start_test_application_windows(self, app_name, num_windows=2):
22 """Start a given number of windows of the requested application"""22 """Start a given number of windows of the requested application"""
23 self.close_all_app(app_name)23 self.process_manager.close_all_app(app_name)
24 windows = []24 windows = []
2525
26 for i in range(num_windows):26 for i in range(num_windows):
27 win = self.start_app_window(app_name)27 win = self.process_manager.start_app_window(app_name)
28 if windows:28 if windows:
29 self.assertThat(win.application, Equals(windows[-1].application))29 self.assertThat(win.application, Equals(windows[-1].application))
3030
@@ -44,7 +44,7 @@
44 """Initiate the Spread for windows of the given app"""44 """Initiate the Spread for windows of the given app"""
45 icon = self.unity.launcher.model.get_icon(desktop_id=desktop_id)45 icon = self.unity.launcher.model.get_icon(desktop_id=desktop_id)
46 self.assertThat(icon, NotEquals(None))46 self.assertThat(icon, NotEquals(None))
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())
4848
49 self.addCleanup(self.keybinding, "spread/cancel")49 self.addCleanup(self.keybinding, "spread/cancel")
50 launcher.click_launcher_icon(icon)50 launcher.click_launcher_icon(icon)
@@ -57,7 +57,7 @@
5757
58 def assertWindowIsClosed(self, xid):58 def assertWindowIsClosed(self, xid):
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"""
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()]
61 self.assertThat(refresh_fn, Eventually(Equals(False)))61 self.assertThat(refresh_fn, Eventually(Equals(False)))
6262
63 def test_scale_application_windows(self):63 def test_scale_application_windows(self):
6464
=== modified file 'tests/autopilot/unity/tests/test_switcher.py'
--- tests/autopilot/unity/tests/test_switcher.py 2013-02-04 19:54:47 +0000
+++ tests/autopilot/unity/tests/test_switcher.py 2013-05-15 16:01:29 +0000
@@ -8,6 +8,7 @@
88
9from __future__ import absolute_import9from __future__ import absolute_import
1010
11from autopilot.display import move_mouse_to_screen
11from autopilot.matchers import Eventually12from autopilot.matchers import Eventually
12from autopilot.testcase import multiply_scenarios13from autopilot.testcase import multiply_scenarios
13import logging14import logging
@@ -60,7 +61,7 @@
60 args = ('Calculator', 'Character Map', 'Character Map')61 args = ('Calculator', 'Character Map', 'Character Map')
61 windows = []62 windows = []
62 for app in args:63 for app in args:
63 windows.append(self.start_app_window(app))64 windows.append(self.process_manager.start_app_window(app))
6465
65 return windows66 return windows
6667
@@ -77,7 +78,7 @@
7778
78 def test_switcher_starts_in_normal_mode(self):79 def test_switcher_starts_in_normal_mode(self):
79 """Switcher must start in normal (i.e.- not details) mode."""80 """Switcher must start in normal (i.e.- not details) mode."""
80 self.start_app("Character Map")81 self.process_manager.start_app("Character Map")
8182
82 self.unity.switcher.initiate()83 self.unity.switcher.initiate()
83 self.addCleanup(self.unity.switcher.terminate)84 self.addCleanup(self.unity.switcher.terminate)
@@ -97,7 +98,7 @@
9798
98 def test_application_window_is_fake_decorated(self):99 def test_application_window_is_fake_decorated(self):
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."""
100 window = self.start_app_window("Text Editor")101 window = self.process_manager.start_app_window("Text Editor")
101 self.unity.switcher.initiate()102 self.unity.switcher.initiate()
102 self.addCleanup(self.unity.switcher.terminate)103 self.addCleanup(self.unity.switcher.terminate)
103104
@@ -109,7 +110,7 @@
109110
110 def test_application_window_is_fake_decorated_in_detail_mode(self):111 def test_application_window_is_fake_decorated_in_detail_mode(self):
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."""
112 window = self.start_app_window("Text Editor")113 window = self.process_manager.start_app_window("Text Editor")
113 self.unity.switcher.initiate(SwitcherMode.DETAIL)114 self.unity.switcher.initiate(SwitcherMode.DETAIL)
114 self.addCleanup(self.unity.switcher.terminate)115 self.addCleanup(self.unity.switcher.terminate)
115116
@@ -178,7 +179,7 @@
178 open the switcher.179 open the switcher.
179180
180 """181 """
181 self.start_app("Character Map")182 self.process_manager.start_app("Character Map")
182183
183 self.keybinding_hold("switcher/reveal_normal")184 self.keybinding_hold("switcher/reveal_normal")
184 self.addCleanup(self.keybinding_release, "switcher/reveal_normal")185 self.addCleanup(self.keybinding_release, "switcher/reveal_normal")
@@ -190,7 +191,7 @@
190191
191 def test_switcher_cancel(self):192 def test_switcher_cancel(self):
192 """Pressing the switcher cancel keystroke must cancel the switcher."""193 """Pressing the switcher cancel keystroke must cancel the switcher."""
193 self.start_app("Character Map")194 self.process_manager.start_app("Character Map")
194195
195 self.unity.switcher.initiate()196 self.unity.switcher.initiate()
196 self.addCleanup(self.unity.switcher.terminate)197 self.addCleanup(self.unity.switcher.terminate)
@@ -201,7 +202,7 @@
201202
202 def test_lazy_switcher_cancel(self):203 def test_lazy_switcher_cancel(self):
203 """Must be able to cancel the switcher after a 'lazy' initiation."""204 """Must be able to cancel the switcher after a 'lazy' initiation."""
204 self.start_app("Character Map")205 self.process_manager.start_app("Character Map")
205206
206 self.keybinding_hold("switcher/reveal_normal")207 self.keybinding_hold("switcher/reveal_normal")
207 self.addCleanup(self.keybinding_release, "switcher/reveal_normal")208 self.addCleanup(self.keybinding_release, "switcher/reveal_normal")
@@ -221,14 +222,14 @@
221 # TODO - this test fails in multi-monitor setups. You can't use addCleanup222 # TODO - this test fails in multi-monitor setups. You can't use addCleanup
222 # a better way would be to have a scenario'd class for multi-monitor223 # a better way would be to have a scenario'd class for multi-monitor
223 # switcher tests.224 # switcher tests.
224 num_monitors = self.screen_geo.get_num_monitors()225 num_monitors = self.display.get_num_screens()
225 if num_monitors == 1:226 if num_monitors == 1:
226 self.skip("No point testing this on one monitor")227 self.skip("No point testing this on one monitor")
227228
228 charmap, calc, mahjongg = self.start_applications()229 charmap, calc, mahjongg = self.start_applications()
229230
230 for monitor in range(num_monitors):231 for monitor in range(num_monitors):
231 self.screen_geo.move_mouse_to_monitor(monitor)232 move_mouse_to_screen(monitor)
232 self.unity.switcher.initiate()233 self.unity.switcher.initiate()
233 self.addCleanup(self.unity.switcher.terminate)234 self.addCleanup(self.unity.switcher.terminate)
234 self.assertThat(self.unity.switcher.monitor, Eventually(Equals(monitor)))235 self.assertThat(self.unity.switcher.monitor, Eventually(Equals(monitor)))
@@ -236,7 +237,7 @@
236 def test_switcher_alt_f4_is_disabled(self):237 def test_switcher_alt_f4_is_disabled(self):
237 """Tests that alt+f4 does not work while switcher is active."""238 """Tests that alt+f4 does not work while switcher is active."""
238239
239 win = self.start_app_window("Text Editor")240 win = self.process_manager.start_app_window("Text Editor")
240241
241 self.unity.switcher.initiate()242 self.unity.switcher.initiate()
242 self.addCleanup(self.unity.switcher.terminate)243 self.addCleanup(self.unity.switcher.terminate)
@@ -333,7 +334,7 @@
333 self.skipTest("This test requires enabled more than one workspace.")334 self.skipTest("This test requires enabled more than one workspace.")
334 initial_workspace = self.workspace.current_workspace335 initial_workspace = self.workspace.current_workspace
335 self.addCleanup(self.workspace.switch_to, initial_workspace)336 self.addCleanup(self.workspace.switch_to, initial_workspace)
336 self.start_app_window("Character Map")337 self.process_manager.start_app_window("Character Map")
337 self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces)338 self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces)
338 self.start_applications("Character Map", "Mahjongg")339 self.start_applications("Character Map", "Mahjongg")
339340
@@ -366,7 +367,7 @@
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.
367368
368 """369 """
369 self.start_app_window("Character Map")370 self.process_manager.start_app_window("Character Map")
370 self.unity.switcher.initiate()371 self.unity.switcher.initiate()
371 self.addCleanup(self.unity.switcher.terminate)372 self.addCleanup(self.unity.switcher.terminate)
372373
@@ -379,7 +380,7 @@
379 must select first item in the model in non-details mode.380 must select first item in the model in non-details mode.
380381
381 """382 """
382 self.start_app("Character Map")383 self.process_manager.start_app("Character Map")
383 self.unity.switcher.initiate()384 self.unity.switcher.initiate()
384 self.addCleanup(self.unity.switcher.terminate)385 self.addCleanup(self.unity.switcher.terminate)
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:
@@ -437,9 +438,9 @@
437 initial_workspace = self.workspace.current_workspace438 initial_workspace = self.workspace.current_workspace
438 self.addCleanup(self.workspace.switch_to, initial_workspace)439 self.addCleanup(self.workspace.switch_to, initial_workspace)
439440
440 calc = self.start_app("Calculator")441 calc = self.process_manager.start_app("Calculator")
441 self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces)442 self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces)
442 char_map = self.start_app("Character Map")443 char_map = self.process_manager.start_app("Character Map")
443444
444 self.unity.switcher.initiate()445 self.unity.switcher.initiate()
445 self.addCleanup(self.unity.switcher.terminate)446 self.addCleanup(self.unity.switcher.terminate)
@@ -453,9 +454,9 @@
453 initial_workspace = self.workspace.current_workspace454 initial_workspace = self.workspace.current_workspace
454 self.addCleanup(self.workspace.switch_to, initial_workspace)455 self.addCleanup(self.workspace.switch_to, initial_workspace)
455456
456 calc = self.start_app("Calculator")457 calc = self.process_manager.start_app("Calculator")
457 self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces)458 self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces)
458 char_map = self.start_app("Character Map")459 char_map = self.process_manager.start_app("Character Map")
459460
460 self.unity.switcher.initiate(SwitcherMode.ALL)461 self.unity.switcher.initiate(SwitcherMode.ALL)
461 self.addCleanup(self.unity.switcher.terminate)462 self.addCleanup(self.unity.switcher.terminate)
@@ -477,14 +478,14 @@
477 # it harder to write the tests.478 # it harder to write the tests.
478 self.set_unity_option("alt_tab_timeout", False)479 self.set_unity_option("alt_tab_timeout", False)
479480
480 self.start_app("Character Map")481 self.process_manager.start_app("Character Map")
481482
482 self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces)483 self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces)
483 char_win2 = self.start_app_window("Character Map")484 char_win2 = self.process_manager.start_app_window("Character Map")
484 self.keybinding("window/minimize")485 self.keybinding("window/minimize")
485 self.assertProperty(char_win2, is_hidden=True)486 self.assertProperty(char_win2, is_hidden=True)
486487
487 self.start_app("Calculator")488 self.process_manager.start_app("Calculator")
488489
489 self.unity.switcher.initiate()490 self.unity.switcher.initiate()
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:

Subscribers

People subscribed via source and target branches

to all changes: