on xenial help sign in
Merge elopio's revert_get_applications, fixing tests.
commitc288e83e83a3abced696c2b4365be48180166375 authorAllan LeSage <allan.lesage@canonical.com> dateWed 2 Apr 2014, 14:05 (13 years ago) parentce3dd1d24871a0
2 files changed+10−13
tests/autopilot/unity8/shell/emulators/dash.py+8−6 tests/autopilot/unity8/shell/tests/test_emulators.py+2−7
tests/autopilot/unity8/shell/emulators/dash.py+8−6
@@ -172,15 +172,17 @@ class DashApps(GenericScopeView):
172172
173173 """
174174 category_element = self._get_category_element(category)
175− application_tiles = category_element.select_many('Card')
176− result = []
177− for card in application_tiles:
178− if card.objectName != 'cardToolCard':
179− result.append(card)
175+ application_cards = category_element.select_many('Card')
180176
181177 def visible_order(card):
182178 """Enable sorting of cards by vertical, horizontal."""
183179 # NOTE that we limit testable resolution to 10K
184180 return card.globalRect[1] * 10000 + card.globalRect[0]
181+ application_cards = sorted(application_cards, key=visible_order)
185182
186− return sorted(result, key=visible_order)
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)
188+ return result
tests/autopilot/unity8/shell/tests/test_emulators.py+2−7
@@ -174,14 +174,10 @@ class DashAppsEmulatorTestCase(DashBaseTestCase):
174174 :expected_apps_count]
175175
176176 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)
181177
182178 self.assertThat(applications, HasLength(expected_apps_count))
183179 for expected in expected_applications:
184− self.assertThat(applications_titles, Contains(expected))
180+ self.assertThat(applications, Contains(expected))
185181
186182 def test_get_applications_list_matches_visible_ordering(self):
187183 category = '2'
@@ -190,9 +186,8 @@ class DashAppsEmulatorTestCase(DashBaseTestCase):
190186 :expected_apps_count]
191187 applications = self.applications_scope.get_applications(category)
192188 for card_num in range(len(applications)):
193− card_header = applications[card_num].select_single('CardHeader')
194189 self.assertEqual(expected_application_titles[card_num],
195− card_header.title)
190+ applications[card_num])
196191
197192 def _get_number_of_application_slots(self, category):
198193 category_element = self.applications_scope._get_category_element(