summaryrefslogtreecommitdiff
path: root/tests
diff options
Diffstat (limited to 'tests')
-rw-r--r--tests/autopilot/unity/emulators/__init__.py10
-rw-r--r--tests/autopilot/unity/emulators/icons.py4
-rw-r--r--tests/autopilot/unity/tests/launcher/test_icon_behavior.py2
-rw-r--r--tests/autopilot/unity/tests/test_dash.py2
-rw-r--r--tests/autopilot/unity/tests/test_quicklist.py6
5 files changed, 15 insertions, 9 deletions
diff --git a/tests/autopilot/unity/emulators/__init__.py b/tests/autopilot/unity/emulators/__init__.py
index 998172b80..9f32530d2 100644
--- a/tests/autopilot/unity/emulators/__init__.py
+++ b/tests/autopilot/unity/emulators/__init__.py
@@ -28,6 +28,16 @@ class UnityIntrospectionObject(CustomEmulatorBase):
_Backend = DBusAddress.SessionBus(DBUS_SERVICE, DBUS_OBJECT)
+ def __repr__(self):
+ with self.no_automatic_refreshing():
+ return "<%s id=%d>" % (self.__class__.__name__, self.id)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.id == other.id
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
def ensure_unity_is_running(timeout=300):
"""Poll the unity debug interface, and return when it's ready for use.
diff --git a/tests/autopilot/unity/emulators/icons.py b/tests/autopilot/unity/emulators/icons.py
index 86cddfb0a..8a93a0fd5 100644
--- a/tests/autopilot/unity/emulators/icons.py
+++ b/tests/autopilot/unity/emulators/icons.py
@@ -58,10 +58,6 @@ class SimpleLauncherIcon(UnityIntrospectionObject):
return self.xids.contains(xid)
- def __repr__(self):
- with self.no_automatic_refreshing():
- return "<%s id=%d>" % (self.__class__.__name__, self.id)
-
class BFBLauncherIcon(SimpleLauncherIcon):
"""Represents the BFB button in the launcher."""
diff --git a/tests/autopilot/unity/tests/launcher/test_icon_behavior.py b/tests/autopilot/unity/tests/launcher/test_icon_behavior.py
index 629e6ef3d..adadfbf91 100644
--- a/tests/autopilot/unity/tests/launcher/test_icon_behavior.py
+++ b/tests/autopilot/unity/tests/launcher/test_icon_behavior.py
@@ -384,7 +384,7 @@ class LauncherDragIconsBehavior(LauncherTestCase):
self.drag_type)
moved_icon = self.unity.launcher.model.\
get_launcher_icons_for_monitor(self.launcher_monitor)[1]
- self.assertThat(moved_icon.id, Equals(calc_icon.id))
+ self.assertThat(moved_icon, Equals(calc_icon))
def test_can_drag_icon_below_window_switcher(self):
"""Application icons must be dragable to below the workspace switcher icon."""
diff --git a/tests/autopilot/unity/tests/test_dash.py b/tests/autopilot/unity/tests/test_dash.py
index 8e719ec75..27dc0a391 100644
--- a/tests/autopilot/unity/tests/test_dash.py
+++ b/tests/autopilot/unity/tests/test_dash.py
@@ -404,7 +404,7 @@ class DashKeyNavTests(DashTestCase):
self.keyboard.press_and_release('Tab')
selected = scope.get_focused_category()
expected = category if category.expand_label_is_visible else None
- self.assertEqual(selected.id if selected else None, expected.id if expected else None)
+ self.assertEqual(selected, expected)
def test_tab_with_filter_bar(self):
""" This test makes sure that Tab works well with the filter bara."""
diff --git a/tests/autopilot/unity/tests/test_quicklist.py b/tests/autopilot/unity/tests/test_quicklist.py
index 130b1636f..c54ccc3b8 100644
--- a/tests/autopilot/unity/tests/test_quicklist.py
+++ b/tests/autopilot/unity/tests/test_quicklist.py
@@ -269,7 +269,7 @@ class QuicklistKeyNavigationTests(UnityTestCase):
def assertCorrectItemSelected(self, item):
"""Ensure the item considers itself selected and that quicklist agrees."""
self.assertThat(item.selected, Eventually(Equals(True)))
- self.assertThat(self.quicklist.selected_item.id, Equals(item.id))
+ self.assertThat(self.quicklist.selected_item, Equals(item))
def test_keynav_selects_first_item_when_unselected(self):
"""Home key MUST select the first selectable item in a quicklist."""
@@ -402,11 +402,11 @@ class QuicklistKeyNavigationTests(UnityTestCase):
# Moving the mouse horizontally doesn't change the selection
self.mouse.move(mouse_item.x + mouse_item.width - 10, mouse_item.y + mouse_item.height / 2)
- self.assertThat(self.quicklist.selected_item.id, Equals(key_item.id))
+ self.assertThat(self.quicklist.selected_item, Equals(key_item))
# Moving the mouse outside doesn't change the selection
self.mouse.move(mouse_item.x + mouse_item.width + 50, mouse_item.y + mouse_item.height / 2)
- self.assertThat(self.quicklist.selected_item.id, Equals(key_item.id))
+ self.assertThat(self.quicklist.selected_item, Equals(key_item))
# Moving the mouse to another entry, changes the selection
mouse_item = self.quicklist.selectable_items[-2]