on xenial help sign in
Add test for the wrong bg...
99eff39Andrea Cimitan
Components/CrossFadeImage.qml−2
@@ -58,7 +58,6 @@ Item {
58 }
58 }
59
59
60 onSourceChanged: {
60 onSourceChanged: {
61− console.log("here")
62 // On creation, the souce handler is called before image pointers are set.
61 // On creation, the souce handler is called before image pointers are set.
63 if (__currentImage === null) {
62 if (__currentImage === null) {
64 __currentImage = image1;
63 __currentImage = image1;
@@ -79,7 +78,6 @@ Item {
79 // If case the image is still in QML's cache, status will be "Ready" immediately
78 // If case the image is still in QML's cache, status will be "Ready" immediately
80 if (__nextImage.status == Image.Ready || __nextImage.source == "") {
79 if (__nextImage.status == Image.Ready || __nextImage.source == "") {
81 swapImages();
80 swapImages();
82−
83 }
81 }
84 }
82 }
85 }
83 }
Shell.qml+5−2
@@ -149,13 +149,16 @@ FocusScope {
149 id: backgroundImage
149 id: backgroundImage
150 objectName: "backgroundImage"
150 objectName: "backgroundImage"
151
151
152− property url gSettingsPicture: backgroundSettings.pictureUri
152+ property url gSettingsPicture: backgroundSettings.pictureUri.length > 0 ? backgroundSettings.pictureUri : defaultBackground
153
153
154 anchors.fill: parent
154 anchors.fill: parent
155
155
156− onGSettingsPictureChanged: source = gSettingsPicture
156+ onGSettingsPictureChanged: {
157+ source = gSettingsPicture
158+ }
157
159
158 onStatusChanged: {
160 onStatusChanged: {
161+ print("################################## image status changed", status, "(", Image.Error,"), source:", source)
159 if (status == Image.Error && source != defaultBackground) {
162 if (status == Image.Error && source != defaultBackground) {
160 source = defaultBackground
163 source = defaultBackground
161 }
164 }
tests/qmltests/tst_Shell.qml+204−205
@@ -74,210 +74,210 @@ Item {
74 swipeUntilScopeViewIsReached(dashHome);
74 swipeUntilScopeViewIsReached(dashHome);
75 }
75 }
76
76
77−// /*
77+ /*
78−// Test the effect of a right-edge drag on the dash in 3 situations:
78+ Test the effect of a right-edge drag on the dash in 3 situations:
79−// 1 - when no application has been launched yet
79+ 1 - when no application has been launched yet
80−// 2 - when there's a minimized application
80+ 2 - when there's a minimized application
81−// 3 - after the last running application has been closed/stopped
81+ 3 - after the last running application has been closed/stopped
82
82
83−// The behavior of Dash on 3 should be the same as on 1.
83+ The behavior of Dash on 3 should be the same as on 1.
84−// */
84+ */
85−// function test_rightEdgeDrag() {
85+ function test_rightEdgeDrag() {
86−// checkRightEdgeDragWithNoRunningApps();
86+ checkRightEdgeDragWithNoRunningApps();
87
87
88−// dragLauncherIntoView();
88+ dragLauncherIntoView();
89−
90−// // Launch an app from the launcher
91−// tapOnAppIconInLauncher();
92−// waitUntilApplicationWindowIsFullyVisible();
93
89
90+ // Launch an app from the launcher
91+ tapOnAppIconInLauncher();
92+ waitUntilApplicationWindowIsFullyVisible();
93+
94−// // Minimize the application we just launched
94+ // Minimize the application we just launched
95−// swipeFromLeftEdge();
95+ swipeFromLeftEdge();
96−
96+
97−// waitForUIToSettle();
97+ waitForUIToSettle();
98−
98+
99−// checkRightEdgeDragWithMinimizedApp();
99+ checkRightEdgeDragWithMinimizedApp();
100−
100+
101−// // Minimize that application once again
101+ // Minimize that application once again
102−// swipeFromLeftEdge();
102+ swipeFromLeftEdge();
103−
103+
104−// // kill it
104+ // kill it
105−// ApplicationManager.mainStageApplications.clear();
105+ ApplicationManager.mainStageApplications.clear();
106−
106+
107−// waitForUIToSettle();
107+ waitForUIToSettle();
108−
108+
109−// // Right edge behavior should now be the same as before that app was launched
109+ // Right edge behavior should now be the same as before that app was launched
110−// checkRightEdgeDragWithNoRunningApps();
110+ checkRightEdgeDragWithNoRunningApps();
111−// }
111+ }
112−
112+
113−// /*
113+ /*
114−// Perform a right-edge drag when the Dash is being show and there are
114+ Perform a right-edge drag when the Dash is being show and there are
115−// no running/minimized apps to be restored.
115+ no running/minimized apps to be restored.
116−
116+
117−// The expected behavior is that an animation should be played to hint the
117+ The expected behavior is that an animation should be played to hint the
118−// user that his right-edge drag gesture has been successfully recognized
118+ user that his right-edge drag gesture has been successfully recognized
119−// but there is no application to be brought to foreground.
119+ but there is no application to be brought to foreground.
120−// */
120+ */
121−// function checkRightEdgeDragWithNoRunningApps() {
121+ function checkRightEdgeDragWithNoRunningApps() {
122−// var touchX = shell.width - (shell.edgeSize / 2);
122+ var touchX = shell.width - (shell.edgeSize / 2);
123−// var touchY = shell.height / 2;
123+ var touchY = shell.height / 2;
124−
124+
125−// var dash = findChild(shell, "dash");
125+ var dash = findChild(shell, "dash");
126−// // check that dash has normal scale and opacity
126+ // check that dash has normal scale and opacity
127−// compare(dash.contentScale, 1.0);
127+ compare(dash.contentScale, 1.0);
128−// compare(dash.opacity, 1.0);
128+ compare(dash.opacity, 1.0);
129−
129+
130−// touchFlick(shell, touchX, touchY, shell.width * 0.1, touchY,
130+ touchFlick(shell, touchX, touchY, shell.width * 0.1, touchY,
131−// true /* beginTouch */, false /* endTouch */);
131+ true /* beginTouch */, false /* endTouch */);
132−
132+
133−// // check that Dash has been scaled down and had its opacity reduced
133+ // check that Dash has been scaled down and had its opacity reduced
134−// tryCompareFunction(function() { return dash.contentScale <= 0.9; }, true);
134+ tryCompareFunction(function() { return dash.contentScale <= 0.9; }, true);
135−// tryCompareFunction(function() { return dash.opacity <= 0.5; }, true);
135+ tryCompareFunction(function() { return dash.opacity <= 0.5; }, true);
136−
136+
137−// touchRelease(shell, shell.width * 0.1, touchY);
137+ touchRelease(shell, shell.width * 0.1, touchY);
138−
138+
139−// // and now everything should have gone back to normal
139+ // and now everything should have gone back to normal
140−// tryCompare(dash, "contentScale", 1.0);
140+ tryCompare(dash, "contentScale", 1.0);
141−// tryCompare(dash, "opacity", 1.0);
141+ tryCompare(dash, "opacity", 1.0);
142−// }
142+ }
143−
143+
144−// /*
144+ /*
145−// Perform a right-edge drag when the Dash is being show and there is
145+ Perform a right-edge drag when the Dash is being show and there is
146−// a running/minimized app to be restored.
146+ a running/minimized app to be restored.
147−
147+
148−// The expected behavior is that the dash should fade away and ultimately be
148+ The expected behavior is that the dash should fade away and ultimately be
149−// made invisible once the gesture is finished as the restored app will now
149+ made invisible once the gesture is finished as the restored app will now
150−// be on foreground.
150+ be on foreground.
151−// */
151+ */
152−// function checkRightEdgeDragWithMinimizedApp() {
152+ function checkRightEdgeDragWithMinimizedApp() {
153−// var touchX = shell.width - (shell.edgeSize / 2);
153+ var touchX = shell.width - (shell.edgeSize / 2);
154−// var touchY = shell.height / 2;
154+ var touchY = shell.height / 2;
155−
155+
156−// var dash = findChild(shell, "dash");
156+ var dash = findChild(shell, "dash");
157−// // check that dash has normal scale and opacity
157+ // check that dash has normal scale and opacity
158−// tryCompare(dash, "contentScale", 1.0);
158+ tryCompare(dash, "contentScale", 1.0);
159−// tryCompare(dash, "opacity", 1.0);
159+ tryCompare(dash, "opacity", 1.0);
160−
160+
161−// touchFlick(shell, touchX, touchY, shell.width * 0.1, touchY,
161+ touchFlick(shell, touchX, touchY, shell.width * 0.1, touchY,
162−// true /* beginTouch */, false /* endTouch */);
162+ true /* beginTouch */, false /* endTouch */);
163−
163+
164−// // check that Dash has been scaled down and had its opacity reduced
164+ // check that Dash has been scaled down and had its opacity reduced
165−// tryCompareFunction(function() { return dash.contentScale <= 0.9; }, true);
165+ tryCompareFunction(function() { return dash.contentScale <= 0.9; }, true);
166−// tryCompareFunction(function() { return dash.opacity <= 0.5; }, true);
166+ tryCompareFunction(function() { return dash.opacity <= 0.5; }, true);
167−
167+
168−// touchRelease(shell, shell.width * 0.1, touchY);
168+ touchRelease(shell, shell.width * 0.1, touchY);
169−
169+
170−// // dash should have gone away, now that the app is on foreground
170+ // dash should have gone away, now that the app is on foreground
171−// tryCompare(dash, "visible", false);
171+ tryCompare(dash, "visible", false);
172−// }
172+ }
173−
173+
174−// // Wait for the whole UI to settle down
174+ // Wait for the whole UI to settle down
175−// function waitForUIToSettle() {
175+ function waitForUIToSettle() {
176−// waitUntilApplicationWindowIsFullyHidden();
176+ waitUntilApplicationWindowIsFullyHidden();
177−// var dashContentList = findChild(shell, "dashContentList");
177+ var dashContentList = findChild(shell, "dashContentList");
178−// tryCompare(dashContentList, "moving", false);
178+ tryCompare(dashContentList, "moving", false);
179−// }
179+ }
180−
180+
181−// function dragLauncherIntoView() {
181+ function dragLauncherIntoView() {
182−// var launcherPanel = findChild(shell, "launcherPanel");
182+ var launcherPanel = findChild(shell, "launcherPanel");
183−// verify(launcherPanel.x = - launcherPanel.width);
183+ verify(launcherPanel.x = - launcherPanel.width);
184−// swipeFromLeftEdge();
184+ swipeFromLeftEdge();
185−// tryCompare(launcherPanel, "x", 0);
185+ tryCompare(launcherPanel, "x", 0);
186−// }
186+ }
187−
187+
188−// function tapOnAppIconInLauncher() {
188+ function tapOnAppIconInLauncher() {
189−// var launcherPanel = findChild(shell, "launcherPanel");
189+ var launcherPanel = findChild(shell, "launcherPanel");
190−
190+
191−// // pick the first icon, the one at the bottom.
191+ // pick the first icon, the one at the bottom.
192−// var appIcon = findChild(launcherPanel, "launcherDelegate0")
192+ var appIcon = findChild(launcherPanel, "launcherDelegate0")
193−
193+
194−// // Swipe upwards over the launcher to ensure that this icon
194+ // Swipe upwards over the launcher to ensure that this icon
195−// // at the bottom is not folded and faded away.
195+ // at the bottom is not folded and faded away.
196−// var touchStartX = launcherPanel.width / 2;
196+ var touchStartX = launcherPanel.width / 2;
197−// var touchStartY = launcherPanel.height / 2;
197+ var touchStartY = launcherPanel.height / 2;
198−// touchFlick(launcherPanel, touchStartX, touchStartY, touchStartX, 0);
198+ touchFlick(launcherPanel, touchStartX, touchStartY, touchStartX, 0);
199−// tryCompare(launcherPanel, "moving", false);
199+ tryCompare(launcherPanel, "moving", false);
200−
200+
201−// // NB tapping (i.e., using touch events) doesn't activate the icon... go figure...
201+ // NB tapping (i.e., using touch events) doesn't activate the icon... go figure...
202−// mouseClick(appIcon, appIcon.width / 2, appIcon.height / 2);
202+ mouseClick(appIcon, appIcon.width / 2, appIcon.height / 2);
203−// }
203+ }
204−
204+
205−// function waitUntilApplicationWindowIsFullyVisible() {
205+ function waitUntilApplicationWindowIsFullyVisible() {
206−// var underlay = findChild(shell, "underlay");
206+ var underlay = findChild(shell, "underlay");
207−// tryCompare(underlay, "visible", false);
207+ tryCompare(underlay, "visible", false);
208−// }
208+ }
209−
209+
210−// function waitUntilApplicationWindowIsFullyHidden() {
210+ function waitUntilApplicationWindowIsFullyHidden() {
211−// var stages = findChild(shell, "stages");
211+ var stages = findChild(shell, "stages");
212−// tryCompare(stages, "fullyHidden", true);
212+ tryCompare(stages, "fullyHidden", true);
213−// }
213+ }
214−
214+
215−// function swipeUntilScopeViewIsReached(scopeView) {
215+ function swipeUntilScopeViewIsReached(scopeView) {
216−// while (!itemIsOnScreen(scopeView)) {
216+ while (!itemIsOnScreen(scopeView)) {
217−// if (itemIsToLeftOfScreen(scopeView)) {
217+ if (itemIsToLeftOfScreen(scopeView)) {
218−// swipeRightFromCenter();
218+ swipeRightFromCenter();
219−// } else {
219+ } else {
220−// swipeLeftFromCenter();
220+ swipeLeftFromCenter();
221−// }
221+ }
222−// waitUntilItemStopsMoving(scopeView);
222+ waitUntilItemStopsMoving(scopeView);
223−// }
223+ }
224−// }
224+ }
225−
225+
226−// function swipeFromLeftEdge() {
226+ function swipeFromLeftEdge() {
227−// var touchStartX = 2;
227+ var touchStartX = 2;
228−// var touchStartY = shell.height / 2;
228+ var touchStartY = shell.height / 2;
229−// touchFlick(shell, touchStartX, touchStartY, shell.width * 0.75, touchStartY);
229+ touchFlick(shell, touchStartX, touchStartY, shell.width * 0.75, touchStartY);
230−// }
230+ }
231−
231+
232−// function swipeLeftFromCenter() {
232+ function swipeLeftFromCenter() {
233−// var touchStartX = shell.width / 2;
233+ var touchStartX = shell.width / 2;
234−// var touchStartY = shell.height / 2;
234+ var touchStartY = shell.height / 2;
235−// touchFlick(shell, touchStartX, touchStartY, 0, touchStartY);
235+ touchFlick(shell, touchStartX, touchStartY, 0, touchStartY);
236−// }
236+ }
237−
237+
238−// function swipeRightFromCenter() {
238+ function swipeRightFromCenter() {
239−// var touchStartX = shell.width / 2;
239+ var touchStartX = shell.width / 2;
240−// var touchStartY = shell.height / 2;
240+ var touchStartY = shell.height / 2;
241−// touchFlick(shell, touchStartX, touchStartY, shell.width, touchStartY);
241+ touchFlick(shell, touchStartX, touchStartY, shell.width, touchStartY);
242−// }
242+ }
243−
243+
244−// function swipeUpFromCenter() {
244+ function swipeUpFromCenter() {
245−// var touchStartX = shell.width / 2;
245+ var touchStartX = shell.width / 2;
246−// var touchStartY = shell.height / 2;
246+ var touchStartY = shell.height / 2;
247−// touchFlick(shell, touchStartX, touchStartY, touchStartX, 0);
247+ touchFlick(shell, touchStartX, touchStartY, touchStartX, 0);
248−// }
248+ }
249−
249+
250−// function itemIsOnScreen(item) {
250+ function itemIsOnScreen(item) {
251−// var itemRectInShell = item.mapToItem(shell, 0, 0, item.width, item.height);
251+ var itemRectInShell = item.mapToItem(shell, 0, 0, item.width, item.height);
252−
252+
253−// return itemRectInShell.x >= 0
253+ return itemRectInShell.x >= 0
254−// && itemRectInShell.y >= 0
254+ && itemRectInShell.y >= 0
255−// && itemRectInShell.x + itemRectInShell.width <= shell.width
255+ && itemRectInShell.x + itemRectInShell.width <= shell.width
256−// && itemRectInShell.y + itemRectInShell.height <= shell.height;
256+ && itemRectInShell.y + itemRectInShell.height <= shell.height;
257−// }
257+ }
258−
258+
259−// function itemIsToLeftOfScreen(item) {
259+ function itemIsToLeftOfScreen(item) {
260−// var itemRectInShell = item.mapToItem(shell, 0, 0, item.width, item.height);
260+ var itemRectInShell = item.mapToItem(shell, 0, 0, item.width, item.height);
261−// return itemRectInShell.x < 0;
261+ return itemRectInShell.x < 0;
262−// }
262+ }
263−
263+
264−// function waitUntilItemStopsMoving(item) {
264+ function waitUntilItemStopsMoving(item) {
265−// var itemRectInShell = item.mapToItem(shell, 0, 0, item.width, item.height);
265+ var itemRectInShell = item.mapToItem(shell, 0, 0, item.width, item.height);
266−// var previousX = itemRectInShell.x;
266+ var previousX = itemRectInShell.x;
267−// var previousY = itemRectInShell.y;
267+ var previousY = itemRectInShell.y;
268−// var isStill = false;
268+ var isStill = false;
269−
269+
270−// do {
270+ do {
271−// wait(100);
271+ wait(100);
272−// itemRectInShell = item.mapToItem(shell, 0, 0, item.width, item.height);
272+ itemRectInShell = item.mapToItem(shell, 0, 0, item.width, item.height);
273−// if (itemRectInShell.x == previousX && itemRectInShell.y == previousY) {
273+ if (itemRectInShell.x == previousX && itemRectInShell.y == previousY) {
274−// isStill = true;
274+ isStill = true;
275−// } else {
275+ } else {
276−// previousX = itemRectInShell.x;
276+ previousX = itemRectInShell.x;
277−// previousY = itemRectInShell.y;
277+ previousY = itemRectInShell.y;
278−// }
278+ }
279−// } while (!isStill);
279+ } while (!isStill);
280−// }
280+ }
281
281
282 function test_wallpaper_data() {
282 function test_wallpaper_data() {
283 return [
283 return [
@@ -289,7 +289,6 @@ Item {
289 function test_wallpaper(data) {
289 function test_wallpaper(data) {
290 var backgroundImage = findChild(shell, "backgroundImage")
290 var backgroundImage = findChild(shell, "backgroundImage")
291 GSettingsController.setPictureUri(data.url)
291 GSettingsController.setPictureUri(data.url)
292− wait(1000)
293 tryCompareFunction(function() { return backgroundImage.source.toString().indexOf(data.url) !== -1; }, true)
292 tryCompareFunction(function() { return backgroundImage.source.toString().indexOf(data.url) !== -1; }, true)
294 tryCompare(backgroundImage, "status", Image.Ready)
293 tryCompare(backgroundImage, "status", Image.Ready)
295 }
294 }
@@ -297,9 +296,9 @@ Item {
297 function test_wallpaper_wrong() {
296 function test_wallpaper_wrong() {
298 var backgroundImage = findChild(shell, "backgroundImage")
297 var backgroundImage = findChild(shell, "backgroundImage")
299 GSettingsController.setPictureUri("wrong")
298 GSettingsController.setPictureUri("wrong")
300− wait(2000)
299+ tryCompare(backgroundImage, "status", Image.Error)
301− //tryCompareFunction(function() { return oldGSettingsBackground == backgroundSettings.pictureUri; }, true)
302−// tryCompareFunction(function() { return backgroundImage.source.toString().indexOf(data.url) !== -1; }, true)
300+ tryCompareFunction(function() { return backgroundImage.source.toString().indexOf(shell.defaultBackground) !== -1; }, true)
301+ tryCompare(backgroundImage, "status", Image.Ready)
303 }
302 }
304 }
303 }
305}
304}