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