| 1 |
<svg version="1.1" baseProfile="basic" 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="AN" author="AQ" status="accepted" |
| 15 |
version="$Revision: 1.3 $" testname="$RCSfile: struct-dom-12-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 |
This test checks two properties from the SVGElementInstance interface, correspondingElement and correspondingUseElement |
| 19 |
</p> |
| 20 |
</d:testDescription> |
| 21 |
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
| 22 |
<p> |
| 23 |
Click the grey rectangle on the right side. |
| 24 |
</p> |
| 25 |
</d:operatorScript> |
| 26 |
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
| 27 |
<p> |
| 28 |
For the test to pass, both lines starting with "Test for" must turn to green |
| 29 |
when the grey rectangle on the right side is clicked, and the grey rectangle |
| 30 |
must also turn green. |
| 31 |
</p> |
| 32 |
</d:passCriteria> |
| 33 |
</d:SVGTestCase> |
| 34 |
<title id="test-title">$RCSfile: struct-dom-12-b.svg,v $</title> |
| 35 |
<defs> |
| 36 |
<font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F"> |
| 37 |
<font-face-src> |
| 38 |
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> |
| 39 |
</font-face-src> |
| 40 |
</font-face> |
| 41 |
</defs> |
| 42 |
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> |
| 43 |
|
| 44 |
<defs> |
| 45 |
<rect id="reference" x="240" y="1" width="239" height="358"/> |
| 46 |
<script type="text/ecmascript"><![CDATA[ |
| 47 |
function test (event) { |
| 48 |
|
| 49 |
// get pointers to use and reference elements |
| 50 |
var reference = document.getElementById('reference'); |
| 51 |
var use = document.getElementById('use'); |
| 52 |
|
| 53 |
// initialize the pass count and colors |
| 54 |
var pass = 0; |
| 55 |
var colors = ['red', 'orange', 'green']; |
| 56 |
|
| 57 |
// event.target.correspondingUseElement test |
| 58 |
if (event.target.correspondingUseElement === use) { |
| 59 |
document.getElementById('assertion_1').setAttributeNS(null, 'fill', 'green'); |
| 60 |
pass++; |
| 61 |
} |
| 62 |
|
| 63 |
// event.target.correspondingElement test |
| 64 |
if (event.target.correspondingElement === reference) { |
| 65 |
document.getElementById('assertion_2').setAttributeNS(null, 'fill', 'green'); |
| 66 |
pass++; |
| 67 |
} |
| 68 |
|
| 69 |
// show the result |
| 70 |
use.setAttributeNS(null, 'fill', colors[pass]); |
| 71 |
} |
| 72 |
|
| 73 |
|
| 74 |
]]></script> |
| 75 |
</defs> |
| 76 |
|
| 77 |
<use id="use" xlink:href="#reference" onclick="test(evt)" fill="grey"/> |
| 78 |
|
| 79 |
<text transform="translate(5,20)">Click on the grey rectangle to start</text> |
| 80 |
<text id="assertion_1" fill="red" transform="translate(5,80)">Test for correspondingUseElement</text> |
| 81 |
<text id="assertion_2" fill="red" transform="translate(5,110)">Test for correspondingElement</text> |
| 82 |
|
| 83 |
</g> |
| 84 |
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> |
| 85 |
<text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.3 $</text> |
| 86 |
</g> |
| 87 |
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/> |
| 88 |
<!-- comment out this watermark once the test is approved |
| 89 |
<g id="draft-watermark"> |
| 90 |
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> |
| 91 |
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" |
| 92 |
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> |
| 93 |
</g>--> |
| 94 |
</svg> |