diff options
| author | handsome_feng <445865575@qq.com> | 2016-03-11 17:11:23 +0800 |
|---|---|---|
| committer | handsome_feng <445865575@qq.com> | 2016-03-11 17:11:23 +0800 |
| commit | 08a96564597230edb7749cedab7aa00103c48e9e (patch) | |
| tree | 31ac013c65957e01a33a4a25e56d9a2376af6fde /tests | |
| parent | aef328dd57863bb810e7b62030e57bf0144e6d3b (diff) | |
Fix some fials in hud and dash autopilot tests
(bzr r4067.4.13)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/autopilot/unity/tests/test_dash.py | 4 | ||||
| -rw-r--r-- | tests/autopilot/unity/tests/test_hud.py | 31 |
2 files changed, 28 insertions, 7 deletions
diff --git a/tests/autopilot/unity/tests/test_dash.py b/tests/autopilot/unity/tests/test_dash.py index 8e488750e..a2f3f6832 100644 --- a/tests/autopilot/unity/tests/test_dash.py +++ b/tests/autopilot/unity/tests/test_dash.py @@ -148,10 +148,10 @@ class DashRevealTests(DashTestCase): self.unity.dash.ensure_visible() - # Click bottom right of the screen, but take into account the non-maximized window - + # Click right of the screen, but take into account the non-maximized window - # we do not want to click on it as it focuses the wrong window w = self.display.get_screen_width() - 1 - h = self.display.get_screen_height() - 1 + h = self.display.get_screen_height() / 2 # If the mouse is over the non-maximized window, move it away from it. (calc_x, calc_y, calc_w, calc_h) = calc_win.get_windows()[0].geometry diff --git a/tests/autopilot/unity/tests/test_hud.py b/tests/autopilot/unity/tests/test_hud.py index 8467caa53..310ceb17f 100644 --- a/tests/autopilot/unity/tests/test_hud.py +++ b/tests/autopilot/unity/tests/test_hud.py @@ -27,6 +27,8 @@ from testtools.matchers import MismatchError from time import sleep from unity.emulators.icons import HudLauncherIcon +from unity.emulators.icons import BFBLauncherIcon +from unity.emulators.launcher import LauncherPosition from unity.tests import UnityTestCase @@ -585,7 +587,10 @@ class HudLauncherInteractionsTests(HudTestsBase): class HudLockedLauncherInteractionsTests(HudTestsBase): - scenarios = _make_monitor_scenarios() + launcher_position = [('Launcher on the left', {'launcher_position': LauncherPosition.LEFT}), + ('Launcher on the bottom', {'launcher_position': LauncherPosition.BOTTOM})] + + scenarios = multiply_scenarios(_make_monitor_scenarios(), launcher_position) def setUp(self): super(HudLockedLauncherInteractionsTests, self).setUp() @@ -593,6 +598,10 @@ class HudLockedLauncherInteractionsTests(HudTestsBase): self.set_unity_option('num_launchers', 0) self.set_unity_option('launcher_hide_mode', 0) + old_pos = self.call_gsettings_cmd('get', 'com.canonical.Unity.Launcher', 'launcher-position') + self.call_gsettings_cmd('set', 'com.canonical.Unity.Launcher', 'launcher-position', '"%s"' % self.launcher_position) + self.addCleanup(self.call_gsettings_cmd, 'set', 'com.canonical.Unity.Launcher', 'launcher-position', old_pos) + move_mouse_to_screen(self.hud_monitor) sleep(0.5) @@ -608,8 +617,9 @@ class HudLockedLauncherInteractionsTests(HudTestsBase): self.unity.hud.ensure_visible() - self.assertTrue(hud_icon.monitors_visibility[self.hud_monitor]) - self.assertTrue(hud_icon.is_on_monitor(self.hud_monitor)) + if self.launcher_position == LauncherPosition.LEFT: + self.assertTrue(hud_icon.monitors_visibility[self.hud_monitor]) + self.assertTrue(hud_icon.is_on_monitor(self.hud_monitor)) # For some reason the BFB icon is always visible :-/ #bfb_icon.visible, Eventually(Equals(False) @@ -622,6 +632,8 @@ class HudLockedLauncherInteractionsTests(HudTestsBase): if isinstance(icon, HudLauncherIcon): self.assertFalse(icon.monitors_desaturated[self.hud_monitor]) else: + if isinstance(icon, BFBLauncherIcon) and self.launcher_position == LauncherPosition.BOTTOM: + continue self.assertTrue(icon.monitors_desaturated[self.hud_monitor]) def test_hud_launcher_icon_click_hides_hud(self): @@ -645,15 +657,24 @@ class HudVisualTests(HudTestsBase): launcher_screen = [('Launcher on all monitors', {'launcher_primary_only': False}), ('Launcher on primary monitor', {'launcher_primary_only': True})] - scenarios = multiply_scenarios(_make_monitor_scenarios(), launcher_modes, launcher_screen) + launcher_position = [('Launcher on the left', {'launcher_position': LauncherPosition.LEFT}), + ('Launcher on the bottom', {'launcher_position': LauncherPosition.BOTTOM})] + + scenarios = multiply_scenarios(_make_monitor_scenarios(), launcher_modes, launcher_screen, launcher_position) def setUp(self): super(HudVisualTests, self).setUp() move_mouse_to_screen(self.hud_monitor) self.set_unity_option('launcher_hide_mode', int(self.launcher_autohide)) self.set_unity_option('num_launchers', int(self.launcher_primary_only)) + + old_pos = self.call_gsettings_cmd('get', 'com.canonical.Unity.Launcher', 'launcher-position') + self.call_gsettings_cmd('set', 'com.canonical.Unity.Launcher', 'launcher-position', '"%s"' % self.launcher_position) + self.addCleanup(self.call_gsettings_cmd, 'set', 'com.canonical.Unity.Launcher', 'launcher-position', old_pos) + self.hud_monitor_is_primary = (self.display.get_primary_screen() == self.hud_monitor) - self.hud_locked = (not self.launcher_autohide and (not self.launcher_primary_only or self.hud_monitor_is_primary)) + self.hud_locked = (not self.launcher_autohide and (not self.launcher_primary_only or self.hud_monitor_is_primary) + and self.launcher_position != LauncherPosition.BOTTOM) sleep(0.5) def test_initially_hidden(self): |
