summaryrefslogtreecommitdiff
path: root/tests
diff options
authorThomi Richards <thomi.richards@canonical.com>2012-07-09 12:06:25 +1200
committerThomi Richards <thomi.richards@canonical.com>2012-07-09 12:06:25 +1200
commit5125d48d3629dee884a36f06e42753beb4033683 (patch)
tree28735093e3ab1ab1d9e9359e3bc284cd9be7de62 /tests
parent0a346536470ccbf7a84be763769413ea5ba6555e (diff)
Cleaned up switcher tests.
(bzr r2470.7.6)
Diffstat (limited to 'tests')
-rw-r--r--tests/autopilot/unity/tests/test_switcher.py46
1 files changed, 4 insertions, 42 deletions
diff --git a/tests/autopilot/unity/tests/test_switcher.py b/tests/autopilot/unity/tests/test_switcher.py
index a4a4be9f5..5324050c3 100644
--- a/tests/autopilot/unity/tests/test_switcher.py
+++ b/tests/autopilot/unity/tests/test_switcher.py
@@ -210,47 +210,6 @@ class SwitcherTests(SwitcherTestCase):
class SwitcherWindowsManagementTests(SwitcherTestCase):
"""Test the switcher window management."""
- def open_three_test_apps(self):
- """Opens three test apps.
-
- This method returns a tuple of BamfWindow instances. The instances are
- in window stacking order. From first to last, the windows are:
-
- * Mahjongg (top of stack, focused)
- * Calculator
- * Mahjongg (buttom of stack)
-
- """
- self.close_all_app("Mahjongg")
- self.close_all_app("Calculator")
-
- mahj = self.start_app("Mahjongg")
- [mah_win1] = mahj.get_windows()
- self.assert_window_focused(mah_win1)
-
- calc = self.start_app("Calculator")
- [calc_win] = calc.get_windows()
- self.assert_window_focused(calc_win)
-
- self.start_app("Mahjongg")
- # Sleeping due to the start_app only waiting for the bamf model to be
- # updated with the application. Since the app has already started,
- # and we are just waiting on a second window, however a defined sleep
- # here is likely to be problematic.
- mah_win2 = None
- for i in range(10):
- try:
- [mah_win2] = [w for w in mahj.get_windows() if w.x_id != mah_win1.x_id]
- self.assert_window_focused(mah_win2)
- break
- except ValueError:
- sleep(1)
-
- if not mah_win2:
- raise AssertionError("Could not find second Mahjongg window.")
-
- return (mah_win2, calc_win, mah_win1)
-
def test_switcher_raises_only_last_focused_window(self):
"""Tests that when we do an alt+tab only the previously focused window is raised.
@@ -259,7 +218,10 @@ class SwitcherWindowsManagementTests(SwitcherTestCase):
Then we close the currently focused window.
"""
- mah_win2, calc_win, mah_win1 = self.open_three_test_apps()
+ mah_win1 = self.start_app_window("Mahjongg")
+ calc_win = self.start_app_window("Calculator")
+ mah_win2 = self.start_app_window("Mahjongg")
+
self.assertVisibleWindowStack([mah_win2, calc_win, mah_win1])
self.keybinding("switcher/reveal_normal")