on xenial help sign in
fix DashContent tests
commit0d4754341847d649555c398cb2393195cb6fc2db authorMichael Zanetti <michael.zanetti@canonical.com> dateFri 4 Jul 2014, 17:15 (12 years ago) parentaa1fee4
2 files changed+5−64
qml/Components/PageHeader.qml+1 tests/qmltests/Dash/tst_DashContent.qml+4−64
qml/Components/PageHeader.qml+1
@@ -204,6 +204,7 @@ Item {
204204
205205 PageHeadStyle {
206206 id: header
207+ objectName: "pageHeader"
207208 anchors { left: parent.left; right: parent.right }
208209 height: headerContainer.height
209210 contentHeight: height
tests/qmltests/Dash/tst_DashContent.qml+4−64
@@ -193,7 +193,7 @@ Item {
193193 dashContent.setCurrentScopeAtIndex(data.index, true, false);
194194 tryCompareFunction(get_current_item_object_name, data.objectName)
195195 var pageHeader = findChild(dashContent, "pageHeader");
196− compare(pageHeader.scope, scopesModel.getScope(data.index));
196+ compare(pageHeader.title, scopesModel.getScope(data.index).name);
197197 }
198198
199199 function test_is_active_data() {
@@ -215,67 +215,6 @@ Item {
215215 tryCompare(scopesModel.getScope(2), "isActive", data.active2);
216216 }
217217
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−
279218 function checkFlickMovingAndNotInteractive()
280219 {
281220 var dashContentList = findChild(dashContent, "dashContentList");
@@ -316,8 +255,8 @@ Item {
316255 }
317256
318257 function closePreview() {
319− var closePreviewMouseArea = findChild(dashContent, "dashContentPreviewList_pageHeader_backButton");
320− mouseClick(closePreviewMouseArea, closePreviewMouseArea.width / 2, closePreviewMouseArea.height / 2);
258+ var closePreviewMouseArea = findChild(dashContent, "pageHeader");
259+ mouseClick(closePreviewMouseArea, units.gu(2), units.gu(2));
321260
322261 var previewListView = findChild(dashContent, "dashContentPreviewList");
323262 tryCompare(previewListView, "open", false);
@@ -459,6 +398,7 @@ Item {
459398 compare(allButton.visible, true);
460399 compare(backButton.visible, true);
461400
401+ waitForRendering(departmentListView);
462402 mouseClick(allButton, 0, 0);
463403 compare(dashDepartments.showList, false);
464404 tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");