on xenial help sign in
Add a test for open scope

we didn't have it before and it would have caught the regression introduced by the first commit on this branch

commitf524787f39dabb7db58da4be394fa157205bc316 authorAlbert Astals Cid <albert.astals@canonical.com> dateMon 15 Feb 2016, 11:14 (11 years ago) parent261c6a0
1 file changed+59
tests/qmltests/Dash/tst_Dash.qml+59
tests/qmltests/Dash/tst_Dash.qml+59
@@ -70,6 +70,42 @@ Item {
7070 waitForRendering(findChild(dash, "scopeLoader0").item);
7171 }
7272
73+ function scrollToCategory(categoryName) {
74+ var dashContentList = findChild(dash, "dashContentList");
75+ var genericScopeView = dashContentList.currentItem;
76+ var categoryListView = findChild(genericScopeView, "categoryListView");
77+ tryCompareFunction(function() {
78+ var category = findChild(genericScopeView, categoryName);
79+ if (category && category.y > 0 && category.y < genericScopeView.height) return true;
80+ touchFlick(genericScopeView, genericScopeView.width/2, units.gu(20),
81+ genericScopeView.width/2, genericScopeView.y)
82+ tryCompare(categoryListView, "moving", false);
83+ return false;
84+ }, true);
85+
86+ tryCompareFunction(function() { return findChild(genericScopeView, "delegate0") !== null; }, true);
87+ return findChild(genericScopeView, categoryName);
88+ }
89+
90+ function clickCategoryDelegate(category, delegate) {
91+ var dashContentList = findChild(dash, "dashContentList");
92+ var genericScopeView = dashContentList.currentItem;
93+ if (category === undefined) category = 0;
94+ if (delegate === undefined) delegate = 0;
95+ tryCompareFunction(function() {
96+ var cardGrid = findChild(genericScopeView, "dashCategory"+category);
97+ if (cardGrid != null) {
98+ var tile = findChild(cardGrid, "delegate"+delegate);
99+ return tile != null;
100+ }
101+ return false;
102+ },
103+ true);
104+ var tile = findChild(findChild(genericScopeView, "dashCategory"+category), "delegate"+delegate);
105+ waitForRendering(tile);
106+ mouseClick(tile);
107+ }
108+
73109 function test_manage_dash_clickscope_unfavoritable() {
74110 // Show the manage dash
75111 touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
@@ -566,6 +602,27 @@ Item {
566602 tryCompare(dashTempScopeItem, "visible", false);
567603 }
568604
605+ function test_openScope()
606+ {
607+ scrollToCategory("dashCategory2");
608+ clickCategoryDelegate(2, 2);
609+
610+ var dashTempScopeItem = findChild(dash, "dashTempScopeItem");
611+ tryCompare(dashTempScopeItem, "x", 0);
612+ tryCompare(dashTempScopeItem, "visible", true);
613+ tryCompare(dashContent, "x", -dash.width);
614+
615+ // Go back
616+ var dashTempScopeItemHeader = findChild(dashTempScopeItem, "scopePageHeader");
617+ var backButton = findChild(findChild(dashTempScopeItemHeader, "innerPageHeader"), "customBackButton");
618+ mouseClick(backButton);
619+
620+ // Check temp scope is gone
621+ tryCompare(dashTempScopeItem, "x", dash.width);
622+ tryCompare(dashTempScopeItem, "visible", false);
623+ tryCompare(dashContent, "x", 0);
624+ }
625+
569626 function test_tempScopeItemXOnResize()
570627 {
571628 // Go to a temp scope
@@ -582,6 +639,7 @@ Item {
582639
583640 shell.width = units.gu(80);
584641 tryCompare(dashTempScopeItem, "x", 0);
642+ tryCompare(dashContent, "x", -dash.width);
585643
586644 shell.width = units.gu(40);
587645 tryCompare(dashTempScopeItem, "x", 0);
@@ -594,6 +652,7 @@ Item {
594652 // Check temp scope is gone
595653 tryCompare(dashTempScopeItem, "x", dash.width);
596654 tryCompare(dashTempScopeItem, "visible", false);
655+ tryCompare(dashContent, "x", 0);
597656 }
598657 }
599658}