summaryrefslogtreecommitdiff
diff options
authorTim Penhey <tim.penhey@canonical.com>2012-03-02 15:01:22 +1300
committerTim Penhey <tim.penhey@canonical.com>2012-03-02 15:01:22 +1300
commit7dbaabd0db4fb2a0e136b39590cc904faeba84f1 (patch)
tree5435f7218a2984cfc3450603200f6a53dc277882
parent477606c04aff51dfbd39720f1b20cd5cf96f2492 (diff)
Make the base autopilot test case use the glib runner, and add more hud tests.
(bzr r2041.2.8)
-rw-r--r--tests/autopilot/autopilot/tests/__init__.py3
-rw-r--r--tests/autopilot/autopilot/tests/test_command_lens.py2
-rw-r--r--tests/autopilot/autopilot/tests/test_dash.py6
-rw-r--r--tests/autopilot/autopilot/tests/test_hud.py49
-rw-r--r--tests/autopilot/autopilot/tests/test_launcher.py3
-rw-r--r--tests/autopilot/autopilot/tests/test_showdesktop.py2
-rw-r--r--tests/autopilot/autopilot/tests/test_switcher.py2
7 files changed, 49 insertions, 18 deletions
diff --git a/tests/autopilot/autopilot/tests/__init__.py b/tests/autopilot/autopilot/tests/__init__.py
index 95afae8fc..1fb95af17 100644
--- a/tests/autopilot/autopilot/tests/__init__.py
+++ b/tests/autopilot/autopilot/tests/__init__.py
@@ -17,6 +17,7 @@ from autopilot.emulators.bamf import Bamf
from autopilot.emulators.unity.switcher import Switcher
from autopilot.emulators.unity.workspace import WorkspaceManager
from autopilot.keybindings import KeybindingsHelper
+from autopilot.glibrunner import GlibRunner
class LoggedTestCase(TestWithScenarios, TestCase):
@@ -65,6 +66,8 @@ class LoggedTestCase(TestWithScenarios, TestCase):
class AutopilotTestCase(LoggedTestCase, KeybindingsHelper):
"""Wrapper around testtools.TestCase that takes care of some cleaning."""
+ run_test_with = GlibRunner
+
KNOWN_APPS = {
'Character Map' : {
'desktop-file': 'gucharmap.desktop',
diff --git a/tests/autopilot/autopilot/tests/test_command_lens.py b/tests/autopilot/autopilot/tests/test_command_lens.py
index e9220a472..a3a885583 100644
--- a/tests/autopilot/autopilot/tests/test_command_lens.py
+++ b/tests/autopilot/autopilot/tests/test_command_lens.py
@@ -13,12 +13,10 @@ from autopilot.emulators.bamf import Bamf
from autopilot.emulators.unity.dash import Dash
from autopilot.emulators.X11 import Keyboard
from autopilot.tests import AutopilotTestCase
-from autopilot.glibrunner import GlibRunner
class CommandLensSearchTests(AutopilotTestCase):
"""Test the command lense search bahavior."""
- run_test_with = GlibRunner
def setUp(self):
self.dash = Dash()
diff --git a/tests/autopilot/autopilot/tests/test_dash.py b/tests/autopilot/autopilot/tests/test_dash.py
index 3ba14f851..50230412e 100644
--- a/tests/autopilot/autopilot/tests/test_dash.py
+++ b/tests/autopilot/autopilot/tests/test_dash.py
@@ -12,12 +12,10 @@ from time import sleep
from autopilot.emulators.unity.dash import Dash
from autopilot.emulators.X11 import Keyboard, Mouse
from autopilot.tests import AutopilotTestCase
-from autopilot.glibrunner import GlibRunner
class DashRevealTests(AutopilotTestCase):
"""Test the unity Dash Reveal."""
- run_test_with = GlibRunner
def setUp(self):
super(DashRevealTests, self).setUp()
@@ -77,7 +75,6 @@ class DashRevealTests(AutopilotTestCase):
class DashKeyNavTests(AutopilotTestCase):
"""Test the unity Dash keyboard navigation."""
- run_test_with = GlibRunner
def setUp(self):
super(DashKeyNavTests, self).setUp()
@@ -270,7 +267,6 @@ class DashKeyNavTests(AutopilotTestCase):
class DashClipboardTests(AutopilotTestCase):
"""Test the Unity clipboard"""
- run_test_with = GlibRunner
def setUp(self):
super(DashClipboardTests, self).setUp()
@@ -369,8 +365,6 @@ class DashClipboardTests(AutopilotTestCase):
class DashKeyboardFocusTests(AutopilotTestCase):
"""Tests that keyboard focus works."""
- run_test_with = GlibRunner
-
def setUp(self):
super(DashKeyboardFocusTests, self).setUp()
self.dash = Dash()
diff --git a/tests/autopilot/autopilot/tests/test_hud.py b/tests/autopilot/autopilot/tests/test_hud.py
index e52848ba5..3581a4033 100644
--- a/tests/autopilot/autopilot/tests/test_hud.py
+++ b/tests/autopilot/autopilot/tests/test_hud.py
@@ -9,18 +9,17 @@
from subprocess import call
from time import sleep
+from testtools.matchers import Equals
+
from autopilot.emulators.bamf import Bamf
from autopilot.emulators.unity.hud import HudController
from autopilot.emulators.unity.launcher import Launcher
from autopilot.emulators.X11 import Keyboard
from autopilot.tests import AutopilotTestCase
-from autopilot.glibrunner import GlibRunner
class HudTests(AutopilotTestCase):
- run_test_with = GlibRunner
-
def get_hud_controller(self):
controllers = HudController.get_all_instances()
self.assertEqual(1, len(controllers))
@@ -43,6 +42,49 @@ class HudTests(AutopilotTestCase):
self.addCleanup(hud.toggle_reveal)
self.assertTrue(hud.is_visible())
+ def test_no_initial_values(self):
+ hud = self.get_hud_controller()
+ hud.toggle_reveal()
+ self.addCleanup(hud.toggle_reveal)
+ self.assertThat(hud.num_buttons, Equals(0))
+ self.assertThat(hud.selected_button, Equals(0))
+
+ def test_check_a_values(self):
+ hud = self.get_hud_controller()
+ hud.toggle_reveal()
+ self.addCleanup(hud.toggle_reveal)
+ self.keyboard.type('a')
+ self.assertThat(hud.num_buttons, Equals(5))
+ self.assertThat(hud.selected_button, Equals(1))
+
+ def test_up_down_arrows(self):
+ hud = self.get_hud_controller()
+ hud.toggle_reveal()
+ self.addCleanup(hud.toggle_reveal)
+ self.keyboard.type('a')
+ self.keyboard.press_and_release('Down')
+ self.assertThat(hud.selected_button, Equals(2))
+ self.keyboard.press_and_release('Down')
+ self.assertThat(hud.selected_button, Equals(3))
+ self.keyboard.press_and_release('Down')
+ self.assertThat(hud.selected_button, Equals(4))
+ self.keyboard.press_and_release('Down')
+ self.assertThat(hud.selected_button, Equals(5))
+ # Down again stays on 5.
+ self.keyboard.press_and_release('Down')
+ self.assertThat(hud.selected_button, Equals(5))
+ self.keyboard.press_and_release('Up')
+ self.assertThat(hud.selected_button, Equals(4))
+ self.keyboard.press_and_release('Up')
+ self.assertThat(hud.selected_button, Equals(3))
+ self.keyboard.press_and_release('Up')
+ self.assertThat(hud.selected_button, Equals(2))
+ self.keyboard.press_and_release('Up')
+ self.assertThat(hud.selected_button, Equals(1))
+ # Up again stays on 1.
+ self.keyboard.press_and_release('Up')
+ self.assertThat(hud.selected_button, Equals(1))
+
def test_slow_tap_not_reveal_hud(self):
hud = self.get_hud_controller()
hud.toggle_reveal(tap_delay=0.3)
@@ -104,3 +146,4 @@ class HudTests(AutopilotTestCase):
# see how many apps are marked as being active:
num_active = self.get_num_active_launcher_icons(launcher)
self.assertLessEqual(num_active, 1, "More than one launcher icon active after test has run!")
+
diff --git a/tests/autopilot/autopilot/tests/test_launcher.py b/tests/autopilot/autopilot/tests/test_launcher.py
index 3739a7bc1..bb68fb5d6 100644
--- a/tests/autopilot/autopilot/tests/test_launcher.py
+++ b/tests/autopilot/autopilot/tests/test_launcher.py
@@ -12,14 +12,12 @@ from testtools.matchers import LessThan
from autopilot.tests import AutopilotTestCase
from autopilot.emulators.unity.launcher import Launcher
from autopilot.emulators.X11 import ScreenGeometry
-from autopilot.glibrunner import GlibRunner
from time import sleep
class LauncherTests(AutopilotTestCase):
"""Test the launcher."""
- run_test_with = GlibRunner
def setUp(self):
super(LauncherTests, self).setUp()
@@ -107,7 +105,6 @@ class LauncherTests(AutopilotTestCase):
class LauncherRevealTests(AutopilotTestCase):
"""Test the launcher reveal bahavior when in autohide mode."""
- run_test_with = GlibRunner
def setUp(self):
super(LauncherRevealTests, self).setUp()
diff --git a/tests/autopilot/autopilot/tests/test_showdesktop.py b/tests/autopilot/autopilot/tests/test_showdesktop.py
index d56cb853f..6bea90f6e 100644
--- a/tests/autopilot/autopilot/tests/test_showdesktop.py
+++ b/tests/autopilot/autopilot/tests/test_showdesktop.py
@@ -12,13 +12,11 @@ from subprocess import call
from autopilot.emulators.unity.launcher import Launcher
from autopilot.emulators.unity.switcher import Switcher
from autopilot.emulators.X11 import Keyboard
-from autopilot.glibrunner import GlibRunner
from autopilot.tests import AutopilotTestCase
class ShowDesktopTests(AutopilotTestCase):
"""Test the 'Show Desktop' functionality."""
- run_test_with = GlibRunner
def setUp(self):
super(ShowDesktopTests, self).setUp()
diff --git a/tests/autopilot/autopilot/tests/test_switcher.py b/tests/autopilot/autopilot/tests/test_switcher.py
index 4ac30e5bd..033d761f5 100644
--- a/tests/autopilot/autopilot/tests/test_switcher.py
+++ b/tests/autopilot/autopilot/tests/test_switcher.py
@@ -12,13 +12,11 @@ from time import sleep
from autopilot.emulators.bamf import Bamf
from autopilot.emulators.unity.switcher import Switcher
-from autopilot.glibrunner import GlibRunner
from autopilot.tests import AutopilotTestCase
class SwitcherTests(AutopilotTestCase):
"""Test the switcher."""
- run_test_with = GlibRunner
def set_timeout_setting(self, value):
self.set_unity_option("alt_tab_timeout", value)