@@ -1,125 +0,0 @@
2− * Copyright 2013 Canonical Ltd.
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
19−import "../../../Components"
22− name: "CrossFadeImage"
24− property alias status: crossFadeImage.status
25− property alias source: crossFadeImage.source
26− property alias crossFade: crossFadeImage.crossFade
27− property alias fadeInFirst: crossFadeImage.fadeInFirst
28− property alias running: crossFadeImage.running
36− target: crossFadeImage
39− function initTestFunction(argCrossFade, argFadeInFirst) {
41− crossFade = argCrossFade
42− fadeInFirst = argFadeInFirst
43− compare(status, Image.Null, "Could not reset CrossFadeImage")
46− function loadImage(url) {
47− console.log("Loading image...")
50− signalSpy.signalName = "statusChanged"
53− if (status == Image.Null) {
58− if (status == Image.Loading) {
63− compare(status, Image.Ready, "Image not ready")
64− console.log("Image loaded.")
67− function waitForAnimation() {
68− signalSpy.signalName = "runningChanged"
73− compare(running, true, "Animation did not start")
77− console.log("Waiting for animation to finish...")
79− compare(running, false, "Animation did not stop within 5 seconds.")
82− function cleanupTest() {
83− compare(running, false, "Animation is running after testcase")
84− compare(crossFadeImage.__nextImage.source, "", "nextimage source is not reset")
87− function test_fadeFirst() {
88− initTestFunction(true, true)
90− loadImage("../../../graphics/phone_background.jpg")
97− function test_no_fadeFirst() {
98− initTestFunction(true, false)
100− loadImage("../../../graphics/phone_background.jpg")
105− function test_crossFade() {
106− initTestFunction(true, false)
108− loadImage("../../../graphics/phone_background.jpg")
110− loadImage("../../../graphics/tablet_background.jpg")
112− // Due to the internal implementation, __currentImage and __nextImage are swapped before the animation starts
113− // Make sure z order reflects that too.
114− compare(crossFadeImage.__currentImage.z > crossFadeImage.__nextImage.z, true, "new image should be above old image")
115− compare(crossFadeImage.__currentImage.opacity < 0.5, true)
116− compare(crossFadeImage.__nextImage.opacity > 0.5, true)
120− compare(crossFadeImage.__currentImage.opacity > 0.5, true)
121− compare(crossFadeImage.__nextImage.opacity < 0.5, true)