@@ -76,6 +76,20 @@ Item {
7676 spy.signalName = "";
7777 }
7878
79+ function scrollToCategory(category) {
80+ var categoryListView = findChild(genericScopeView, "categoryListView");
81+ tryCompareFunction(function() {
82+ if (findChild(genericScopeView, category)) return true;
83+ mouseFlick(genericScopeView, genericScopeView.width/2, genericScopeView.height,
84+ genericScopeView.width/2, genericScopeView.y)
85+ tryCompare(categoryListView, "moving", false);
86+ return findChild(genericScopeView, category) !== null;
87+ }, true);
88+
89+ tryCompareFunction(function() { return findChild(genericScopeView, "delegate0") !== null; }, true);
90+ return findChild(genericScopeView, category);
91+ }
92+
7993 function test_isActive() {
8094 tryCompare(genericScopeView.scope, "isActive", false)
8195 genericScopeView.isCurrent = true
@@ -226,12 +240,7 @@ Item {
226240 }
227241
228242 function test_forced_category_expansion() {
229− tryCompareFunction(function() {
230− mouseFlick(genericScopeView, genericScopeView.width/2, genericScopeView.height,
231− genericScopeView.width/2, genericScopeView.y)
232− return findChild(genericScopeView, "dashCategory19") !== null;
233− }, true);
234− var category = findChild(genericScopeView, "dashCategory19")
243+ var category = scrollToCategory("dashCategory19");
235244 compare(category.expandable, false, "Category with collapsed-rows: 0 should not be expandable");
236245
237246 var grid = findChild(category, "19");
@@ -289,20 +298,13 @@ Item {
289298 }
290299
291300 function test_showPreviewCarousel() {
292− tryCompareFunction(function() {
293− var dashCategory1 = findChild(genericScopeView, "dashCategory1");
294− if (dashCategory1 != null) {
295− var tile = findChild(dashCategory1, "carouselDelegate1");
296− return tile != null;
297− }
298− return false;
299− },
300− true);
301+ var category = scrollToCategory("dashCategory1");
301302
302303 tryCompare(testCase.previewListView, "open", false);
303304
304− var dashCategory1 = findChild(genericScopeView, "dashCategory1");
305− var tile = findChild(dashCategory1, "carouselDelegate1");
305+ var tile = findChild(category, "carouselDelegate1");
306+ verify(tile, "Could not find delegate");
307+
306308 mouseClick(tile, tile.width / 2, tile.height / 2);
307309 tryCompare(tile, "explicitlyScaled", true);
308310 mouseClick(tile, tile.width / 2, tile.height / 2);
@@ -310,6 +312,35 @@ Item {
310312 tryCompare(testCase.previewListView, "x", 0);
311313
312314 closePreview();
315+
316+ mousePress(tile, tile.width / 2, tile.height / 2);
317+ tryCompare(testCase.previewListView, "open", true);
318+ tryCompare(testCase.previewListView, "x", 0);
319+ mouseRelease(tile, tile.width / 2, tile.height / 2);
320+
321+ closePreview();
322+ }
323+
324+ function test_showPreviewHorizontalList() {
325+ var category = scrollToCategory("dashCategory18");
326+
327+ tryCompare(testCase.previewListView, "open", false);
328+
329+ var tile = findChild(category, "delegate1");
330+ verify(tile, "Could not find delegate");
331+
332+ mouseClick(tile, tile.width / 2, tile.height / 2);
333+ tryCompare(testCase.previewListView, "open", true);
334+ tryCompare(testCase.previewListView, "x", 0);
335+
336+ closePreview();
337+
338+ mousePress(tile, tile.width / 2, tile.height / 2);
339+ tryCompare(testCase.previewListView, "open", true);
340+ tryCompare(testCase.previewListView, "x", 0);
341+ mouseRelease(tile, tile.width / 2, tile.height / 2);
342+
343+ closePreview();
313344 }
314345
315346 function test_previewCycle() {