Debian Codegraph @

tests/auto/qmltest-blacklist/animators/tst_transformorigin.qml

raw
1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the test suite of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21 ** included in the packaging of this file. Please review the following
22 ** information to ensure the GNU General Public License requirements will
23 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24 **
25 ** $QT_END_LICENSE$
26 **
27 ****************************************************************************/
28
29 import QtQuick 2.2
30 import QtTest 1.1
31
32 Item {
33 id: root;
34 width: 300
35 height: 300
36
37 Timer {
38 id: timer;
39 running: testCase.windowShown
40 interval: 1000
41 repeat: false
42 onTriggered: triggered = true;
43 property bool triggered: false;
44 }
45
46 TestCase {
47 id: testCase
48 name: "animators-transformorigin"
49 when: timer.triggered
50 function test_endresult() {
51
52 var image = grabImage(root);
53
54 var white = Qt.rgba(1, 1, 1);
55 var blue = Qt.rgba(0, 0, 1);
56
57
58 // topleft
59 verify(image.pixel(40, 40) == white);
60 verify(image.pixel(60, 40) == white);
61 verify(image.pixel(40, 60) == white);
62 verify(image.pixel(60, 60) == blue);
63
64 // top
65 verify(image.pixel(140, 40) == white);
66 verify(image.pixel(160, 40) == white);
67 verify(image.pixel(140, 60) == blue);
68 verify(image.pixel(160, 60) == blue);
69
70 // topright
71 verify(image.pixel(240, 40) == white);
72 verify(image.pixel(260, 40) == white);
73 verify(image.pixel(240, 60) == blue);
74 verify(image.pixel(260, 60) == white);
75
76
77 // left
78 verify(image.pixel(40, 140) == white);
79 verify(image.pixel(60, 140) == blue);
80 verify(image.pixel(40, 160) == white);
81 verify(image.pixel(60, 160) == blue);
82
83 // center
84 verify(image.pixel(140, 140) == blue);
85 verify(image.pixel(160, 140) == blue);
86 verify(image.pixel(140, 160) == blue);
87 verify(image.pixel(160, 160) == blue);
88
89 // right
90 verify(image.pixel(240, 140) == blue);
91 verify(image.pixel(260, 140) == white);
92 verify(image.pixel(240, 160) == blue);
93 verify(image.pixel(260, 160) == white);
94
95
96 // bottomleft
97 verify(image.pixel(40, 240) == white);
98 verify(image.pixel(60, 240) == blue);
99 verify(image.pixel(40, 260) == white);
100 verify(image.pixel(60, 260) == white);
101
102 // bottom
103 verify(image.pixel(140, 240) == blue);
104 verify(image.pixel(160, 240) == blue);
105 verify(image.pixel(140, 260) == white);
106 verify(image.pixel(160, 260) == white);
107
108 // bottomright
109 verify(image.pixel(240, 240) == blue);
110 verify(image.pixel(260, 240) == white);
111 verify(image.pixel(240, 260) == white);
112 verify(image.pixel(260, 260) == white);
113
114 }
115 }
116
117 property var origins: [Item.TopLeft, Item.Top, Item.TopRight,
118 Item.Left, Item.Center, Item.Right,
119 Item.BottomLeft, Item.Bottom, Item.BottomRight];
120
121 Grid {
122 anchors.fill: parent
123 rows: 3
124 columns: 3
125
126 Repeater {
127 model: 9
128 Item {
129 width: 100
130 height: 100
131 Rectangle {
132 id: box
133 color: "blue"
134 anchors.centerIn: parent
135 width: 10
136 height: 10
137 antialiasing: true;
138
139 transformOrigin: root.origins[index];
140
141 ScaleAnimator { target: box; from: 1; to: 5.5; duration: 100; running: true; }
142 }
143 }
144 }
145 }
146
147 }