on xenial help sign in
Polish + add test
9c4d2e2Albert Astals Cid
qml/Dash/Dash.qml+3−1
@@ -36,10 +36,12 @@ Showable {
36 }
36 }
37 }
37 }
38
38
39+ property bool windowActive: window.active
40+
39 DashCommunicatorService {
41 DashCommunicatorService {
40 objectName: "dashCommunicatorService"
42 objectName: "dashCommunicatorService"
41 onSetCurrentScopeRequested: {
43 onSetCurrentScopeRequested: {
42− if (!isSwipe || !window.active || bottomEdgeController.progress != 0 || scopeItem.scope || dashContent.subPageShown) {
44+ if (!isSwipe || !windowActive || bottomEdgeController.progress != 0 || scopeItem.scope || dashContent.subPageShown) {
43 if (bottomEdgeController.progress != 0 && window.active) animate = false;
45 if (bottomEdgeController.progress != 0 && window.active) animate = false;
44 dashContent.setCurrentScopeAtIndex(index, animate, isSwipe)
46 dashContent.setCurrentScopeAtIndex(index, animate, isSwipe)
45 backToDashContent()
47 backToDashContent()
tests/qmltests/Dash/tst_DashShell.qml+35−17
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright 2013 Canonical Ltd.
2+ * Copyright 2015 Canonical Ltd.
3 *
3 *
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/>.
15 */
15 */
16
16
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 {
29
28
30 Shell {
29 Shell {
31 id: shell
30 id: shell
32− height: root.height
33− width: root.width / 2
31+ width: parent.width / 2
32+ height: parent.height
34 }
33 }
35
34
36 Dash {
35 Dash {
37 id: dash
36 id: dash
38− height: root.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
42 }
41 }
43
42
@@ -53,6 +52,8 @@ Item {
53 readonly property var scopes: dashContent.scopes
52 readonly property var scopes: dashContent.scopes
54
53
55 function init() {
54 function init() {
55+ dash.windowActive = true;
56+
56 var greeter = findChild(shell, "greeter");
57 var greeter = findChild(shell, "greeter");
57 greeter.forceShow();
58 greeter.forceShow();
58
59
@@ -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");
89
90
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)
95+ var stopY = startY;
96+ touchFlick(shell, startX, startY, stopX, stopY);
97+
98+ // Now do a long launcher movement
99+ touchFlick(shell, stopX, startY, startX, stopY);
100+
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);
105+
106+ // Make sure that opening the launcher doesn't change the scope
107+ compare(dashContentList.currentIndex, 2, "Opening the launcher changed the current scope");
108+
94 mouseClick(buttonShowDashHome);
109 mouseClick(buttonShowDashHome);
95 tryCompare(dashContentList, "currentIndex", 0);
110 tryCompare(dashContentList, "currentIndex", 0);
96 }
111 }
97
112
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");
108
123
124+ // Pretend the dash is not active
125+ dash.windowActive = false;
126+
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);
114
133
115− // Now do a long launcher movement
134+ // Now do a small launcher movement
116−
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");
119 }
137 }
120 }
138 }
121}
139}