@@ -0,0 +1,135 @@
2+ * Copyright 2015 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/>.
19+import "../../../qml/Dash"
20+import "../../../qml/"
21+import Ubuntu.Components 1.3
22+import Unity.Test 0.1 as UT
31+ width: parent.width / 2
32+ height: parent.height
37+ width: parent.width / 2
38+ height: parent.height
47+ readonly property Item dashContent: findChild(dash, "dashContent");
48+ readonly property var scopes: dashContent.scopes
51+ dash.windowActive = true;
53+ var greeter = findChild(shell, "greeter");
56+ // clear and reload the scopes.
58+ var dashContentList = findChild(dash, "dashContentList");
59+ verify(dashContentList != undefined);
60+ tryCompare(dashContentList, "count", 0);
62+ tryCompare(dashContentList, "currentIndex", 0);
63+ tryCompare(dashContentList, "count", 6);
64+ tryCompare(scopes, "loaded", true);
65+ tryCompareFunction(function() {
66+ var mockScope1Loader = findChild(dash, "scopeLoader0");
67+ return mockScope1Loader && mockScope1Loader.item != null; },
69+ tryCompareFunction(function() {
70+ var mockScope1Loader = findChild(dash, "scopeLoader0");
71+ return mockScope1Loader && mockScope1Loader.status === Loader.Ready; },
73+ waitForRendering(findChild(dash, "scopeLoader0").item);
76+ function test_setShellHome() {
77+ var dashContentList = findChild(dash, "dashContentList");
78+ var startX = dash.width - units.gu(1);
79+ var startY = dash.height / 2;
80+ var stopX = units.gu(1)
82+ waitForRendering(dashContentList);
83+ touchFlick(dash, startX, startY, stopX, stopY);
84+ touchFlick(dash, startX, startY, stopX, stopY);
85+ compare(dashContentList.currentIndex, 2, "Could not flick to scope id 2");
87+ // Flick the greeter away
88+ var startX = shell.width - units.gu(1);
89+ var startY = shell.height / 2;
90+ var stopX = units.gu(1)
92+ touchFlick(shell, startX, startY, stopX, stopY);
94+ // Now do a long launcher movement
95+ touchFlick(shell, stopX, startY, startX, stopY);
97+ var launcher = findChild(shell, "launcher");
98+ var buttonShowDashHome = findChild(launcher, "buttonShowDashHome");
99+ tryCompare(buttonShowDashHome, "enabled", true);
100+ tryCompare(launcher, "visibleWidth", launcher.panelWidth);
102+ // Make sure that opening the launcher doesn't change the scope
103+ compare(dashContentList.currentIndex, 2, "Opening the launcher changed the current scope");
105+ mouseClick(buttonShowDashHome);
106+ tryCompare(dashContentList, "currentIndex", 0);
109+ function test_setShortLauncherMoveResetNonActiveDash() {
110+ var dashContentList = findChild(dash, "dashContentList");
111+ var startX = dash.width - units.gu(1);
112+ var startY = dash.height / 2;
113+ var stopX = units.gu(1)
115+ waitForRendering(dashContentList);
116+ touchFlick(dash, startX, startY, stopX, stopY);
117+ touchFlick(dash, startX, startY, stopX, stopY);
118+ compare(dashContentList.currentIndex, 2, "Could not flick to scope id 2");
120+ // Pretend the dash is not active
121+ dash.windowActive = false;
123+ // Flick the greeter away
124+ var startX = shell.width - units.gu(1);
125+ var startY = shell.height / 2;
126+ var stopX = units.gu(1)
128+ touchFlick(shell, startX, startY, stopX, stopY);
130+ // Now do a small launcher movement
131+ touchFlick(shell, stopX, startY, startX, stopY);
132+ compare(dashContentList.currentIndex, 0, "Small launcher move did not reset dash on non active window");