OLD | NEW |
1 <svg version="1.1" baseProfile="tiny" onload="testSVGLocatable()" id="svg-root" | 1 <svg version="1.1" baseProfile="tiny" onload="testSVGLocatable()" id="svg-root" |
2 width="100%" height="100%" viewBox="0 0 480 360" | 2 width="100%" height="100%" viewBox="0 0 480 360" |
3 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | 3 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> |
4 <!--======================================================================--> | 4 <!--======================================================================--> |
5 <!--= SVG 1.1 2nd Edition Test Case =--> | 5 <!--= SVG 1.1 2nd Edition Test Case =--> |
6 <!--======================================================================--> | 6 <!--======================================================================--> |
7 <!--= Copyright 2009 World Wide Web Consortium, (Massachusetts =--> | 7 <!--= Copyright 2009 World Wide Web Consortium, (Massachusetts =--> |
8 <!--= Institute of Technology, European Research Consortium for =--> | 8 <!--= Institute of Technology, European Research Consortium for =--> |
9 <!--= Informatics and Mathematics (ERCIM), Keio University). =--> | 9 <!--= Informatics and Mathematics (ERCIM), Keio University). =--> |
10 <!--= All Rights Reserved. =--> | 10 <!--= All Rights Reserved. =--> |
11 <!--= See http://www.w3.org/Consortium/Legal/. =--> | 11 <!--= See http://www.w3.org/Consortium/Legal/. =--> |
12 <!--======================================================================--> | 12 <!--======================================================================--> |
13 <d:SVGTestCase xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/" | 13 <d:SVGTestCase xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/" |
14 template-version="1.3" reviewer="AE,ED" author="AN" status="accepted" | 14 template-version="1.3" reviewer="AE,ED" author="AN" status="accepted" |
15 version="$Revision: 1.6 $" testname="$RCSfile: types-dom-01-b.svg,v $"> | 15 version="$Revision: 1.6 $" testname="$RCSfile: types-dom-01-b.svg,v $"> |
16 <d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.
org/TR/SVG11/types.html#BasicDOMInterfaces"> | 16 <d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.
org/TR/SVG11/types.html#BasicDOMInterfaces"> |
17 <p> | 17 <p> |
18 This test checks all the methods and properties of the SVGLocatable inte
rface. | 18 This test checks all the methods and properties of the SVGLocatable inte
rface. |
19 Note the use of nested svg elements and testing against different elemen
ts in the hierarchy. | 19 Note the use of nested svg elements and testing against different elemen
ts in the hierarchy. |
20 Note that the values of .getScreenCTM() and .getCTM() can only be tested
correctly if they are | 20 Note that the values of .getScreenCTM() and .getCTM() can only be tested
correctly if they are |
21 in the html-based test or the width and height of the root element is ex
plicitly set to 480x360. | 21 in the html-based test or the width and height of the root element is ex
plicitly set to 480x360. |
22 The methods .getScreenCTM() and .getCTM() are tested from the rotated te
xt element, the method .getBBox(), | 22 The methods .getScreenCTM() and .getCTM() are tested from the rotated te
xt element, the method .getBBox() is tested between the rotated text and its par
ent group, the method .getBBox() and |
23 .getTransformToElement() is tested between the rotated text and its pare
nt group, the method .getBBox() and | |
24 the properties .farthestViewportElement and .nearestViewportElement are
tested on the blue circle. | 23 the properties .farthestViewportElement and .nearestViewportElement are
tested on the blue circle. |
25 </p> | 24 </p> |
26 </d:testDescription> | 25 </d:testDescription> |
27 <d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> | 26 <d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
28 <p> | 27 <p> |
29 Run the test. No interaction required. Make sure scripting is enabled. | 28 Run the test. No interaction required. Make sure scripting is enabled. |
30 </p> | 29 </p> |
31 </d:operatorScript> | 30 </d:operatorScript> |
32 <d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> | 31 <d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
33 <p> | 32 <p> |
34 For the test to pass, the values generated by script must match the valu
es provided in the png image. The correct values are: | 33 For the test to pass, the values generated by script must match the valu
es provided in the png image. The correct values are: |
35 </p> | 34 </p> |
36 <p> | 35 <p> |
37 .getScreenCTM() for id "rotText": 0.42,0.42,-0.42,0.42,70.00,-60.00 | 36 .getScreenCTM() for id "rotText": 0.42,0.42,-0.42,0.42,70.00,-60.00 |
38 </p> | 37 </p> |
39 <p> | 38 <p> |
40 .getCTM() for id "rotText": 0.42,0.42,-0.42,0.42,70.00,-60.00 | 39 .getCTM() for id "rotText": 0.42,0.42,-0.42,0.42,70.00,-60.00 |
41 </p> | 40 </p> |
42 <p> | 41 <p> |
43 .getTransformToElement() between id "rotText" and id "parentGroup": 0.42
,0.42,-0.42,0.42,0.00,0.00 | |
44 </p> | |
45 <p> | |
46 .getBBox() for 'blueCircle': .x=-50,.y=-50,.width=100,.height=100 | 42 .getBBox() for 'blueCircle': .x=-50,.y=-50,.width=100,.height=100 |
47 </p> | 43 </p> |
48 <p> | 44 <p> |
49 .farthestViewportElement of blueCircle=svg-root | 45 .farthestViewportElement of blueCircle=svg-root |
50 </p> | 46 </p> |
51 <p> | 47 <p> |
52 .nearestViewportElement of blueCircle=nestedSVG | 48 .nearestViewportElement of blueCircle=nestedSVG |
53 </p> | 49 </p> |
54 </d:passCriteria> | 50 </d:passCriteria> |
55 </d:SVGTestCase> | 51 </d:SVGTestCase> |
56 <title id="test-title">$RCSfile: types-dom-01-b.svg,v $</title> | 52 <title id="test-title">$RCSfile: types-dom-01-b.svg,v $</title> |
57 <defs> | 53 <defs> |
58 <font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F"> | 54 <font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F"> |
59 <font-face-src> | 55 <font-face-src> |
60 <font-face-uri xlink:href="../custom/resources/SVGFreeSans.svg#ascii"/> | 56 <font-face-uri xlink:href="../custom/resources/SVGFreeSans.svg#ascii"/> |
61 </font-face-src> | 57 </font-face-src> |
62 </font-face> | 58 </font-face> |
63 </defs> | 59 </defs> |
64 <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size=
"18"> | 60 <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size=
"18"> |
65 <script type="text/ecmascript"> | 61 <script type="text/ecmascript"> |
66 function testSVGLocatable() { | 62 function testSVGLocatable() { |
67 var rotText = document.getElementById("rotatedText"); | 63 var rotText = document.getElementById("rotatedText"); |
68 var blueCircle = document.getElementById("blueCircle") | 64 var blueCircle = document.getElementById("blueCircle") |
69 var matr = rotText.getScreenCTM(); | 65 var matr = rotText.getScreenCTM(); |
70 document.getElementById("result1").firstChild.nodeValue = ".getScreenCTM()
: " + matr.a.toFixed(2) + "," + matr.b.toFixed(2) + "," + matr.c.toFixed(2) + ",
" + matr.d.toFixed(2) + "," + matr.e.toFixed(2) + "," + matr.f.toFixed(2); | 66 document.getElementById("result1").firstChild.nodeValue = ".getScreenCTM()
: " + matr.a.toFixed(2) + "," + matr.b.toFixed(2) + "," + matr.c.toFixed(2) + ",
" + matr.d.toFixed(2) + "," + matr.e.toFixed(2) + "," + matr.f.toFixed(2); |
71 var matr = rotText.getCTM(); | 67 var matr = rotText.getCTM(); |
72 document.getElementById("result2").firstChild.nodeValue = ".getCTM(): " +
matr.a.toFixed(2) + "," + matr.b.toFixed(2) + "," + matr.c.toFixed(2) + "," + ma
tr.d.toFixed(2) + "," + matr.e.toFixed(2) + "," + matr.f.toFixed(2); | 68 document.getElementById("result2").firstChild.nodeValue = ".getCTM(): " +
matr.a.toFixed(2) + "," + matr.b.toFixed(2) + "," + matr.c.toFixed(2) + "," + ma
tr.d.toFixed(2) + "," + matr.e.toFixed(2) + "," + matr.f.toFixed(2); |
73 var matr = rotText.getTransformToElement(document.getElementById("parentGr
oup")); | |
74 document.getElementById("result3").firstChild.nodeValue = ".getTransformTo
Element(): " + matr.a.toFixed(2) + "," + matr.b.toFixed(2) + "," + matr.c.toFixe
d(2) + "," + matr.d.toFixed(2) + "," + matr.e.toFixed(2) + "," + matr.f.toFixed(
2); | |
75 var bbox = blueCircle.getBBox(); | 69 var bbox = blueCircle.getBBox(); |
76 document.getElementById("result4").firstChild.nodeValue = ".getBBox() for
'blueCircle': .x="+bbox.x+",.y="+bbox.y+",.width="+bbox.width+",.height="+bbox.h
eight; | 70 document.getElementById("result3").firstChild.nodeValue = ".getBBox() for
'blueCircle': .x="+bbox.x+",.y="+bbox.y+",.width="+bbox.width+",.height="+bbox.h
eight; |
77 document.getElementById("result5").firstChild.nodeValue = ".farthestViewpo
rtElement of blueCircle="+blueCircle.farthestViewportElement.getAttributeNS(null
,"id"); | 71 document.getElementById("result4").firstChild.nodeValue = ".farthestViewpo
rtElement of blueCircle="+blueCircle.farthestViewportElement.getAttributeNS(null
,"id"); |
78 document.getElementById("result6").firstChild.nodeValue = ".nearestViewpor
tElement of blueCircle="+blueCircle.nearestViewportElement.getAttributeNS(null,"
id"); | 72 document.getElementById("result5").firstChild.nodeValue = ".nearestViewpor
tElement of blueCircle="+blueCircle.nearestViewportElement.getAttributeNS(null,"
id"); |
79 } | 73 } |
80 </script> | 74 </script> |
81 <g font-size="12"> | 75 <g font-size="12"> |
82 <g id="parentGroup" transform="translate(70,-60)"> | 76 <g id="parentGroup" transform="translate(70,-60)"> |
83 <text id="rotatedText" transform="scale(0.6),rotate(45)" font-size="20"
x="30" y="150">Rotated Text for testing SVGLocatable</text> | 77 <text id="rotatedText" transform="scale(0.6),rotate(45)" font-size="20"
x="30" y="150">Rotated Text for testing SVGLocatable</text> |
84 <text id="otherText" transform="scale(0.7)" font-size="20" x="100" y="13
0">Some other text with id 'otherText'</text> | 78 <text id="otherText" transform="scale(0.7)" font-size="20" x="100" y="13
0">Some other text with id 'otherText'</text> |
85 <svg id="nestedSVG" x="200" y="100" width="110" height="110" viewBox="-5
5 -55 110 110"> | 79 <svg id="nestedSVG" x="200" y="100" width="110" height="110" viewBox="-5
5 -55 110 110"> |
86 <circle id="blueCircle" cx="0" cy="0" r="50" fill="blue"/> | 80 <circle id="blueCircle" cx="0" cy="0" r="50" fill="blue"/> |
87 </svg> | 81 </svg> |
88 </g> | 82 </g> |
89 <text id="result1" x="10" y="200"> </text> | 83 <text id="result1" x="10" y="200"> </text> |
90 <text id="result2" x="10" y="220"> </text> | 84 <text id="result2" x="10" y="220"> </text> |
91 <text id="result3" x="10" y="240"> </text> | 85 <text id="result3" x="10" y="240"> </text> |
92 <text id="result4" x="10" y="260"> </text> | 86 <text id="result4" x="10" y="260"> </text> |
93 <text id="result5" x="10" y="280"> </text> | 87 <text id="result5" x="10" y="280"> </text> |
94 <text id="result6" x="10" y="300"> </text> | |
95 </g> | 88 </g> |
96 </g> | 89 </g> |
97 <g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> | 90 <g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> |
98 <text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.6
$</text> | 91 <text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.6
$</text> |
99 </g> | 92 </g> |
100 <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke=
"#000"/> | 93 <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke=
"#000"/> |
101 <!-- comment out this watermark once the test is approved --> | 94 <!-- comment out this watermark once the test is approved --> |
102 <!--<g id="draft-watermark"> | 95 <!--<g id="draft-watermark"> |
103 <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-w
idth="1"/> | 96 <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-w
idth="1"/> |
104 <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size
="20" x="240" | 97 <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size
="20" x="240" |
105 text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white"
>DRAFT</text> | 98 text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white"
>DRAFT</text> |
106 </g>--> | 99 </g>--> |
107 </svg> | 100 </svg> |
OLD | NEW |