on xenial help sign in
Fix unity8.shell.tests.test_emulators.DashAppsEmulatorTestCase.test_get_applications_should_return_list_with_names
71582d7Albert Astals
qml/Dash/CardTool.qml+1−1
@@ -130,7 +130,7 @@ Item {
130
130
131 Card {
131 Card {
132 id: card
132 id: card
133− objectName: "card"
133+ objectName: "cardToolCard"
134 template: cardTool.template
134 template: cardTool.template
135 components: cardTool.components
135 components: cardTool.components
136
136
tests/autopilot/unity8/shell/emulators/dash.py+6−2
@@ -207,7 +207,11 @@ class DashApps(GenericScopeView):
207
207
208 """
208 """
209 category_element = self._get_category_element(category)
209 category_element = self._get_category_element(category)
210− application_tiles = category_element.select_many('Tile')
210+ application_tiles = category_element.select_many('Card')
211 # TODO return them on the same order they are displayed.
211 # TODO return them on the same order they are displayed.
212 # --elopio - 2014-1-15
212 # --elopio - 2014-1-15
213+ result = []
213− return [tile.text for tile in application_tiles]
214+ for card in application_tiles:
215+ if card.objectName != 'cardToolCard':
216+ result.append(card)
217+ return result
tests/autopilot/unity8/shell/tests/test_emulators.py+10−6
@@ -158,9 +158,9 @@ class GenericScopeViewEmulatorTestCase(DashBaseTestCase):
158class DashAppsEmulatorTestCase(DashBaseTestCase):
158class DashAppsEmulatorTestCase(DashBaseTestCase):
159
159
160 available_applications = [
160 available_applications = [
161− 'Title.1', 'Title.21', 'Title.41', 'Title.61', 'Title.81',
161+ 'Title.2.0', 'Title.2.1', 'Title.2.2', 'Title.2.3', 'Title.2.4',
162− 'Title.101', 'Title.121', 'Title.141', 'Title.161', 'Title.181',
162+ 'Title.2.5', 'Title.2.6', 'Title.2.7', 'Title.2.8', 'Title.2.9',
163− 'Title.201', 'Title.221', 'Title.241', 'Title.261', 'Title.281']
163+ 'Title.2.9', 'Title.2.10', 'Title.2.11']
164
164
165 def setUp(self):
165 def setUp(self):
166 # Set up the fake scopes before launching unity.
166 # Set up the fake scopes before launching unity.
@@ -178,21 +178,25 @@ class DashAppsEmulatorTestCase(DashBaseTestCase):
178 'No category found with name unexisting category', str(exception))
178 'No category found with name unexisting category', str(exception))
179
179
180 def test_get_applications_should_return_list_with_names(self):
180 def test_get_applications_should_return_list_with_names(self):
181− category = 'installed'
181+ category = '2'
182 expected_apps_count = self._get_number_of_application_slots(category)
182 expected_apps_count = self._get_number_of_application_slots(category)
183 expected_applications = self.available_applications[
183 expected_applications = self.available_applications[
184 :expected_apps_count]
184 :expected_apps_count]
185
185
186 applications = self.applications_scope.get_applications(category)
186 applications = self.applications_scope.get_applications(category)
187+ applications_titles = []
188+ for application in applications:
189+ cardHeader = application.select_single('CardHeader')
190+ applications_titles.append(cardHeader.title)
187
191
188 self.assertThat(applications, HasLength(expected_apps_count))
192 self.assertThat(applications, HasLength(expected_apps_count))
189 for expected in expected_applications:
193 for expected in expected_applications:
190− self.assertThat(applications, Contains(expected))
194+ self.assertThat(applications_titles, Contains(expected))
191
195
192 def _get_number_of_application_slots(self, category):
196 def _get_number_of_application_slots(self, category):
193 category_element = self.applications_scope._get_category_element(
197 category_element = self.applications_scope._get_category_element(
194 category)
198 category)
195− grid = category_element.select_single('GenericFilterGrid')
199+ grid = category_element.select_single('DashFilterGrid')
196 return grid.columns * grid.rows
200 return grid.columns * grid.rows
197
201
198 def test_open_preview(self):
202 def test_open_preview(self):
tests/mocks/Unity/fake_resultsmodel.cpp+3−2
@@ -90,15 +90,16 @@ QVariant ResultsModel::get(int row) const
90}
90}
91
91
92QVariant
92QVariant
93−ResultsModel::data(const QModelIndex& /*index*/, int role) const
93+ResultsModel::data(const QModelIndex& index, int role) const
94{
94{
95 switch (role) {
95 switch (role) {
96 case RoleUri:
96 case RoleUri:
97 case RoleCategoryId:
97 case RoleCategoryId:
98 case RoleDndUri:
98 case RoleDndUri:
99 case RoleResult:
99 case RoleResult:
100− case RoleTitle:
101 return QString();
100 return QString();
101+ case RoleTitle:
102+ return QString("Title.%1.%2").arg(m_categoryId).arg(index.row());
102 case RoleArt:
103 case RoleArt:
103 return qmlDirectory() + "graphics/applicationIcons/dash.png";
104 return qmlDirectory() + "graphics/applicationIcons/dash.png";
104 case RoleSubtitle:
105 case RoleSubtitle:
tests/qmltests/Dash/tst_CardTool.qml+1−1
@@ -256,7 +256,7 @@ Rectangle {
256 id: testCase
256 id: testCase
257 name: "Card"
257 name: "Card"
258
258
259− property Card internalCard: findChild(cardTool, "card")
259+ property Card internalCard: findChild(cardTool, "cardToolCard")
260
260
261 when: windowShown
261 when: windowShown
262
262