@@ -20,8 +20,6 @@ import "../../../qml/Dash"
2020import Ubuntu.Components 0.1
2121import Unity.Test 0.1 as UT
2222
23−// TODO We don't have any tests for the overlay scope functionality.
24−
2523Item {
2624 id: shell
2725 width: units.gu(40)
@@ -153,5 +151,153 @@ Item {
153151 tryCompare(overviewController, "progress", 0);
154152 compare(dashContentList.currentIndex, 1);
155153 }
154+
155+ function test_dash_overview_all_temp_scope_done_from_all() {
156+ // Wait for stuff to be loaded
157+ tryCompare(scopes, "loaded", true);
158+ var dashContentList = findChild(dash, "dashContentList");
159+ tryCompare(dashContentList, "count", 6);
160+ var mockScope1Loader = findChild(dash, "MockScope1 loader");
161+ tryCompareFunction(function() { return mockScope1Loader.item != null; }, true);
162+
163+ // Show the overview
164+ touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18));
165+ var overviewController = findInvisibleChild(dash, "overviewController");
166+ tryCompare(overviewController, "progress", 1);
167+
168+ // Make sure tab is where it should
169+ var scopesOverview = findChild(dash, "scopesOverview");
170+ compare(scopesOverview.currentTab, 0);
171+
172+ // Make sure stuff is loaded
173+ var scopesOverviewFavoritesRepeater = findChild(dash, "scopesOverviewFavoritesRepeater");
174+ tryCompare(scopesOverviewFavoritesRepeater, "count", 6);
175+ tryCompareFunction(function() { return scopesOverviewFavoritesRepeater.itemAt(0).item != null; }, true);
176+ waitForRendering(scopesOverviewFavoritesRepeater.itemAt(1).item);
177+
178+ // Click on the all tab
179+ var scopesOverviewAllTabButton = findChild(dash, "scopesOverviewAllTabButton");
180+ mouseClick(scopesOverviewAllTabButton, 0, 0);
181+
182+ // Wait for all tab to be enabled (animation finish)
183+ var scopesOverviewAllView = findChild(dash, "scopesOverviewRepeaterChild1");
184+ tryCompare(scopesOverviewAllView, "enabled", true);
185+
186+ // Click on a temp scope
187+ var tempScopeCard = findChild(scopesOverviewAllView, "delegate1");
188+ mouseClick(tempScopeCard, 0, 0);
189+
190+ // Check the bottom edge (overview) is disabled from temp scope
191+ var overviewDragHandle = findChild(dash, "overviewDragHandle");
192+ compare(overviewDragHandle.enabled, false);
193+
194+ // Check temp scope is there
195+ var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem");
196+ tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope != null; }, true);
197+ tryCompare(scopesOverviewTempScopeItem, "enabled", true);
198+
199+ // Go back
200+ var scopesOverviewTempScopeItemHeader = findChild(scopesOverviewTempScopeItem, "scopePageHeader");
201+ var backButton = findChild(findChild(scopesOverviewTempScopeItemHeader, "innerPageHeader"), "backButton");
202+ mouseClick(backButton, 0, 0);
203+
204+ // Check temp scope is gone
205+ var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem");
206+ tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope == null; }, true);
207+ tryCompare(scopesOverviewTempScopeItem, "enabled", false);
208+
209+ // Press on done
210+ var scopesOverviewDoneButton = findChild(scopesOverview, "scopesOverviewDoneButton");
211+ mouseClick(scopesOverviewDoneButton, 0, 0);
212+
213+ // Check the dash overview is gone
214+ tryCompare(overviewController, "progress", 0);
215+
216+ // Original list is still on 0
217+ compare(dashContentList.currentIndex, 0);
218+ }
219+
220+ function test_temp_scope_dash_overview_all_search_temp_scope_favorite_from_all() {
221+ // Wait for stuff to be loaded
222+ tryCompare(scopes, "loaded", true);
223+ var dashContentList = findChild(dash, "dashContentList");
224+ tryCompare(dashContentList, "count", 6);
225+ var mockScope1Loader = findChild(dash, "MockScope1 loader");
226+ tryCompareFunction(function() { return mockScope1Loader.item != null; }, true);
227+
228+ // Swipe right to Apps scope
229+ touchFlick(dash, dash.width - 1, units.gu(1), dash.width - units.gu(10), units.gu(1));
230+ tryCompare(dashContentList, "contentX", dashContentList.width);
231+ tryCompare(dashContentList, "currentIndex", 1);
232+
233+ // Click on card that opens temp scope
234+ var dashCategory2 = findChild(dashContentList.currentItem, "dashCategory2");
235+ var card2 = findChild(dashCategory2, "delegate2");
236+ waitForRendering(card2);
237+ mouseClick(card2, 0, 0);
238+
239+ // Wait for temp scope to be there
240+ var dashTempScopeItem = findChild(dash, "dashTempScopeItem");
241+ tryCompare(dashTempScopeItem, "x", 0);
242+
243+ // Show the overview
244+ touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18));
245+ var overviewController = findInvisibleChild(dash, "overviewController");
246+ tryCompare(overviewController, "progress", 1);
247+
248+ // Make sure tab is where it should
249+ var scopesOverview = findChild(dash, "scopesOverview");
250+ compare(scopesOverview.currentTab, 1);
251+
252+ // Do a search
253+ var scopesOverviewPageHeader = findChild(scopesOverview, "scopesOverviewPageHeader");
254+ var searchButton = findChild(scopesOverviewPageHeader, "search_header_button");
255+ mouseClick(searchButton, 0, 0);
256+
257+ // Type something
258+ keyClick(Qt.Key_H);
259+
260+ // Check results grid is there and the other lists are not
261+ var searchResultsViewer = findChild(scopesOverview, "searchResultsViewer");
262+ var scopesOverviewRepeater = findChild(dash, "scopesOverviewRepeater");
263+ tryCompare(searchResultsViewer, "opacity", 1);
264+ tryCompare(scopesOverviewRepeater, "count", 0);
265+
266+ // Click on a temp scope in the search
267+ var dashCategorysearchA = findChild(searchResultsViewer, "dashCategorysearchA");
268+ var cardTempScope = findChild(dashCategorysearchA, "delegate2");
269+ waitForRendering(cardTempScope);
270+ mouseClick(cardTempScope, cardTempScope.width / 2, cardTempScope.height / 2);
271+
272+ // Check the bottom edge (overview) is disabled from temp scope
273+ var overviewDragHandle = findChild(dash, "overviewDragHandle");
274+ compare(overviewDragHandle.enabled, false);
275+
276+ // Check temp scope is there
277+ var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem");
278+ tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope != null; }, true);
279+ tryCompare(scopesOverviewTempScopeItem, "enabled", true);
280+
281+ // Go back
282+ var scopesOverviewTempScopeItemHeader = findChild(scopesOverviewTempScopeItem, "scopePageHeader");
283+ var backButton = findChild(findChild(scopesOverviewTempScopeItemHeader, "innerPageHeader"), "backButton");
284+ mouseClick(backButton, 0, 0);
285+
286+ // Check temp scope is gone
287+ var scopesOverviewTempScopeItem = findChild(dash, "scopesOverviewTempScopeItem");
288+ tryCompareFunction( function() { return scopesOverviewTempScopeItem.scope == null; }, true);
289+ tryCompare(scopesOverviewTempScopeItem, "enabled", false);
290+
291+ // Press on a favorite
292+ var dashCategorysearchB = findChild(searchResultsViewer, "dashCategorysearchB");
293+ var cardFavSearch = findChild(dashCategorysearchB, "delegate3");
294+ mouseClick(cardFavSearch, 0, 0);
295+
296+ // Check the dash overview is gone
297+ tryCompare(overviewController, "progress", 0);
298+
299+ // Original list went to the favorite
300+ compare(dashContentList.currentIndex, 0);
301+ }
156302 }
157303}