| 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.8 $" 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"> |
| 15 |
<p> |
| 16 |
Tests the liveness of SVGTransform.matrix. |
| 17 |
</p> |
| 18 |
</d:testDescription> |
| 19 |
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
| 20 |
<p> |
| 21 |
Load the svg, you should see a green circle. |
| 22 |
</p> |
| 23 |
</d:operatorScript> |
| 24 |
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
| 25 |
<p> |
| 26 |
The test has passed if: |
| 27 |
</p> |
| 28 |
<ul> |
| 29 |
<li>There is no red visible</li> |
| 30 |
<li>There is a green circle visible</li> |
| 31 |
</ul> |
| 32 |
</d:passCriteria> |
| 33 |
</d:SVGTestCase> |
| 34 |
<title id="test-title">$RCSfile: coords-dom-01-f.svg,v $</title> |
| 35 |
<defs> |
| 36 |
<font-face |
| 37 |
font-family="SVGFreeSansASCII" |
| 38 |
unicode-range="U+0-7F"> |
| 39 |
<font-face-src> |
| 40 |
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> |
| 41 |
</font-face-src> |
| 42 |
</font-face> |
| 43 |
</defs> |
| 44 |
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> |
| 45 |
|
| 46 |
|
| 47 |
<g transform="translate(240 180)"> |
| 48 |
<g id="reference"> |
| 49 |
<circle r="40" fill="red"/> |
| 50 |
</g> |
| 51 |
|
| 52 |
<g id="g" transform="translate(20 20)"> |
| 53 |
<circle id="c" r="41" fill="blue"/> |
| 54 |
</g> |
| 55 |
</g> |
| 56 |
|
| 57 |
<script type="text/ecmascript"><![CDATA[ |
| 58 |
var eps = 1 / 65535; // 16.16 fixpoint epsilon |
| 59 |
var passed = false; |
| 60 |
|
| 61 |
function isequal( value, expected, epsilon ) |
| 62 |
{ |
| 63 |
return(Math.abs(value - expected) < epsilon); |
| 64 |
} |
| 65 |
|
| 66 |
try |
| 67 |
{ |
| 68 |
var g = document.getElementById("g"); |
| 69 |
var c = document.getElementById("c"); |
| 70 |
var tfm = g.transform.baseVal.getItem(0); |
| 71 |
var mtx = tfm.matrix; |
| 72 |
tfm.setTranslate(300,200); |
| 73 |
if(tfm.type == SVGTransform.SVG_TRANSFORM_TRANSLATE && |
| 74 |
isequal(mtx.e, 300, eps) && isequal(mtx.f, 200, eps)) |
| 75 |
{ |
| 76 |
tfm.setScale(4,4); |
| 77 |
if(tfm.type == SVGTransform.SVG_TRANSFORM_SCALE && |
| 78 |
isequal(mtx.a, 4, eps) && isequal(mtx.d, 4, eps)) |
| 79 |
{ |
| 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)) |
| 85 |
{ |
| 86 |
passed = true; |
| 87 |
} |
| 88 |
} |
| 89 |
} |
| 90 |
} |
| 91 |
catch(e) {} |
| 92 |
|
| 93 |
if(passed) |
| 94 |
{ |
| 95 |
c.setAttribute("fill", "lime"); |
| 96 |
} |
| 97 |
else |
| 98 |
{ |
| 99 |
c.setAttribute("fill", "red"); |
| 100 |
} |
| 101 |
]]></script> |
| 102 |
|
| 103 |
</g> |
| 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.8 $</text> |
| 107 |
</g> |
| 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> |
| 114 |
</g>--> |
| 115 |
</svg> |