Merge lp:~mzanetti/unity8/drop-crossfadeimage into lp:unity8

Proposed by Michael Zanetti
Status: Merged
Approved by: Michał Sawicz
Approved revision: 337
Merged at revision: 343
Proposed branch: lp:~mzanetti/unity8/drop-crossfadeimage
Merge into: lp:unity8
Diff against target: 322 lines (+2/-278)
5 files modified
Components/CrossFadeImage.qml (+0/-151)
Greeter/GreeterContent.qml (+1/-1)
Shell.qml (+1/-0)
tests/qmltests/CMakeLists.txt (+0/-1)
tests/qmltests/Components/tst_CrossFadeImage.qml (+0/-125)
To merge this branch: bzr merge lp:~mzanetti/unity8/drop-crossfadeimage
Reviewer Review Type Date Requested Status
Michał Sawicz Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+187229@code.launchpad.net

Commit message

drop our CrossFadeImage in favor of the SDK one.

To post a comment you must log in.
337. By Michael Zanetti

debug--

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:337
http://jenkins.qa.ubuntu.com/job/unity8-ci/1096/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/3923
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/1501
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/1836
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/120
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1097
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1097/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1096
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/254
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-i386/3985
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-i386/3985/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/1503
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/1503/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/1271
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/1281

Click here to trigger a rebuild:
http://s-jenkins:8080/job/unity8-ci/1096/rebuild

review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Is the "fadeInFirst" removal expected? Does it not affect the visuals?

review: Needs Information
Revision history for this message
Michael Zanetti (mzanetti) wrote :

> Is the "fadeInFirst" removal expected? Does it not affect the visuals?

Not really used any more. the SDK component has it set to "false" which is what we want in Shell and Greeter. The only place where we needed it set to true was the dummy infographics pictures we don't use any more.

Actually I think it even fixes the weirdness we've seen in the Greeter autopilot tests ;)

Revision history for this message
Michał Sawicz (saviq) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'Components/CrossFadeImage.qml'
2--- Components/CrossFadeImage.qml 2013-08-12 16:11:20 +0000
3+++ Components/CrossFadeImage.qml 1970-01-01 00:00:00 +0000
4@@ -1,151 +0,0 @@
5-/*
6- * Copyright (C) 2013 Canonical, Ltd.
7- *
8- * This program is free software; you can redistribute it and/or modify
9- * it under the terms of the GNU General Public License as published by
10- * the Free Software Foundation; version 3.
11- *
12- * This program is distributed in the hope that it will be useful,
13- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15- * GNU General Public License for more details.
16- *
17- * You should have received a copy of the GNU General Public License
18- * along with this program. If not, see <http://www.gnu.org/licenses/>.
19- */
20-
21-import QtQuick 2.0
22-
23-Item {
24- property url source
25-
26- /*
27- * true: fade out old image in parallel with fading in the new one.
28- * false: fade in new image above old one.
29- *
30- * The reason why this is required is that crossfading has the isse that in
31- * the middle of the animation, both images are only 50% opaque which make
32- * any background shine through. Not wanted for background images etc, but
33- * wanted for overlays.
34- */
35- property bool crossFade: true
36-
37- /*
38- * true: the very first source url should be faded in already.
39- * false: the very first source url should just be shown without animation.
40- */
41- property bool fadeInFirst: true
42-
43- readonly property size sourceSize: __currentImage.sourceSize
44- readonly property var status: __currentImage ? __currentImage.status : Image.Null
45- readonly property bool running: crossFadeImages.running || nextImageFadeIn.running
46-
47- property Image __currentImage: image1
48- property Image __nextImage: image2
49-
50- function swapImages() {
51- __currentImage.z = 0
52- __nextImage.z = 1
53- if (crossFade) {
54- crossFadeImages.start();
55- } else {
56- nextImageFadeIn.start();
57- }
58-
59- var tmpImage = __currentImage
60- __currentImage = __nextImage
61- __nextImage = tmpImage
62- }
63-
64- onSourceChanged: {
65- // On creation, the souce handler is called before image pointers are set.
66- if (__currentImage === null) {
67- __currentImage = image1;
68- __nextImage = image2;
69- }
70-
71- crossFadeImages.stop();
72- nextImageFadeIn.stop();
73-
74- // Don't fade in initial picture, only fade changes
75- if (__currentImage.source == "" && !fadeInFirst) {
76- __currentImage.source = source;
77- } else {
78- nextImageFadeIn.stop();
79- __nextImage.opacity = 0.0;
80- __nextImage.source = source;
81-
82- // If case the image is still in QML's cache, status will be "Ready" immediately
83- if (__nextImage.status == Image.Ready || __nextImage.source == "") {
84- swapImages();
85- }
86- }
87- }
88-
89- Connections {
90- target: __nextImage
91- onStatusChanged: {
92- if (__nextImage.status == Image.Ready || __nextImage.status == Image.Error) {
93- swapImages();
94- }
95- }
96- }
97-
98- Image {
99- id: image1
100- anchors.fill: parent
101- cache: false
102- asynchronous: true
103- fillMode: Image.PreserveAspectCrop
104- z: 1
105- }
106-
107- Image {
108- id: image2
109- anchors.fill: parent
110- cache: false
111- asynchronous: true
112- fillMode: Image.PreserveAspectCrop
113- z: 0
114- }
115-
116- NumberAnimation {
117- id: nextImageFadeIn
118- target: __nextImage
119- property: "opacity"
120- duration: 400
121- to: 1.0
122- easing.type: Easing.InOutQuad
123-
124- onRunningChanged: {
125- if (!running) {
126- __nextImage.source = "";
127- }
128- }
129- }
130-
131- ParallelAnimation {
132- id: crossFadeImages
133- NumberAnimation {
134- target: __nextImage
135- property: "opacity"
136- duration: 400
137- to: 1.0
138- easing.type: Easing.InOutQuad
139- }
140-
141- NumberAnimation {
142- target: __currentImage
143- property: "opacity"
144- duration: 400
145- to: 0
146- easing.type: Easing.InOutQuad
147- }
148-
149- onRunningChanged: {
150- if (!running) {
151- __nextImage.source = "";
152- }
153- }
154- }
155-}
156
157=== modified file 'Greeter/GreeterContent.qml'
158--- Greeter/GreeterContent.qml 2013-09-13 15:17:02 +0000
159+++ Greeter/GreeterContent.qml 2013-09-24 13:03:23 +0000
160@@ -47,7 +47,7 @@
161 id: wallpaper
162 objectName: "wallpaper"
163 anchors.fill: parent
164- fadeInFirst: false
165+ fillMode: Image.PreserveAspectCrop
166 }
167
168 // See Shell.qml's backgroundSettings treatment for why we need a separate
169
170=== modified file 'Shell.qml'
171--- Shell.qml 2013-09-18 19:03:14 +0000
172+++ Shell.qml 2013-09-24 13:03:23 +0000
173@@ -198,6 +198,7 @@
174
175 anchors.fill: parent
176 source: shell.background
177+ fillMode: Image.PreserveAspectCrop
178 }
179
180 Rectangle {
181
182=== modified file 'tests/qmltests/CMakeLists.txt'
183--- tests/qmltests/CMakeLists.txt 2013-09-09 14:34:15 +0000
184+++ tests/qmltests/CMakeLists.txt 2013-09-24 13:03:23 +0000
185@@ -13,7 +13,6 @@
186 set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal")
187 add_qml_test(Components AnimationControllerWithSignals)
188 add_qml_test(Components Carousel)
189-add_qml_test(Components CrossFadeImage)
190 add_qml_test(Components MathLocal)
191 add_qml_test(Components OpenEffect)
192 add_qml_test(Components RatingStars)
193
194=== removed file 'tests/qmltests/Components/tst_CrossFadeImage.qml'
195--- tests/qmltests/Components/tst_CrossFadeImage.qml 2013-06-05 22:03:08 +0000
196+++ tests/qmltests/Components/tst_CrossFadeImage.qml 1970-01-01 00:00:00 +0000
197@@ -1,125 +0,0 @@
198-/*
199- * Copyright 2013 Canonical Ltd.
200- *
201- * This program is free software; you can redistribute it and/or modify
202- * it under the terms of the GNU General Public License as published by
203- * the Free Software Foundation; version 3.
204- *
205- * This program is distributed in the hope that it will be useful,
206- * but WITHOUT ANY WARRANTY; without even the implied warranty of
207- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
208- * GNU General Public License for more details.
209- *
210- * You should have received a copy of the GNU General Public License
211- * along with this program. If not, see <http://www.gnu.org/licenses/>.
212- */
213-
214-import QtQuick 2.0
215-import QtTest 1.0
216-import "../../../Components"
217-
218-TestCase {
219- name: "CrossFadeImage"
220-
221- property alias status: crossFadeImage.status
222- property alias source: crossFadeImage.source
223- property alias crossFade: crossFadeImage.crossFade
224- property alias fadeInFirst: crossFadeImage.fadeInFirst
225- property alias running: crossFadeImage.running
226-
227- CrossFadeImage {
228- id: crossFadeImage
229- }
230-
231- SignalSpy {
232- id: signalSpy
233- target: crossFadeImage
234- }
235-
236- function initTestFunction(argCrossFade, argFadeInFirst) {
237- source = ""
238- crossFade = argCrossFade
239- fadeInFirst = argFadeInFirst
240- compare(status, Image.Null, "Could not reset CrossFadeImage")
241- }
242-
243- function loadImage(url) {
244- console.log("Loading image...")
245- source = url
246-
247- signalSpy.signalName = "statusChanged"
248- signalSpy.wait()
249-
250- if (status == Image.Null) {
251- signalSpy.clear()
252- signalSpy.wait()
253- }
254-
255- if (status == Image.Loading) {
256- signalSpy.clear()
257- signalSpy.wait()
258- }
259-
260- compare(status, Image.Ready, "Image not ready")
261- console.log("Image loaded.")
262- }
263-
264- function waitForAnimation() {
265- signalSpy.signalName = "runningChanged"
266-
267- if (!running) {
268- signalSpy.clear()
269- signalSpy.wait()
270- compare(running, true, "Animation did not start")
271- }
272-
273- signalSpy.clear()
274- console.log("Waiting for animation to finish...")
275- signalSpy.wait()
276- compare(running, false, "Animation did not stop within 5 seconds.")
277- }
278-
279- function cleanupTest() {
280- compare(running, false, "Animation is running after testcase")
281- compare(crossFadeImage.__nextImage.source, "", "nextimage source is not reset")
282- }
283-
284- function test_fadeFirst() {
285- initTestFunction(true, true)
286-
287- loadImage("../../../graphics/phone_background.jpg")
288-
289- waitForAnimation()
290-
291- cleanupTest()
292- }
293-
294- function test_no_fadeFirst() {
295- initTestFunction(true, false)
296-
297- loadImage("../../../graphics/phone_background.jpg")
298-
299- cleanupTest()
300- }
301-
302- function test_crossFade() {
303- initTestFunction(true, false)
304-
305- loadImage("../../../graphics/phone_background.jpg")
306-
307- loadImage("../../../graphics/tablet_background.jpg")
308-
309- // Due to the internal implementation, __currentImage and __nextImage are swapped before the animation starts
310- // Make sure z order reflects that too.
311- compare(crossFadeImage.__currentImage.z > crossFadeImage.__nextImage.z, true, "new image should be above old image")
312- compare(crossFadeImage.__currentImage.opacity < 0.5, true)
313- compare(crossFadeImage.__nextImage.opacity > 0.5, true)
314-
315- waitForAnimation()
316-
317- compare(crossFadeImage.__currentImage.opacity > 0.5, true)
318- compare(crossFadeImage.__nextImage.opacity < 0.5, true)
319-
320- cleanupTest()
321- }
322-}

Subscribers

People subscribed via source and target branches