From d566eac2698c5ed8ff181712b2f44e1cc9728fef Mon Sep 17 00:00:00 2001 From: Brandon Schaefer Date: Tue, 4 Mar 2014 14:50:22 -0800 Subject: * Fix AP tests dealing with QL/Tooltips as they are now destoryed when hidden (bzr r3695.3.1) --- .../unity/tests/launcher/test_icon_behavior.py | 2 +- tests/autopilot/unity/tests/launcher/test_tooltips.py | 5 ++--- tests/autopilot/unity/tests/test_quicklist.py | 17 +++++++++++------ tests/autopilot/unity/tests/test_spread.py | 4 ++-- 4 files changed, 16 insertions(+), 12 deletions(-) (limited to 'tests/autopilot') diff --git a/tests/autopilot/unity/tests/launcher/test_icon_behavior.py b/tests/autopilot/unity/tests/launcher/test_icon_behavior.py index 669747ee4..e469be7fa 100644 --- a/tests/autopilot/unity/tests/launcher/test_icon_behavior.py +++ b/tests/autopilot/unity/tests/launcher/test_icon_behavior.py @@ -70,7 +70,7 @@ class LauncherIconsTests(LauncherTestCase): self.unity.dash.ensure_visible() self.addCleanup(self.unity.dash.ensure_hidden) - self.assertThat(bfb.get_tooltip().active, Eventually(Equals(False))) + self.assertThat(bfb.get_tooltip(), Equals(None)) def test_bfb_tooltip_is_disabled_when_dash_is_open(self): """Tests the that bfb tooltip is disabled when the dash is open.""" diff --git a/tests/autopilot/unity/tests/launcher/test_tooltips.py b/tests/autopilot/unity/tests/launcher/test_tooltips.py index 4ea8e53a3..f403a8a80 100644 --- a/tests/autopilot/unity/tests/launcher/test_tooltips.py +++ b/tests/autopilot/unity/tests/launcher/test_tooltips.py @@ -38,14 +38,13 @@ class LauncherTooltipTests(LauncherTestCase): if size > 5: size = 5 - # subsequent tooltips reveal instantly, but hide on exit + # subsequent tooltips reveal instantly, but are destroyed on exit, meaning None a, b = 0, 1 while b < size: self.mouse.move(self.icons[b].center.x, self.icons[b].center.y) self.assertThat(lambda: self.icons[b].get_tooltip(), Eventually(NotEquals(None))) self.assertThat(self.icons[b].get_tooltip().active, Eventually(Equals(True))) - self.assertThat(lambda: self.icons[a].get_tooltip(), Eventually(NotEquals(None))) - self.assertThat(self.icons[a].get_tooltip().active, Eventually(Equals(False))) + self.assertThat(self.icons[a].get_tooltip(), Equals(None)) a, b = a + 1, b + 1 b -= 1 diff --git a/tests/autopilot/unity/tests/test_quicklist.py b/tests/autopilot/unity/tests/test_quicklist.py index 743a9fabb..9e3dd00c9 100644 --- a/tests/autopilot/unity/tests/test_quicklist.py +++ b/tests/autopilot/unity/tests/test_quicklist.py @@ -11,8 +11,9 @@ from __future__ import absolute_import from autopilot.display import move_mouse_to_screen from autopilot.matchers import Eventually +from autopilot.introspection.dbus import StateNotFoundError import os.path -from testtools.matchers import Contains, Equals, NotEquals +from testtools.matchers import Contains, Equals, NotEquals, Not, Raises from time import sleep from xdg.DesktopEntry import DesktopEntry @@ -90,8 +91,7 @@ class QuicklistActionTests(UnityTestCase): self.assertThat(lambda: len(nautilus_windows_fn()), Eventually(Equals(1))) [nautilus_window] = nautilus_windows_fn() - self.assertThat(lambda: self.get_startup_notification_timestamp(nautilus_window), - Eventually(Equals(new_win_ql_item.activate_timestamp))) + self.assertThat(new_win_ql_item.wait_until_destroyed, Not(Raises())) def test_quicklist_application_item_focus_last_active_window(self): """This tests shows that when you activate a quicklist application item @@ -198,7 +198,7 @@ class QuicklistActionTests(UnityTestCase): icon1_ql = self.open_quicklist_for_icon(icons[1]) self.assertThat(icon1_ql.active, Eventually(Equals(True))) - self.assertThat(icon0_ql.active, Eventually(Equals(False))) + self.assertThat(icon0_ql.wait_until_destroyed, Not(Raises())) def test_right_clicking_same_icon_doesnt_reopen_ql(self): """A right click to the same icon in the launcher must @@ -213,8 +213,13 @@ class QuicklistActionTests(UnityTestCase): calc_ql = self.open_quicklist_for_icon(calc_icon) self.assertThat(calc_ql.active, Eventually(Equals(True))) - calc_ql = self.open_quicklist_for_icon(calc_icon) - self.assertThat(calc_ql.active, Eventually(Equals(False))) + # We've to manually open the icon this time, as when the quicklist goes away + # its Destroyed, so its None! + launcher = self.unity.launcher.get_launcher_for_monitor(0) + launcher.click_launcher_icon(calc_icon, button=3) + self.addCleanup(self.keyboard.press_and_release, "Escape") + calc_ql = calc_icon.get_quicklist() + self.assertThat(calc_ql, Equals(None)) class QuicklistKeyNavigationTests(UnityTestCase): diff --git a/tests/autopilot/unity/tests/test_spread.py b/tests/autopilot/unity/tests/test_spread.py index 7093b9303..0368d6f0f 100644 --- a/tests/autopilot/unity/tests/test_spread.py +++ b/tests/autopilot/unity/tests/test_spread.py @@ -70,7 +70,7 @@ class SpreadTests(UnityTestCase): def assertWindowIsClosed(self, xid): """Assert that a window is not in the list of the open windows""" refresh_fn = lambda: xid in [w.x_id for w in self.process_manager.get_open_windows()] - self.assertThat(refresh_fn, Eventually(Equals(False))) + self.assertThat(refresh_fn, Equals(None)) def assertLauncherIconsSaturated(self): for icon in self.unity.launcher.model.get_launcher_icons(): @@ -200,7 +200,7 @@ class SpreadTests(UnityTestCase): self.assertThat(icon.get_tooltip().active, Eventually(Equals(True))) self.initiate_spread_for_screen() - self.assertThat(icon.get_tooltip().active, Eventually(Equals(False))) + self.assertThat(icon.get_tooltip(), Equals(None)) def test_spread_puts_panel_in_overlay_mode(self): """Test that the panel is in overlay mode when in spread""" -- cgit v1.2.3