aboutsummaryrefslogtreecommitdiffstats
path: root/tests/baseline/scenegraph/data/shape/shape_updatefill.qml
blob: 8e034c7676685183b96962f49c3d20a668ae5c10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
import QtQuick
import QtQuick.Shapes

Rectangle {
    width: 320
    height: 480
    color: "lightgray"

    ListModel {
        id: renderers
        ListElement { renderer: Shape.GeometryRenderer }
        ListElement { renderer: Shape.CurveRenderer }
    }

    LinearGradient {
        id: grad1
        x2: 60; y2: 60
        GradientStop { position: 0; color: "black" }
        GradientStop { position: 1; color: "red" }
    }

    ConicalGradient {
        id: grad2
        centerX: 15; centerY: 15
        GradientStop { position: 0; color: "yellow" }
        GradientStop { position: .5; color: "black" }
        GradientStop { position: 1; color: "yellow" }
    }

    Image {
        id: img1
        source: "../shared/world.png"
        visible: false
    }

    Image {
        id: img2
        source: "../shared/sample_1.png"
        visible: false
    }

    Row {
        padding: 10
        spacing: 20
        Repeater {
            model: renderers
            Shape {
                width: 140
                preferredRendererType: renderer

                ShapePath {
                    id: c1
                    strokeColor: "black"
                    fillColor: "cyan"
                    fillTransform: PlanarTransform.fromTranslate(rc1.x, rc1.y)

                    PathRectangle {
                        id: rc1
                        width: 60; height: 60
                    }
                }

                ShapePath {
                    id: c2
                    strokeColor: "black"
                    fillColor: "cyan"
                    fillTransform: PlanarTransform.fromTranslate(rc2.x, rc2.y)

                    PathRectangle {
                        id: rc2
                        x: 80
                        width: 60; height: 60
                    }
                }

                ShapePath {
                    id: g1
                    strokeColor: "black"
                    fillColor: "cyan"
                    fillTransform: PlanarTransform.fromTranslate(rg1.x, rg1.y)
                    fillGradient: grad1

                    PathRectangle {
                        id: rg1
                        y: 80
                        width: 60; height: 60
                    }
                }

                ShapePath {
                    id: t1
                    strokeColor: "black"
                    fillColor: "cyan"
                    fillItem: img1
                    fillTransform: PlanarTransform.fromTranslate(rt1.x, rt1.y)

                    PathRectangle {
                        id: rt1
                        x: 80; y: 80
                        width: 60; height: 60
                    }
                }

                ShapePath {
                    id: g2
                    strokeColor: "black"
                    fillColor: "cyan"
                    fillTransform: PlanarTransform.fromTranslate(rg2.x, rg2.y)
                    fillGradient: grad1

                    PathRectangle {
                        id: rg2
                        y: 2 * 80
                        width: 60; height: 60
                    }
                }

                ShapePath {
                    id: t2
                    strokeColor: "black"
                    fillColor: "cyan"
                    fillTransform: PlanarTransform.fromTranslate(rt2.x, rt2.y)
                    fillItem: img1

                    PathRectangle {
                        id: rt2
                        x: 80; y: 2 * 80
                        width: 60; height: 60
                    }
                }

                ShapePath {
                    id: g3
                    strokeColor: "black"
                    fillColor: "cyan"
                    fillTransform: PlanarTransform.fromTranslate(rg3.x, rg3.y)
                    fillGradient: grad1

                    PathRectangle {
                        id: rg3
                        y: 3 * 80
                        width: 60; height: 60
                    }
                }

                ShapePath {
                    id: t3
                    strokeColor: "black"
                    fillColor: "cyan"
                    fillTransform: PlanarTransform.fromTranslate(rt3.x, rt3.y)
                    fillItem: img1

                    PathRectangle {
                        id: rt3
                        x: 80; y: 3 * 80
                        width: 60; height: 60
                    }
                }

                ShapePath {
                    id: g4
                    strokeColor: "black"
                    fillColor: "cyan"
                    fillTransform: PlanarTransform.fromTranslate(rg4.x, rg4.y)
                    fillGradient: grad2

                    PathRectangle {
                        id: rg4
                        y: 4 * 80
                        width: 60; height: 60
                    }
                }

                ShapePath {
                    id: t4
                    strokeColor: "black"
                    fillColor: "cyan"
                    fillTransform: PlanarTransform.fromTranslate(rt4.x, rt4.y)
                    fillItem: img2

                    PathRectangle {
                        id: rt4
                        x: 80; y: 4 * 80
                        width: 60; height: 60
                    }
                }

                Timer {
                    running: true
                    interval: 150 // <200ms needed for scenegrabber; disable for manual testing
                    onTriggered: {
                        // Test all changes A->B, where A,B in {fillColor, fillGradient, fillItem}
                        // plus change of fillTransform

                        c1.fillGradient = grad1
                        g1.fillGradient = null
                        g2.fillGradient = null
                        g2.fillItem = img1
                        g3.fillGradient = grad2

                        c2.fillItem = img1
                        t1.fillItem = null
                        t2.fillGradient = grad1
                        t3.fillItem = img2

                        g4.fillTransform = g4.fillTransform.times(PlanarTransform.fromRotate(45, 30, 30))
                        t4.fillTransform = t4.fillTransform.times(PlanarTransform.fromRotate(45, 30, 30))
                    }
                }
            }
        }
    }
}