on xenial help sign in
More mistakes
66f01adAndrea Cimitan
Components/CrossFadeImage.qml+2−5
@@ -43,8 +43,6 @@ Item {
43 property Image __currentImage: image1
43 property Image __currentImage: image1
44 property Image __nextImage: image2
44 property Image __nextImage: image2
45
45
46− signal swapped
47−
48 function swapImages() {
46 function swapImages() {
49 __currentImage.z = 0
47 __currentImage.z = 0
50 __nextImage.z = 1
48 __nextImage.z = 1
@@ -57,12 +55,10 @@ Item {
57 var tmpImage = __currentImage
55 var tmpImage = __currentImage
58 __currentImage = __nextImage
56 __currentImage = __nextImage
59 __nextImage = tmpImage
57 __nextImage = tmpImage
60− console.log("swapped here")
61− swapped()
62 }
58 }
63− onSwapped: console.log("swapped component signal")
64
59
65 onSourceChanged: {
60 onSourceChanged: {
61+ console.log("here")
66 // On creation, the souce handler is called before image pointers are set.
62 // On creation, the souce handler is called before image pointers are set.
67 if (__currentImage === null) {
63 if (__currentImage === null) {
68 __currentImage = image1;
64 __currentImage = image1;
@@ -83,6 +79,7 @@ Item {
83 // If case the image is still in QML's cache, status will be "Ready" immediately
79 // If case the image is still in QML's cache, status will be "Ready" immediately
84 if (__nextImage.status == Image.Ready || __nextImage.source == "") {
80 if (__nextImage.status == Image.Ready || __nextImage.source == "") {
85 swapImages();
81 swapImages();
82+
86 }
83 }
87 }
84 }
88 }
85 }
Shell.qml+7−20
@@ -119,6 +119,8 @@ FocusScope {
119 GSettings {
119 GSettings {
120 id: backgroundSettings
120 id: backgroundSettings
121 schema.id: "org.gnome.desktop.background"
121 schema.id: "org.gnome.desktop.background"
122+
123+ onPictureUriChanged: backgroundImage.source = pictureUri
122 }
124 }
123
125
124 VolumeControl {
126 VolumeControl {
@@ -149,28 +151,13 @@ FocusScope {
149 id: backgroundImage
151 id: backgroundImage
150 objectName: "backgroundImage"
152 objectName: "backgroundImage"
151
153
152− property url oldWorkingBackground: shell.defaultBackground
153−
154− source: shell.background
155 anchors.fill: parent
154 anchors.fill: parent
156− onSwapped: {
157− console.log("swapped")
158−// if (status == Image.Ready) {
159−// console.log("hhhhhhhhhhhhhhhhhhhhhhh", source)
160−// oldWorkingBackground = source
161−// }
162− }
163
155
164−// onStatusChanged: {
156+ onStatusChanged: {
165−// if (status == Image.Error) {
157+ if (status == Image.Error && source != defaultBackground) {
166−// GSettingsController.setPictureUri(oldWorkingBackground)
158+ source = defaultBackground
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−// }
159+ }
173−// }
160+ }
174 }
161 }
175
162
176 Rectangle {
163 Rectangle {
tests/qmltests/tst_Shell.qml+19−26
@@ -49,35 +49,30 @@ Item {
49 id: shell
49 id: shell
50 }
50 }
51
51
52− GSettings {
53− id: backgroundSettings
54− schema.id: "org.gnome.desktop.background"
55− }
56−
57 UT.UnityTestCase {
52 UT.UnityTestCase {
58 name: "Shell"
53 name: "Shell"
59 when: windowShown
54 when: windowShown
60
55
61−// function initTestCase() {
56+ function initTestCase() {
62−// // swipe away the greeter/lockscreen
57+ // swipe away the greeter/lockscreen
63−// var touchX = shell.width - (shell.edgeSize / 2);
58+ var touchX = shell.width - (shell.edgeSize / 2);
64−// var touchY = shell.height / 2;
59+ var touchY = shell.height / 2;
65−// touchFlick(shell, touchX, touchY, shell.width * 0.1, touchY);
60+ touchFlick(shell, touchX, touchY, shell.width * 0.1, touchY);
66
61
67−// var dash = findChild(shell, "dash");
62+ var dash = findChild(shell, "dash");
68−// // wait until the animation has finished
63+ // wait until the animation has finished
69−// tryCompare(dash, "contentScale", 1.0);
64+ tryCompare(dash, "contentScale", 1.0);
70−// tryCompare(dash, "opacity", 1.0);
65+ tryCompare(dash, "opacity", 1.0);
71−// }
66+ }
72
67
73−// function cleanup() {
68+ function cleanup() {
74−// // kill all (fake) running apps
69+ // kill all (fake) running apps
75−// ApplicationManager.mainStageApplications.clear();
70+ ApplicationManager.mainStageApplications.clear();
76−// ApplicationManager.sideStageApplications.clear();
71+ ApplicationManager.sideStageApplications.clear();
77
72
78−// var dashHome = findChild(shell, "DashHome");
73+ var dashHome = findChild(shell, "DashHome");
79−// swipeUntilScopeViewIsReached(dashHome);
74+ swipeUntilScopeViewIsReached(dashHome);
80−// }
75+ }
81
76
82// /*
77// /*
83// 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:
@@ -294,17 +289,15 @@ Item {
294 function test_wallpaper(data) {
289 function test_wallpaper(data) {
295 var backgroundImage = findChild(shell, "backgroundImage")
290 var backgroundImage = findChild(shell, "backgroundImage")
296 GSettingsController.setPictureUri(data.url)
291 GSettingsController.setPictureUri(data.url)
292+ wait(1000)
297 tryCompareFunction(function() { return backgroundImage.source.toString().indexOf(data.url) !== -1; }, true)
293 tryCompareFunction(function() { return backgroundImage.source.toString().indexOf(data.url) !== -1; }, true)
298 tryCompare(backgroundImage, "status", Image.Ready)
294 tryCompare(backgroundImage, "status", Image.Ready)
299 }
295 }
300
296
301 function test_wallpaper_wrong() {
297 function test_wallpaper_wrong() {
302 var backgroundImage = findChild(shell, "backgroundImage")
298 var backgroundImage = findChild(shell, "backgroundImage")
303− var oldGSettingsBackground = backgroundSettings.pictureUri
304− var oldShellBackground = shell.background
305− wait(2000)
306 GSettingsController.setPictureUri("wrong")
299 GSettingsController.setPictureUri("wrong")
307− console.log("WRONG ", oldGSettingsBackground, backgroundSettings.pictureUri)
300+ wait(2000)
308 //tryCompareFunction(function() { return oldGSettingsBackground == backgroundSettings.pictureUri; }, true)
301 //tryCompareFunction(function() { return oldGSettingsBackground == backgroundSettings.pictureUri; }, true)
309// tryCompareFunction(function() { return backgroundImage.source.toString().indexOf(data.url) !== -1; }, true)
302// tryCompareFunction(function() { return backgroundImage.source.toString().indexOf(data.url) !== -1; }, true)
310 }
303 }