Debian Codegraph @

samples/tests/spec/scripting/suspendRedraw.svg

raw
1 <?xml version="1.0" standalone="no"?>
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN"
3 "http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd">
4
5 <!--
6
7 Licensed to the Apache Software Foundation (ASF) under one or more
8 contributor license agreements. See the NOTICE file distributed with
9 this work for additional information regarding copyright ownership.
10 The ASF licenses this file to You under the Apache License, Version 2.0
11 (the "License"); you may not use this file except in compliance with
12 the License. You may obtain a copy of the License at
13
14 http://www.apache.org/licenses/LICENSE-2.0
15
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
21
22 -->
23 <!-- ====================================================================== -->
24 <!-- Modification of a rect's x,y,width and height attributes in an -->
25 <!-- 'onclick' event handler. This is actually mostly testing a change in -->
26 <!-- the documents size. -->
27 <!-- -->
28 <!-- @author [email protected] -->
29 <!-- @version $Id$ -->
30 <!-- ========================================================================= -->
31 <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
32 <svg id="body" width="450" height="500" viewBox="0 0 450 500">
33 <title>&lt;rect&gt; fill modification with redraw suspended.</title>
34
35 <script type="text/ecmascript">
36 var root = document.rootElement;
37
38 function setRect(target, color){
39 var t = document.getElementById(target);
40 t.setAttributeNS(null, "fill", color);
41 }
42
43 var suspendId;
44 function testSuspend(target, time) {
45 suspendId = root.suspendRedraw(time);
46 setRect(target, "crimson");
47 }
48
49 function testUnsuspendRedrawId(target, time) {
50 suspendId = root.suspendRedraw(time);
51 setRect(target, "crimson");
52 setTimeout("doUnsuspend(" + suspendId + ")",(time/2));
53 }
54
55 function testUnsuspendRedrawAll(target, time) {
56 suspendId = root.suspendRedraw(time);
57 setRect(target, "crimson");
58 setTimeout("doUnsuspendAll()",(time/2));
59 }
60
61 function testMulti(target, t1, t2) {
62 root.suspendRedraw(t1);
63 setRect(target, "crimson");
64 root.suspendRedraw(t2);
65 }
66
67 function testMultiIdFirst(target, t1, t2) {
68 suspendId = root.suspendRedraw(t1);
69 setRect(target, "crimson");
70 root.suspendRedraw(t2);
71
72 setTimeout("doUnsuspend(" + suspendId + ")",(t1/2));
73 }
74
75 function testMultiIdSecond(target, t1, t2) {
76 root.suspendRedraw(t1);
77 setRect(target, "crimson");
78 suspendId = root.suspendRedraw(t2);
79 setTimeout("doUnsuspend(" + suspendId + ")",(t2/2));
80 }
81
82 function testMultiIdBoth(target, t1, t2) {
83 suspendId = root.suspendRedraw(t1);
84 setTimeout("doUnsuspend(" + suspendId + ")",(t1/2));
85
86 setRect(target, "crimson");
87
88 suspendId = root.suspendRedraw(t2);
89 setTimeout("doUnsuspend(" + suspendId + ")",(t2/2));
90 }
91
92 function testMultiAll(target, t1, t2) {
93 suspendId = root.suspendRedraw(t1);
94 setRect(target, "crimson");
95 suspendId = root.suspendRedraw(t2);
96 setTimeout("doUnsuspendAll()",(t2/2));
97 }
98
99 function doUnsuspend(id) {
100 root.unsuspendRedraw(0+id);
101 }
102
103 function doUnsuspendAll() {
104 root.unsuspendRedrawAll();
105 }
106
107
108 </script>
109
110 <text x="50%" y="40" class="title"
111 >&lt;rect&gt; fill modification with redraw suspended.</text>
112
113
114 <g id="test-content" font-size="10">
115 <rect id="rect.t1" fill="gold" x="10" y="50" width="80" height="40"
116 onclick="testSuspend('rect.t1', 2000)"/>
117
118 <rect id="rect.t2" fill="gold" x="235" y="50" width="80" height="40"
119 onclick="testUnsuspendRedrawId('rect.t2', 4000)"/>
120
121 <rect id="rect.t3" fill="gold" x="235" y="100" width="80" height="40"
122 onclick="testUnsuspendRedrawAll('rect.t3', 4000)"/>
123
124 <text x="100" y="70">suspendRedraw(2000)</text>
125
126 <text x="320" y="70">unsuspendRedraw(id) @2s</text>
127
128 <text x="320" y="120">unsuspendRedrawAll() @2s</text>
129
130
131
132 <rect id="rect.t4" fill="gold" x="10" y="170" width="80" height="40"
133 onclick="testMulti('rect.t4', 1000, 2000)"/>
134
135 <rect id="rect.t5" fill="gold" x="10" y="220" width="80" height="40"
136 onclick="testMultiAll('rect.t5', 3000, 4000)"/>
137
138 <rect id="rect.t61" fill="gold" x="235" y="170" width="80" height="40"
139 onclick="testMultiIdBoth('rect.t61', 2000, 4000)"/>
140
141 <rect id="rect.t62" fill="gold" x="235" y="220" width="80" height="40"
142 onclick="testMultiIdBoth('rect.t62', 4000, 2000)"/>
143
144 <text x="100" y="187">suspendRedraw 1000, 2000</text>
145
146 <text x="100" y="237">suspendRedraw 3000, 4000
147 <tspan x="100" y="249">unsuspendAll @2s</tspan></text>
148
149 <text x="320" y="183">suspendRedraw 2000, 4000
150 <tspan x="320" y="193">unsuspend 1st @1s</tspan>
151 <tspan x="320" y="203">unsuspend 2nd @2s</tspan></text>
152
153 <text x="320" y="233">suspendRedraw 4000, 2000
154 <tspan x="320" y="243">unsuspend 1st @2s</tspan>
155 <tspan x="320" y="253">unsuspend 2nd @1s</tspan></text>
156
157 <rect id="rect.t7" fill="gold" x="10" y="290" width="80" height="40"
158 onclick="testMultiIdFirst('rect.t7', 1000, 2000)"/>
159
160 <rect id="rect.t8" fill="gold" x="10" y="340" width="80" height="40"
161 onclick="testMultiIdFirst('rect.t8', 3000, 2000)"/>
162
163 <rect id="rect.t9" fill="gold" x="10" y="390" width="80" height="40"
164 onclick="testMultiIdFirst('rect.t9', 4000, 1000)"/>
165
166 <text x="100" y="307">suspendRedraw 1000, 2000
167 <tspan x="100" y="319">unsuspend 1st @ .5s</tspan></text>
168
169 <text x="100" y="357">suspendRedraw 3000, 2000
170 <tspan x="100" y="369">unsuspend 1st @ 1.5s</tspan></text>
171
172 <text x="100" y="407">suspendRedraw 4000, 1000
173 <tspan x="100" y="419">unsuspend 1st @ 2s</tspan></text>
174
175 <rect id="rect.t10" fill="gold" x="235" y="290" width="80" height="40"
176 onclick="testMultiIdSecond('rect.t10', 2000, 1000)"/>
177
178 <rect id="rect.t11" fill="gold" x="235" y="340" width="80" height="40"
179 onclick="testMultiIdSecond('rect.t11', 2000, 3000)"/>
180
181 <rect id="rect.t12" fill="gold" x="235" y="390" width="80" height="40"
182 onclick="testMultiIdSecond('rect.t12', 1000, 4000)"/>
183
184 <text x="320" y="307">suspendRedraw 2000, 1000
185 <tspan x="320" y="319">unsuspend 2nd @ .5s</tspan></text>
186
187 <text x="320" y="357">suspendRedraw 2000, 3000
188 <tspan x="320" y="369">unsuspend 2nd @ 1.5s</tspan></text>
189
190 <text x="320" y="407">suspendRedraw 1000, 4000
191 <tspan x="320" y="419">unsuspend 2nd @ 2s</tspan></text>
192
193 <text class="legend">
194 <tspan x="225" y="460">Click on the Rectangles one at a time.</tspan>
195 <tspan x="225" y="470">The rectangles should change color ~2sec after you click</tspan>
196 </text>
197 -->
198 </g>
199 </svg>