Debian Codegraph @

test_non_regression/fail/na/script/struct-dom-14-f.svg

raw
1 <svg id="svg-root" width="100%" height="100%"
2 viewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg"
3 xmlns:xlink="http://www.w3.org/1999/xlink" onload="runTest()">
4 <!--======================================================================-->
5 <!--= Copyright 2008 World Wide Web Consortium, (Massachusetts =-->
6 <!--= Institute of Technology, European Research Consortium for =-->
7 <!--= Informatics and Mathematics (ERCIM), Keio University). =-->
8 <!--= All Rights Reserved. =-->
9 <!--= See http://www.w3.org/Consortium/Legal/. =-->
10 <!--======================================================================-->
11 <d:SVGTestCase xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/"
12 template-version="1.4" reviewer="SVGWG" author="ED" status="accepted"
13 version="$Revision: 1.4 $" testname="$RCSfile: struct-dom-14-f.svg,v $">
14 <d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGElementInstance">
15 <p>
16 Test SVGElementInstance.childNodes.
17 </p>
18 <p>
19 The test has an optional subtest that indicates whether SVGElementInstance.firstChild and
20 SVGElementInstance.childNodes.item(0) are strictly equal. The status of this subtest is
21 displayed by a circle in the middle of the testframe, it will be yellow if the objects are
22 not strictly equal, and green if they are.
23 </p>
24 </d:testDescription>
25 <d:operatorScript xmlns="http://www.w3.org/1999/xhtml">
26 <p>
27 Run the test. No interaction required.
28 </p>
29 </d:operatorScript>
30 <d:passCriteria xmlns="http://www.w3.org/1999/xhtml">
31 <p>
32 The test is passed if there is a green rect visible,
33 and there is a yellow or dark green circle in the middle.
34 If there's any red visible the test has failed.
35 </p>
36 </d:passCriteria>
37 </d:SVGTestCase>
38 <title id="test-title">$RCSfile: struct-dom-14-f.svg,v $</title>
39 <defs>
40 <font-face
41 font-family="SVGFreeSansASCII"
42 unicode-range="U+0-7F">
43 <font-face-src>
44 <font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/>
45 </font-face-src>
46 </font-face>
47 </defs>
48 <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
49
50 <defs>
51 <g id="defsg1">
52 <circle id="defscircle3" cx="80" cy="180" r="25"/>
53 <circle id="defscircle4" cx="1000" cy="180" r="25"/>
54 <use xlink:href="#defscircle4" transform="translate(-600, 0)"/>
55 </g>
56 <script>
57 <![CDATA[
58 function runTest()
59 {
60 try
61 {
62 var use = document.getElementById("use1");
63 var instanceroot = use.instanceRoot;
64
65 if (instanceroot.firstChild.correspondingElement !== instanceroot.childNodes.item(0).correspondingElement)
66 throw("failed");
67 if (instanceroot.firstChild.nextSibling.correspondingElement !== instanceroot.childNodes.item(1).correspondingElement)
68 throw("failed");
69 if (instanceroot.lastChild.correspondingElement !== instanceroot.childNodes.item(instanceroot.childNodes.length-1).correspondingElement)
70 throw("failed");
71
72 // indicate test passed
73 document.getElementById("status").setAttribute("fill", "lime");
74
75 // This is an optional part of the test, which indicates whether SVGElementInstance(List) follows the normal DOM NodeList conventions and
76 // whether the returned objects are actually the same objects as those that the SVGElementInstance traversal attributes return.
77 if (instanceroot.firstChild !== instanceroot.childNodes.item(0))
78 throw("failed");
79 if (instanceroot.firstChild.nextSibling !== instanceroot.childNodes.item(1))
80 throw("failed");
81 if (instanceroot.lastChild !== instanceroot.childNodes.item(instanceroot.childNodes.length-1))
82 throw("failed");
83
84 // indicate status of the optional part of the test
85 document.getElementById("optional").setAttribute("fill", "green");
86 }
87 catch(e)
88 {
89 }
90 }
91 ]]>
92 </script>
93 </defs>
94
95 <use id="use1" xlink:href="#defsg1"/>
96
97 <rect id="status" width="100%" height="100%" fill="red"/>
98 <circle id="optional" cx="50%" cy="50%" r="10%" fill="yellow"/>
99
100 </g>
101 <g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
102 <text id="revision" x="10" y="340" stroke="none"
103 fill="black">$Revision: 1.4 $</text>
104 </g>
105 <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/>
106 <!-- comment out this watermark once the test is approved -->
107 <!--g id="draft-watermark">
108 <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/>
109 <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240"
110 text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text>
111 </g-->
112 </svg>