on xenial help sign in
Regression test for bug LP #1193419
dd84c49Daniel d'Andrada
Dash/Apps/RunningApplicationsGrid.qml+1
@@ -20,6 +20,7 @@ import "../../Components"
20ResponsiveFlowView {
20ResponsiveFlowView {
21 id: root
21 id: root
22 clip: true
22 clip: true
23+ objectName: "runningApplicationsGrid"
23
24
24 signal updateScreenshots
25 signal updateScreenshots
25
26
Dash/DashApps.qml+2
@@ -23,6 +23,7 @@ import "Apps"
23
23
24ScopeView {
24ScopeView {
25 id: scopeView
25 id: scopeView
26+ objectName: "DashApps"
26
27
27 // FIXME: a way to aggregate these models would be ideal
28 // FIXME: a way to aggregate these models would be ideal
28 property var mainStageApplicationsModel: shell.applicationManager.mainStageApplications
29 property var mainStageApplicationsModel: shell.applicationManager.mainStageApplications
@@ -99,6 +100,7 @@ ScopeView {
99
100
100 ScopeListView {
101 ScopeListView {
101 id: categoryView
102 id: categoryView
103+ objectName: "categoryListView"
102 anchors.fill: parent
104 anchors.fill: parent
103 model: SortFilterProxyModel {
105 model: SortFilterProxyModel {
104 model: categoryListModel
106 model: categoryListModel
Dash/DashHome.qml+1
@@ -26,6 +26,7 @@ import "Music"
26
26
27ScopeView {
27ScopeView {
28 id: root
28 id: root
29+ objectName: "DashHome"
29
30
30 onMovementStarted: listView.showHeader()
31 onMovementStarted: listView.showHeader()
31
32
Shell.qml+4
@@ -129,6 +129,7 @@ FocusScope {
129
129
130 Item {
130 Item {
131 id: underlay
131 id: underlay
132+ objectName: "underlay"
132 anchors.fill: parent
133 anchors.fill: parent
133
134
134 // Whether the underlay is fully covered by opaque UI elements.
135 // Whether the underlay is fully covered by opaque UI elements.
@@ -207,6 +208,7 @@ FocusScope {
207
208
208 Showable {
209 Showable {
209 id: stages
210 id: stages
211+ objectName: "stages"
210
212
211 x: width
213 x: width
212
214
@@ -407,6 +409,7 @@ FocusScope {
407
409
408 Greeter {
410 Greeter {
409 id: greeter
411 id: greeter
412+ objectName: "greeter"
410
413
411 available: true
414 available: true
412 hides: [launcher, panel.indicators, hud]
415 hides: [launcher, panel.indicators, hud]
@@ -545,6 +548,7 @@ FocusScope {
545
548
546 Launcher {
549 Launcher {
547 id: launcher
550 id: launcher
551+ objectName: "launcher"
548
552
549 anchors.top: parent.top
553 anchors.top: parent.top
550 anchors.bottom: parent.bottom
554 anchors.bottom: parent.bottom
tests/mocks/Unity/fake_scopes.cpp+2−2
@@ -52,8 +52,8 @@ void Scopes::updateScopes()
52 clear();
52 clear();
53 addScope(new Scope("MockScope1", "People", true, this));
53 addScope(new Scope("MockScope1", "People", true, this));
54 addScope(new Scope("MockScope2", "Music", false, this));
54 addScope(new Scope("MockScope2", "Music", false, this));
55− addScope(new Scope("MockScope3", "Home", true, this));
55+ addScope(new Scope("home.scope", "Home", true, this));
56− addScope(new Scope("MockScope4", "Applications", true, this));
56+ addScope(new Scope("applications.scope", "Applications", true, this));
57 addScope(new Scope("MockScope5", "Videos", true, this));
57 addScope(new Scope("MockScope5", "Videos", true, this));
58
58
59 if (!m_loaded) {
59 if (!m_loaded) {
tests/qmltests/tst_Shell.qml+169−1
@@ -20,6 +20,7 @@
20import QtQuick 2.0
20import QtQuick 2.0
21import QtTest 1.0
21import QtTest 1.0
22import Unity.Test 0.1 as UT
22import Unity.Test 0.1 as UT
23+import Ubuntu.Application 0.1
23
24
24import "../.."
25import "../.."
25
26
@@ -35,10 +36,23 @@ Shell {
35 var touchY = shell.height / 2;
36 var touchY = shell.height / 2;
36 touchFlick(shell, touchX, touchY, shell.width * 0.1, touchY);
37 touchFlick(shell, touchX, touchY, shell.width * 0.1, touchY);
37
38
38− var dash = findChild(shell, "dash");
39 // wait until the animation has finished
39 // wait until the animation has finished
40+
41+ var dash = findChild(shell, "dash");
40 tryCompare(dash, "contentScale", 1.0);
42 tryCompare(dash, "contentScale", 1.0);
41 tryCompare(dash, "opacity", 1.0);
43 tryCompare(dash, "opacity", 1.0);
44+
45+ var greeter = findChild(shell, "greeter");
46+ tryCompare(greeter, "x", -greeter.width);
47+ }
48+
49+ function cleanup() {
50+ // kill all (fake) running apps
51+ ApplicationManager.mainStageApplications.clear();
52+ ApplicationManager.sideStageApplications.clear();
53+
54+ var dashHome = findChild(shell, "DashHome");
55+ swipeUntilScopeViewIsReached(dashHome);
42 }
56 }
43
57
44 /*
58 /*
@@ -71,5 +85,159 @@ Shell {
71 tryCompare(dash, "contentScale", 1.0);
85 tryCompare(dash, "contentScale", 1.0);
72 tryCompare(dash, "opacity", 1.0);
86 tryCompare(dash, "opacity", 1.0);
73 }
87 }
88+
89+ /*
90+ Regression test for bug https://bugs.launchpad.net/touch-preview-images/+bug/1193419
91+
92+ When the user minimizes an application (left-edge swipe) he should always end up in the "Running Apps"
93+ category of the "Applications" scope view.
94+
95+ Steps:
96+ - go to apps lens
97+ - scroll to the bottom
98+ - reveal launcher and launch an app
99+ - perform long left edge swipe to go minimize the app and go back to the dash.
100+
101+ Expected Results
102+ - apps lens shown and Running Apps visible on screen
103+ */
104+ function test_minimizingAppTakesToRunningApps() {
105+ var dashApps = findChild(shell, "DashApps");
106+
107+ swipeUntilScopeViewIsReached(dashApps);
108+
109+ // swipe finger up until the running/recent apps section (which we assume
110+ // it's the first one) is as far from view as possible.
111+ var appsCategoryListView = findChild(dashApps, "categoryListView");
112+ while (!appsCategoryListView.atYEnd) {
113+ swipeUpFromCenter();
114+ tryCompare(appsCategoryListView, "moving", false);
115+ }
116+
117+ // Switch away from the Applications scope.
118+ swipeRightFromCenter();
119+ waitUntilItemStopsMoving(dashApps);
120+ verify(!itemIsOnScreen(dashApps));
121+
122+ dragLauncherIntoView();
123+
124+ // Launch an app from the launcher
125+ tapOnAppIconInLauncher();
126+
127+ waitUntilApplicationWindowIsFullyVisible();
128+
129+ // Minimize the application we just launched
130+ swipeFromLeftEdge();
131+
132+ // Wait for the whole UI to settle down
133+ waitUntilApplicationWindowIsFullyHidden();
134+ waitUntilItemStopsMoving(dashApps);
135+ tryCompare(appsCategoryListView, "moving", false);
136+
137+ verify(itemIsOnScreen(dashApps));
138+ var runningApplicationsGrid = findChild(dashApps, "runningApplicationsGrid");
139+ verify(itemIsOnScreen(runningApplicationsGrid));
140+ }
141+
142+ function dragLauncherIntoView() {
143+ var launcherPanel = findChild(shell, "launcherPanel");
144+ verify(launcherPanel.x = - launcherPanel.width);
145+ swipeFromLeftEdge();
146+ tryCompare(launcherPanel, "x", 0);
147+ }
148+
149+ function tapOnAppIconInLauncher() {
150+ var launcherPanel = findChild(shell, "launcherPanel");
151+
152+ // pick the first icon, the one at the bottom.
153+ var appIcon = findChild(launcherPanel, "launcherDelegate0")
154+
155+ // Swipe upwards over the launcher to ensure that this icon
156+ // at the bottom is not folded and faded away.
157+ var touchStartX = launcherPanel.width / 2;
158+ var touchStartY = launcherPanel.height / 2;
159+ touchFlick(launcherPanel, touchStartX, touchStartY, touchStartX, 0);
160+ tryCompare(launcherPanel, "moving", false);
161+
162+ // NB tapping (i.e., using touch events) doesn't activate the icon... go figure...
163+ mouseClick(appIcon, appIcon.width / 2, appIcon.height / 2);
164+ }
165+
166+ function waitUntilApplicationWindowIsFullyVisible() {
167+ var underlay = findChild(shell, "underlay");
168+ tryCompare(underlay, "visible", false);
169+ }
170+
171+ function waitUntilApplicationWindowIsFullyHidden() {
172+ var stages = findChild(shell, "stages");
173+ tryCompare(stages, "fullyHidden", true);
174+ }
175+
176+ function swipeUntilScopeViewIsReached(scopeView) {
177+ while (!itemIsOnScreen(scopeView)) {
178+ if (itemIsToLeftOfScreen(scopeView)) {
179+ swipeRightFromCenter();
180+ } else {
181+ swipeLeftFromCenter();
182+ }
183+ waitUntilItemStopsMoving(scopeView);
184+ }
185+ }
186+
187+ function swipeFromLeftEdge() {
188+ var touchStartX = 2;
189+ var touchStartY = shell.height / 2;
190+ touchFlick(shell, touchStartX, touchStartY, shell.width * 0.75, touchStartY);
191+ }
192+
193+ function swipeLeftFromCenter() {
194+ var touchStartX = shell.width / 2;
195+ var touchStartY = shell.height / 2;
196+ touchFlick(shell, touchStartX, touchStartY, 0, touchStartY);
197+ }
198+
199+ function swipeRightFromCenter() {
200+ var touchStartX = shell.width / 2;
201+ var touchStartY = shell.height / 2;
202+ touchFlick(shell, touchStartX, touchStartY, shell.width, touchStartY);
203+ }
204+
205+ function swipeUpFromCenter() {
206+ var touchStartX = shell.width / 2;
207+ var touchStartY = shell.height / 2;
208+ touchFlick(shell, touchStartX, touchStartY, touchStartX, 0);
209+ }
210+
211+ function waitUntilItemStopsMoving(item) {
212+ var itemRectInShell = item.mapToItem(shell, 0, 0, item.width, item.height);
213+ var previousX = itemRectInShell.x;
214+ var previousY = itemRectInShell.y;
215+ var isStill = false;
216+
217+ do {
218+ wait(100);
219+ itemRectInShell = item.mapToItem(shell, 0, 0, item.width, item.height);
220+ if (itemRectInShell.x == previousX && itemRectInShell.y == previousY) {
221+ isStill = true;
222+ } else {
223+ previousX = itemRectInShell.x;
224+ previousY = itemRectInShell.y;
225+ }
226+ } while (!isStill);
227+ }
228+
229+ function itemIsOnScreen(item) {
230+ var itemRectInShell = item.mapToItem(shell, 0, 0, item.width, item.height);
231+
232+ return itemRectInShell.x >= 0
233+ && itemRectInShell.y >= 0
234+ && itemRectInShell.x + itemRectInShell.width <= shell.width
235+ && itemRectInShell.y + itemRectInShell.height <= shell.height;
236+ }
237+
238+ function itemIsToLeftOfScreen(item) {
239+ var itemRectInShell = item.mapToItem(shell, 0, 0, item.width, item.height);
240+ return itemRectInShell.x < 0;
241+ }
74 }
242 }
75}
243}