on xenial help sign in
Make the last tests i had marked as non passing pass
7e36abeAlbert Astals
qml/Dash/Card.qml+1
@@ -26,6 +26,7 @@ AbstractButton {
26 property alias fontScale: header.fontScale
26 property alias fontScale: header.fontScale
27 property alias headerAlignment: header.headerAlignment
27 property alias headerAlignment: header.headerAlignment
28 property alias headerHeight: header.height
28 property alias headerHeight: header.height
29+ readonly property alias title: header.title
29
30
30 property bool showHeader: true
31 property bool showHeader: true
31
32
qml/Dash/DashContent.qml+7−6
@@ -24,7 +24,7 @@ Item {
24
24
25 property var model: null
25 property var model: null
26 property var scopes: null
26 property var scopes: null
27− property alias currentIndex: dashContentList.currentIndex
27+ readonly property alias currentIndex: dashContentList.currentIndex
28 property alias previewOpen: previewListView.open
28 property alias previewOpen: previewListView.open
29
29
30 property ScopeDelegateMapper scopeMapper : ScopeDelegateMapper {}
30 property ScopeDelegateMapper scopeMapper : ScopeDelegateMapper {}
@@ -51,6 +51,12 @@ Item {
51 }
51 }
52
52
53 function setCurrentScopeAtIndex(index, animate, reset) {
53 function setCurrentScopeAtIndex(index, animate, reset) {
54+ // if the scopes haven't loaded yet, then wait until they are.
55+ if (!scopes.loaded) {
56+ set_current_index = [ index, animate, reset ]
57+ return;
58+ }
59+
54 var storedMoveDuration = dashContentList.highlightMoveDuration
60 var storedMoveDuration = dashContentList.highlightMoveDuration
55 var storedMoveSpeed = dashContentList.highlightMoveVelocity
61 var storedMoveSpeed = dashContentList.highlightMoveVelocity
56 if (!animate) {
62 if (!animate) {
@@ -58,11 +64,6 @@ Item {
58 dashContentList.highlightMoveDuration = 0
64 dashContentList.highlightMoveDuration = 0
59 }
65 }
60
66
61− // if the scopes haven't loaded yet, then wait until they are.
62− if (!scopes.loaded) {
63− set_current_index = [ index, animate, reset ]
64− return;
65− }
66 set_current_index = undefined;
67 set_current_index = undefined;
67
68
68 if (dashContentList.count > index)
69 if (dashContentList.count > index)
tests/autopilot/unity8/shell/emulators/dash.py+3−35
@@ -136,24 +136,9 @@ class Dash(emulators.UnityEmulatorBase):
136 self.dash_content_list.currentIndex.wait_for(original_index + 1)
136 self.dash_content_list.currentIndex.wait_for(original_index + 1)
137
137
138
138
139−class DashPreview(emulators.UnityEmulatorBase):
140− """Autopilot emulator for the generic preview."""
141−
142− def get_details(self):
143− """Return the details of the open preview."""
144− title = self.select_single('Label', objectName='titleLabel').text
145− subtitle = self.select_single(
146− 'Label', objectName='subtitleLabel').text
147− description = self.select_single(
148− 'Label', objectName='descriptionLabel').text
149− return dict(title=title, subtitle=subtitle, description=description)
150−
151−
152class GenericScopeView(emulators.UnityEmulatorBase):
139class GenericScopeView(emulators.UnityEmulatorBase):
153 """Autopilot emulator for generic scopes."""
140 """Autopilot emulator for generic scopes."""
154
141
155− preview_class = DashPreview
156−
157 @autopilot_logging.log_action(logger.info)
142 @autopilot_logging.log_action(logger.info)
158 def open_preview(self, category, app_name):
143 def open_preview(self, category, app_name):
159 """Open the preview of an application.
144 """Open the preview of an application.
@@ -163,15 +148,13 @@ class GenericScopeView(emulators.UnityEmulatorBase):
163
148
164 """
149 """
165 category_element = self._get_category_element(category)
150 category_element = self._get_category_element(category)
166− icon = category_element.select_single('Tile', text=app_name)
151+ icon = category_element.select_single('Card', title=app_name)
167 # FIXME some categories need a long press in order to see the preview.
152 # FIXME some categories need a long press in order to see the preview.
168 # Some categories do not show previews, like recent apps.
153 # Some categories do not show previews, like recent apps.
169 # --elopio - 2014-1-14
154 # --elopio - 2014-1-14
170 self.pointing_device.click_object(icon)
155 self.pointing_device.click_object(icon)
171− preview = self.get_root_instance().wait_select_single(
156+ return self.get_root_instance().wait_select_single(
172− self.preview_class, isCurrent=True)
157+ 'PreviewListView', objectName='dashContentPreviewList')
173− preview.showProcessingAction.wait_for(False)
174− return preview
175
158
176 def _get_category_element(self, category):
159 def _get_category_element(self, category):
177 try:
160 try:
@@ -182,24 +165,9 @@ class GenericScopeView(emulators.UnityEmulatorBase):
182 'No category found with name {}'.format(category))
165 'No category found with name {}'.format(category))
183
166
184
167
185−class AppPreview(DashPreview):
186− """Autopilot emulator for the application preview."""
187−
188− def get_details(self):
189− """Return the details of the application showed in its preview."""
190− details = super(AppPreview, self).get_details()
191− # TODO return screenshots, icon, rating and reviews.
192− # --elopio - 2014-1-15
193− return dict(
194− title=details.get('title'), publisher=details.get('subtitle'),
195− description=details.get('description'))
196−
197−
198class DashApps(GenericScopeView):
168class DashApps(GenericScopeView):
199 """Autopilot emulator for the applications scope."""
169 """Autopilot emulator for the applications scope."""
200
170
201− preview_class = AppPreview
202−
203 def get_applications(self, category):
171 def get_applications(self, category):
204 """Return the list of applications on a category.
172 """Return the list of applications on a category.
205
173
tests/autopilot/unity8/shell/tests/test_emulators.py+4−27
@@ -140,20 +140,8 @@ class GenericScopeViewEmulatorTestCase(DashBaseTestCase):
140 self.generic_scope = self.dash.open_scope('MockScope1')
140 self.generic_scope = self.dash.open_scope('MockScope1')
141
141
142 def test_open_preview(self):
142 def test_open_preview(self):
143− preview = self.generic_scope.open_preview('0', 'Title.0')
143+ preview = self.generic_scope.open_preview('0', 'Title.0.0')
144− self.assertIsInstance(preview, dash_emulators.DashPreview)
144+ preview.x.wait_for(0)
145− self.assertTrue(preview.isCurrent)
146− self.assertFalse(preview.showProcessingAction)
147−
148− def test_get_details(self):
149− expected_details = dict(
150− title='Title', subtitle='Subtitle', description='Description')
151−
152− preview = self.generic_scope.open_preview('0', 'Title.0')
153− details = preview.get_details()
154−
155− self.assertEqual(expected_details, details)
156−
157
145
158class DashAppsEmulatorTestCase(DashBaseTestCase):
146class DashAppsEmulatorTestCase(DashBaseTestCase):
159
147
@@ -200,16 +188,5 @@ class DashAppsEmulatorTestCase(DashBaseTestCase):
200 return grid.columns * grid.rows
188 return grid.columns * grid.rows
201
189
202 def test_open_preview(self):
190 def test_open_preview(self):
203− preview = self.applications_scope.open_preview('installed', 'Title.1')
191+ preview = self.applications_scope.open_preview('2', 'Title.2.1')
204− self.assertIsInstance(preview, dash_emulators.AppPreview)
192+ preview.x.wait_for(0)
205− self.assertTrue(preview.isCurrent)
206− self.assertFalse(preview.showProcessingAction)
207−
208− def test_get_details(self):
209− expected_details = dict(
210− title='Title', publisher='', description='Description')
211−
212− preview = self.applications_scope.open_preview('installed', 'Title.1')
213− details = preview.get_details()
214−
215− self.assertEqual(expected_details, details)
tests/mocks/Unity/fake_scopes.cpp+1−1
@@ -39,7 +39,7 @@ Scopes::Scopes(QObject *parent)
39 QObject::connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged()));
39 QObject::connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged()));
40
40
41 timer.setSingleShot(true);
41 timer.setSingleShot(true);
42− timer.setInterval(100);
42+ timer.setInterval(500);
43 QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(updateScopes()));
43 QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(updateScopes()));
44 load();
44 load();
45}
45}