on xenial help sign in
Polish + add test
commit9c4d2e236e9ce7f85e122c9a75f1562689f0e8ab authorAlbert Astals Cid <albert.astals@canonical.com> dateTue 21 Jul 2015, 16:23 (11 years ago) parent419d8cf
2 files changed+38−18
qml/Dash/Dash.qml+3−1 tests/qmltests/Dash/tst_DashShell.qml+35−17
qml/Dash/Dash.qml+3−1
@@ -36,10 +36,12 @@ Showable {
3636 }
3737 }
3838
39+ property bool windowActive: window.active
40+
3941 DashCommunicatorService {
4042 objectName: "dashCommunicatorService"
4143 onSetCurrentScopeRequested: {
42− if (!isSwipe || !window.active || bottomEdgeController.progress != 0 || scopeItem.scope || dashContent.subPageShown) {
44+ if (!isSwipe || !windowActive || bottomEdgeController.progress != 0 || scopeItem.scope || dashContent.subPageShown) {
4345 if (bottomEdgeController.progress != 0 && window.active) animate = false;
4446 dashContent.setCurrentScopeAtIndex(index, animate, isSwipe)
4547 backToDashContent()
tests/qmltests/Dash/tst_DashShell.qml+35−17
@@ -1,5 +1,5 @@
11/*
2− * Copyright 2013 Canonical Ltd.
2+ * Copyright 2015 Canonical Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -14,8 +14,7 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−import QtQuick 2.0
18−import QtQuick.Window 2.0
17+import QtQuick 2.4
1918import QtTest 1.0
2019import "../../../qml/Dash"
2120import "../../../qml/"
@@ -29,15 +28,15 @@ Item {
2928
3029 Shell {
3130 id: shell
32− height: root.height
33− width: root.width / 2
31+ width: parent.width / 2
32+ height: parent.height
3433 }
3534
3635 Dash {
3736 id: dash
38− height: root.height
39− width: root.width / 2
40− x: root.width / 2
37+ width: parent.width / 2
38+ height: parent.height
39+ x: width
4140 clip: true
4241 }
4342
@@ -53,6 +52,8 @@ Item {
5352 readonly property var scopes: dashContent.scopes
5453
5554 function init() {
55+ dash.windowActive = true;
56+
5657 var greeter = findChild(shell, "greeter");
5758 greeter.forceShow();
5859
@@ -83,39 +84,56 @@ Item {
8384 var stopX = units.gu(1)
8485 var stopY = startY;
8586 waitForRendering(dashContentList);
86− mouseFlick(dash, startX, startY, stopX, stopY);
87− mouseFlick(dash, startX, startY, stopX, stopY);
87+ touchFlick(dash, startX, startY, stopX, stopY);
88+ touchFlick(dash, startX, startY, stopX, stopY);
8889 compare(dashContentList.currentIndex, 2, "Could not flick to scope id 2");
8990
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+
90101 var launcher = findChild(shell, "launcher");
91− launcher.switchToNextState("visible")
92102 var buttonShowDashHome = findChild(launcher, "buttonShowDashHome");
93103 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+
94109 mouseClick(buttonShowDashHome);
95110 tryCompare(dashContentList, "currentIndex", 0);
96111 }
97112
98− function test_setLongSwipeOnDashNoChangeScope() {
113+ function test_setShortLauncherMoveResetNonActiveDash() {
99114 var dashContentList = findChild(dash, "dashContentList");
100115 var startX = dash.width - units.gu(1);
101116 var startY = dash.height / 2;
102117 var stopX = units.gu(1)
103118 var stopY = startY;
104119 waitForRendering(dashContentList);
105− mouseFlick(dash, startX, startY, stopX, stopY);
106− mouseFlick(dash, startX, startY, stopX, stopY);
120+ touchFlick(dash, startX, startY, stopX, stopY);
121+ touchFlick(dash, startX, startY, stopX, stopY);
107122 compare(dashContentList.currentIndex, 2, "Could not flick to scope id 2");
108123
124+ // Pretend the dash is not active
125+ dash.windowActive = false;
126+
127+ // Flick the greeter away
109128 var startX = shell.width - units.gu(1);
110129 var startY = shell.height / 2;
111130 var stopX = units.gu(1)
112131 var stopY = startY;
113132 touchFlick(shell, startX, startY, stopX, stopY);
114133
115− // Now do a long launcher movement
116−
134+ // Now do a small launcher movement
117135 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");
119137 }
120138 }
121139}