@@ -1,5 +1,5 @@
2− * Copyright 2013 Canonical Ltd.
2+ * Copyright 2015 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
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
5 * it under the terms of the GNU General Public License as published by
@@ -14,8 +14,7 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17−import QtQuick 2.0
17+import QtQuick 2.4
18−import QtQuick.Window 2.0
19import QtTest 1.0
18import QtTest 1.0
20import "../../../qml/Dash"
19import "../../../qml/Dash"
21import "../../../qml/"
20import "../../../qml/"
@@ -29,15 +28,15 @@ Item {
33− width: root.width / 2
31+ width: parent.width / 2
32+ height: parent.height
39− width: root.width / 2
37+ width: parent.width / 2
38+ height: parent.height
40− x: root.width / 2
39+ x: width
41 clip: true
40 clip: true
@@ -53,6 +52,8 @@ Item {
53 readonly property var scopes: dashContent.scopes
52 readonly property var scopes: dashContent.scopes
55 function init() {
54 function init() {
55+ dash.windowActive = true;
56 var greeter = findChild(shell, "greeter");
57 var greeter = findChild(shell, "greeter");
57 greeter.forceShow();
58 greeter.forceShow();
@@ -83,39 +84,56 @@ Item {
83 var stopX = units.gu(1)
84 var stopX = units.gu(1)
84 var stopY = startY;
85 var stopY = startY;
85 waitForRendering(dashContentList);
86 waitForRendering(dashContentList);
86− mouseFlick(dash, startX, startY, stopX, stopY);
87+ touchFlick(dash, startX, startY, stopX, stopY);
87− mouseFlick(dash, startX, startY, stopX, stopY);
88+ touchFlick(dash, startX, startY, stopX, stopY);
88 compare(dashContentList.currentIndex, 2, "Could not flick to scope id 2");
89 compare(dashContentList.currentIndex, 2, "Could not flick to scope id 2");
91+ // Flick the greeter away
92+ var startX = shell.width - units.gu(1);
93+ var startY = shell.height / 2;
94+ var stopX = units.gu(1)
96+ touchFlick(shell, startX, startY, stopX, stopY);
98+ // Now do a long launcher movement
99+ touchFlick(shell, stopX, startY, startX, stopY);
90 var launcher = findChild(shell, "launcher");
101 var launcher = findChild(shell, "launcher");
91− launcher.switchToNextState("visible")
92 var buttonShowDashHome = findChild(launcher, "buttonShowDashHome");
102 var buttonShowDashHome = findChild(launcher, "buttonShowDashHome");
93 tryCompare(buttonShowDashHome, "enabled", true);
103 tryCompare(buttonShowDashHome, "enabled", true);
104+ tryCompare(launcher, "visibleWidth", launcher.panelWidth);
106+ // Make sure that opening the launcher doesn't change the scope
107+ compare(dashContentList.currentIndex, 2, "Opening the launcher changed the current scope");
94 mouseClick(buttonShowDashHome);
109 mouseClick(buttonShowDashHome);
95 tryCompare(dashContentList, "currentIndex", 0);
110 tryCompare(dashContentList, "currentIndex", 0);
98− function test_setLongSwipeOnDashNoChangeScope() {
113+ function test_setShortLauncherMoveResetNonActiveDash() {
99 var dashContentList = findChild(dash, "dashContentList");
114 var dashContentList = findChild(dash, "dashContentList");
100 var startX = dash.width - units.gu(1);
115 var startX = dash.width - units.gu(1);
101 var startY = dash.height / 2;
116 var startY = dash.height / 2;
102 var stopX = units.gu(1)
117 var stopX = units.gu(1)
103 var stopY = startY;
118 var stopY = startY;
104 waitForRendering(dashContentList);
119 waitForRendering(dashContentList);
105− mouseFlick(dash, startX, startY, stopX, stopY);
120+ touchFlick(dash, startX, startY, stopX, stopY);
106− mouseFlick(dash, startX, startY, stopX, stopY);
121+ touchFlick(dash, startX, startY, stopX, stopY);
107 compare(dashContentList.currentIndex, 2, "Could not flick to scope id 2");
122 compare(dashContentList.currentIndex, 2, "Could not flick to scope id 2");
124+ // Pretend the dash is not active
125+ dash.windowActive = false;
127+ // Flick the greeter away
109 var startX = shell.width - units.gu(1);
128 var startX = shell.width - units.gu(1);
110 var startY = shell.height / 2;
129 var startY = shell.height / 2;
111 var stopX = units.gu(1)
130 var stopX = units.gu(1)
112 var stopY = startY;
131 var stopY = startY;
113 touchFlick(shell, startX, startY, stopX, stopY);
132 touchFlick(shell, startX, startY, stopX, stopY);
115− // Now do a long launcher movement
134+ // Now do a small launcher movement
117 touchFlick(shell, stopX, startY, startX, stopY);
135 touchFlick(shell, stopX, startY, startX, stopY);
118− compare(dashContentList.currentIndex, 2, "Opening the launcher changed the current scope");
136+ compare(dashContentList.currentIndex, 0, "Small launcher move did not reset dash on non active window");