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">
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=
"ED" author=
"CM" status=
"accepted"
13 version=
"$Revision: 1.5 $" testname=
"$RCSfile: struct-dom-11-f.svg,v $">
14 <d:testDescription xmlns=
"http://www.w3.org/1999/xhtml" href=
"http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGSVGElement">
16 This tests that the getIntersectionList() and getEnclosureList()
17 methods return NodeLists that are not live.
20 After loading the test, two rectangles will be presented. The
21 upper rectangle indicates the result of testing whether
22 getIntersectionList() returns a non-live NodeList, while the
23 lower rectangle indicates so for getEnclosureList().
26 <d:operatorScript xmlns=
"http://www.w3.org/1999/xhtml">
28 Run the test. No interaction required.
31 <d:passCriteria xmlns=
"http://www.w3.org/1999/xhtml">
33 The test is passed if both rectangles are green.
37 <title id=
"test-title">$RCSfile: struct-dom-
11-f.svg,v $
</title>
40 font-family=
"SVGFreeSansASCII"
41 unicode-range=
"U+0-7F">
43 <font-face-uri xlink:
href=
"../resources/SVGFreeSans.svg#ascii"/>
47 <g id=
"test-body-content" font-family=
"SVGFreeSansASCII,sans-serif" font-size=
"18">
49 <text x='
10' y='
40' font-size='
13'
>Test getIntersectionList and getEnclosureList return value liveness
</text>
51 <rect id='r1' x='
10' y='
70' width='
50' height='
50' fill='black'
/>
52 <text x='
70' y='
100'
>getIntersectionList
</text>
54 <rect id='r2' x='
10' y='
130' width='
50' height='
50' fill='black'
/>
55 <text x='
70' y='
160'
>getEnclosureList
</text>
57 <g id=
"g1" visibility=
"hidden" pointer-events=
"painted">
58 <circle id='c1' cx='
305' cy='
100' r='
5'
/>
59 <circle id='c2' cx='
305' cy='
150' r='
5'
/>
64 function userspace2viewport(elm, r)
66 var ctm = elm.getCTM();
69 for(var i =
0; i <
4; i++)
70 corners.push(svg.createSVGPoint());
74 corners[
1].x = r.x + r.width;
76 corners[
2].x = r.x + r.width;
77 corners[
2].y = r.y + r.height;
79 corners[
3].y = r.y + r.height;
81 for(var i =
0; i <
4; i++)
82 corners[i] = corners[i].matrixTransform(ctm);
84 var min = svg.createSVGPoint();
85 var max = svg.createSVGPoint();
91 for(var i =
1; i <
4; i++)
107 var res = svg.createSVGRect();
110 res.width = max.x - min.x;
111 res.height = max.y - min.y;
115 var svg = document.documentElement,
116 c = document.getElementById('c'),
117 r1 = document.getElementById('r1'),
118 r2 = document.getElementById('r2'),
119 c1 = document.getElementById('c1'),
120 c2 = document.getElementById('c2'),
121 g1 = document.getElementById('g1'),
122 r = svg.createSVGRect(),
131 r = userspace2viewport(g1, r);
133 nl = svg.getIntersectionList(r, null);
134 if (nl && nl.length ==
1) {
135 c1.parentNode.removeChild(c1);
136 r1.setAttribute('fill', nl.length ==
1 ? 'lime' : 'red');
147 r = userspace2viewport(g1, r);
149 nl = svg.getEnclosureList(r, null);
150 if (nl && nl.length ==
1) {
151 c2.parentNode.removeChild(c2);
152 r2.setAttribute('fill', nl.length ==
1 ? 'lime' : 'red');
158 <g font-family=
"SVGFreeSansASCII,sans-serif" font-size=
"32">
159 <text id=
"revision" x=
"10" y=
"340" stroke=
"none"
160 fill=
"black">$Revision:
1.5 $
</text>
162 <rect id=
"test-frame" x=
"1" y=
"1" width=
"478" height=
"358" fill=
"none" stroke=
"#000"/>
163 <!-- comment out this watermark once the test is approved -->
164 <!--<g id="draft-watermark">
165 <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/>
166 <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240"
167 text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text>