@@ -78,6 +78,20 @@ Item {
7878 spy.signalName = "";
7979 }
8080
81+ function scrollToCategory(category) {
82+ var categoryListView = findChild(genericScopeView, "categoryListView");
83+ tryCompareFunction(function() {
84+ if (findChild(genericScopeView, category)) return true;
85+ mouseFlick(genericScopeView, genericScopeView.width/2, genericScopeView.height,
86+ genericScopeView.width/2, genericScopeView.y)
87+ tryCompare(categoryListView, "moving", false);
88+ return findChild(genericScopeView, category) !== null;
89+ }, true);
90+
91+ tryCompareFunction(function() { return findChild(genericScopeView, "delegate0") !== null; }, true);
92+ return findChild(genericScopeView, category);
93+ }
94+
8195 function test_isActive() {
8296 tryCompare(genericScopeView.scope, "isActive", false)
8397 genericScopeView.isCurrent = true
@@ -224,12 +238,7 @@ Item {
224238 }
225239
226240 function test_forced_category_expansion() {
227− tryCompareFunction(function() {
228− mouseFlick(genericScopeView, genericScopeView.width/2, genericScopeView.height,
229− genericScopeView.width/2, genericScopeView.y)
230− return findChild(genericScopeView, "dashCategory19") !== null;
231− }, true);
232− var category = findChild(genericScopeView, "dashCategory19")
241+ var category = scrollToCategory("dashCategory19");
233242 compare(category.expandable, false, "Category with collapsed-rows: 0 should not be expandable");
234243
235244 var grid = findChild(category, "19");
@@ -287,20 +296,13 @@ Item {
287296 }
288297
289298 function test_showPreviewCarousel() {
290− tryCompareFunction(function() {
291− var dashCategory1 = findChild(genericScopeView, "dashCategory1");
292− if (dashCategory1 != null) {
293− var tile = findChild(dashCategory1, "carouselDelegate1");
294− return tile != null;
295− }
296− return false;
297− },
298− true);
299+ var category = scrollToCategory("dashCategory1");
299300
300301 tryCompare(testCase.subPageLoader, "open", false);
301302
302− var dashCategory1 = findChild(genericScopeView, "dashCategory1");
303− var tile = findChild(dashCategory1, "carouselDelegate1");
303+ var tile = findChild(category, "carouselDelegate1");
304+ verify(tile, "Could not find delegate");
305+
304306 mouseClick(tile, tile.width / 2, tile.height / 2);
305307 tryCompare(tile, "explicitlyScaled", true);
306308 mouseClick(tile, tile.width / 2, tile.height / 2);
@@ -308,6 +310,35 @@ Item {
308310 tryCompare(testCase.subPageLoader, "x", 0);
309311
310312 closePreview();
313+
314+ mousePress(tile, tile.width / 2, tile.height / 2);
315+ tryCompare(testCase.subPageLoader, "open", true);
316+ tryCompare(testCase.subPageLoader, "x", 0);
317+ mouseRelease(tile, tile.width / 2, tile.height / 2);
318+
319+ closePreview();
320+ }
321+
322+ function test_showPreviewHorizontalList() {
323+ var category = scrollToCategory("dashCategory18");
324+
325+ tryCompare(testCase.subPageLoader, "open", false);
326+
327+ var tile = findChild(category, "delegate1");
328+ verify(tile, "Could not find delegate");
329+
330+ mouseClick(tile, tile.width / 2, tile.height / 2);
331+ tryCompare(testCase.subPageLoader, "open", true);
332+ tryCompare(testCase.subPageLoader, "x", 0);
333+
334+ closePreview();
335+
336+ mousePress(tile, tile.width / 2, tile.height / 2);
337+ tryCompare(testCase.subPageLoader, "open", true);
338+ tryCompare(testCase.subPageLoader, "x", 0);
339+ mouseRelease(tile, tile.width / 2, tile.height / 2);
340+
341+ closePreview();
311342 }
312343
313344 function test_previewCycle() {
@@ -379,6 +410,7 @@ Item {
379410 verify(background, "Could not find the background");
380411 compare(background.style, data.background);
381412
413+ wait(50) // XXX Cimi my machine needs this to pass the following checks
382414 var image = findChild(genericScopeView, "titleImage");
383415 if (data.logo == "") expectFail(data.tag, "Title image should not exist.");
384416 verify(image, "Could not find the title image.");