@@ -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
@@ -222,12 +236,7 @@ Item {
222236 }
223237
224238 function test_forced_category_expansion() {
225− tryCompareFunction(function() {
226− mouseFlick(genericScopeView, genericScopeView.width/2, genericScopeView.height,
227− genericScopeView.width/2, genericScopeView.y)
228− return findChild(genericScopeView, "dashCategory19") !== null;
229− }, true);
230− var category = findChild(genericScopeView, "dashCategory19")
239+ var category = scrollToCategory("dashCategory19");
231240 compare(category.expandable, false, "Category with collapsed-rows: 0 should not be expandable");
232241
233242 var grid = findChild(category, "19");
@@ -285,20 +294,13 @@ Item {
285294 }
286295
287296 function test_showPreviewCarousel() {
288− tryCompareFunction(function() {
289− var dashCategory1 = findChild(genericScopeView, "dashCategory1");
290− if (dashCategory1 != null) {
291− var tile = findChild(dashCategory1, "carouselDelegate1");
292− return tile != null;
293− }
294− return false;
295− },
296− true);
297+ var category = scrollToCategory("dashCategory1");
297298
298299 tryCompare(testCase.previewListView, "open", false);
299300
300− var dashCategory1 = findChild(genericScopeView, "dashCategory1");
301− var tile = findChild(dashCategory1, "carouselDelegate1");
301+ var tile = findChild(category, "carouselDelegate1");
302+ verify(tile, "Could not find delegate");
303+
302304 mouseClick(tile, tile.width / 2, tile.height / 2);
303305 tryCompare(tile, "explicitlyScaled", true);
304306 mouseClick(tile, tile.width / 2, tile.height / 2);
@@ -306,6 +308,35 @@ Item {
306308 tryCompare(testCase.previewListView, "x", 0);
307309
308310 closePreview();
311+
312+ mousePress(tile, tile.width / 2, tile.height / 2);
313+ tryCompare(testCase.previewListView, "open", true);
314+ tryCompare(testCase.previewListView, "x", 0);
315+ mouseRelease(tile, tile.width / 2, tile.height / 2);
316+
317+ closePreview();
318+ }
319+
320+ function test_showPreviewHorizontalList() {
321+ var category = scrollToCategory("dashCategory18");
322+
323+ tryCompare(testCase.previewListView, "open", false);
324+
325+ var tile = findChild(category, "delegate1");
326+ verify(tile, "Could not find delegate");
327+
328+ mouseClick(tile, tile.width / 2, tile.height / 2);
329+ tryCompare(testCase.previewListView, "open", true);
330+ tryCompare(testCase.previewListView, "x", 0);
331+
332+ closePreview();
333+
334+ mousePress(tile, tile.width / 2, tile.height / 2);
335+ tryCompare(testCase.previewListView, "open", true);
336+ tryCompare(testCase.previewListView, "x", 0);
337+ mouseRelease(tile, tile.width / 2, tile.height / 2);
338+
339+ closePreview();
309340 }
310341
311342 function test_previewCycle() {