on xenial help sign in
More mistakes
commit66f01ad25f2df6556fc0c7923c204f7147f204f7 authorAndrea Cimitan <andrea.cimitan@canonical.com> dateMon 12 Aug 2013, 13:51 (13 years ago) parente8d32a0
3 files changed+28−51
Components/CrossFadeImage.qml+2−5 Shell.qml+7−20 tests/qmltests/tst_Shell.qml+19−26
Components/CrossFadeImage.qml+2−5
@@ -43,8 +43,6 @@ Item {
4343 property Image __currentImage: image1
4444 property Image __nextImage: image2
4545
46− signal swapped
47−
4846 function swapImages() {
4947 __currentImage.z = 0
5048 __nextImage.z = 1
@@ -57,12 +55,10 @@ Item {
5755 var tmpImage = __currentImage
5856 __currentImage = __nextImage
5957 __nextImage = tmpImage
60− console.log("swapped here")
61− swapped()
6258 }
63− onSwapped: console.log("swapped component signal")
6459
6560 onSourceChanged: {
61+ console.log("here")
6662 // On creation, the souce handler is called before image pointers are set.
6763 if (__currentImage === null) {
6864 __currentImage = image1;
@@ -83,6 +79,7 @@ Item {
8379 // If case the image is still in QML's cache, status will be "Ready" immediately
8480 if (__nextImage.status == Image.Ready || __nextImage.source == "") {
8581 swapImages();
82+
8683 }
8784 }
8885 }
Shell.qml+7−20
@@ -119,6 +119,8 @@ FocusScope {
119119 GSettings {
120120 id: backgroundSettings
121121 schema.id: "org.gnome.desktop.background"
122+
123+ onPictureUriChanged: backgroundImage.source = pictureUri
122124 }
123125
124126 VolumeControl {
@@ -149,28 +151,13 @@ FocusScope {
149151 id: backgroundImage
150152 objectName: "backgroundImage"
151153
152− property url oldWorkingBackground: shell.defaultBackground
153−
154− source: shell.background
155154 anchors.fill: parent
156− onSwapped: {
157− console.log("swapped")
158−// if (status == Image.Ready) {
159−// console.log("hhhhhhhhhhhhhhhhhhhhhhh", source)
160−// oldWorkingBackground = source
161−// }
162− }
163155
164−// onStatusChanged: {
165−// if (status == Image.Error) {
166−// GSettingsController.setPictureUri(oldWorkingBackground)
167−// console.log("pic",backgroundSettings.pictureUri.toString(), oldWorkingBackground.toString())
168−// //backgroundSettings.pictureUri = oldWorkingBackground
169−// } else {
170−// console.log("XXXXXXXXXX else",status, source.toString(), oldWorkingBackground.toString())
171−// oldWorkingBackground = source
172−// }
173−// }
156+ onStatusChanged: {
157+ if (status == Image.Error && source != defaultBackground) {
158+ source = defaultBackground
159+ }
160+ }
174161 }
175162
176163 Rectangle {
tests/qmltests/tst_Shell.qml+19−26
@@ -49,35 +49,30 @@ Item {
4949 id: shell
5050 }
5151
52− GSettings {
53− id: backgroundSettings
54− schema.id: "org.gnome.desktop.background"
55− }
56−
5752 UT.UnityTestCase {
5853 name: "Shell"
5954 when: windowShown
6055
61−// function initTestCase() {
62−// // swipe away the greeter/lockscreen
63−// var touchX = shell.width - (shell.edgeSize / 2);
64−// var touchY = shell.height / 2;
65−// touchFlick(shell, touchX, touchY, shell.width * 0.1, touchY);
56+ function initTestCase() {
57+ // swipe away the greeter/lockscreen
58+ var touchX = shell.width - (shell.edgeSize / 2);
59+ var touchY = shell.height / 2;
60+ touchFlick(shell, touchX, touchY, shell.width * 0.1, touchY);
6661
67−// var dash = findChild(shell, "dash");
68−// // wait until the animation has finished
69−// tryCompare(dash, "contentScale", 1.0);
70−// tryCompare(dash, "opacity", 1.0);
71−// }
62+ var dash = findChild(shell, "dash");
63+ // wait until the animation has finished
64+ tryCompare(dash, "contentScale", 1.0);
65+ tryCompare(dash, "opacity", 1.0);
66+ }
7267
73−// function cleanup() {
74−// // kill all (fake) running apps
75−// ApplicationManager.mainStageApplications.clear();
76−// ApplicationManager.sideStageApplications.clear();
68+ function cleanup() {
69+ // kill all (fake) running apps
70+ ApplicationManager.mainStageApplications.clear();
71+ ApplicationManager.sideStageApplications.clear();
7772
78−// var dashHome = findChild(shell, "DashHome");
79−// swipeUntilScopeViewIsReached(dashHome);
80−// }
73+ var dashHome = findChild(shell, "DashHome");
74+ swipeUntilScopeViewIsReached(dashHome);
75+ }
8176
8277// /*
8378// Test the effect of a right-edge drag on the dash in 3 situations:
@@ -294,17 +289,15 @@ Item {
294289 function test_wallpaper(data) {
295290 var backgroundImage = findChild(shell, "backgroundImage")
296291 GSettingsController.setPictureUri(data.url)
292+ wait(1000)
297293 tryCompareFunction(function() { return backgroundImage.source.toString().indexOf(data.url) !== -1; }, true)
298294 tryCompare(backgroundImage, "status", Image.Ready)
299295 }
300296
301297 function test_wallpaper_wrong() {
302298 var backgroundImage = findChild(shell, "backgroundImage")
303− var oldGSettingsBackground = backgroundSettings.pictureUri
304− var oldShellBackground = shell.background
305− wait(2000)
306299 GSettingsController.setPictureUri("wrong")
307− console.log("WRONG ", oldGSettingsBackground, backgroundSettings.pictureUri)
300+ wait(2000)
308301 //tryCompareFunction(function() { return oldGSettingsBackground == backgroundSettings.pictureUri; }, true)
309302// tryCompareFunction(function() { return backgroundImage.source.toString().indexOf(data.url) !== -1; }, true)
310303 }