| 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-01-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 handler and DOM manipulation through |
| 19 |
ECMAScript binding. |
| 20 |
</p> |
| 21 |
<p> |
| 22 |
The test uses ECMAScript and initially displays a target with |
| 23 |
a message asking the user to click on the target. Once the user |
| 24 |
has done so, and if both event handling and DOM manipulation are |
| 25 |
supported, then the target and initial text are hidden and a text |
| 26 |
message indicating that the test was successful is displayed. |
| 27 |
</p> |
| 28 |
</d:testDescription> |
| 29 |
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
| 30 |
<p>Load the test. Click on the blue square.</p> |
| 31 |
</d:operatorScript> |
| 32 |
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
| 33 |
<p>The test passes if, after clicking on the blue square, it and |
| 34 |
the instruction text "Click on the blue square" is removed |
| 35 |
and replaced with green text stating "Scripting Test Passed!".</p> |
| 36 |
</d:passCriteria> |
| 37 |
</d:SVGTestCase> |
| 38 |
<title id="test-title">$RCSfile: script-handle-01-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 |
<!-- Displayed Title --> |
| 48 |
<text x="140" y="20" fill="black"> |
| 49 |
Event and DOM Access Test |
| 50 |
</text> |
| 51 |
|
| 52 |
<!-- When the user clicks on the "target" group, the onMouseClick should --> |
| 53 |
<!-- be invoked. That handler will hide the target and show a message --> |
| 54 |
<!-- indicating that the test passed. --> |
| 55 |
<g id="targetGroup"> |
| 56 |
<g id="target" onclick="onMouseClick( evt )"> |
| 57 |
<text x="70" y="150">Click on the blue square</text> |
| 58 |
<rect x="60" y="160" width="20" height="20" fill="blue" stroke="none"/> |
| 59 |
</g> |
| 60 |
<g id="testPassed" visibility="hidden"> |
| 61 |
<text x="70" y="170" fill="green" font-size="30" font-weight="bold">Scripting Test Passed!</text> |
| 62 |
</g> |
| 63 |
</g> |
| 64 |
|
| 65 |
<script type="text/ecmascript"><![CDATA[ |
| 66 |
|
| 67 |
function onMouseClick(evt) { |
| 68 |
|
| 69 |
// Get Document |
| 70 |
var target = evt.target; |
| 71 |
var doc = target.ownerDocument; |
| 72 |
|
| 73 |
// Make test result visible |
| 74 |
var testPassed = doc.getElementById('testPassed'); |
| 75 |
testPassed.setAttribute('visibility', 'visible'); |
| 76 |
|
| 77 |
// Make target invisible |
| 78 |
var target = doc.getElementById('target'); |
| 79 |
target.setAttribute('visibility', 'hidden'); |
| 80 |
} |
| 81 |
|
| 82 |
]]></script> |
| 83 |
|
| 84 |
</g> |
| 85 |
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> |
| 86 |
<text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.7 $</text> |
| 87 |
</g> |
| 88 |
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/> |
| 89 |
<!-- comment out this watermark once the test is approved --> |
| 90 |
<!--<g id="draft-watermark"> |
| 91 |
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> |
| 92 |
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" |
| 93 |
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> |
| 94 |
</g>--> |
| 95 |
</svg> |