Back to index

unity  6.0.0
test_shortcut.py
Go to the documentation of this file.
00001 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
00002 # Copyright 2012 Canonical
00003 # Authors: Thomi Richards,
00004 #          Marco Trevisan (TreviƱo)
00005 #
00006 # This program is free software: you can redistribute it and/or modify it
00007 # under the terms of the GNU General Public License version 3, as published
00008 # by the Free Software Foundation.
00009 
00010 from __future__ import absolute_import
00011 
00012 from autopilot.matchers import Eventually
00013 import logging
00014 from testtools.matchers import Equals
00015 from time import sleep
00016 
00017 from unity.tests.launcher import LauncherTestCase
00018 
00019 logger = logging.getLogger(__name__)
00020 
00021 
00022 class LauncherShortcutTests(LauncherTestCase):
00023     """Tests for the shortcut hint window."""
00024 
00025     def setUp(self):
00026         super(LauncherShortcutTests, self).setUp()
00027         self.launcher_instance.keyboard_reveal_launcher()
00028         self.addCleanup(self.launcher_instance.keyboard_unreveal_launcher)
00029         sleep(2)
00030 
00031     def test_launcher_keyboard_reveal_shows_shortcut_hints(self):
00032         """Launcher icons must show shortcut hints after revealing with keyboard."""
00033         self.assertThat(self.launcher_instance.shortcuts_shown, Eventually(Equals(True)))
00034 
00035     def test_launcher_switcher_keeps_shorcuts(self):
00036         """Initiating launcher switcher after showing shortcuts must not hide shortcuts"""
00037         self.launcher_instance.switcher_start()
00038         self.addCleanup(self.launcher_instance.switcher_cancel)
00039 
00040         self.assertThat(self.launcher.key_nav_is_active, Eventually(Equals(True)))
00041         self.assertThat(self.launcher_instance.shortcuts_shown, Eventually(Equals(True)))
00042 
00043     def test_launcher_switcher_next_keeps_shortcuts(self):
00044         """Launcher switcher next action must keep shortcuts after they've been shown."""
00045         self.launcher_instance.switcher_start()
00046         self.addCleanup(self.launcher_instance.switcher_cancel)
00047         self.launcher_instance.switcher_next()
00048         self.assertThat(self.launcher_instance.shortcuts_shown, Eventually(Equals(True)))
00049 
00050     def test_launcher_switcher_prev_keeps_shortcuts(self):
00051         """Launcher switcher prev action must keep shortcuts after they've been shown."""
00052         self.launcher_instance.switcher_start()
00053         self.addCleanup(self.launcher_instance.switcher_cancel)
00054         self.launcher_instance.switcher_prev()
00055         self.assertThat(self.launcher_instance.shortcuts_shown, Eventually(Equals(True)))