| 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="SVGWG" author="Vincent Hardy" status="issue" |
| 15 |
version="$Revision: 1.9 $" testname="$RCSfile: script-handle-02-b.svg,v $"> |
| 16 |
<d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/script.html#EventHandling"> |
| 17 |
<p> |
| 18 |
<strong>Resolved to unapproved this test because elements being |
| 19 |
focusable and activatable is underdefined in the spec. ACTION-2977</strong> |
| 20 |
</p> |
| 21 |
<p> |
| 22 |
Tests basic mouse event handlers. |
| 23 |
</p> |
| 24 |
<p> |
| 25 |
The test shows a target that can be used to generate the various |
| 26 |
kinds of events supported in SVG. Below the |
| 27 |
target, the list of events is shown with red markers next to each. |
| 28 |
</p> |
| 29 |
<p> |
| 30 |
If the test passes, all the markers should have turned to green |
| 31 |
after the events have been triggered on the target. If any event |
| 32 |
has not triggered, its marker will remain red. |
| 33 |
</p> |
| 34 |
</d:testDescription> |
| 35 |
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
| 36 |
<p>Load the test. Focus the gray circle, activate it, then move the focus away from the circle.</p> |
| 37 |
</d:operatorScript> |
| 38 |
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
| 39 |
<p>The test passes if, after following the operator script, the three rectangles are green.</p> |
| 40 |
</d:passCriteria> |
| 41 |
</d:SVGTestCase> |
| 42 |
<title id="test-title">$RCSfile: script-handle-02-b.svg,v $</title> |
| 43 |
<defs> |
| 44 |
<font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F"> |
| 45 |
<font-face-src> |
| 46 |
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> |
| 47 |
</font-face-src> |
| 48 |
</font-face> |
| 49 |
</defs> |
| 50 |
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> |
| 51 |
|
| 52 |
<!-- Displayed Title --> |
| 53 |
<text x="100" y="40" fill="black" font-size="24"> |
| 54 |
Mouse event handlers test. |
| 55 |
</text> |
| 56 |
|
| 57 |
<!-- The test defines a target and defines all the handlers for the target --> |
| 58 |
<!-- There are legends for each handler that are modified after the handler--> |
| 59 |
<!-- has been invoked --> |
| 60 |
|
| 61 |
<g id="targetGroup" transform="translate(60, 140)"> |
| 62 |
<text x="-40" y="-50" font-size="32">Target</text> |
| 63 |
<text x="60" y="7" font-size="24">Use the target to trigger events</text> |
| 64 |
<!-- The target has all the event handlers defined --> |
| 65 |
<!-- Use this <g> instead --> |
| 66 |
<g id="target" onfocusin="onEvent(evt, 'onfocusin')" onfocusout="onEvent(evt, 'onfocusout')" onactivate="onEvent(evt, 'onactivate')"> |
| 67 |
|
| 68 |
<circle cx="0" cy="0" r="30" fill="#cccccc" stroke="black"/> |
| 69 |
<line x1="-30" y1="0" x2="30" y2="0"/> |
| 70 |
<line x1="0" y1="-30" x2="0" y2="30"/> |
| 71 |
</g> |
| 72 |
</g> |
| 73 |
<!-- targetGroup --> |
| 74 |
|
| 75 |
<g id="labels"> |
| 76 |
<g id="mouseEvents" transform="translate(65, 190)"> |
| 77 |
<g id="mouseEventsLabels"> |
| 78 |
<text x="10" y="20" font-size="32">onfocusin</text> |
| 79 |
<text x="10" y="50" font-size="32">onfocusout</text> |
| 80 |
<text x="10" y="80" font-size="32">onactivate</text> |
| 81 |
</g> |
| 82 |
<g id="mouseEventsTestIndicators"> |
| 83 |
<!-- onfocusin --> |
| 84 |
<rect x="-15" y="2" width="20" height="20" fill="green"/> |
| 85 |
<rect id="onfocusin" x="-15" y="2" width="20" height="20" fill="red"/> |
| 86 |
|
| 87 |
<!-- onfocusout --> |
| 88 |
<rect x="-15" y="32" width="20" height="20" fill="green"/> |
| 89 |
<rect id="onfocusout" x="-15" y="32" width="20" height="20" fill="red"/> |
| 90 |
|
| 91 |
<!-- onactivate --> |
| 92 |
<rect x="-15" y="62" width="20" height="20" fill="green"/> |
| 93 |
<rect id="onactivate" x="-15" y="62" width="20" height="20" fill="red"/> |
| 94 |
|
| 95 |
</g> |
| 96 |
</g> |
| 97 |
<!-- Mouse Events --> |
| 98 |
</g> |
| 99 |
|
| 100 |
<script type="text/ecmascript"><![CDATA[ |
| 101 |
|
| 102 |
function onEvent(evt, indicatorId){ |
| 103 |
// Get Document |
| 104 |
var target = evt.target; |
| 105 |
var doc = target.ownerDocument; |
| 106 |
|
| 107 |
// Mark test as passed |
| 108 |
var testPassed = doc.getElementById(indicatorId); |
| 109 |
testPassed.setAttribute('visibility', 'hidden'); |
| 110 |
} |
| 111 |
]]></script> |
| 112 |
|
| 113 |
</g> |
| 114 |
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> |
| 115 |
<text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.9 $</text> |
| 116 |
</g> |
| 117 |
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/> |
| 118 |
<!-- comment out this watermark once the test is approved --> |
| 119 |
<g id="draft-watermark"> |
| 120 |
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> |
| 121 |
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" |
| 122 |
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> |
| 123 |
</g> |
| 124 |
</svg> |