OLD | NEW |
1 <?xml version="1.0" encoding="UTF-8"?> | 1 <?xml version="1.0" encoding="UTF-8"?> |
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/
SVG/1.1/DTD/svg11-tiny-flat.dtd"> | 2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/
SVG/1.1/DTD/svg11-tiny-flat.dtd"> |
3 <svg version="1.1" baseProfile="tiny" id="svg-root" width="480" height="360" vie
wBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3
.org/1999/xlink" onload="testSVGLocatable()"> | 3 <svg version="1.1" baseProfile="tiny" id="svg-root" width="480" height="360" vie
wBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3
.org/1999/xlink" onload="testSVGLocatable()"> |
4 <!--======================================================================--> | 4 <!--======================================================================--> |
5 <!--= Copyright 2006 World Wide Web Consortium, (Massachusetts =--> | 5 <!--= Copyright 2006 World Wide Web Consortium, (Massachusetts =--> |
6 <!--= Institute of Technology, European Research Consortium for =--> | 6 <!--= Institute of Technology, European Research Consortium for =--> |
7 <!--= Informatics and Mathematics (ERCIM), Keio University). =--> | 7 <!--= Informatics and Mathematics (ERCIM), Keio University). =--> |
8 <!--= All Rights Reserved. =--> | 8 <!--= All Rights Reserved. =--> |
9 <!--= See http://www.w3.org/Consortium/Legal/. =--> | 9 <!--= See http://www.w3.org/Consortium/Legal/. =--> |
10 <!--======================================================================--> | 10 <!--======================================================================--> |
11 <!-- NOTE: CVS will automatically update the --> | 11 <!-- NOTE: CVS will automatically update the --> |
12 <!-- "$RCSfile: types-basicDOM-01-b.svg,v $" and "$Revision: 1.1 $"
--> | 12 <!-- "$RCSfile: types-basicDOM-01-b.svg,v $" and "$Revision: 1.1 $"
--> |
13 <!-- fields in the file. --> | 13 <!-- fields in the file. --> |
14 <!-- There is no need to update this information. --> | 14 <!-- There is no need to update this information. --> |
15 <!-- =====================================================================--> | 15 <!-- =====================================================================--> |
16 <SVGTestCase xmlns="http://www.w3.org/2000/02/svg/testsuite/description/" revi
ewer="AE,ED" owner="AN" desc="Tests the interface SVGLocatable" status="accepted
" version="$Revision: 1.1 $" testname="$RCSfile: types-basicDOM-01-b.svg,v $"> | 16 <SVGTestCase xmlns="http://www.w3.org/2000/02/svg/testsuite/description/" revi
ewer="AE,ED" owner="AN" desc="Tests the interface SVGLocatable" status="accepted
" version="$Revision: 1.1 $" testname="$RCSfile: types-basicDOM-01-b.svg,v $"> |
17 <OperatorScript> | 17 <OperatorScript> |
18 <Paragraph> | 18 <Paragraph> |
19 This test checks all the methods and properties of the SVGLocatable inte
rface. Note the use of nested svg elements and testing against different element
s in the hierarchy. Note that the values of .getScreenCTM() and .getCTM() can on
ly be tested correctly if they are in the html-based test or the width and heigh
t of the root element is explicitly set to 480x360. The methods .getScreenCTM()
and .getCTM() are tested from the rotated text element, the method .getBBox(), .
getTransformToElement() is tested between the rotated text and its parent group,
the method .getBBox() and the properties .farthestViewportElement and .nearestV
iewportElement are tested on the red circle. | 19 This test checks all the methods and properties of the SVGLocatable inte
rface. Note the use of nested svg elements and testing against different element
s in the hierarchy. Note that the values of .getScreenCTM() and .getCTM() can on
ly be tested correctly if they are in the html-based test or the width and heigh
t of the root element is explicitly set to 480x360. The methods .getScreenCTM()
and .getCTM() are tested from the rotated text element, the method .getBBox(), i
s tested between the rotated text and its parent group, the method .getBBox() an
d the properties .farthestViewportElement and .nearestViewportElement are tested
on the red circle. |
20 </Paragraph> | 20 </Paragraph> |
21 <Paragraph> | 21 <Paragraph> |
22 For the test to pass, the values generated by script must match
the values provided in the png image. The correct values are: | 22 For the test to pass, the values generated by script must match
the values provided in the png image. The correct values are: |
23 </Paragraph> | 23 </Paragraph> |
24 <Paragraph> | 24 <Paragraph> |
25 .getScreenCTM() for id "rotText": 0.42,0.42,-0.42,0.42,70.00,-60
.00 | 25 .getScreenCTM() for id "rotText": 0.42,0.42,-0.42,0.42,70.00,-60
.00 |
26 </Paragraph> | 26 </Paragraph> |
27 <Paragraph> | 27 <Paragraph> |
28 .getCTM() for id "rotText": 0.42,0.42,-0.42,0.42,70.00,-60.00 | 28 .getCTM() for id "rotText": 0.42,0.42,-0.42,0.42,70.00,-60.00 |
29 </Paragraph> | 29 </Paragraph> |
30 <Paragraph> | |
31 .getTransformToElement() between id "rotText" and id "parentGrou
p": 0.42,0.42,-0.42,0.42,0.00,0.00 | |
32 </Paragraph> | |
33 <Paragraph> | 30 <Paragraph> |
34 .getBBox() for 'redCircle': .x=-50,.y=-50,.width=100,.height=100 | 31 .getBBox() for 'redCircle': .x=-50,.y=-50,.width=100,.height=100 |
35 </Paragraph> | 32 </Paragraph> |
36 <Paragraph> | 33 <Paragraph> |
37 .farthestViewportElement of redCircle=svg-root | 34 .farthestViewportElement of redCircle=svg-root |
38 </Paragraph> | 35 </Paragraph> |
39 <Paragraph> | 36 <Paragraph> |
40 .nearestViewportElement of redCircle=nestedSVG | 37 .nearestViewportElement of redCircle=nestedSVG |
41 </Paragraph> | 38 </Paragraph> |
42 </OperatorScript> | 39 </OperatorScript> |
43 </SVGTestCase> | 40 </SVGTestCase> |
44 <title id="test-title">types-basicDOM-01-b.svg</title> | 41 <title id="test-title">types-basicDOM-01-b.svg</title> |
45 <!--======================================================================--> | 42 <!--======================================================================--> |
46 <!--Content of Test Case follows... =====================--> | 43 <!--Content of Test Case follows... =====================--> |
47 <!--======================================================================--> | 44 <!--======================================================================--> |
48 <g id="test-body-content"> | 45 <g id="test-body-content"> |
49 <script type="text/ecmascript"><![CDATA[ | 46 <script type="text/ecmascript"><![CDATA[ |
50 function testSVGLocatable() { | 47 function testSVGLocatable() { |
51 var rotText = document.getElementById("rotatedText"); | 48 var rotText = document.getElementById("rotatedText"); |
52 var redCircle = document.getElementById("redCircle") | 49 var redCircle = document.getElementById("redCircle") |
53 var matr = rotText.getScreenCTM(); | 50 var matr = rotText.getScreenCTM(); |
54 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); | 51 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); |
55 var matr = rotText.getCTM(); | 52 var matr = rotText.getCTM(); |
56 document.getElementById("result2").firstChild.nodeValue
= ".getCTM(): " + matr.a.toFixed(2) + "," + matr.b.toFixed(2) + "," + matr.c.toF
ixed(2) + "," + matr.d.toFixed(2) + "," + matr.e.toFixed(2) + "," + matr.f.toFix
ed(2); | 53 document.getElementById("result2").firstChild.nodeValue
= ".getCTM(): " + matr.a.toFixed(2) + "," + matr.b.toFixed(2) + "," + matr.c.toF
ixed(2) + "," + matr.d.toFixed(2) + "," + matr.e.toFixed(2) + "," + matr.f.toFix
ed(2); |
57 var matr = rotText.getTransformToElement(document.getEle
mentById("parentGroup")); | |
58 document.getElementById("result3").firstChild.nodeValue
= ".getTransformToElement(): " + matr.a.toFixed(2) + "," + matr.b.toFixed(2) + "
," + matr.c.toFixed(2) + "," + matr.d.toFixed(2) + "," + matr.e.toFixed(2) + ","
+ matr.f.toFixed(2); | |
59 var bbox = redCircle.getBBox(); | 54 var bbox = redCircle.getBBox(); |
60 » » » document.getElementById("result4").firstChild.nodeValue
= ".getBBox() for 'redCircle': .x="+bbox.x+",.y="+bbox.y+",.width="+bbox.width+"
,.height="+bbox.height; | 55 » » » document.getElementById("result3").firstChild.nodeValue
= ".getBBox() for 'redCircle': .x="+bbox.x+",.y="+bbox.y+",.width="+bbox.width+"
,.height="+bbox.height; |
61 » » » document.getElementById("result5").firstChild.nodeValue
= ".farthestViewportElement of redCircle="+redCircle.farthestViewportElement.get
AttributeNS(null,"id"); | 56 » » » document.getElementById("result4").firstChild.nodeValue
= ".farthestViewportElement of redCircle="+redCircle.farthestViewportElement.get
AttributeNS(null,"id"); |
62 » » » document.getElementById("result6").firstChild.nodeValue
= ".nearestViewportElement of redCircle="+redCircle.nearestViewportElement.getAt
tributeNS(null,"id"); | 57 » » » document.getElementById("result5").firstChild.nodeValue
= ".nearestViewportElement of redCircle="+redCircle.nearestViewportElement.getAt
tributeNS(null,"id"); |
63 } | 58 } |
64 ]]></script> | 59 ]]></script> |
65 <g font-family="sans-serif" font-size="12"> | 60 <g font-family="sans-serif" font-size="12"> |
66 <g id="parentGroup" transform="translate(70,-60)"> | 61 <g id="parentGroup" transform="translate(70,-60)"> |
67 <text id="rotatedText" transform="scale(0.6),rot
ate(45)" font-size="20" x="30" y="150">Rotated Text for testing SVGLocatable</te
xt> | 62 <text id="rotatedText" transform="scale(0.6),rot
ate(45)" font-size="20" x="30" y="150">Rotated Text for testing SVGLocatable</te
xt> |
68 <text id="otherText" transform="scale(0.7)" font
-size="20" x="100" y="130">Some other text with id 'otherText'</text> | 63 <text id="otherText" transform="scale(0.7)" font
-size="20" x="100" y="130">Some other text with id 'otherText'</text> |
69 <svg id="nestedSVG" x="200" y="100" width="110"
height="110" viewBox="-55 -55 110 110"> | 64 <svg id="nestedSVG" x="200" y="100" width="110"
height="110" viewBox="-55 -55 110 110"> |
70 <circle id="redCircle" cx="0" cy="0" r="
50" fill="red"/> | 65 <circle id="redCircle" cx="0" cy="0" r="
50" fill="red"/> |
71 </svg> | 66 </svg> |
72 </g> | 67 </g> |
73 <text id="result1" x="10" y="200"> </text> | 68 <text id="result1" x="10" y="200"> </text> |
74 <text id="result2" x="10" y="220"> </text> | 69 <text id="result2" x="10" y="220"> </text> |
75 <text id="result3" x="10" y="240"> </text> | 70 <text id="result3" x="10" y="240"> </text> |
76 <text id="result4" x="10" y="260"> </text> | 71 <text id="result4" x="10" y="260"> </text> |
77 <text id="result5" x="10" y="280"> </text> | 72 <text id="result5" x="10" y="280"> </text> |
78 <text id="result6" x="10" y="300"> </text> | |
79 </g> | 73 </g> |
80 </g> | 74 </g> |
81 <text id="revision" x="10" y="340" font-size="40" stroke="none" fill="black">$
Revision: 1.1 $</text> | 75 <text id="revision" x="10" y="340" font-size="40" stroke="none" fill="black">$
Revision: 1.1 $</text> |
82 <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke=
"#000"/> | 76 <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke=
"#000"/> |
83 </svg> | 77 </svg> |
OLD | NEW |