Exemplo n.º 1
0
 def key_nav_start(self):
     """Start keyboard navigation mode by pressing Alt+F1."""
     move_mouse_to_screen(self.monitor)
     logger.debug("Initiating launcher keyboard navigation with Alt+F1.")
     self.keybinding("launcher/keynav")
     self._get_controller().key_nav_is_active.wait_for(True)
     self.in_keynav_mode = True
Exemplo n.º 2
0
 def key_nav_start(self):
     """Start keyboard navigation mode by pressing Alt+F1."""
     move_mouse_to_screen(self.monitor)
     logger.debug("Initiating launcher keyboard navigation with Alt+F1.")
     self.keybinding("launcher/keynav")
     self._get_controller().key_nav_is_active.wait_for(True)
     self.in_keynav_mode = True
Exemplo n.º 3
0
 def switcher_start(self):
     """Start the super+Tab switcher on this launcher."""
     move_mouse_to_screen(self.monitor)
     logger.debug("Starting Super+Tab switcher.")
     self.keybinding_hold_part_then_tap("launcher/switcher")
     self._get_controller().key_nav_is_active.wait_for(True)
     self.in_switcher_mode = True
Exemplo n.º 4
0
 def switcher_start(self):
     """Start the super+Tab switcher on this launcher."""
     move_mouse_to_screen(self.monitor)
     logger.debug("Starting Super+Tab switcher.")
     self.keybinding_hold_part_then_tap("launcher/switcher")
     self._get_controller().key_nav_is_active.wait_for(True)
     self.in_switcher_mode = True
Exemplo n.º 5
0
    def setUp(self):
        super(HudBehaviorTests, self).setUp()

        if not environ.get('UBUNTU_MENUPROXY', ''):
            self.patch_environment('UBUNTU_MENUPROXY', 'libappmenu.so')
        self.hud_monitor = self.display.get_primary_screen()
        move_mouse_to_screen(self.hud_monitor)
Exemplo n.º 6
0
 def keyboard_unreveal_launcher(self):
     """Un-reveal this launcher using the keyboard."""
     move_mouse_to_screen(self.monitor)
     logger.debug("Un-revealing launcher with keyboard.")
     self.keybinding_release("launcher/reveal")
     # only wait if the launcher is set to autohide
     if self.hidemode == 1:
         self.is_showing.wait_for(False)
Exemplo n.º 7
0
 def keyboard_unreveal_launcher(self):
     """Un-reveal this launcher using the keyboard."""
     move_mouse_to_screen(self.monitor)
     logger.debug("Un-revealing launcher with keyboard.")
     self.keybinding_release("launcher/reveal")
     # only wait if the launcher is set to autohide
     if self.hidemode == 1:
         self.is_showing.wait_for(False)
Exemplo n.º 8
0
    def setUp(self):
        super(HudLockedLauncherInteractionsTests, self).setUp()
        # Locked Launchers on all monitors
        self.set_unity_option('num_launchers', 0)
        self.set_unity_option('launcher_hide_mode', 0)

        move_mouse_to_screen(self.hud_monitor)
        sleep(0.5)
Exemplo n.º 9
0
 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))
     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))
     sleep(0.5)
Exemplo n.º 10
0
 def on_test_end(cls, test_instance):
     """Put mouse in a known safe state."""
     global _PRESSED_MOUSE_BUTTONS
     for btn in _PRESSED_MOUSE_BUTTONS:
         _logger.debug("Releasing mouse button %d as part of cleanup", btn)
         fake_input(get_display(), X.ButtonRelease, btn)
     _PRESSED_MOUSE_BUTTONS = []
     move_mouse_to_screen(0)
Exemplo n.º 11
0
    def move_mouse_over_launcher(self):
        """Move the mouse over this launcher."""
        move_mouse_to_screen(self.monitor)
        (x, y, w, h) = self.geometry
        target_x = x + w / 2
        target_y = y + h / 2

        logger.debug("Moving mouse to center of launcher.")
        self._mouse.move(target_x, target_y)
Exemplo n.º 12
0
    def move_mouse_over_launcher(self):
        """Move the mouse over this launcher."""
        move_mouse_to_screen(self.monitor)
        (x, y, w, h) = self.geometry
        target_x = x + w / 2
        target_y = y + h / 2

        logger.debug("Moving mouse to center of launcher.")
        self._mouse.move(target_x, target_y)
Exemplo n.º 13
0
    def move_mouse_to_right_of_launcher(self):
        """Places the mouse to the right of this launcher."""
        move_mouse_to_screen(self.monitor)
        (x, y, w, h) = self.geometry
        target_x = x + w + 10
        target_y = y + h / 2

        logger.debug("Moving mouse away from launcher.")
        self._mouse.move(target_x, target_y, False)
        sleep(self.show_timeout)
Exemplo n.º 14
0
    def move_mouse_to_right_of_launcher(self):
        """Places the mouse to the right of this launcher."""
        move_mouse_to_screen(self.monitor)
        (x, y, w, h) = self.geometry
        target_x = x + w + 10
        target_y = y + h / 2

        logger.debug("Moving mouse away from launcher.")
        self._mouse.move(target_x, target_y, False)
        sleep(self.show_timeout)
Exemplo n.º 15
0
 def test_launcher_does_not_reveal_with_mouse_down(self):
     """Launcher must not reveal if have mouse button 1 down."""
     move_mouse_to_screen(self.launcher_instance.monitor)
     self.mouse.press(1)
     self.addCleanup(self.mouse.release, 1)
     #FIXME: This is really bad API. it says reveal but it's expected to fail. bad bad bad!!
     self.launcher_instance.mouse_reveal_launcher()
     # Need a sleep here otherwise this test would pass even if the code failed.
     # THis test needs to be rewritten...
     sleep(5)
     self.assertThat(self.launcher_instance.is_showing, Equals(False))
Exemplo n.º 16
0
 def test_launcher_does_not_reveal_with_mouse_down(self):
     """Launcher must not reveal if have mouse button 1 down."""
     move_mouse_to_screen(self.launcher_instance.monitor)
     self.mouse.press(1)
     self.addCleanup(self.mouse.release, 1)
     #FIXME: This is really bad API. it says reveal but it's expected to fail. bad bad bad!!
     self.launcher_instance.mouse_reveal_launcher()
     # Need a sleep here otherwise this test would pass even if the code failed.
     # THis test needs to be rewritten...
     sleep(5)
     self.assertThat(self.launcher_instance.is_showing, Equals(False))
Exemplo n.º 17
0
    def test_hud_does_not_open_when_fullscreen_window(self):
        """ The Hud must not open if a window is fullscreen. """
        gedit = self.process_manager.start_app("Text Editor")
        self.keyboard.press_and_release('F11')

        monitor = gedit.get_windows()[0].monitor
        move_mouse_to_screen(monitor)

        self.keybinding("hud/reveal")
        self.addCleanup(self.unity.hud.ensure_hidden)

        self.assertThat(self.unity.hud.visible, Eventually(Equals(False)))
Exemplo n.º 18
0
    def test_hud_opens_on_second_monitor_if_first_has_fullscreen_window(self):
        """ The Hud must open if the mouse is over the second monitor while the
            first monitor has a fullscreen window. """

        gedit = self.process_manager.start_app("Text Editor")
        monitor = gedit.get_windows()[0].monitor
        self.keyboard.press_and_release('F11')

        move_mouse_to_screen((monitor + 1) % self.display.get_num_screens())
        self.keybinding("hud/reveal")
        self.addCleanup(self.unity.hud.ensure_hidden)

        self.assertThat(self.unity.hud.visible, Eventually(Equals(True)))
Exemplo n.º 19
0
    def test_hud_stays_on_same_monitor(self):
        """If the hud is opened, then the mouse is moved to another monitor and
        the keyboard is used. The hud must not move to that monitor.
        """

        current_monitor = self.unity.hud.ideal_monitor

        self.unity.hud.ensure_visible()
        self.addCleanup(self.unity.hud.ensure_hidden)

        move_mouse_to_screen((current_monitor + 1) % self.display.get_num_screens())
        self.keyboard.type("abc")

        self.assertThat(self.unity.hud.ideal_monitor, Eventually(Equals(current_monitor)))
Exemplo n.º 20
0
    def test_hud_close_on_cross_monitor_click(self):
        """Hud must close when clicking on a window in a different screen."""

        self.addCleanup(self.unity.hud.ensure_hidden)

        for monitor in range(self.display.get_num_screens()-1):
            move_mouse_to_screen(monitor)
            self.unity.hud.ensure_visible()

            move_mouse_to_screen(monitor+1)
            sleep(.5)
            self.mouse.click()

            self.assertThat(self.unity.hud.visible, Eventually(Equals(False)))
Exemplo n.º 21
0
    def open_quicklist_with_keyboard(self):
        """Opens a quicklist using the keyboard."""
        move_mouse_to_screen(0)
        self.ql_launcher.key_nav_start()
        self.addCleanup(self.ql_launcher.key_nav_cancel)

        self.ql_launcher.keyboard_select_icon(self.launcher_position, tooltip_text=self.ql_app.name)
        self.keybinding(keys[self.launcher_position + "/launcher/keynav/open-quicklist"])
        self.addCleanup(self.keybinding, "launcher/keynav/close-quicklist")

        self.assertThat(self.ql_launcher_icon.get_quicklist,
                        Eventually(NotEquals(None)))
        self.quicklist = self.ql_launcher_icon.get_quicklist()
        self.assertThat(lambda: self.quicklist.selected_item,
                        Eventually(NotEquals(None)))
Exemplo n.º 22
0
    def open_quicklist_with_keyboard(self):
        """Opens a quicklist using the keyboard."""
        move_mouse_to_screen(0)
        self.ql_launcher.key_nav_start()
        self.addCleanup(self.ql_launcher.key_nav_cancel)

        self.ql_launcher.keyboard_select_icon(tooltip_text=self.ql_app.name)
        self.keybinding("launcher/keynav/open-quicklist")
        self.addCleanup(self.keybinding, "launcher/keynav/close-quicklist")

        self.assertThat(self.ql_launcher_icon.get_quicklist,
                        Eventually(NotEquals(None)))
        self.quicklist = self.ql_launcher_icon.get_quicklist()
        self.assertThat(lambda: self.quicklist.selected_item,
                        Eventually(NotEquals(None)))
Exemplo n.º 23
0
    def mouse_reveal_launcher(self):
        """Reveal this launcher with the mouse.

        If the launcher is already visible calling this method does nothing.
        """
        if self.is_showing:
            return
        move_mouse_to_screen(self.monitor)
        (x, y, w, h) = self.geometry

        target_x = x - 300 # this is the pressure we need to reveal the launcher.
        target_y = y + h / 2
        logger.debug("Revealing launcher on monitor %d with mouse.", self.monitor)
        self._mouse.move(target_x, target_y, True, 5, .002)

        # Move the mouse back to the launcher for multi-monitor
        self._mouse.move(x, target_y, True, 5, .002)
Exemplo n.º 24
0
    def mouse_reveal_launcher(self):
        """Reveal this launcher with the mouse.

        If the launcher is already visible calling this method does nothing.
        """
        if self.is_showing:
            return
        move_mouse_to_screen(self.monitor)
        (x, y, w, h) = self.geometry

        target_x = x - 300  # this is the pressure we need to reveal the launcher.
        target_y = y + h / 2
        logger.debug("Revealing launcher on monitor %d with mouse.",
                     self.monitor)
        self._mouse.move(target_x, target_y, True, 5, .002)

        # Move the mouse back to the launcher for multi-monitor
        self._mouse.move(x, target_y, True, 5, .002)
Exemplo n.º 25
0
    def test_switcher_appears_on_monitor_with_mouse(self):
        """Tests that the switches appears on the correct monitor.

        This is defined as the monitor with the mouse.

        """
        # TODO - this test fails in multi-monitor setups. You can't use addCleanup
        # a better way would be to have a scenario'd class for multi-monitor
        # switcher tests.
        num_monitors = self.display.get_num_screens()
        if num_monitors == 1:
            self.skip("No point testing this on one monitor")

        charmap, calc, mahjongg = self.start_applications()

        self.addCleanup(self.unity.switcher.terminate)

        for monitor in range(num_monitors):
            move_mouse_to_screen(monitor)
            self.unity.switcher.initiate()
            self.assertThat(self.unity.switcher.monitor, Eventually(Equals(monitor)))
            self.unity.switcher.terminate()
            sleep(1)
Exemplo n.º 26
0
    def test_switcher_appears_on_monitor_with_mouse(self):
        """Tests that the switches appears on the correct monitor.

        This is defined as the monitor with the mouse.

        """
        # TODO - this test fails in multi-monitor setups. You can't use addCleanup
        # a better way would be to have a scenario'd class for multi-monitor
        # switcher tests.
        num_monitors = self.display.get_num_screens()
        if num_monitors == 1:
            self.skip("No point testing this on one monitor")

        charmap, calc, mahjongg = self.start_applications()

        self.addCleanup(self.unity.switcher.terminate)

        for monitor in range(num_monitors):
            move_mouse_to_screen(monitor)
            self.unity.switcher.initiate()
            self.assertThat(self.unity.switcher.monitor,
                            Eventually(Equals(monitor)))
            self.unity.switcher.terminate()
            sleep(1)
Exemplo n.º 27
0
 def move_mouse_to_screen_of_current_launcher(self):
     """Places the mouse on the screen of this launcher."""
     move_mouse_to_screen(self.monitor)
Exemplo n.º 28
0
 def move_mouse_to_screen_of_current_launcher(self):
     """Places the mouse on the screen of this launcher."""
     move_mouse_to_screen(self.monitor)
Exemplo n.º 29
0
 def move_mouse_over_launcher(self):
     """Move the mouse over this launcher."""
     move_mouse_to_screen(self.monitor)
     logger.debug("Moving mouse to center of launcher.")
     self._mouse.move_to_object(self)
Exemplo n.º 30
0
 def keyboard_reveal_launcher(self):
     """Reveal this launcher using the keyboard."""
     move_mouse_to_screen(self.monitor)
     logger.debug("Revealing launcher with keyboard.")
     self.keybinding_hold("launcher/reveal")
     self.is_showing.wait_for(True)
Exemplo n.º 31
0
 def keyboard_reveal_launcher(self):
     """Reveal this launcher using the keyboard."""
     move_mouse_to_screen(self.monitor)
     logger.debug("Revealing launcher with keyboard.")
     self.keybinding_hold("launcher/reveal")
     self.is_showing.wait_for(True)