Rubber-stamped by Brady Eidson.
[webbrowser.git] / LayoutTests / svg / custom / getTransformToElement.svg
blobd419e51e825321beacc22196299bcdc8b29c79ac
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">
3 <svg version="1.1" baseProfile="basic" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" onload="runTest()">
4 <script type="text/ecmascript"><![CDATA[
5 function runTest() {
6 var referenceElement = document.getElementById("referenceText");
7 var ctm = referenceElement.getTransformToElement(document.getElementById("group1"));
8 if (ctm.a == 0.5 && ctm.b == 0 && ctm.c == 0 && ctm.d == 0.5 &&
9 ctm.e == -20 && ctm.f == -20) {
10 ctm = referenceElement.getTransformToElement(document.getElementById("group2"));
11 if (ctm.a.toFixed(3) == 0.354 && ctm.b.toFixed(3) == -0.354 &&
12 ctm.c.toFixed(3) == 0.354 && ctm.d.toFixed(3) == 0.354 &&
13 ctm.e.toFixed(3) == -7.071 && ctm.f.toFixed(8) == 0.0) {
14 ctm = referenceElement.getTransformToElement(document.getElementById("redRect"));
15 if (ctm.a.toFixed(3) == 0.354 && ctm.b.toFixed(3) == -0.354 &&
16 ctm.c.toFixed(3) == 0.354 && ctm.d.toFixed(3) == 0.354 &&
17 ctm.e.toFixed(3) == -107.071 && ctm.f.toFixed(8) == 0.0) {
18 try {
19 var ctm = referenceElement.getTransformToElement(document.getElementById("group0"));
20 } catch(e) {
21 document.getElementById("referenceText").textContent = "Passed";
27 ]]></script>
28 <g id="group0" transform="scale(0)"/>
29 <g id="group1" transform="translate(15,15)">
30 <text id="referenceText" transform="translate(-20,-20),scale(0.5)" font-size="30" x="50" y="150">Failed</text>
31 </g>
32 <g id="group2" transform="rotate(45)">
33 <rect id="redRect" transform="translate(100,0)" x="50" y="50" width="70" height="30" fill="none"/>
34 </g>
35 </svg>