Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / W3C-SVG-1.1 / struct-dom-05-b.svg
blobd09b8ec084fd123b7426a6c2a2a8adacfcdf8006
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-05-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%" viewBox="0 0 480 360" onload="domTest(evt)">
17 <SVGTestCase xmlns="http://www.w3.org/2000/02/svg/testsuite/description/">
18 <OperatorScript version="$Revision: 1.2 $" testname="struct-dom-05-b.svg">
19 <Paragraph>Verify the basic capability to handle the hasFeature DOMImplementation method.
20 The DOMImplementation instance is retreived from the Document instance. Then,
21 its hasFeature method is invoked on the various SVG feature strings.
22 </Paragraph>
23 <Paragraph>The test displays the set of SVG feature strings and, next to them, a text
24 string that shows whether the feature is supported or not.
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 false) appears next to the feature string
28 value.
29 </Paragraph>
30 <Paragraph>Note that this test uses the 'onload' event on the root svg element.
31 </Paragraph>
32 <Paragraph>The rendered picture should match the reference image, except for the yes and
33 no values which may differ depending on the implementation.
34 </Paragraph>
35 </OperatorScript>
36 </SVGTestCase>
37 <title id="test-title">struct-dom-05-b</title>
38 <desc id="test-desc">Checks if DOM/ECMA Script binding is supported. Checks 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[
47 var featureStrings = new Array();
48 var length = 0;
50 featureStrings[length++] = "xml";
51 featureStrings[length++] = "stylesheets";
52 featureStrings[length++] = "views";
53 featureStrings[length++] = "css2";
54 featureStrings[length++] = "events";
55 featureStrings[length++] = "uievents ";
56 featureStrings[length++] = "mouseevents";
57 featureStrings[length++] = "mutationevents";
58 featureStrings[length++] = "traversal";
59 featureStrings[length++] = "org.w3c.svg";
60 featureStrings[length++] = "org.w3c.svg.lang";
61 featureStrings[length++] = "org.w3c.svg.dynamic";
62 featureStrings[length++] = "org.w3c.svg.static";
63 featureStrings[length++] = "org.w3c.dom.svg";
64 featureStrings[length++] = "org.w3c.svg";
66 featureStrings[length++] = "org.w3c.dom.svg.static";
67 featureStrings[length++] = "org.w3c.dom.svg.animation";
68 featureStrings[length++] = "org.w3c.dom.svg.dynamic";
69 featureStrings[length++] = "org.w3c.dom.svg.all";
70 featureStrings[length++] = "org.w3c.svg.all";
71 var svg_ns = "http://www.w3.org/2000/svg"
72 function domTest(evt) {
73 // Get Document
74 var target = evt.target;
75 var doc = target.ownerDocument;
77 // Get DOMImplementation
78 var domImpl = doc.implementation;
80 //
81 // Iterate through the feature strings
83 for(var i=0; i<featureStrings.length; i++){
84 var supports = domImpl.hasFeature(featureStrings[i], '2.0');
86 // if time, pretty up by putting xml to traveral in a left column and
87 // org.w3c.svg to org.w3c.dom.svg.all in a right column; add an extra
88 // parameter to addTextElemen t for x coord, and test if i &lt; 9
90 addTextElement(featureStrings[i], supports, doc, target, (45 + 40*i));
94 function addTextElement(label, value, doc, svg, y){
95 var newText = doc.createElementNS(svg_ns, 'text');
96 newText.setAttribute('font-size', '30');
97 newText.setAttribute('x', '5');
98 newText.setAttribute('y', y);
99 var textValue = label;
100 var textContent = doc.createTextNode(textValue);
101 newText.appendChild(textContent);
102 svg.appendChild(newText);
104 newText = doc.createElementNS(svg_ns, 'text');
105 newText.setAttribute('font-size', '30');
106 newText.setAttribute('x', '385');
107 newText.setAttribute('y', y);
108 textValue = value;
109 textContent = doc.createTextNode(textValue);
110 newText.appendChild(textContent);
111 svg.appendChild(newText);
114 ]]></script>
115 </g>
116 <text id="revision" x="10" y="340" font-size="30" stroke="none" fill="black">$Revision: 1.2 $</text>
117 <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
118 </svg>