1 <svg id=
"svg-root" width=
"100%" height=
"100%"
2 viewBox=
"0 0 480 360" xmlns=
"http://www.w3.org/2000/svg"
3 xmlns:
xlink=
"http://www.w3.org/1999/xlink">
4 <!--======================================================================-->
5 <!--= Copyright 2008 World Wide Web Consortium, (Massachusetts =-->
6 <!--= Institute of Technology, European Research Consortium for =-->
7 <!--= Informatics and Mathematics (ERCIM), Keio University). =-->
8 <!--= All Rights Reserved. =-->
9 <!--= See http://www.w3.org/Consortium/Legal/. =-->
10 <!--======================================================================-->
11 <d:SVGTestCase xmlns:
d=
"http://www.w3.org/2000/02/svg/testsuite/description/"
12 template-version=
"1.4" reviewer=
"CM" author=
"ED" status=
"accepted"
13 version=
"$Revision: 1.7 $" testname=
"$RCSfile: coords-dom-01-f.svg,v $">
14 <d:testDescription xmlns=
"http://www.w3.org/1999/xhtml" href=
"http://www.w3.org/TR/SVG11/coords.html#DOMInterfaces">
16 Tests the liveness of SVGTransform.matrix.
19 <d:operatorScript xmlns=
"http://www.w3.org/1999/xhtml">
21 Load the svg, you should see a green circle.
24 <d:passCriteria xmlns=
"http://www.w3.org/1999/xhtml">
26 The test has passed if:
29 <li>There is no red visible
</li>
30 <li>There is a green circle visible
</li>
34 <title id=
"test-title">$RCSfile: coords-dom-
01-f.svg,v $
</title>
37 font-family=
"SVGFreeSansASCII"
38 unicode-range=
"U+0-7F">
40 <font-face-uri xlink:
href=
"../custom/resources/SVGFreeSans.svg#ascii"/>
44 <g id=
"test-body-content" font-family=
"SVGFreeSansASCII,sans-serif" font-size=
"18">
47 <g transform=
"translate(240 180)">
49 <circle r=
"40" fill=
"red"/>
52 <g id=
"g" transform=
"translate(20 20)">
53 <circle id=
"c" r=
"40" fill=
"blue"/>
57 <script type=
"text/ecmascript"><![CDATA[
58 var eps =
1 /
65535; //
16.16 fixpoint epsilon
61 function isequal( value, expected, epsilon )
63 return(Math.abs(value - expected) < epsilon);
68 var g = document.getElementById(
"g");
69 var c = document.getElementById(
"c");
70 var tfm = g.transform.baseVal.getItem(
0);
72 tfm.setTranslate(
300,
200);
73 if(tfm.type == SVGTransform.SVG_TRANSFORM_TRANSLATE &&
74 isequal(mtx.e,
300, eps) && isequal(mtx.f,
200, eps))
77 if(tfm.type == SVGTransform.SVG_TRANSFORM_SCALE &&
78 isequal(mtx.a,
4, eps) && isequal(mtx.d,
4, eps))
80 tfm.setRotate(
90,
0,
0);
81 if(tfm.type == SVGTransform.SVG_TRANSFORM_ROTATE &&
82 isequal(mtx.a, Math.cos(Math.PI/
2), eps) && isequal(mtx.b, Math.sin(Math.PI/
2), eps) &&
83 isequal(mtx.c, -Math.sin(Math.PI/
2), eps) && isequal(mtx.d, Math.cos(Math.PI/
2), eps) &&
84 isequal(mtx.e,
0, eps) && isequal(mtx.f,
0, eps))
95 c.setAttribute(
"fill",
"lime");
99 c.setAttribute(
"fill",
"red");
104 <g font-family=
"SVGFreeSansASCII,sans-serif" font-size=
"32">
105 <text id=
"revision" x=
"10" y=
"340" stroke=
"none"
106 fill=
"black">$Revision:
1.7 $
</text>
108 <rect xml:
id=
"test-frame" x=
"1" y=
"1" width=
"478" height=
"358" fill=
"none" stroke=
"#000"/>
109 <!-- comment out this watermark once the test is approved --><!--
110 <g id="draft-watermark">
111 <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/>
112 <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240"
113 text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text>