@@ -87,19 +87,26 @@ Item {
87 tryCompare(previewListView, "open", false);
87 tryCompare(previewListView, "open", false);
90− function openPreview() {
90+ function openPreview(filterGridName, willOpen) {
91− var categoryListView = findChild(genericScopeView, "categoryListView");
91+ if (filterGridName === undefined)
92− categoryListView.positionAtBeginning();
92+ filterGridName = "0";
93−
93+ if (willOpen === undefined)
94 tryCompareFunction(function() {
95 tryCompareFunction(function() {
95− var tile = findChild(findChild(genericScopeView, "0"), "delegate0");
96+ var filterGrid = findChild(genericScopeView, filterGridName);
97+ console.log(filterGrid)
98+ if (filterGrid != null) {
99+ var tile = findChild(filterGrid, "delegate0");
96− return tile != undefined;
100+ return tile != undefined;
99− var tile = findChild(findChild(genericScopeView, "0"), "delegate0");
105+ var tile = findChild(findChild(genericScopeView, filterGridName), "delegate0");
106+ console.log(tile, tile.x, tile.y, tile.width, tile.height)
100 mouseClick(tile, tile.width / 2, tile.height / 2);
107 mouseClick(tile, tile.width / 2, tile.height / 2);
101− tryCompare(previewListView, "open", true);
108+ tryCompare(previewListView, "open", willOpen);
102− tryCompare(openEffect, "gap", 1);
109+ tryCompare(openEffect, "gap", willOpen ? 1 : 0);
105 function checkArrowPosition(index) {
112 function checkArrowPosition(index) {
@@ -129,6 +136,8 @@ Item {
130 function test_previewOpenClose() {
137 function test_previewOpenClose() {
131 tryCompare(previewListView, "open", false);
138 tryCompare(previewListView, "open", false);
139+ var categoryListView = findChild(genericScopeView, "categoryListView");
140+ categoryListView.positionAtBeginning();
133 openPreview();
142 openPreview();
@@ -168,6 +177,9 @@ Item {
170 function test_previewCycle() {
179 function test_previewCycle() {
180+ var categoryListView = findChild(genericScopeView, "categoryListView");
181+ categoryListView.positionAtBeginning();
171 tryCompare(previewListView, "open", false);
183 tryCompare(previewListView, "open", false);
172 tryCompare(openEffect, "gap", 0);
184 tryCompare(openEffect, "gap", 0);
@@ -222,8 +234,13 @@ Item {
224 function test_show_spinner() {
236 function test_show_spinner() {
237+ var categoryListView = findChild(genericScopeView, "categoryListView");
238+ waitForRendering(categoryListView);
239+ categoryListView.contentY = units.gu(13);
225 openPreview();
240 openPreview();
226 var previewLoader = findChild(previewListView, "previewLoader0");
241 var previewLoader = findChild(previewListView, "previewLoader0");
242+ compare(previewLoader.source.toString().split("/").pop(), "DashPreviewPlaceholder.qml");
243+ compare(categoryListView.contentY, 0)
227 tryCompare(previewLoader, "progress", 1.0);
244 tryCompare(previewLoader, "progress", 1.0);
228 tryCompareFunction(function() { return previewLoader.item != undefined; }, true);
245 tryCompareFunction(function() { return previewLoader.item != undefined; }, true);
@@ -295,13 +312,13 @@ Item {
296 function test_filter_expand_expand() {
313 function test_filter_expand_expand() {
297 // wait for the item to be there
314 // wait for the item to be there
298− tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeader2") != undefined; }, true);
315+ tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeaderinstalled") != undefined; }, true);
300 var categoryListView = findChild(genericScopeView, "categoryListView");
317 var categoryListView = findChild(genericScopeView, "categoryListView");
301 categoryListView.contentY = categoryListView.height;
318 categoryListView.contentY = categoryListView.height;
303− var header2 = findChild(genericScopeView, "dashSectionHeader2")
320+ var header2 = findChild(genericScopeView, "dashSectionHeaderinstalled")
304− var category2 = findChild(genericScopeView, "dashCategory2")
321+ var category2 = findChild(genericScopeView, "dashCategoryinstalled")
305 var category2FilterGrid = category2.children[0].children[0].children[0];
322 var category2FilterGrid = category2.children[0].children[0].children[0];
306 verify(UT.Util.isInstanceOf(category2FilterGrid, "FilterGrid"));
323 verify(UT.Util.isInstanceOf(category2FilterGrid, "FilterGrid"));
@@ -330,6 +347,20 @@ Item {
330 tryCompare(category2, "filtered", true);
347 tryCompare(category2, "filtered", true);
331 tryCompare(category2FilterGrid, "filter", true);
348 tryCompare(category2FilterGrid, "filter", true);
351+ function test_no_move_y_no_preview() {
352+ waitForRendering(genericScopeView);
353+ var categoryListView = findChild(genericScopeView, "categoryListView");
354+ waitForRendering(categoryListView);
355+ var category = findChild(genericScopeView, "dashCategoryinstalled")
356+ categoryListView.contentY = category.y;
357+ waitForRendering(categoryListView);
358+ var contentYBefore = categoryListView.contentY
359+ openPreview("installed", false); // This actually doesn't open anything because we
360+ // have code so that the item of installed
361+ // does activate instead of preview and never shows a preview
362+ compare(categoryListView.contentY, contentYBefore);