/usr/lib/python2.7/dist-packages/unity/tests/launcher/test_shortcut.py is in unity-autopilot 7.5.0+18.04.20180413-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2012 Canonical
# Authors: Thomi Richards,
# Marco Trevisan (TreviƱo)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
from __future__ import absolute_import
from autopilot.matchers import Eventually
import logging
from testtools.matchers import Equals
from time import sleep
from unity.tests.launcher import LauncherTestCase
logger = logging.getLogger(__name__)
class LauncherShortcutTests(LauncherTestCase):
"""Tests for the shortcut hint window."""
def setUp(self):
super(LauncherShortcutTests, self).setUp()
self.launcher_instance.keyboard_reveal_launcher()
self.addCleanup(self.launcher_instance.keyboard_unreveal_launcher)
sleep(2)
def test_launcher_keyboard_reveal_shows_shortcut_hints(self):
"""Launcher icons must show shortcut hints after revealing with keyboard."""
self.assertThat(self.launcher_instance.shortcuts_shown, Eventually(Equals(True)))
def test_launcher_switcher_keeps_shorcuts(self):
"""Initiating launcher switcher after showing shortcuts must not hide shortcuts"""
self.launcher_instance.switcher_start()
self.addCleanup(self.launcher_instance.switcher_cancel)
self.assertThat(self.unity.launcher.key_nav_is_active, Eventually(Equals(True)))
self.assertThat(self.launcher_instance.shortcuts_shown, Eventually(Equals(True)))
def test_launcher_switcher_next_keeps_shortcuts(self):
"""Launcher switcher next action must keep shortcuts after they've been shown."""
self.launcher_instance.switcher_start()
self.addCleanup(self.launcher_instance.switcher_cancel)
self.launcher_instance.switcher_next()
self.assertThat(self.launcher_instance.shortcuts_shown, Eventually(Equals(True)))
def test_launcher_switcher_prev_keeps_shortcuts(self):
"""Launcher switcher prev action must keep shortcuts after they've been shown."""
self.launcher_instance.switcher_start()
self.addCleanup(self.launcher_instance.switcher_cancel)
self.launcher_instance.switcher_prev()
self.assertThat(self.launcher_instance.shortcuts_shown, Eventually(Equals(True)))
def test_tooltip_not_shown(self):
"""Tooltip must not be shown after revealing the launcher with keyboard
and mouse is not on the launcher.
"""
self.assertThat(self.launcher_instance.tooltip_shown, Eventually(Equals(False)))
|