on xenial help sign in
Merge elopio's revert_get_applications, fixing tests.
c288e83Allan LeSage
tests/autopilot/unity8/shell/emulators/dash.py+8−6
@@ -172,15 +172,17 @@ class DashApps(GenericScopeView):
172
172
173 """
173 """
174 category_element = self._get_category_element(category)
174 category_element = self._get_category_element(category)
175− application_tiles = category_element.select_many('Card')
175+ application_cards = category_element.select_many('Card')
176− result = []
177− for card in application_tiles:
178− if card.objectName != 'cardToolCard':
179− result.append(card)
180
176
181 def visible_order(card):
177 def visible_order(card):
182 """Enable sorting of cards by vertical, horizontal."""
178 """Enable sorting of cards by vertical, horizontal."""
183 # NOTE that we limit testable resolution to 10K
179 # NOTE that we limit testable resolution to 10K
184 return card.globalRect[1] * 10000 + card.globalRect[0]
180 return card.globalRect[1] * 10000 + card.globalRect[0]
181+ application_cards = sorted(application_cards, key=visible_order)
185
182
183+ result = []
184+ for card in application_cards:
185+ if card.objectName != 'cardToolCard':
186+ card_header = card.select_single('CardHeader')
187+ result.append(card_header.title)
186− return sorted(result, key=visible_order)
188+ return result
tests/autopilot/unity8/shell/tests/test_emulators.py+2−7
@@ -174,14 +174,10 @@ class DashAppsEmulatorTestCase(DashBaseTestCase):
174 :expected_apps_count]
174 :expected_apps_count]
175
175
176 applications = self.applications_scope.get_applications(category)
176 applications = self.applications_scope.get_applications(category)
177− applications_titles = []
178− for application in applications:
179− cardHeader = application.select_single('CardHeader')
180− applications_titles.append(cardHeader.title)
181
177
182 self.assertThat(applications, HasLength(expected_apps_count))
178 self.assertThat(applications, HasLength(expected_apps_count))
183 for expected in expected_applications:
179 for expected in expected_applications:
184− self.assertThat(applications_titles, Contains(expected))
180+ self.assertThat(applications, Contains(expected))
185
181
186 def test_get_applications_list_matches_visible_ordering(self):
182 def test_get_applications_list_matches_visible_ordering(self):
187 category = '2'
183 category = '2'
@@ -190,9 +186,8 @@ class DashAppsEmulatorTestCase(DashBaseTestCase):
190 :expected_apps_count]
186 :expected_apps_count]
191 applications = self.applications_scope.get_applications(category)
187 applications = self.applications_scope.get_applications(category)
192 for card_num in range(len(applications)):
188 for card_num in range(len(applications)):
193− card_header = applications[card_num].select_single('CardHeader')
194 self.assertEqual(expected_application_titles[card_num],
189 self.assertEqual(expected_application_titles[card_num],
195− card_header.title)
190+ applications[card_num])
196
191
197 def _get_number_of_application_slots(self, category):
192 def _get_number_of_application_slots(self, category):
198 category_element = self.applications_scope._get_category_element(
193 category_element = self.applications_scope._get_category_element(