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