OLD | NEW |
| (Empty) |
1 <?xml version="1.0" encoding="UTF-8"?> | |
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics
/SVG/1.1/DTD/svg11-basic.dtd"> | |
3 <!--======================================================================--> | |
4 <!--= Copyright 2000 World Wide Web Consortium, (Massachusetts =--> | |
5 <!--= Institute of Technology, Institut National de Recherche en =--> | |
6 <!--= Informatique et en Automatique, Keio University). All Rights =--> | |
7 <!--= Reserved. See http://www.w3.org/Consortium/Legal/. =--> | |
8 <!--======================================================================--> | |
9 <!-- ===================================================================== --> | |
10 <!-- struct-dom-02-f --> | |
11 <!-- split for 1.1 suite to struct-dom-02-b --> | |
12 <!-- dom-featureString-BE-03.svg --> | |
13 <!-- renamed for 1.1 suite to struct-dom-02-b --> | |
14 <!-- Author : Vincent Hardy 06-08-2000 --> | |
15 <!-- Revised for 1.1 : Chris Lilley, 15-Mar-2002 --> | |
16 <!-- Revised for 1.1 : Darryl Fuller, 27-Jun-2002 --> | |
17 <!--======================================================================--> | |
18 <svg version="1.1" baseProfile="basic" xmlns="http://www.w3.org/2000/svg" xmlns:
xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" vi
ewBox="0 0 480 360" onload="domTest(evt)"> | |
19 <SVGTestCase xmlns="http://www.w3.org/2000/02/svg/testsuite/description/"> | |
20 <OperatorScript version="$Revision: 1.1 $" testname="struct-dom-
02-b.svg"> | |
21 <Paragraph>Verify the basic capability to handle the has
Feature DOMImplementation method. | |
22 The DOMImplementation instance is retreived from the Doc
ument instance. Then, | |
23 its hasFeature method is invoked on the various SVG feat
ure strings. | |
24 </Paragraph> | |
25 <Paragraph>The test displays the set of SVG feature stri
ngs and, next to them, a text | |
26 string that shows whether the feature is supported or no
t. | |
27 </Paragraph> | |
28 <Paragraph>Note that the test passes whether or not the
feature is supported (i.e., true or | |
29 false are valid). The test fails if no value (true or fa
lse) appears next to the feature string | |
30 value. | |
31 </Paragraph> | |
32 <Paragraph>Note that this test uses the 'onload' event o
n the root svg element. | |
33 </Paragraph> | |
34 <Paragraph>The rendered picture should match the referen
ce image, except for the yes and | |
35 no values which may differ depending on the implementati
on. | |
36 </Paragraph> | |
37 </OperatorScript> | |
38 </SVGTestCase> | |
39 <title id="test-title">struct-dom-02-b</title> | |
40 <desc id="test-desc">Checks if DOM/ECMA Script binding is supported. Che
cks support for the | |
41 hasFeature method on the DOMImplementation. | |
42 </desc> | |
43 <!--====================================================================
==--> | |
44 <!--Content of Test Case follows... ===================
==--> | |
45 <!--====================================================================
==--> | |
46 <g id="test-body-content"> | |
47 <script type="text/ecmascript"><![CDATA[ | |
48 | |
49 var featureStrings = new Array(); | |
50 var length = 0; | |
51 featureStrings[length++] = "xml"; | |
52 featureStrings[length++] = "stylesheets"; | |
53 featureStrings[length++] = "views"; | |
54 featureStrings[length++] = "css2"; | |
55 featureStrings[length++] = "events"; | |
56 var svg_ns = "http://www.w3.org/2000/svg" | |
57 function domTest(evt) { | |
58 // Get Document | |
59 var target = evt.target; | |
60 var doc = target.ownerDocument; | |
61 | |
62 // Get DOMImplementation | |
63 var domImpl = doc.implementation; | |
64 | |
65 // | |
66 // Iterate through the feature strings | |
67 // | |
68 for(var i=0; i<featureStrings.length; i++){ | |
69 var supports = domImpl.hasFeature(featureStrings[i], '2.
0'); | |
70 // | |
71 // if time, pretty up by putting xml to traveral in a le
ft column and | |
72 // org.w3c.svg to org.w3c.dom.svg.all in a right column;
add an extra | |
73 // parameter to addTextElemen t for x coord, and test if
i < 9 | |
74 // | |
75 addTextElement(featureStrings[i], supports, doc, target,
(55 + 55*i)); | |
76 } | |
77 } | |
78 | |
79 function addTextElement(label, value, doc, svg, y){ | |
80 var newText = doc.createElementNS(svg_ns, 'text'); | |
81 newText.setAttribute('font-size', '30'); | |
82 newText.setAttribute('x', '10'); | |
83 newText.setAttribute('y', y); | |
84 var textValue = label; | |
85 var textContent = doc.createTextNode(textValue); | |
86 newText.appendChild(textContent); | |
87 svg.appendChild(newText); | |
88 | |
89 newText = doc.createElementNS(svg_ns, 'text'); | |
90 newText.setAttribute('font-size', '30'); | |
91 newText.setAttribute('x', '340'); | |
92 newText.setAttribute('y', y); | |
93 textValue = value; | |
94 textContent = doc.createTextNode(textValue); | |
95 newText.appendChild(textContent); | |
96 svg.appendChild(newText); | |
97 } | |
98 | |
99 ]]></script> | |
100 </g> | |
101 <text id="revision" x="10" y="340" font-size="30" stroke="none" fill="bl
ack">$Revision: 1.1 $</text> | |
102 <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" s
troke="#000000"/> | |
103 </svg> | |
104 | |
OLD | NEW |