diff options
| -rw-r--r-- | tests/autopilot/unity/emulators/launcher.py | 5 | ||||
| -rw-r--r-- | tests/autopilot/unity/tests/launcher/test_reveal.py | 33 |
2 files changed, 26 insertions, 12 deletions
diff --git a/tests/autopilot/unity/emulators/launcher.py b/tests/autopilot/unity/emulators/launcher.py index 1ae9bb40d..fa135efce 100644 --- a/tests/autopilot/unity/emulators/launcher.py +++ b/tests/autopilot/unity/emulators/launcher.py @@ -305,7 +305,7 @@ class Launcher(UnityIntrospectionObject, KeybindingsHelper): self._perform_switcher_binding("launcher/switcher/down") self._get_controller().key_nav_selection.wait_for(NotEquals(old_selection)) - def click_launcher_icon(self, icon, button=1): + def click_launcher_icon(self, icon, button=1, move_mouse_after=True): """Move the mouse over the launcher icon, and click it. `icon` must be an instance of SimpleLauncherIcon or it's descendants. """ @@ -325,7 +325,8 @@ class Launcher(UnityIntrospectionObject, KeybindingsHelper): self._mouse.move(target_x, target_y ) sleep(1) self._mouse.click(button) - self.move_mouse_to_right_of_launcher() + if (move_mouse_after): + self.move_mouse_to_right_of_launcher() def drag_icon_to_position(self, icon, pos, drag_type=IconDragType.INSIDE): """Place the supplied icon above the icon in the position pos. diff --git a/tests/autopilot/unity/tests/launcher/test_reveal.py b/tests/autopilot/unity/tests/launcher/test_reveal.py index 06b184f46..cc61cf194 100644 --- a/tests/autopilot/unity/tests/launcher/test_reveal.py +++ b/tests/autopilot/unity/tests/launcher/test_reveal.py @@ -74,22 +74,35 @@ class LauncherRevealTests(LauncherTestCase): self.assertThat(self.launcher_instance.is_showing, Equals(False)) def test_launcher_stays_open_after_spread(self): - """When """ - calc_win1 = self.start_app_window("Calculator") - #calc_win2 = self.start_app_window("Calculator") - calc_app = calc_win1.application + """When clicking on the launcher to close spread the launcher must not autohide.""" + char_win1 = self.start_app_window("Character Map") + char_win2 = self.start_app_window("Character Map") + char_app = char_win1.application - #self.assertVisibleWindowStack([calc_win2, calc_win1]) - #self.assertProperty(calc_win2, is_focused=True) + self.assertVisibleWindowStack([char_win2, char_win1]) + self.assertProperty(char_win2, is_focused=True) - calc_icon = self.launcher.model.get_icon(desktop_id=calc_app.desktop_file) - #self.addCleanup(self.keybinding, "spread/cancel") - self.launcher_instance.click_launcher_icon(calc_icon) - self.launcher_instance.click_launcher_icon(calc_icon) + char_icon = self.launcher.model.get_icon(desktop_id=char_app.desktop_file) + self.launcher_instance.click_launcher_icon(char_icon, move_mouse_after=False) + self.assertThat(self.window_manager.scale_active, Eventually(Equals(True))) + self.launcher_instance.click_launcher_icon(char_icon, move_mouse_after=False) + + self.assertThat(self.launcher_instance.is_showing, Eventually(Equals(True))) self.assertThat(self.window_manager.scale_active, Eventually(Equals(False))) + def test_launcher_stays_open_after_icon_click(self): + """When clicking on an icon the launcher must not autohide.""" + char_win = self.start_app_window("Character Map") + char_app = char_win.application + + char_icon = self.launcher.model.get_icon(desktop_id=char_app.desktop_file) + self.launcher_instance.click_launcher_icon(char_icon, move_mouse_after=False) + # Have to sleep to give the launcher time to hide (what the old behavior was) + sleep(1) + + self.assertThat(self.launcher_instance.is_showing, Eventually(Equals(True))) def test_new_icon_has_the_shortcut(self): """New icons should have an associated shortcut""" |
