on xenial help sign in
fix DashContent tests
0d47543Michael Zanetti
qml/Components/PageHeader.qml+1
@@ -204,6 +204,7 @@ Item {
204
204
205 PageHeadStyle {
205 PageHeadStyle {
206 id: header
206 id: header
207+ objectName: "pageHeader"
207 anchors { left: parent.left; right: parent.right }
208 anchors { left: parent.left; right: parent.right }
208 height: headerContainer.height
209 height: headerContainer.height
209 contentHeight: height
210 contentHeight: height
tests/qmltests/Dash/tst_DashContent.qml+4−64
@@ -193,7 +193,7 @@ Item {
193 dashContent.setCurrentScopeAtIndex(data.index, true, false);
193 dashContent.setCurrentScopeAtIndex(data.index, true, false);
194 tryCompareFunction(get_current_item_object_name, data.objectName)
194 tryCompareFunction(get_current_item_object_name, data.objectName)
195 var pageHeader = findChild(dashContent, "pageHeader");
195 var pageHeader = findChild(dashContent, "pageHeader");
196− compare(pageHeader.scope, scopesModel.getScope(data.index));
196+ compare(pageHeader.title, scopesModel.getScope(data.index).name);
197 }
197 }
198
198
199 function test_is_active_data() {
199 function test_is_active_data() {
@@ -215,67 +215,6 @@ Item {
215 tryCompare(scopesModel.getScope(2), "isActive", data.active2);
215 tryCompare(scopesModel.getScope(2), "isActive", data.active2);
216 }
216 }
217
217
218− function doFindMusicButton(parent) {
219− for (var i = 0; i < parent.children.length; i++) {
220− var c = parent.children[i];
221− if (UT.Util.isInstanceOf(c, "AbstractButton") && parent.x >= 0) {
222− for (var ii = 0; ii < c.children.length; ii++) {
223− var cc = c.children[ii];
224− if (UT.Util.isInstanceOf(cc, "Label") && cc.text == "Music") {
225− return c;
226− }
227− }
228− }
229− var r = doFindMusicButton(c);
230− if (r !== undefined) {
231− return r;
232− }
233− }
234− return undefined;
235− }
236−
237− function findMusicButton() {
238− // We need to find a AbstractButton that has a Label child
239− // with text Music and it's parent x is >= 0
240− var tabbar = findChild(dashContent, "tabbar");
241− return doFindMusicButton(tabbar);
242− }
243−
244− function test_tabBar_index_change() {
245− tryCompare(scopesModel, "loaded", true);
246− var tabbar = findChild(dashContent, "tabbar");
247−
248− tryCompare(dashContent, "currentIndex", 0);
249− tryCompare(tabbar, "selectedIndex", 0);
250− tryCompare(tabbar, "selectionMode", false);
251−
252− mouseClick(tabbar, units.gu(5), units.gu(5))
253−
254− tryCompare(tabbar, "selectionMode", true);
255− tryCompare(tabbar, "selectedIndex", 0);
256− tryCompare(dashContent, "currentIndex", 0);
257−
258− var button;
259− tryCompareFunction(function() { button = findMusicButton(); return button != undefined; }, true);
260− waitForRendering(button);
261−
262− tryCompareFunction(function() { return button.opacity > 0; }, true);
263− mouseClick(button, button.width / 2, button.height / 2)
264−
265− tryCompare(tabbar, "selectionMode", false);
266− tryCompare(tabbar, "selectedIndex", 1);
267− tryCompare(dashContent, "currentIndex", 1);
268− }
269−
270− function test_tabBar_listens_to_index_change() {
271− var tabbar = findChild(dashContent, "tabbar");
272− tryCompare(dashContent, "currentIndex", 0);
273− compare(tabbar.selectedIndex, 0);
274− var dashContentList = findChild(dashContent, "dashContentList");
275− dashContentList.currentIndex = 1;
276− compare(tabbar.selectedIndex, 1);
277− }
278−
279 function checkFlickMovingAndNotInteractive()
218 function checkFlickMovingAndNotInteractive()
280 {
219 {
281 var dashContentList = findChild(dashContent, "dashContentList");
220 var dashContentList = findChild(dashContent, "dashContentList");
@@ -316,8 +255,8 @@ Item {
316 }
255 }
317
256
318 function closePreview() {
257 function closePreview() {
319− var closePreviewMouseArea = findChild(dashContent, "dashContentPreviewList_pageHeader_backButton");
258+ var closePreviewMouseArea = findChild(dashContent, "pageHeader");
320− mouseClick(closePreviewMouseArea, closePreviewMouseArea.width / 2, closePreviewMouseArea.height / 2);
259+ mouseClick(closePreviewMouseArea, units.gu(2), units.gu(2));
321
260
322 var previewListView = findChild(dashContent, "dashContentPreviewList");
261 var previewListView = findChild(dashContent, "dashContentPreviewList");
323 tryCompare(previewListView, "open", false);
262 tryCompare(previewListView, "open", false);
@@ -459,6 +398,7 @@ Item {
459 compare(allButton.visible, true);
398 compare(allButton.visible, true);
460 compare(backButton.visible, true);
399 compare(backButton.visible, true);
461
400
401+ waitForRendering(departmentListView);
462 mouseClick(allButton, 0, 0);
402 mouseClick(allButton, 0, 0);
463 compare(dashDepartments.showList, false);
403 compare(dashDepartments.showList, false);
464 tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
404 tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");