@@ -32,7 +32,7 @@ Item {
3232 id: scopes
3333
3434 onLoadedChanged: {
35− genericScopeView.scope = scopes.get(0)
35+ genericScopeView.scope = scopes.get(2)
3636 }
3737 }
3838
@@ -41,17 +41,10 @@ Item {
4141 signal mainStageFocusedApplicationChanged()
4242 }
4343
44− PreviewListView {
45− id: previewListView
46− anchors.fill: parent
47− openEffect: openEffect
48− categoryView: genericScopeView.categoryView
49− scope: genericScopeView.scope
50− }
51−
5244 DashContentOpenEffect {
5345 id: openEffect
5446 previewListView: previewListView
47+ sourceItem: genericScopeView
5548 }
5649
5750 PageHeaderLabel {
@@ -101,36 +94,42 @@ Item {
10194 function test_showDash() {
10295 previewListView.open = true;
10396 tryCompare(openEffect, "live", true);
104− scopes.get(0).showDash();
97+ scopes.get(2).showDash();
10598 tryCompare(previewListView, "open", false);
10699 tryCompare(openEffect, "live", true);
107100 }
108101
109102 function test_hideDash() {
110103 previewListView.open = true;
111− scopes.get(0).hideDash();
104+ scopes.get(2).hideDash();
112105 tryCompare(previewListView, "open", false);
106+ tryCompare(openEffect, "gap", 0);
113107 }
114108
115− function openPreview() {
116− var categoryListView = findChild(genericScopeView, "categoryListView");
117− categoryListView.positionAtBeginning();
118−
109+ function openPreview(filterGridName, willOpen) {
110+ if (filterGridName === undefined)
111+ filterGridName = "0";
112+ if (willOpen === undefined)
113+ willOpen = true;
119114 tryCompareFunction(function() {
120− var tile = findChild(findChild(genericScopeView, "0"), "delegate0");
121− return tile != undefined;
115+ var filterGrid = findChild(genericScopeView, filterGridName);
116+ if (filterGrid != null) {
117+ var tile = findChild(filterGrid, "delegate0");
118+ return tile != null;
119+ }
120+ return false;
122121 },
123122 true);
124− var tile = findChild(findChild(genericScopeView, "0"), "delegate0");
123+ var tile = findChild(findChild(genericScopeView, filterGridName), "delegate0");
125124 mouseClick(tile, tile.width / 2, tile.height / 2);
126− tryCompare(previewListView, "open", true);
127− tryCompare(openEffect, "gap", 1);
125+ tryCompare(previewListView, "open", willOpen);
126+ tryCompare(openEffect, "gap", willOpen ? 1 : 0);
128127 }
129128
130129 function checkArrowPosition(index) {
131130 tryCompareFunction(function() {
132131 var tile = findChild(findChild(genericScopeView, "0"), "delegate" + index);
133− return tile != undefined;
132+ return tile != null;
134133 },
135134 true);
136135 var tile = findChild(findChild(genericScopeView, "0"), "delegate" + index);
@@ -154,6 +153,8 @@ Item {
154153
155154 function test_previewOpenClose() {
156155 tryCompare(previewListView, "open", false);
156+ var categoryListView = findChild(genericScopeView, "categoryListView");
157+ categoryListView.positionAtBeginning();
157158
158159 openPreview();
159160
@@ -193,7 +194,11 @@ Item {
193194 }
194195
195196 function test_previewCycle() {
197+ var categoryListView = findChild(genericScopeView, "categoryListView");
198+ categoryListView.positionAtBeginning();
199+
196200 tryCompare(previewListView, "open", false);
201+ tryCompare(openEffect, "gap", 0);
197202
198203 openPreview();
199204
@@ -211,7 +216,7 @@ Item {
211216 checkArrowPosition(0);
212217
213218 // flick to the next previews
214−
219+ tryCompare(previewListView, "count", 15);
215220 for (var i = 1; i < previewListView.count; ++i) {
216221
217222 mouseFlick(previewListView, previewListView.width - units.gu(1),
@@ -246,8 +251,13 @@ Item {
246251 }
247252
248253 function test_show_spinner() {
254+ var categoryListView = findChild(genericScopeView, "categoryListView");
255+ waitForRendering(categoryListView);
256+ categoryListView.contentY = units.gu(13);
249257 openPreview();
250258 var previewLoader = findChild(previewListView, "previewLoader0");
259+ compare(previewLoader.source.toString().split("/").pop(), "DashPreviewPlaceholder.qml");
260+ compare(categoryListView.contentY, 0)
251261 tryCompare(previewLoader, "progress", 1.0);
252262 tryCompareFunction(function() { return previewLoader.item != undefined; }, true);
253263
@@ -263,13 +273,13 @@ Item {
263273 function test_changeScope() {
264274 genericScopeView.scope.searchQuery = "test"
265275 genericScopeView.scope = scopes.get(1)
266− genericScopeView.scope = scopes.get(0)
276+ genericScopeView.scope = scopes.get(2)
267277 tryCompare(genericScopeView.scope, "searchQuery", "")
268278 }
269279
270280 function test_filter_expand_collapse() {
271281 // wait for the item to be there
272− tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeader0") != undefined; }, true);
282+ tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeader0") != null; }, true);
273283
274284 var header = findChild(genericScopeView, "dashSectionHeader0")
275285 var category = findChild(genericScopeView, "dashCategory0")
@@ -306,7 +316,7 @@ Item {
306316 }
307317
308318 function test_showPreviewCarousel() {
309− tryCompareFunction(function() { return findChild(genericScopeView, "carouselDelegate") != undefined; }, true);
319+ tryCompareFunction(function() { return findChild(genericScopeView, "carouselDelegate") != null; }, true);
310320 var tile = findChild(genericScopeView, "carouselDelegate");
311321 mouseClick(tile, tile.width / 2, tile.height / 2);
312322 tryCompare(openEffect, "gap", 1);
@@ -332,15 +342,15 @@ Item {
332342 tryCompare(previewListView, "open", false);
333343 }
334344
335− function test_filter_expand_expand() {
345+ function test_filter_expand_expand_collapse() {
336346 // wait for the item to be there
337− tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeader2") != undefined; }, true);
347+ tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeaderapplications.scope") != null; }, true);
338348
339349 var categoryListView = findChild(genericScopeView, "categoryListView");
340350 categoryListView.contentY = categoryListView.height;
341351
342− var header2 = findChild(genericScopeView, "dashSectionHeader2")
343− var category2 = findChild(genericScopeView, "dashCategory2")
352+ var header2 = findChild(genericScopeView, "dashSectionHeaderapplications.scope")
353+ var category2 = findChild(genericScopeView, "dashCategoryapplications.scope")
344354 var category2FilterGrid = category2.children[0].children[0].children[0];
345355 verify(UT.Util.isInstanceOf(category2FilterGrid, "FilterGrid"));
346356
@@ -368,11 +378,30 @@ Item {
368378 tryCompare(category0, "filtered", false);
369379 tryCompare(category2, "filtered", true);
370380 tryCompare(category2FilterGrid, "filter", true);
381+ mouseClick(header0, header0.width / 2, header0.height / 2);
382+ tryCompare(category0, "filtered", true);
383+ tryCompare(category2, "filtered", true);
384+ }
385+
386+ function test_bug1271676_no_move_y_no_preview() {
387+ waitForRendering(genericScopeView);
388+ var categoryListView = findChild(genericScopeView, "categoryListView");
389+ waitForRendering(categoryListView);
390+ tryCompareFunction(function() { return findChild(genericScopeView, "dashCategoryapplications.scope") != null; }, true);
391+ var category = findChild(genericScopeView, "dashCategoryapplications.scope")
392+ categoryListView.contentY = category.y;
393+ waitForRendering(categoryListView);
394+ var contentYBefore = categoryListView.contentY
395+ openPreview("applications.scope", false); // This actually doesn't open anything because we
396+ // have code so that the item of installed
397+ // does activate instead of preview and never shows a preview
398+ compare(categoryListView.contentY, contentYBefore);
371399 }
372400
373401 function test_narrow_delegate_ranges_expand() {
374402 tryCompareFunction(function() { return findChild(genericScopeView, "dashCategory0") != undefined; }, true);
375403 var category = findChild(genericScopeView, "dashCategory0")
404+ tryCompare(category, "filtered", true);
376405
377406 shell.width = units.gu(20)
378407 var categoryListView = findChild(genericScopeView, "categoryListView");
@@ -386,4 +415,12 @@ Item {
386415 }
387416 }
388417 }
418+
419+ PreviewListView {
420+ id: previewListView
421+ anchors.fill: parent
422+ openEffect: openEffect
423+ categoryView: genericScopeView.categoryView
424+ scope: genericScopeView.scope
425+ }
389426}