Debian Codegraph @

tests/auto/qmltest-blacklist/item/tst_layerInPositioner.qml

raw
1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 Jolla Ltd, author: <[email protected]>
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.4
30 import QtTest 1.1
31
32 Item {
33 id: root;
34 width: 400
35 height: 400
36
37 TestCase {
38 id: testCase
39 name: "transparentForPositioner"
40 when: windowShown
41 function test_endresult() {
42 var image = grabImage(root);
43
44 // Row of red, green, blue and white box inside blue
45 // At 10,10, spanning 10x10 pixels each
46 verify(image.pixel(10, 10) == Qt.rgba(1, 0, 0, 1));
47 verify(image.pixel(20, 10) == Qt.rgba(0, 1, 0, 1));
48 verify(image.pixel(30, 10) == Qt.rgba(0, 0, 1, 1));
49
50 // Column of red, green, blue and white box inside blue
51 // At 10,30, spanning 10x10 pixels each
52 verify(image.pixel(10, 30) == Qt.rgba(1, 0, 0, 1));
53 verify(image.pixel(10, 40) == Qt.rgba(0, 1, 0, 1));
54 verify(image.pixel(10, 50) == Qt.rgba(0, 0, 1, 1));
55
56 // Flow of red, green, blue and white box inside blue
57 // At 30,30, spanning 10x10 pixels each, wrapping after two boxes
58 verify(image.pixel(30, 30) == Qt.rgba(1, 0, 0, 1));
59 verify(image.pixel(40, 30) == Qt.rgba(0, 1, 0, 1));
60 verify(image.pixel(30, 40) == Qt.rgba(0, 0, 1, 1));
61
62 // Flow of red, green, blue and white box inside blue
63 // At 100,10, spanning 10x10 pixels each, wrapping after two boxes
64 verify(image.pixel(60, 10) == Qt.rgba(1, 0, 0, 1));
65 verify(image.pixel(70, 10) == Qt.rgba(0, 1, 0, 1));
66 verify(image.pixel(60, 20) == Qt.rgba(0, 0, 1, 1));
67 }
68 }
69
70 Component {
71 id: greenPassThrough
72 ShaderEffect {
73 fragmentShader:
74 "
75 uniform lowp sampler2D source;
76 varying highp vec2 qt_TexCoord0;
77 void main() {
78 gl_FragColor = texture2D(source, qt_TexCoord0) * vec4(0, 1, 0, 1);
79 }
80 "
81 }
82 }
83
84 Row {
85 id: theRow
86 x: 10
87 y: 10
88 Rectangle {
89 width: 10
90 height: 10
91 color: "#ff0000"
92 layer.enabled: true
93 }
94
95 Rectangle {
96 width: 10
97 height: 10
98 color: "#ffffff"
99 layer.enabled: true
100 layer.effect: greenPassThrough
101 }
102
103 Rectangle {
104 id: blueInRow
105 width: 10
106 height: 10
107 color: "#0000ff"
108 }
109 }
110
111 Column {
112 id: theColumn
113 x: 10
114 y: 30
115 Rectangle {
116 width: 10
117 height: 10
118 color: "#ff0000"
119 layer.enabled: true
120 }
121
122 Rectangle {
123 width: 10
124 height: 10
125 color: "#ffffff"
126 layer.enabled: true
127 layer.effect: greenPassThrough
128 }
129
130 Rectangle {
131 id: blueInColumn
132 width: 10
133 height: 10
134 color: "#0000ff"
135 }
136 }
137
138 Flow {
139 id: theFlow
140 x: 30
141 y: 30
142 width: 20
143 Rectangle {
144 width: 10
145 height: 10
146 color: "#ff0000"
147 layer.enabled: true
148 }
149
150 Rectangle {
151 width: 10
152 height: 10
153 color: "#ffffff"
154 layer.enabled: true
155 layer.effect: greenPassThrough
156 }
157
158 Rectangle {
159 id: blueInFlow
160 width: 10
161 height: 10
162 color: "#0000ff"
163 }
164 }
165
166 Grid {
167 id: theGrid
168 x: 60
169 y: 10
170 columns: 2
171 Rectangle {
172 width: 10
173 height: 10
174 color: "#ff0000"
175 layer.enabled: true
176 }
177
178 Rectangle {
179 width: 10
180 height: 10
181 color: "#ffffff"
182 layer.enabled: true
183 layer.effect: greenPassThrough
184 }
185
186 Rectangle {
187 id: blueInGrid
188 width: 10
189 height: 10
190 color: "#0000ff"
191 }
192 }
193
194 }