Bug 616542 - Shorten file path length of mochitest; r=ted
[gecko.git] / content / svg / content / test / test_dataTypes.html
blob75930af3020bf618bba21b0954bb1959853e616e
1 <!DOCTYPE html>
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=437448
5 -->
6 <head>
7 <title>Test for Bug 437448</title>
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
10 </head>
11 <body>
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=437448">Mozilla Bug 437448</a>
13 <p id="display"></p>
14 <div id="content" style="display: none"></div>
16 <iframe id="svg" src="dataTypes-helper.svg"></iframe>
18 <pre id="test">
19 <script class="testbody" type="application/javascript">
20 SimpleTest.waitForExplicitFinish();
22 function runTests()
24 var doc = $("svg").contentWindow.document;
25 var filter = doc.getElementById("filter");
26 var convolve = doc.getElementById("convolve");
27 var blur = doc.getElementById("blur");
28 var marker = doc.getElementById("marker");
30 // class attribute
31 filter.setAttribute("class", "foo");
32 is(filter.getAttribute("class"), "foo", "class attribute");
33 is(filter.className.baseVal, "foo", "className baseVal");
34 is(filter.className.animVal, "foo", "className animVal");
35 filter.className.baseVal = "bar";
36 is(filter.getAttribute("class"), "bar", "class attribute");
37 is(filter.className.baseVal, "bar", "className baseVal");
38 is(filter.className.animVal, "bar", "className animVal");
39 filter.removeAttribute("class");
40 is(filter.hasAttribute("class"), false, "class attribute");
41 is(filter.className.baseVal, "", "className baseVal");
42 is(filter.className.animVal, "", "className animVal");
44 // length attribute
46 marker.setAttribute("markerWidth", "12.5");
47 is(marker.markerWidth.baseVal.value, 12.5, "length baseVal");
48 is(marker.markerWidth.animVal.value, 12.5, "length animVal");
50 var baseMarkerWidth = marker.markerWidth.baseVal;
51 var animMarkerWidth = marker.markerWidth.animVal;
52 marker.setAttribute("markerWidth", "15.5");
53 is(baseMarkerWidth.value, 15.5, "length baseVal");
54 is(animMarkerWidth.value, 15.5, "length animVal");
56 marker.markerWidth.baseVal.value = 7.5;
57 is(marker.markerWidth.animVal.value, 7.5, "length animVal");
58 is(marker.getAttribute("markerWidth"), "7.5", "length attribute");
60 // number attribute
62 convolve.setAttribute("divisor", "12.5");
63 is(convolve.divisor.baseVal, 12.5, "number baseVal");
64 is(convolve.divisor.animVal, 12.5, "number animVal");
66 convolve.divisor.baseVal = 7.5;
67 is(convolve.divisor.animVal, 7.5, "number animVal");
68 is(convolve.getAttribute("divisor"), "7.5", "number attribute");
70 // number-optional-number attribute
72 blur.setAttribute("stdDeviation", "20.5");
73 is(blur.stdDeviationX.baseVal, 20.5, "number-optional-number first baseVal");
74 is(blur.stdDeviationX.animVal, 20.5, "number-optional-number first animVal");
75 is(blur.stdDeviationY.baseVal, 20.5, "number-optional-number second baseVal");
76 is(blur.stdDeviationY.animVal, 20.5, "number-optional-number second animVal");
78 blur.stdDeviationX.baseVal = 8.5;
79 is(blur.stdDeviationX.animVal, 8.5, "number-optional-number first animVal");
80 is(blur.stdDeviationY.animVal, 20.5, "number-optional-number second animVal");
81 is(blur.getAttribute("stdDeviation"), "8.5, 20.5", "number-optional-number attribute");
83 blur.stdDeviationY.baseVal = 8.5;
84 is(blur.getAttribute("stdDeviation"), "8.5", "number-optional-number attribute");
86 blur.setStdDeviation(24.5, 0.5);
87 is(blur.stdDeviationX.baseVal, 24.5, "integer-optional-integer first baseVal");
88 is(blur.stdDeviationX.animVal, 24.5, "integer-optional-integer first animVal");
89 is(blur.stdDeviationY.baseVal, 0.5, "integer-optional-integer second baseVal");
90 is(blur.stdDeviationY.animVal, 0.5, "integer-optional-integer second animVal");
92 // integer attribute
94 convolve.setAttribute("targetX", "12");
95 is(convolve.targetX.baseVal, 12, "integer baseVal");
96 is(convolve.targetX.animVal, 12, "integer animVal");
97 convolve.targetX.baseVal = 7;
98 is(convolve.targetX.animVal, 7, "integer animVal");
99 is(convolve.getAttribute("targetX"), "7", "integer attribute");
101 // integer-optional-integer attribute
103 filter.setAttribute("filterRes", "100");
104 is(filter.filterResX.baseVal, 100, "integer-optional-integer first baseVal");
105 is(filter.filterResX.animVal, 100, "integer-optional-integer first animVal");
106 is(filter.filterResY.baseVal, 100, "integer-optional-integer second baseVal");
107 is(filter.filterResY.animVal, 100, "integer-optional-integer second animVal");
109 filter.filterResX.baseVal = 50;
110 is(filter.filterResX.animVal, 50, "integer-optional-integer first animVal");
111 is(filter.filterResY.animVal, 100, "integer-optional-integer second animVal");
112 is(filter.getAttribute("filterRes"), "50, 100", "integer-optional-integer attribute");
114 filter.filterResY.baseVal = 50;
115 is(filter.getAttribute("filterRes"), "50", "integer-optional-integer attribute");
117 filter.setFilterRes(80, 90);
118 is(filter.filterResX.baseVal, 80, "integer-optional-integer first baseVal");
119 is(filter.filterResX.animVal, 80, "integer-optional-integer first animVal");
120 is(filter.filterResY.baseVal, 90, "integer-optional-integer second baseVal");
121 is(filter.filterResY.animVal, 90, "integer-optional-integer second animVal");
123 // angle attribute
125 marker.setAttribute("orient", "90deg");
126 is(marker.orientAngle.baseVal.value, 90, "angle baseVal");
127 is(marker.orientAngle.animVal.value, 90, "angle animVal");
129 var baseAngle = marker.orientAngle.baseVal;
130 var animAngle = marker.orientAngle.animVal;
131 marker.setAttribute("orient", "45deg");
132 is(baseAngle.value, 45, "angle baseVal");
133 is(animAngle.value, 45, "angle animVal");
135 marker.orientAngle.baseVal.value = 30;
136 is(marker.orientAngle.animVal.value, 30, "angle animVal");
137 is(marker.getAttribute("orient"), "30deg", "angle attribute");
139 // boolean attribute
141 convolve.setAttribute("preserveAlpha", "false");
142 is(convolve.preserveAlpha.baseVal, false, "boolean baseVal");
143 is(convolve.preserveAlpha.animVal, false, "boolean animVal");
144 convolve.preserveAlpha.baseVal = true;
145 is(convolve.preserveAlpha.animVal, true, "boolean animVal");
146 is(convolve.getAttribute("preserveAlpha"), "true", "boolean attribute");
148 // enum attribute
150 convolve.setAttribute("edgeMode", "wrap");
151 is(convolve.edgeMode.baseVal, 2, "enum baseVal");
152 is(convolve.edgeMode.animVal, 2, "enum animVal");
153 convolve.edgeMode.baseVal = 1;
154 is(convolve.edgeMode.animVal, 1, "enum animVal");
155 is(convolve.getAttribute("edgeMode"), "duplicate", "enum attribute");
157 // string attribute
159 convolve.setAttribute("result", "foo");
160 is(convolve.result.baseVal, "foo", "string baseVal");
161 is(convolve.result.animVal, "foo", "string animVal");
162 convolve.result.baseVal = "bar";
163 is(convolve.result.animVal, "bar", "string animVal");
164 is(convolve.getAttribute("result"), "bar", "string attribute");
166 // preserveAspectRatio attribute
168 marker.setAttribute("preserveAspectRatio", "xMinYMid slice");
169 is(marker.preserveAspectRatio.baseVal.align, 5, "preserveAspectRatio.align baseVal");
170 is(marker.preserveAspectRatio.animVal.align, 5, "preserveAspectRatio.align animVal");
171 is(marker.preserveAspectRatio.baseVal.meetOrSlice, 2, "preserveAspectRatio.meetOrSlice baseVal");
172 is(marker.preserveAspectRatio.animVal.meetOrSlice, 2, "preserveAspectRatio.meetOrSlice animVal");
173 marker.preserveAspectRatio.baseVal.align = 3;
174 is(marker.preserveAspectRatio.animVal.align, 3, "preserveAspectRatio animVal");
175 is(marker.preserveAspectRatio.animVal.meetOrSlice, 2, "preserveAspectRatio.meetOrSlice animVal");
176 marker.preserveAspectRatio.baseVal.meetOrSlice = 1;
177 is(marker.preserveAspectRatio.animVal.align, 3, "preserveAspectRatio animVal");
178 is(marker.preserveAspectRatio.animVal.meetOrSlice, 1, "preserveAspectRatio.meetOrSlice animVal");
179 is(marker.getAttribute("preserveAspectRatio"), "xMidYMin meet", "preserveAspectRatio attribute");
181 var basePreserveAspectRatio = marker.preserveAspectRatio.baseVal;
182 var animPreserveAspectRatio = marker.preserveAspectRatio.animVal;
183 marker.setAttribute("preserveAspectRatio", "xMaxYMid slice");
184 is(basePreserveAspectRatio.align, 7, "preserveAspectRatio.align baseVal");
185 is(animPreserveAspectRatio.align, 7, "preserveAspectRatio.align animVal");
186 is(basePreserveAspectRatio.meetOrSlice, 2, "preserveAspectRatio.meetOrSlice baseVal");
187 is(animPreserveAspectRatio.meetOrSlice, 2, "preserveAspectRatio.meetOrSlice animVal");
189 // viewBox attribute
190 var baseViewBox = marker.viewBox.baseVal;
191 var animViewBox = marker.viewBox.animVal;
192 is(baseViewBox.x, 0, "viewBox baseVal");
193 is(animViewBox.x, 0, "viewBox baseVal");
194 is(baseViewBox.y, 0, "viewBox baseVal");
195 is(animViewBox.y, 0, "viewBox baseVal");
196 is(baseViewBox.width, 0, "viewBox baseVal");
197 is(animViewBox.width, 0, "viewBox baseVal");
198 is(baseViewBox.height, 0, "viewBox baseVal");
199 is(animViewBox.height, 0, "viewBox baseVal");
200 baseViewBox.x = 10;
201 baseViewBox.y = 11;
202 baseViewBox.width = 12;
203 baseViewBox.height = 13;
204 is(marker.getAttribute("viewBox"), "10 11 12 13", "viewBox attribute");
206 marker.setAttribute("viewBox", "1 2 3 4");
207 is(marker.viewBox.baseVal.x, 1, "viewBox.x baseVal");
208 is(marker.viewBox.animVal.x, 1, "viewBox.x animVal");
209 is(marker.viewBox.baseVal.y, 2, "viewbox.y baseVal");
210 is(marker.viewBox.animVal.y, 2, "viewbox.y animVal");
211 is(marker.viewBox.baseVal.width, 3, "viewbox.width baseVal");
212 is(marker.viewBox.animVal.width, 3, "viewbox.width animVal");
213 is(marker.viewBox.baseVal.height, 4, "viewbox.heigth baseVal");
214 is(marker.viewBox.animVal.height, 4, "viewbox.heigth animVal");
215 marker.viewBox.baseVal.x = 5;
216 is(marker.viewBox.animVal.x, 5, "viewBox.x animVal");
217 marker.viewBox.baseVal.y = 6;
218 is(marker.viewBox.animVal.y, 6, "viewBox.y animVal");
219 marker.viewBox.baseVal.width = 7;
220 is(marker.viewBox.animVal.width, 7, "viewBox.width animVal");
221 marker.viewBox.baseVal.height = 8;
222 is(marker.viewBox.animVal.height, 8, "viewBox.height animVal");
223 is(marker.getAttribute("viewBox"), "5 6 7 8", "viewBox attribute");
224 marker.removeAttribute("viewBox");
225 is(marker.hasAttribute("viewBox"), false, "viewBox hasAttribute");
227 SimpleTest.finish();
230 window.addEventListener("load", runTests, false);
231 </script>
232 </pre>
233 </body>
234 </html>