Debian Codegraph @

test_non_regression/fail/na/script/struct-dom-06-b.svg

raw
1 <svg version="1.1" baseProfile="basic" onload="domTest(evt)" id="svg-root"
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">
4 <!--======================================================================-->
5 <!--= SVG 1.1 2nd Edition Test Case =-->
6 <!--======================================================================-->
7 <!--= Copyright 2009 World Wide Web Consortium, (Massachusetts =-->
8 <!--= Institute of Technology, European Research Consortium for =-->
9 <!--= Informatics and Mathematics (ERCIM), Keio University). =-->
10 <!--= All Rights Reserved. =-->
11 <!--= See http://www.w3.org/Consortium/Legal/. =-->
12 <!--======================================================================-->
13 <d:SVGTestCase xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/"
14 template-version="1.4" reviewer="SVGWG" author="Vincent Hardy" status="accepted"
15 version="$Revision: 1.8 $" testname="$RCSfile: struct-dom-06-b.svg,v $">
16 <d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/struct.html#DOMInterfaces">
17 <p>
18 Verify the basic capability to handle the DOM API. The test is composed of a top
19 level svg element with an onload event handler. This handler invokes core (i.e., non
20 SVG specific) DOM API methods to modify the document's content: it removes an element,
21 modifies an attribute and adds elements.
22 </p>
23 </d:testDescription>
24 <d:operatorScript xmlns="http://www.w3.org/1999/xhtml">
25 <p>
26 Run the test. No interaction required.
27 </p>
28 </d:operatorScript>
29 <d:passCriteria xmlns="http://www.w3.org/1999/xhtml">
30 <p>The test passes if the text "DOM API is supported" is shown, the text
31 "Removing DOM Elements is not supported" is not shown, and no red is
32 visible.</p>
33 </d:passCriteria>
34 </d:SVGTestCase>
35 <title id="test-title">$RCSfile: struct-dom-06-b.svg,v $</title>
36 <defs>
37 <font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F">
38 <font-face-src>
39 <font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/>
40 </font-face-src>
41 </font-face>
42 </defs>
43 <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
44 <script type="text/ecmascript"><![CDATA[
45
46 function domTest(evt) {
47 // Get Document
48 var target = evt.target;
49 var doc = target.ownerDocument;
50
51 //
52 // Test attribute modification
53 //
54 var attributeErrorRect = doc.getElementById('attributeErrorRect');
55 attributeErrorRect.setAttribute('width', '0')
56 attributeErrorRect.setAttribute('height', '0');
57
58 //
59 // Test removing element from DOM tree
60 //
61 var elementErrorText = doc.getElementById('elementErrorText');
62 var parent = elementErrorText.parentNode;
63 parent.removeChild(elementErrorText);
64
65 //
66 // Test adding element to the DOM tree
67 //
68 var svg_ns = "http://www.w3.org/2000/svg"
69 var newText = doc.createElementNS(svg_ns, 'text');
70 newText.setAttribute('x', '50');
71 newText.setAttribute('y', '200');
72 var textContent = doc.createTextNode('DOM API is supported');
73 newText.appendChild(textContent);
74 parent.appendChild(newText);
75 }
76
77 ]]></script>
78 <!-- ===================================================================== -->
79 <!-- The following rectangle's color is red. It is modified to zero size -->
80 <!-- in the 'domTest' ECMAScript handler. -->
81 <!-- ===================================================================== -->
82 <rect id="attributeErrorRect" width="450" height="450" fill="red"/>
83 <!-- ===================================================================== -->
84 <!-- The following text element is removed from the document in the -->
85 <!-- 'domTest' ECMAScript handler. -->
86 <!-- ===================================================================== -->
87 <text id="elementErrorText" x="50" y="200" font-family="Verdana" font-size="30" fill="black">
88 Removing DOM Elements is not supported
89 </text>
90 </g>
91 <g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
92 <text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.8 $</text>
93 </g>
94 <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
95 <!-- comment out this watermark once the test is approved -->
96 <!--<g id="draft-watermark">
97 <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/>
98 <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240"
99 text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text>
100 </g>-->
101 </svg>