@@ -0,0 +1,126 @@
2+ * Copyright 2013 Canonical Ltd.
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
18+import QtQuick.Window 2.0
20+import "../../../qml/Dash"
21+import "../../../qml/"
22+import Ubuntu.Components 0.1
23+import Unity.Test 0.1 as UT
30+ // BEGIN To reduce warnings
31+ // TODO I think it we should pass down these variables
32+ // as needed instead of hoping they will be globally around
33+ property var greeter: null
34+ property var panel: null
35+ // BEGIN To reduce warnings
41+ width: root.width / 2
47+ width: root.width / 2
60+ readonly property Item dashContent: findChild(dash, "dashContent");
61+ readonly property var scopes: dashContent.scopes
64+ // clear and reload the scopes.
66+ var dashContentList = findChild(dash, "dashContentList");
67+ verify(dashContentList != undefined);
68+ tryCompare(dashContentList, "count", 0);
70+ tryCompare(dashContentList, "currentIndex", 0);
71+ tryCompare(dashContentList, "count", 6);
72+ tryCompare(scopes, "loaded", true);
73+ tryCompareFunction(function() {
74+ var mockScope1Loader = findChild(dash, "scopeLoader0");
75+ return mockScope1Loader && mockScope1Loader.item != null; },
77+ tryCompareFunction(function() {
78+ var mockScope1Loader = findChild(dash, "scopeLoader0");
79+ return mockScope1Loader && mockScope1Loader.status === Loader.Ready; },
81+ waitForRendering(findChild(dash, "scopeLoader0").item);
84+ function test_setShellHome() {
85+ var dashContentList = findChild(dash, "dashContentList");
86+ var startX = dash.width - units.gu(1);
87+ var startY = dash.height / 2;
88+ var stopX = units.gu(1)
90+ waitForRendering(dashContentList);
91+ mouseFlick(dash, startX, startY, stopX, stopY);
92+ mouseFlick(dash, startX, startY, stopX, stopY);
93+ compare(dashContentList.currentIndex, 2, "Could not flick to scope id 2");
95+ var launcher = findChild(shell, "launcher");
96+ launcher.switchToNextState("visible")
97+ var buttonShowDashHome = findChild(launcher, "buttonShowDashHome");
98+ tryCompare(buttonShowDashHome, "enabled", true);
99+ mouseClick(buttonShowDashHome);
100+ tryCompare(dashContentList, "currentIndex", 0);
103+ function test_setLongSwipeOnDashNoChangeScope() {
104+ var dashContentList = findChild(dash, "dashContentList");
105+ var startX = dash.width - units.gu(1);
106+ var startY = dash.height / 2;
107+ var stopX = units.gu(1)
109+ waitForRendering(dashContentList);
110+ mouseFlick(dash, startX, startY, stopX, stopY);
111+ mouseFlick(dash, startX, startY, stopX, stopY);
112+ compare(dashContentList.currentIndex, 2, "Could not flick to scope id 2");
114+ var startX = shell.width - units.gu(1);
115+ var startY = shell.height / 2;
116+ var stopX = units.gu(1)
118+ touchFlick(shell, startX, startY, stopX, stopY);
120+ // Now do a long launcher movement
122+ touchFlick(shell, stopX, startY, startX, stopY);
123+ compare(dashContentList.currentIndex, 2, "Opening the launcher changed the current scope");