summaryrefslogtreecommitdiff
path: root/tests
diff options
authorThomi Richards <thomi.richards@canonical.com>2012-11-23 12:01:38 +1300
committerThomi Richards <thomi.richards@canonical.com>2012-11-23 12:01:38 +1300
commit8b293a8fbb4e628557a9985bbc21e8e99fcb7ef9 (patch)
tree9edaa386d93b8546508c439c822aefd7629e5e53 /tests
parentb9d0dca7985b330370998c1d39d55500cb73109d (diff)
Code cleanup - PEP8 fixes, removed a few lambda functions that were not needed.
(bzr r2895.1.17)
Diffstat (limited to 'tests')
-rw-r--r--tests/autopilot/unity/tests/test_dash.py8
-rw-r--r--tests/autopilot/unity/tests/test_hud.py2
-rw-r--r--tests/autopilot/unity/tests/test_spread.py10
3 files changed, 9 insertions, 11 deletions
diff --git a/tests/autopilot/unity/tests/test_dash.py b/tests/autopilot/unity/tests/test_dash.py
index 9f2c55f13..acf887197 100644
--- a/tests/autopilot/unity/tests/test_dash.py
+++ b/tests/autopilot/unity/tests/test_dash.py
@@ -117,9 +117,6 @@ class DashRevealWithSpreadTests(DashTestCase):
apps. We use a place holder app so that it is activated as we require.
"""
- def setUp(self):
- super(DashRevealWithSpreadTests, self).setUp()
- self.start_placeholder_app()
def start_placeholder_app(self):
window_spec = {
@@ -129,6 +126,7 @@ class DashRevealWithSpreadTests(DashTestCase):
def test_dash_closes_on_spread(self):
"""This test shows that when the spread is initiated, the dash closes."""
+ self.start_placeholder_app()
self.dash.ensure_visible()
self.addCleanup(self.keybinding, "spread/cancel")
self.keybinding("spread/start")
@@ -137,6 +135,7 @@ class DashRevealWithSpreadTests(DashTestCase):
def test_dash_opens_when_in_spread(self):
"""This test shows the dash opens when in spread mode."""
+ self.start_placeholder_app()
self.keybinding("spread/start")
self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
@@ -145,6 +144,7 @@ class DashRevealWithSpreadTests(DashTestCase):
def test_command_lens_opens_when_in_spread(self):
"""This test shows the command lens opens when in spread mode."""
+ self.start_placeholder_app()
self.keybinding("spread/start")
self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
@@ -153,6 +153,7 @@ class DashRevealWithSpreadTests(DashTestCase):
def test_lens_opens_when_in_spread(self):
"""This test shows that any lens opens when in spread mode."""
+ self.start_placeholder_app()
self.keybinding("spread/start")
self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
@@ -160,7 +161,6 @@ class DashRevealWithSpreadTests(DashTestCase):
self.assertThat(self.dash.active_lens, Eventually(Equals('applications.lens')))
-
class DashSearchInputTests(DashTestCase):
"""Test features involving input to the dash search"""
diff --git a/tests/autopilot/unity/tests/test_hud.py b/tests/autopilot/unity/tests/test_hud.py
index 4623990be..61cfa4748 100644
--- a/tests/autopilot/unity/tests/test_hud.py
+++ b/tests/autopilot/unity/tests/test_hud.py
@@ -222,6 +222,8 @@ class HudBehaviorTests(HudTestsBase):
def test_hud_closes_on_spread(self):
"""This test shows that when the spread is initiated, the hud closes."""
+ # Need at least one application open for the spread to work.
+ self.start_app_window("Calculator")
self.hud.ensure_visible()
self.addCleanup(self.keybinding, "spread/cancel")
self.keybinding("spread/start")
diff --git a/tests/autopilot/unity/tests/test_spread.py b/tests/autopilot/unity/tests/test_spread.py
index f1e3fc3f0..89afcd74c 100644
--- a/tests/autopilot/unity/tests/test_spread.py
+++ b/tests/autopilot/unity/tests/test_spread.py
@@ -9,12 +9,10 @@
from __future__ import absolute_import
from autopilot.matchers import Eventually
-import logging
-from time import sleep
from testtools.matchers import Equals, NotEquals
+from time import sleep
from unity.tests import UnityTestCase
-from unity.emulators.screen import Screen
class SpreadTests(UnityTestCase):
@@ -27,7 +25,7 @@ class SpreadTests(UnityTestCase):
for i in range(num_windows):
win = self.start_app_window(app_name)
- if len(windows):
+ if windows:
self.assertThat(win.application, Equals(windows[-1].application))
windows.append(win)
@@ -43,11 +41,10 @@ class SpreadTests(UnityTestCase):
sleep(1)
self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
-
def initiate_spread_for_application(self, desktop_id):
"""Initiate the Spread for windows of the given app"""
icon = self.launcher.model.get_icon(desktop_id=desktop_id)
- self.assertThat(lambda: icon, Eventually(NotEquals(None)))
+ self.assertThat(icon, NotEquals(None))
launcher = self.launcher.get_launcher_for_monitor(self.screen_geo.get_primary_monitor())
self.addCleanup(self.keybinding, "spread/cancel")
@@ -64,7 +61,6 @@ class SpreadTests(UnityTestCase):
refresh_fn = lambda: xid in [w.x_id for w in self.bamf.get_open_windows()]
self.assertThat(refresh_fn, Eventually(Equals(False)))
-
def test_scale_application_windows(self):
"""Test if all the windows of an application are scaled when application spread is initiated"""
[win1, win2] = self.start_test_application_windows("Calculator")