| 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.3" reviewer="ED" author="CM" status="accepted" |
| 13 |
version="$Revision: 1.7 $" testname="$RCSfile: coords-dom-03-f.svg,v $"> |
| 14 |
<d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/coords.html#InterfaceSVGTransformList"> |
| 15 |
<p> |
| 16 |
This tests that SVGTransformList.createSVGTransformFromMatrix(), |
| 17 |
SVGSVGElement.createSVGTransformFromMatrix() and SVGTransform.setMatrix() |
| 18 |
all do not track changes to the SVGMatrix passed to them. |
| 19 |
</p> |
| 20 |
<p> |
| 21 |
After loading the test, three rectangles will be presented. The |
| 22 |
upper rectangle indicates the result of testing whether |
| 23 |
SVGTransformList.createSVGTransformFromMatrix() behaved correctly, |
| 24 |
the middle rectangle indicates the status for SVGSVGElement.createSVGTransformFromMatrix(), |
| 25 |
and the bottom rectangle for SVGTransform.setMatrix(). |
| 26 |
</p> |
| 27 |
</d:testDescription> |
| 28 |
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
| 29 |
<p> |
| 30 |
Run the test. No interaction required. |
| 31 |
</p> |
| 32 |
</d:operatorScript> |
| 33 |
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
| 34 |
<p> |
| 35 |
The test is passed if the three rectangles are green. |
| 36 |
</p> |
| 37 |
</d:passCriteria> |
| 38 |
</d:SVGTestCase> |
| 39 |
<title id="test-title">$RCSfile: coords-dom-03-f.svg,v $</title> |
| 40 |
<defs> |
| 41 |
<font-face |
| 42 |
font-family="SVGFreeSansASCII" |
| 43 |
unicode-range="U+0-7F"> |
| 44 |
<font-face-src> |
| 45 |
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> |
| 46 |
</font-face-src> |
| 47 |
</font-face> |
| 48 |
</defs> |
| 49 |
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> |
| 50 |
|
| 51 |
<text x='10' y='30' font-size='14'>Test that some methods taking an SVGMatrix take a copy of it</text> |
| 52 |
|
| 53 |
<rect id='r1' x='10' y='50' width='50' height='50'/> |
| 54 |
<rect id='r2' x='10' y='110' width='50' height='50'/> |
| 55 |
<rect id='r3' x='10' y='170' width='50' height='50'/> |
| 56 |
<g font-size='10'> |
| 57 |
<text x='70' y='80'>SVGTransformList.createSVGTransformFromMatrix()</text> |
| 58 |
<text x='70' y='140'>SVGSVGElement.createSVGTransformFromMatrix()</text> |
| 59 |
<text x='70' y='200'>SVGTransform.setMatrix()</text> |
| 60 |
</g> |
| 61 |
|
| 62 |
<g id='g' transform='scale(5)'/> |
| 63 |
|
| 64 |
<script><![CDATA[ |
| 65 |
var svg = document.documentElement, |
| 66 |
g = document.getElementById('g'), |
| 67 |
r1 = document.getElementById('r1'), |
| 68 |
r2 = document.getElementById('r2'), |
| 69 |
r3 = document.getElementById('r3'); |
| 70 |
|
| 71 |
var m1 = svg.createSVGMatrix(), |
| 72 |
m2 = svg.createSVGMatrix(), |
| 73 |
m3 = svg.createSVGMatrix(); |
| 74 |
|
| 75 |
var t; |
| 76 |
|
| 77 |
m1.a = 3; m1.b = 0; m1.c = 0; m1.d = 1; m1.e = 0; m1.f = 0; |
| 78 |
m2.a = 3; m2.b = 0; m2.c = 0; m2.d = 1; m2.e = 0; m2.f = 0; |
| 79 |
m3.a = 3; m3.b = 0; m3.c = 0; m3.d = 1; m3.e = 0; m3.f = 0; |
| 80 |
|
| 81 |
try { |
| 82 |
t = g.transform.baseVal.createSVGTransformFromMatrix(m1); |
| 83 |
m1.a = 2; |
| 84 |
r1.setAttribute('fill', t.matrix != m1 && t.matrix.a == 3 ? 'lime' : 'red'); |
| 85 |
} catch (e) { |
| 86 |
} |
| 87 |
|
| 88 |
try { |
| 89 |
t = svg.createSVGTransformFromMatrix(m2); |
| 90 |
m2.a = 2; |
| 91 |
r2.setAttribute('fill', t.matrix != m2 && t.matrix.a == 3 ? 'lime' : 'red'); |
| 92 |
} catch (e) { |
| 93 |
} |
| 94 |
|
| 95 |
try { |
| 96 |
t = g.transform.baseVal.getItem(0); |
| 97 |
t.setMatrix(m3); |
| 98 |
m3.a = 2; |
| 99 |
r3.setAttribute('fill', t.matrix != m3 && t.matrix.a == 3 ? 'lime' : 'red'); |
| 100 |
} catch (e) { |
| 101 |
} |
| 102 |
]]></script> |
| 103 |
|
| 104 |
</g> |
| 105 |
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> |
| 106 |
<text id="revision" x="10" y="340" stroke="none" |
| 107 |
fill="black">$Revision: 1.7 $</text> |
| 108 |
</g> |
| 109 |
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/> |
| 110 |
<!-- comment out this watermark once the test is approved --> |
| 111 |
<!--<g id="draft-watermark"> |
| 112 |
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> |
| 113 |
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" |
| 114 |
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> |
| 115 |
</g>--> |
| 116 |
</svg> |