| 1 |
<svg version="1.1" baseProfile="full" onload="init();" 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="AQ" author="ED" status="accepted" |
| 15 |
version="$Revision: 1.8 $" testname="$RCSfile: struct-dom-07-f.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 |
The svg contains three use elements that each reference three rects from an svg element in the document. |
| 19 |
Before the onload-script is run there should be 9 red rects visible. The script changes the fill of the rects to be green. |
| 20 |
</p> |
| 21 |
</d:testDescription> |
| 22 |
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
| 23 |
<p> |
| 24 |
Run the test. No interaction required. |
| 25 |
</p> |
| 26 |
</d:operatorScript> |
| 27 |
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
| 28 |
<p> |
| 29 |
The test is passed if 9 green rectangles are shown. |
| 30 |
</p> |
| 31 |
</d:passCriteria> |
| 32 |
</d:SVGTestCase> |
| 33 |
<title id="test-title">$RCSfile: struct-dom-07-f.svg,v $</title> |
| 34 |
<defs> |
| 35 |
<font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F"> |
| 36 |
<font-face-src> |
| 37 |
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> |
| 38 |
</font-face-src> |
| 39 |
</font-face> |
| 40 |
</defs> |
| 41 |
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> |
| 42 |
<script><![CDATA[ |
| 43 |
function init() |
| 44 |
{ |
| 45 |
var use = document.getElementById("use-elm"); |
| 46 |
var firstElementChild = use.instanceRoot.firstChild; |
| 47 |
|
| 48 |
// Get the <g> elements SVGElementInstance |
| 49 |
while(firstElementChild.correspondingElement.nodeType != Node.ELEMENT_NODE) |
| 50 |
firstElementChild = firstElementChild.nextSibling; |
| 51 |
|
| 52 |
// the childnodes of the g element shadowtree |
| 53 |
var childNodes = firstElementChild.childNodes; |
| 54 |
for(var i = 0; i < childNodes.length; i++) |
| 55 |
{ |
| 56 |
var item = childNodes.item(i); |
| 57 |
if(item.correspondingElement.nodeType == Node.ELEMENT_NODE) |
| 58 |
{ |
| 59 |
item.correspondingElement.setAttribute("fill", "green"); |
| 60 |
} |
| 61 |
} |
| 62 |
} |
| 63 |
]]></script> |
| 64 |
<defs> |
| 65 |
<svg xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-sub-root" viewBox="0 0 450 450"> |
| 66 |
<g id="drawRects" fill="red" stroke="black" stroke-width="5"> |
| 67 |
<rect x="225" y="0" width="225" height="225"/> |
| 68 |
<rect x="0" y="225" width="225" height="225"/> |
| 69 |
<rect x="225" y="225" width="225" height="225"/> |
| 70 |
</g> |
| 71 |
</svg> |
| 72 |
</defs> |
| 73 |
|
| 74 |
<g transform="translate(100,30)"> |
| 75 |
<use id="use-elm" x="60" y="50" width="240" height="240" transform="translate(50,50) scale(0.4)" xlink:href="#svg-sub-root"/> |
| 76 |
<use id="use-elm-2" x="60" y="50" width="240" height="240" transform="scale(0.4)" xlink:href="#svg-sub-root"/> |
| 77 |
<use id="use-elm-3" width="450" height="450" transform="translate(124,120) scale(0.213333)" xlink:href="#drawRects"/> |
| 78 |
</g> |
| 79 |
</g> |
| 80 |
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> |
| 81 |
<text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.8 $</text> |
| 82 |
</g> |
| 83 |
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="black"/> |
| 84 |
<!-- comment out this watermark once the test is approved --> |
| 85 |
<!--<g id="draft-watermark"> |
| 86 |
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> |
| 87 |
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" |
| 88 |
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> |
| 89 |
</g>--> |
| 90 |
</svg> |