on xenial help sign in
Fix qml tests - loader around PageHeader, more retries for selecting a scope and undefined attributes in mock overview scope.
027f37cMichał Sawicz
tests/mocks/Unity/fake_scopesoverview.cpp+4−2
@@ -105,11 +105,12 @@ ScopesOverviewCategories::data(const QModelIndex& index, int role) const
105 }
105 }
106 case RoleComponents:
106 case RoleComponents:
107 {
107 {
108− QVariantMap map, artMap;
108+ QVariantMap map, artMap, attributesMap;
109 artMap["aspect-ratio"] = "0.5";
109 artMap["aspect-ratio"] = "0.5";
110 artMap["field"] = "art";
110 artMap["field"] = "art";
111 map["art"] = artMap;
111 map["art"] = artMap;
112 map["title"] = "HOLA";
112 map["title"] = "HOLA";
113+ map["attributes"] = attributesMap;
113 return map;
114 return map;
114 }
115 }
115 case RoleResults:
116 case RoleResults:
@@ -188,11 +189,12 @@ ScopesOverviewSearchCategories::data(const QModelIndex& index, int role) const
188 }
189 }
189 case RoleComponents:
190 case RoleComponents:
190 {
191 {
191− QVariantMap map, artMap;
192+ QVariantMap map, artMap, attributesMap;
192 artMap["aspect-ratio"] = "1";
193 artMap["aspect-ratio"] = "1";
193 artMap["field"] = "art";
194 artMap["field"] = "art";
194 map["art"] = artMap;
195 map["art"] = artMap;
195 map["title"] = "HOLA";
196 map["title"] = "HOLA";
197+ map["attributes"] = attributesMap;
196 return map;
198 return map;
197 }
199 }
198 case RoleResults:
200 case RoleResults:
tests/qmltests/Dash/tst_Dash.qml+7−7
@@ -54,6 +54,7 @@ Item {
54 tryCompare(dashContentList, "count", 0);
54 tryCompare(dashContentList, "count", 0);
55 scopes.load();
55 scopes.load();
56 tryCompare(dashContentList, "currentIndex", 0);
56 tryCompare(dashContentList, "currentIndex", 0);
57+ tryCompare(dashContentList, "count", 6);
57 }
58 }
58
59
59 function get_scope_data() {
60 function get_scope_data() {
@@ -273,6 +274,8 @@ Item {
273 // Click on a temp scope in the search
274 // Click on a temp scope in the search
274 var dashCategorysearchA = findChild(searchResultsViewer, "dashCategorysearchA");
275 var dashCategorysearchA = findChild(searchResultsViewer, "dashCategorysearchA");
275 var cardTempScope = findChild(dashCategorysearchA, "delegate2");
276 var cardTempScope = findChild(dashCategorysearchA, "delegate2");
277+ verify(cardTempScope, "Could not find delegate2");
278+
276 waitForRendering(cardTempScope);
279 waitForRendering(cardTempScope);
277 mouseClick(cardTempScope, cardTempScope.width / 2, cardTempScope.height / 2);
280 mouseClick(cardTempScope, cardTempScope.width / 2, cardTempScope.height / 2);
278
281
@@ -313,13 +316,10 @@ Item {
313 var startY = dash.height / 2;
316 var startY = dash.height / 2;
314 var stopX = units.gu(1)
317 var stopX = units.gu(1)
315 var stopY = startY;
318 var stopY = startY;
316− var retry = 0;
317− while (dashContentList.currentIndex != 2 && retry <= 5) {
318− mouseFlick(dash, startX, startY, stopX, stopY)
319− waitForRendering(dashContentList)
319+ waitForRendering(dashContentList)
320− retry++;
320+ mouseFlick(dash, startX, startY, stopX, stopY);
321− }
321+ mouseFlick(dash, startX, startY, stopX, stopY);
322− compare(dashContentList.currentIndex, 2);
322+ compare(dashContentList.currentIndex, 2, "Could not flick to scope id 2");
323 var dashCommunicatorService = findInvisibleChild(dash, "dashCommunicatorService");
323 var dashCommunicatorService = findInvisibleChild(dash, "dashCommunicatorService");
324 dashCommunicatorService.mockSetCurrentScope("clickscope", true, true);
324 dashCommunicatorService.mockSetCurrentScope("clickscope", true, true);
325 tryCompare(dashContentList, "currentIndex", 1)
325 tryCompare(dashContentList, "currentIndex", 1)
tests/qmltests/Dash/tst_DashContent.qml+1−1
@@ -390,7 +390,7 @@ Item {
390 var categoryListView = findChild(scope, "categoryListView");
390 var categoryListView = findChild(scope, "categoryListView");
391 waitForRendering(categoryListView);
391 waitForRendering(categoryListView);
392
392
393− compare(categoryListView.pageHeader.searchHint, "Search People");
393+ compare(categoryListView.pageHeader.item.searchHint, "Search People");
394 }
394 }
395 }
395 }
396}
396}