on xenial help sign in
Fix qml tests - loader around PageHeader, more retries for selecting a scope and undefined attributes in mock overview scope.

Approved by: Michael Zanetti

commit027f37ca2dffa622a7602828f39dc685880a7311 authorMichał Sawicz <michal.sawicz@canonical.com> dateThu 14 Aug 2014, 01:28 (12 years ago) parentf55a107990c345
3 files changed+12−10
tests/mocks/Unity/fake_scopesoverview.cpp+4−2 tests/qmltests/Dash/tst_Dash.qml+7−7 tests/qmltests/Dash/tst_DashContent.qml+1−1
tests/mocks/Unity/fake_scopesoverview.cpp+4−2
@@ -105,11 +105,12 @@ ScopesOverviewCategories::data(const QModelIndex& index, int role) const
105105 }
106106 case RoleComponents:
107107 {
108− QVariantMap map, artMap;
108+ QVariantMap map, artMap, attributesMap;
109109 artMap["aspect-ratio"] = "0.5";
110110 artMap["field"] = "art";
111111 map["art"] = artMap;
112112 map["title"] = "HOLA";
113+ map["attributes"] = attributesMap;
113114 return map;
114115 }
115116 case RoleResults:
@@ -188,11 +189,12 @@ ScopesOverviewSearchCategories::data(const QModelIndex& index, int role) const
188189 }
189190 case RoleComponents:
190191 {
191− QVariantMap map, artMap;
192+ QVariantMap map, artMap, attributesMap;
192193 artMap["aspect-ratio"] = "1";
193194 artMap["field"] = "art";
194195 map["art"] = artMap;
195196 map["title"] = "HOLA";
197+ map["attributes"] = attributesMap;
196198 return map;
197199 }
198200 case RoleResults:
tests/qmltests/Dash/tst_Dash.qml+7−7
@@ -54,6 +54,7 @@ Item {
5454 tryCompare(dashContentList, "count", 0);
5555 scopes.load();
5656 tryCompare(dashContentList, "currentIndex", 0);
57+ tryCompare(dashContentList, "count", 6);
5758 }
5859
5960 function get_scope_data() {
@@ -273,6 +274,8 @@ Item {
273274 // Click on a temp scope in the search
274275 var dashCategorysearchA = findChild(searchResultsViewer, "dashCategorysearchA");
275276 var cardTempScope = findChild(dashCategorysearchA, "delegate2");
277+ verify(cardTempScope, "Could not find delegate2");
278+
276279 waitForRendering(cardTempScope);
277280 mouseClick(cardTempScope, cardTempScope.width / 2, cardTempScope.height / 2);
278281
@@ -313,13 +316,10 @@ Item {
313316 var startY = dash.height / 2;
314317 var stopX = units.gu(1)
315318 var stopY = startY;
316− var retry = 0;
317− while (dashContentList.currentIndex != 2 && retry <= 5) {
318− mouseFlick(dash, startX, startY, stopX, stopY)
319− waitForRendering(dashContentList)
320− retry++;
321− }
322− compare(dashContentList.currentIndex, 2);
319+ waitForRendering(dashContentList)
320+ mouseFlick(dash, startX, startY, stopX, stopY);
321+ mouseFlick(dash, startX, startY, stopX, stopY);
322+ compare(dashContentList.currentIndex, 2, "Could not flick to scope id 2");
323323 var dashCommunicatorService = findInvisibleChild(dash, "dashCommunicatorService");
324324 dashCommunicatorService.mockSetCurrentScope("clickscope", true, true);
325325 tryCompare(dashContentList, "currentIndex", 1)
tests/qmltests/Dash/tst_DashContent.qml+1−1
@@ -390,7 +390,7 @@ Item {
390390 var categoryListView = findChild(scope, "categoryListView");
391391 waitForRendering(categoryListView);
392392
393− compare(categoryListView.pageHeader.searchHint, "Search People");
393+ compare(categoryListView.pageHeader.item.searchHint, "Search People");
394394 }
395395 }
396396}