@@ -428,5 +428,74 @@ Item {
428428 tryCompare(bottomEdgeController, "progress", 0);
429429 tryCompare(dashContentList, "currentIndex", 1)
430430 }
431+
432+ function test_close_temp_scope_preview_opening_scope() {
433+ // Show the manage dash
434+ touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
435+ var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
436+ tryCompare(bottomEdgeController, "progress", 1);
437+
438+ // Make sure stuff is loaded
439+ var nonfavScopesListCategory = findChild(dash, "scopesListCategoryother");
440+ var nonfavScopesListCategoryList = findChild(nonfavScopesListCategory, "scopesListCategoryInnerList");
441+ tryCompare(nonfavScopesListCategoryList, "currentIndex", 0);
442+
443+ // Click on a non favorite scope
444+ mouseClick(nonfavScopesListCategoryList.currentItem);
445+
446+ // Check the bottom edge (manage dash) is disabled from temp scope
447+ var overviewDragHandle = findChild(dash, "overviewDragHandle");
448+ compare(overviewDragHandle.enabled, false);
449+
450+ // Check temp scope is there
451+ var dashTempScopeItem = findChild(dash, "dashTempScopeItem");
452+ tryCompare(dashTempScopeItem, "x", 0);
453+ tryCompare(dashTempScopeItem, "visible", true);
454+
455+ // Check the manage dash is gone
456+ tryCompare(bottomEdgeController, "progress", 0);
457+
458+ // Open preview
459+ var categoryListView = findChild(dashTempScopeItem, "categoryListView");
460+ categoryListView.positionAtBeginning();
461+ tryCompareFunction(function() {
462+ var cardGrid = findChild(dashTempScopeItem, "dashCategory0");
463+ if (cardGrid != null) {
464+ var tile = findChild(cardGrid, "delegate0");
465+ return tile != null;
466+ }
467+ return false;
468+ },
469+ true);
470+ var tile = findChild(findChild(dashTempScopeItem, "dashCategory0"), "delegate0");
471+ waitForRendering(tile);
472+ mouseClick(tile);
473+ var subPageLoader = findChild(dashTempScopeItem, "subPageLoader");
474+ tryCompare(subPageLoader, "open", true);
475+ tryCompare(subPageLoader, "x", 0);
476+ tryCompare(findChild(dashTempScopeItem, "categoryListView"), "visible", false);
477+ var previewListRow0 = findChild(subPageLoader, "previewListRow0");
478+ touchFlick(previewListRow0, previewListRow0.width / 2, units.gu(20), previewListRow0.width / 2, units.gu(1));
479+ tryCompare(previewListRow0, "atYEnd", true);
480+ tryCompare(previewListRow0, "moving", false);
481+ var widget = findChild(subPageLoader, "widget-21");
482+ var initialWidgetHeight = widget.height;
483+ var openButton = findChild(widget, "buttonopen_click");
484+ mouseClick(openButton);
485+
486+ tryCompare(subPageLoader, "open", false);
487+ tryCompare(subPageLoader, "x", subPageLoader.width);
488+
489+ compare(dashTempScopeItem.scope.id, "MockScope9");
490+
491+ // Go back
492+ var dashTempScopeItemHeader = findChild(dashTempScopeItem, "scopePageHeader");
493+ var backButton = findChild(findChild(dashTempScopeItemHeader, "innerPageHeader"), "customBackButton");
494+ mouseClick(backButton);
495+
496+ // Check temp scope is gone
497+ tryCompare(dashTempScopeItem, "x", dash.width);
498+ tryCompare(dashTempScopeItem, "visible", false);
499+ }
431500 }
432501}