1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: http://www.qt-project.org/
7 ** This file is part of the test suite of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
45 id: animatedimageelementtest
47 property string testtext: ""
50 id: animatedimageelementcontainer
51 height: 100; width: 100
52 anchors.centerIn: parent
53 AnimatedImage { id: animatedimageelement; anchors.fill: parent; source: "pics/cat.gif" }
54 Behavior on height { NumberAnimation { duration: 1000 } }
55 Behavior on width { NumberAnimation { duration: 1000 } }
58 SystemTestHelp { id: helpbubble; visible: statenum != 0
59 anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
61 BugPanel { id: bugpanel }
64 State { name: "start"; when: statenum == 1
65 PropertyChanges { target: animatedimageelementtest
66 testtext: "This is an AnimatedImage element. It should be small and showing an animated cat.\n"+
67 "Next, it should animatedly increase to twice its size" }
69 State { name: "large"; when: statenum == 2
70 PropertyChanges { target: animatedimageelementcontainer; height: 200; width: 150 }
71 PropertyChanges { target: animatedimageelementtest
72 testtext: "It should be large and still showing the cat, but slightly stretched.\n"+
73 "Next, let's change it to preserve its aspect ratio" }
75 State { name: "largefit"; when: statenum == 3
76 PropertyChanges { target: animatedimageelementcontainer; height: 200; width: 150 }
77 PropertyChanges { target: animatedimageelement; fillMode: Image.PreserveAspectFit }
78 PropertyChanges { target: animatedimageelementtest
79 testtext: "It should be large and now showing the cat normally (square).\n"+
80 "Next, it will change its aspect ratio to fit, but cropping the sides" }
82 State { name: "largecrop"; when: statenum == 4
83 PropertyChanges { target: animatedimageelementcontainer; height: 200; width: 150 }
84 PropertyChanges { target: animatedimageelement; fillMode: Image.PreserveAspectCrop }
85 PropertyChanges { target: animatedimageelementtest
86 testtext: "It should be large and now showing the cat with the sides removed.\n"+
87 "Next, let's change the image to tile the square" }
89 State { name: "largetile"; when: statenum == 5
90 PropertyChanges { target: animatedimageelementcontainer; height: 200; width: 150 }
91 PropertyChanges { target: animatedimageelement; fillMode: Image.Tile; }
92 PropertyChanges { target: animatedimageelementtest
93 testtext: "The image should be repeated both horizontally and vertically.\n"+
94 "Next, let's change the image to tile the square vertically" }
96 State { name: "largetilevertical"; when: statenum == 6
97 PropertyChanges { target: animatedimageelementcontainer; height: 200; width: 150 }
98 PropertyChanges { target: animatedimageelement; fillMode: Image.TileVertically; }
99 PropertyChanges { target: animatedimageelementtest
100 testtext: "The image should be repeated only vertically.\n"+
101 "Next, let's change the image to tile the square horizontally" }
103 State { name: "largetilehorizontal"; when: statenum == 7
104 PropertyChanges { target: animatedimageelementcontainer; height: 200; width: 150 }
105 PropertyChanges { target: animatedimageelement; fillMode: Image.TileHorizontally; }
106 PropertyChanges { target: animatedimageelementtest
107 testtext: "The image should be repeated only horizontally.\n"+
108 "The next step will return the image to a small, stretched state" }