diff options
| author | Ćukasz 'sil2100' Zemczak <lukasz.zemczak@canonical.com> | 2013-03-21 02:49:35 +0000 |
|---|---|---|
| committer | Tarmac <> | 2013-03-21 02:49:35 +0000 |
| commit | 8fd0c5d6de0b66b1d5c0e655acbcddd3afbb2d69 (patch) | |
| tree | 06ef2531b381db5cdae03a347c6474e816e965fa /tests | |
| parent | 9d1de6663c1c5597fe9d0ca10c11f9820d56bf59 (diff) | |
| parent | b6cb5ebd60ee675e82debe168eb5864797aa7314 (diff) | |
Workaround the issue of test_super_h failing because of the keybinding change not yet applied - let's try a few times before deciding that the keybinding does not work.
Approved by PS Jenkins bot, Francis Ginther. (bzr r3242)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/autopilot/unity/tests/test_hud.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/autopilot/unity/tests/test_hud.py b/tests/autopilot/unity/tests/test_hud.py index bc040a1ed..bcb80ad03 100644 --- a/tests/autopilot/unity/tests/test_hud.py +++ b/tests/autopilot/unity/tests/test_hud.py @@ -22,6 +22,7 @@ from testtools.matchers import ( LessThan, NotEquals, ) +from testtools.matchers import MismatchError from time import sleep from unity.emulators.icons import HudLauncherIcon @@ -716,18 +717,36 @@ class HudVisualTests(HudTestsBase): class HudAlternativeKeybindingTests(HudTestsBase): + def alternateCheck(self, keybinding="Alt", hide=False): + """Nasty workaround for LP: #1157738""" + # So, since we have no way of making sure that after changing the unity option + # the change will be already 'applied' on the system, let's try the keybinding + # a few times before deciding that it does not work and we have a regression + # Seems better than a sleep(some_value_here) + for i in range(1, 4): + try: + self.keyboard.press_and_release(keybinding) + self.assertThat(self.unity.hud.visible, Eventually(Equals(True), timeout=3)) + break + except MismatchError: + continue + if hide: + self.unity.hud.ensure_hidden() + def test_super_h(self): """Test hud reveal on <Super>h.""" + self.addCleanup(self.alternateCheck, hide=True) self.set_unity_option("show_hud", "<Super>h") # Don't use reveal_hud, but be explicit in the keybindings. - self.keyboard.press_and_release("Super+h") + self.alternateCheck("Super+h") self.assertThat(self.unity.hud.visible, Eventually(Equals(True))) def test_ctrl_alt_h(self): """Test hud reveal on <Contrl><Alt>h.""" + self.addCleanup(self.alternateCheck, hide=True) self.set_unity_option("show_hud", "<Control><Alt>h") # Don't use reveal_hud, but be explicit in the keybindings. - self.keyboard.press_and_release("Ctrl+Alt+h") + self.alternateCheck("Ctrl+Alt+h") self.assertThat(self.unity.hud.visible, Eventually(Equals(True))) |
