| 1 |
<svg id="svg-root" width="100%" height="100%" viewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> |
| 2 |
<!--======================================================================--> |
| 3 |
<!--= Copyright 2008 World Wide Web Consortium, (Massachusetts =--> |
| 4 |
<!--= Institute of Technology, European Research Consortium for =--> |
| 5 |
<!--= Informatics and Mathematics (ERCIM), Keio University). =--> |
| 6 |
<!--= All Rights Reserved. =--> |
| 7 |
<!--= See http://www.w3.org/Consortium/Legal/. =--> |
| 8 |
<!--======================================================================--> |
| 9 |
<d:SVGTestCase xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/" template-version="1.4" reviewer="[reviewer]" author="Microsoft" status="created" version="$Revision: 1.4 $" testname="$RCSfile: struct-dom-18-f.svg,v $"> |
| 10 |
<d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://dev.w3.org/SVG/profiles/1.1F2/publish/struct.html#InterfaceSVGSVGElement"> |
| 11 |
<p> |
| 12 |
<!--[[ |
| 13 |
The 'SVGSVGElement' supports 'getIntersectionList' and 'getEnclosureList' with all renderable elements. |
| 14 |
]]--> |
| 15 |
</p> |
| 16 |
</d:testDescription> |
| 17 |
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
| 18 |
<p> |
| 19 |
<!--[[ |
| 20 |
Markup for an instance of each renderable SVG element is placed in an 'svg' element. The 'getIntersectionList' and 'getEnclosureList' |
| 21 |
methods are called from a reference to the parent 'svg' element. For 'getIntersectionList', an 'SVGRect' is used with 'x', 'y', 'width', |
| 22 |
and 'height' attributes set to intersect each of the renderable elements. For 'getEnclosureList', the same 'SVGRect' is modified to |
| 23 |
completely enclose all of the renderable elements. For both 'getIntersectionList' and 'getEnclosureList', the returned 'NodeList' element |
| 24 |
is iterated through and each element is verified through their respective 'id' attributes. For the 'use' element, the 'correspondingUseElement' |
| 25 |
attribute must be used because an 'SVGElementInstance' reference is obtained via 'getEnclosureList' and 'getIntersectionList'. |
| 26 |
]]--> |
| 27 |
</p> |
| 28 |
</d:operatorScript> |
| 29 |
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
| 30 |
<p> |
| 31 |
<!--[[ |
| 32 |
Test passes if there is no red visible on the page. |
| 33 |
]]--> |
| 34 |
</p> |
| 35 |
</d:passCriteria> |
| 36 |
</d:SVGTestCase> |
| 37 |
<title id="test-title">$RCSfile: struct-dom-18-f.svg,v $</title> |
| 38 |
<defs> |
| 39 |
<font-face |
| 40 |
font-family="SVGFreeSansASCII" |
| 41 |
unicode-range="U+0-7F"> |
| 42 |
<font-face-src> |
| 43 |
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> |
| 44 |
</font-face-src> |
| 45 |
</font-face> |
| 46 |
</defs> |
| 47 |
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> |
| 48 |
<svg id="testSVG"> |
| 49 |
<circle cx="96" cy="96" r="48" id="testCircle" /> |
| 50 |
<ellipse cx="96" cy="96" rx="48" ry="48" id="testEllipse" /> |
| 51 |
<line x1="10" y1="10" x2="10" y2="100" stroke="black" id="testLine" /> |
| 52 |
<path d="M0 10 H 100" stroke-width="5" stroke="black" fill="none" id="testPath" /> |
| 53 |
<polyline points="0,0 120,100 120,120" stroke="black" fill="black" id="testPolyline" /> |
| 54 |
<polygon points="0,0 100,100" stroke="black" fill="black" id="testPolygon" /> |
| 55 |
<rect width="96" height="96" id="testRect" /> |
| 56 |
<use xlink:href="#testRect" id="testUse" /> |
| 57 |
<image xlink:href="../images/black10x10.png" width="100" height="100" id="testImage" /> |
| 58 |
<text x="100" y="100" fill="black" id="testText">Filler text</text> |
| 59 |
</svg> |
| 60 |
<text id="failText" x="350" y="350" font-size="50" fill="red">FAIL</text> |
| 61 |
<script type="text/javascript"><![CDATA[ |
| 62 |
try |
| 63 |
{ |
| 64 |
var passedCount = 0; |
| 65 |
var expectedIDList = ["testCircle", "testEllipse", "testLine", "testPath", "testPolyline", "testPolygon", "testRect", "testUse", "testImage", "testText"]; |
| 66 |
var testSVG = document.getElementById("testSVG"); |
| 67 |
var rectElem = testSVG.createSVGRect(); |
| 68 |
|
| 69 |
rectElem.x = 10; |
| 70 |
rectElem.y = 0; |
| 71 |
rectElem.width = 130; |
| 72 |
rectElem.height = 98; |
| 73 |
|
| 74 |
var intersectionList = testSVG.getIntersectionList(rectElem, null); |
| 75 |
|
| 76 |
if (null != intersectionList && expectedIDList.length == intersectionList.length) |
| 77 |
{ |
| 78 |
passedCount++; |
| 79 |
} |
| 80 |
|
| 81 |
for (var i = 0; i < intersectionList.length; i++) |
| 82 |
{ |
| 83 |
var curIntersection = intersectionList[i]; |
| 84 |
var curExpectedId = expectedIDList[i]; |
| 85 |
|
| 86 |
if (curExpectedId == curIntersection.id) |
| 87 |
{ |
| 88 |
passedCount++; |
| 89 |
} |
| 90 |
// Special case for "use" and SVGElementInstance |
| 91 |
else if (null != curIntersection.correspondingUseElement && curExpectedId == curIntersection.correspondingUseElement.id) |
| 92 |
{ |
| 93 |
passedCount++; |
| 94 |
} |
| 95 |
} |
| 96 |
|
| 97 |
rectElem.x = 0; |
| 98 |
rectElem.y = 0; |
| 99 |
rectElem.width = 200; |
| 100 |
rectElem.height = 200; |
| 101 |
|
| 102 |
var enclosureList = testSVG.getEnclosureList(rectElem, null); |
| 103 |
|
| 104 |
if (null != enclosureList && expectedIDList.length == enclosureList.length) |
| 105 |
{ |
| 106 |
passedCount++; |
| 107 |
} |
| 108 |
|
| 109 |
for (var i = 0; i < enclosureList.length; i++) |
| 110 |
{ |
| 111 |
var curEnclosure = enclosureList[i]; |
| 112 |
var curExpectedId = expectedIDList[i]; |
| 113 |
|
| 114 |
if (curExpectedId == curEnclosure.id) |
| 115 |
{ |
| 116 |
passedCount++; |
| 117 |
} |
| 118 |
// Special case for "use" and SVGElementInstance |
| 119 |
else if (null != curEnclosure.correspondingUseElement && curExpectedId == curEnclosure.correspondingUseElement.id) |
| 120 |
{ |
| 121 |
passedCount++; |
| 122 |
} |
| 123 |
} |
| 124 |
|
| 125 |
if (22 == passedCount) |
| 126 |
{ |
| 127 |
document.getElementById("failText").setAttribute("display", "none"); |
| 128 |
} |
| 129 |
} |
| 130 |
catch(ex) |
| 131 |
{ |
| 132 |
// alert('ERROR: ' + ex.message); |
| 133 |
}]]> |
| 134 |
</script> |
| 135 |
</g> |
| 136 |
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> |
| 137 |
<text id="revision" x="10" y="340" stroke="none" |
| 138 |
fill="black">$Revision: 1.4 $</text> |
| 139 |
</g> |
| 140 |
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/> |
| 141 |
<!-- comment out this watermark once the test is approved --> |
| 142 |
<g id="draft-watermark"> |
| 143 |
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> |
| 144 |
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" |
| 145 |
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> |
| 146 |
</g> |
| 147 |
</svg> |