| 1 |
<svg version="1.1" baseProfile="basic" onload="onEvent(evt, 'Rect6', 'visible')" 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="SVGWG" author="Jon Ferraiolo" status="accepted |
| 15 |
" |
| 16 |
version="$Revision: 1.6 $" testname="$RCSfile: interact-events-01-b.svg,v $"> |
| 17 |
<d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/interact.html#SVGEvents"> |
| 18 |
<p> |
| 19 |
Test 'onload' event attribute. |
| 20 |
</p> |
| 21 |
<p> |
| 22 |
Six blue rectangles have been defined, each initially defined with |
| 23 |
'visibility:hidden'. 'onload' event attributes are assigned in |
| 24 |
a variety of ways, usually to set 'visibility:visible'. |
| 25 |
The red text indicates the correct behavior |
| 26 |
(whether a given rectangle should appear in the visual result). |
| 27 |
</p> |
| 28 |
<p> |
| 29 |
The first rectangle has no associated 'onload' event so it remains invisible. |
| 30 |
The second rectangle has an 'onload' event on itself, which invokes a script |
| 31 |
which sets 'visibility:visible', so it should appear. |
| 32 |
The third rectangle has an 'onload' event on its parent 'g', which invokes a script |
| 33 |
which sets 'visibility:visible' on the rectangle, so it should appear. |
| 34 |
The fourth rectangle has an 'onload' event on an ancestor 'svg', which invokes a script |
| 35 |
which sets 'visibility:visible' on the rectangle, so it should appear. |
| 36 |
The fifth rectangle has an 'onload' event both itself and its parent 'g'. |
| 37 |
The rectangle's script sets 'visibility:visible' on the rectangle |
| 38 |
but the parent's script sets 'visibility:hidden' on the rectangle, |
| 39 |
which should happen afterwards, so the rectangle should not appear. |
| 40 |
The sixth rectangle has an 'onload' event on the outermost 'svg', which invokes a script |
| 41 |
which sets 'visibility:visible' on the rectangle, so it should appear. |
| 42 |
</p> |
| 43 |
</d:testDescription> |
| 44 |
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
| 45 |
<p>Run the test. No interaction required.</p> |
| 46 |
</d:operatorScript> |
| 47 |
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
| 48 |
<p> |
| 49 |
The test is passed if blue squares are visible for subtests 2, 3, 4 and 6 (only) |
| 50 |
</p> |
| 51 |
</d:passCriteria> |
| 52 |
</d:SVGTestCase> |
| 53 |
<title id="test-title">$RCSfile: interact-events-01-b.svg,v $</title> |
| 54 |
<defs> |
| 55 |
<font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F"> |
| 56 |
<font-face-src> |
| 57 |
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> |
| 58 |
</font-face-src> |
| 59 |
</font-face> |
| 60 |
</defs> |
| 61 |
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> |
| 62 |
<defs> |
| 63 |
<script type="text/ecmascript"><![CDATA[ |
| 64 |
|
| 65 |
function onEvent(evt, indicatorId, visibilityValue){ |
| 66 |
// Get Document |
| 67 |
var target = evt.target; |
| 68 |
var doc = target.ownerDocument; |
| 69 |
|
| 70 |
// Mark test as passed |
| 71 |
var elementToShow = doc.getElementById(indicatorId); |
| 72 |
elementToShow.setAttribute('visibility', '' + visibilityValue); |
| 73 |
} |
| 74 |
|
| 75 |
]]></script> |
| 76 |
</defs> |
| 77 |
<text font-family="Arial" font-size="40" x="30" y="40"> |
| 78 |
'onload' event attribute. |
| 79 |
</text> |
| 80 |
<g font-family="Arial" font-size="40" fill="blue" stroke="none"> |
| 81 |
<g transform="translate(77.5,45)"> |
| 82 |
<rect id="Rect1" width="80" height="80" visibility="hidden"/> |
| 83 |
<text x="-30" y="120" fill="red">1: No</text> |
| 84 |
</g> |
| 85 |
<g transform="translate(202.5,45)"> |
| 86 |
<rect id="Rect2" width="80" height="80" onload="onEvent(evt, 'Rect2', 'visible')" visibility="hidden"/> |
| 87 |
<text x="-30" y="120" fill="red">2: Yes</text> |
| 88 |
</g> |
| 89 |
<g transform="translate(327.5,45)"> |
| 90 |
<g onload="onEvent(evt, 'Rect3', 'visible')"> |
| 91 |
<rect id="Rect3" width="80" height="80" visibility="hidden"/> |
| 92 |
</g> |
| 93 |
<text x="-30" y="120" fill="red">3: Yes</text> |
| 94 |
</g> |
| 95 |
<g transform="translate(77.5,178)"> |
| 96 |
<svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="200" height="200" onload="onEvent(evt, 'Rect4', 'visible')"> |
| 97 |
<rect id="Rect4" width="80" height="80" visibility="hidden"/> |
| 98 |
</svg> |
| 99 |
<text x="-30" y="120" fill="red">4: Yes</text> |
| 100 |
</g> |
| 101 |
<g transform="translate(202.5,178)"> |
| 102 |
<g onload="onEvent(evt, 'Rect5', 'hidden')"> |
| 103 |
<rect id="Rect5" width="80" height="80" onload="onEvent(evt, 'Rect5', 'visible')" visibility="hidden"/> |
| 104 |
</g> |
| 105 |
<text x="-30" y="120" fill="red">5: No</text> |
| 106 |
</g> |
| 107 |
<g transform="translate(327.5,178)"> |
| 108 |
<rect id="Rect6" width="80" height="80" visibility="hidden"/> |
| 109 |
<text x="-30" y="120" fill="red">6: Yes</text> |
| 110 |
</g> |
| 111 |
</g> |
| 112 |
</g> |
| 113 |
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> |
| 114 |
<text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.6 $</text> |
| 115 |
</g> |
| 116 |
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/> |
| 117 |
<!-- comment out this watermark once the test is approved --> |
| 118 |
<!--<g id="draft-watermark"> |
| 119 |
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> |
| 120 |
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" |
| 121 |
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> |
| 122 |
</g>--> |
| 123 |
</svg> |