@@ -28,13 +28,8 @@ don't break them for those external projects.
32− from unittest import mock
36from unity8 import process_helpers
31from unity8 import process_helpers
37−from unity8.shell import emulators, fixture_setup, tests
32+from unity8.shell import fixture_setup, tests
38from unity8.shell.emulators import dash as dash_emulators
33from unity8.shell.emulators import dash as dash_emulators
@@ -55,35 +50,6 @@ class DashEmulatorTestCase(tests.DashBaseTestCase):
55 text_field = self.dash._get_search_text_field()
50 text_field = self.dash._get_search_text_field()
56 self.assertEqual(text_field.text, 'Test')
51 self.assertEqual(text_field.text, 'Test')
58− def test_open_unexisting_scope(self):
59− scope_name = 'unexisting'
60− with mock.patch.object(self.dash, 'pointing_device') as mock_pointer:
61− exception = self.assertRaises(
62− emulators.UnityEmulatorException,
63− self.dash.open_scope, scope_name)
66− 'No scope found with id unexisting', str(exception))
67− self.assertFalse(mock_pointer.called)
69− def test_open_already_opened_scope(self):
70− scope_id = self._get_current_scope_id()
71− with mock.patch.object(self.dash, 'pointing_device') as mock_pointer:
72− scope = self.dash.open_scope(scope_id)
74− self.assertFalse(mock_pointer.called)
75− self._assert_scope_is_opened(scope, scope_id)
77− def _assert_scope_is_opened(self, scope, scope_id):
78− self.assertTrue(scope.isCurrent)
79− scope_loader = scope.get_parent()
80− self.assertEqual(scope_loader.scopeId, scope_id)
82− def _get_current_scope_id(self):
83− scope = self.dash.dash_content_list.select_single(
84− 'QQuickLoader', isCurrent=True)
87 def test_open_scope_to_the_right(self):
53 def test_open_scope_to_the_right(self):
88 leftmost_scope = self._get_leftmost_scope_id()
54 leftmost_scope = self._get_leftmost_scope_id()
89 self.dash.open_scope(leftmost_scope)
55 self.dash.open_scope(leftmost_scope)
@@ -92,6 +58,11 @@ class DashEmulatorTestCase(tests.DashBaseTestCase):
92 scope = self.dash.open_scope(scope_id)
58 scope = self.dash.open_scope(scope_id)
93 self._assert_scope_is_opened(scope, scope_id)
59 self._assert_scope_is_opened(scope, scope_id)
61+ def _assert_scope_is_opened(self, scope, scope_id):
62+ self.assertTrue(scope.isCurrent)
63+ scope_loader = scope.get_parent()
64+ self.assertEqual(scope_loader.scopeId, scope_id)
95 def _get_leftmost_scope_id(self):
66 def _get_leftmost_scope_id(self):
96 scope_loaders = self._get_scope_loaders()
67 scope_loaders = self._get_scope_loaders()
97 leftmost_scope_loader = scope_loaders[0]
68 leftmost_scope_loader = scope_loaders[0]
@@ -161,15 +132,6 @@ class DashAppsEmulatorTestCase(tests.DashBaseTestCase):
161 super(DashAppsEmulatorTestCase, self).setUp()
132 super(DashAppsEmulatorTestCase, self).setUp()
162 self.applications_scope = self.dash.open_scope('clickscope')
133 self.applications_scope = self.dash.open_scope('clickscope')
164− def test_get_applications_with_unexisting_category(self):
165− exception = self.assertRaises(
166− emulators.UnityEmulatorException,
167− self.applications_scope.get_applications,
168− 'unexisting category')
171− 'No category found with name unexisting category', str(exception))
173 def test_get_applications_should_return_correct_applications(self):
135 def test_get_applications_should_return_correct_applications(self):
174 category = '2'
136 category = '2'
175 category_element = self.applications_scope._get_category_element(
137 category_element = self.applications_scope._get_category_element(
@@ -181,9 +143,10 @@ class DashAppsEmulatorTestCase(tests.DashBaseTestCase):
181 :expected_apps_count]
143 :expected_apps_count]
182 x_center = list_view.globalRect.x + list_view.width / 2
144 x_center = list_view.globalRect.x + list_view.width / 2
183 y_center = list_view.globalRect.y + list_view.height / 2
145 y_center = list_view.globalRect.y + list_view.height / 2
184− y_diff = category_element.y - list_view.height + category_element.height
147+ category_element.y - list_view.height + category_element.height
185− list_view._slow_drag(x_center, x_center,
149+ list_view._slow_drag(x_center, x_center, y_center, y_center - y_diff)
186− y_center, y_center - y_diff)
187 applications = self.applications_scope.get_applications(category)
150 applications = self.applications_scope.get_applications(category)
188 self.assertEqual(expected_applications, applications)
151 self.assertEqual(expected_applications, applications)