| 1 |
<svg version="1.1" baseProfile="tiny" 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="ED" status="accepted" |
| 15 |
version="$Revision: 1.6 $" testname="$RCSfile: interact-pevents-01-b.svg,v $"> |
| 16 |
<d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/interact.html#PointerEventsProperty"> |
| 17 |
<p> |
| 18 |
This test tests 'pointer-events' on text. Initially you should see four big rects with black stroke. |
| 19 |
In the uppermost rect there should be 10 'O':s with black fill. |
| 20 |
In the second rect from the top there should be 10 'O':s with no fill but with black stroke. |
| 21 |
In the third and fourth rects there should be no visible 'O':s at all. |
| 22 |
In the fourth rect there should be two green rects, and in each of the other three rects there should be one green rect. |
| 23 |
</p> |
| 24 |
<p> |
| 25 |
For UA debugging purposes it's possible to click the "Toggle freeze" button before running the test. |
| 26 |
That will reset the visibility, fill and stroke on each 'O' as the cursor moves over them so that it's |
| 27 |
possible to trigger the change more than once. If the "Toggle freeze" button is clicked once again that |
| 28 |
means the change will remain after the cursor moves out. |
| 29 |
</p> |
| 30 |
</d:testDescription> |
| 31 |
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
| 32 |
<p> |
| 33 |
Using the pointer device move the cursor over the rects all the rects from left to right. |
| 34 |
As the mouseover event triggers the 'O':s will become visible and marked in either green (a pass) or red (a fail). |
| 35 |
</p> |
| 36 |
</d:operatorScript> |
| 37 |
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
| 38 |
<p> |
| 39 |
The test has passed if after moving the cursor over all the rects: |
| 40 |
</p> |
| 41 |
<ol> |
| 42 |
<li>all the 'O':s in the green rects have green fill</li> |
| 43 |
<li>there are no red 'O':s visible</li> |
| 44 |
<li>there are 9 green 'O':s in the first and second rect, 4 in the third rect and 6 in the fourth rect</li> |
| 45 |
</ol> |
| 46 |
</d:passCriteria> |
| 47 |
</d:SVGTestCase> |
| 48 |
<title id="test-title">$RCSfile: interact-pevents-01-b.svg,v $</title> |
| 49 |
<defs> |
| 50 |
<font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F"> |
| 51 |
<font-face-src> |
| 52 |
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> |
| 53 |
</font-face-src> |
| 54 |
</font-face> |
| 55 |
</defs> |
| 56 |
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> |
| 57 |
<g font-family="sans-serif" font-size="40" text-rendering="geometricPrecision"> |
| 58 |
<script><![CDATA[ |
| 59 |
var no_reset = 1; |
| 60 |
|
| 61 |
function pass_in(elm) |
| 62 |
{ |
| 63 |
elm.setAttribute("fill", "green"); |
| 64 |
elm.setAttribute("visibility", "visible"); |
| 65 |
} |
| 66 |
|
| 67 |
function pass_out(elm) |
| 68 |
{ |
| 69 |
if(!no_reset) |
| 70 |
{ |
| 71 |
elm.removeAttribute("fill"); |
| 72 |
elm.removeAttribute("visibility"); |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
function fail_in(elm) |
| 77 |
{ |
| 78 |
elm.setAttribute("fill", "red"); |
| 79 |
elm.setAttribute("visibility", "visible"); |
| 80 |
} |
| 81 |
|
| 82 |
function fail_out(elm) |
| 83 |
{ |
| 84 |
if(!no_reset) |
| 85 |
{ |
| 86 |
elm.removeAttribute("fill"); |
| 87 |
elm.removeAttribute("visibility"); |
| 88 |
} |
| 89 |
} |
| 90 |
|
| 91 |
function toggle_freeze() |
| 92 |
{ |
| 93 |
no_reset = !no_reset; |
| 94 |
} |
| 95 |
]]></script> |
| 96 |
|
| 97 |
<text x="240" y="40" text-anchor="middle" font-size="20">Test pointer-events on text</text> |
| 98 |
<g transform="translate(40, -10)"> |
| 99 |
<g id="first-line"> |
| 100 |
<text x="50" y="100" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 101 |
<text x="80" y="100" pointer-events="visiblePainted" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 102 |
<text x="110" y="100" pointer-events="visibleFill" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 103 |
<text x="140" y="100" pointer-events="visibleStroke" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 104 |
<text x="170" y="100" pointer-events="visible" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 105 |
<text x="200" y="100" pointer-events="painted" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 106 |
<text x="230" y="100" pointer-events="fill" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 107 |
<text x="260" y="100" pointer-events="stroke" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 108 |
<text x="290" y="100" pointer-events="all" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 109 |
<text x="320" y="100" pointer-events="none" onmouseover="fail_in(evt.target)" onmouseout="fail_out(evt.target)">O</text> |
| 110 |
|
| 111 |
<g pointer-events="none"> |
| 112 |
<rect x="50" y="65" height="40" width="270" fill="green" fill-opacity="0.5" visibility="visible"/> |
| 113 |
|
| 114 |
<rect x="50" y="65" height="40" width="300" fill="none" stroke="black" visibility="visible"/> |
| 115 |
</g> |
| 116 |
</g> |
| 117 |
|
| 118 |
<g id="second-line" transform="translate(0 60)" fill="none" stroke="black"> |
| 119 |
<text x="50" y="100" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 120 |
<text x="80" y="100" pointer-events="visiblePainted" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 121 |
<text x="110" y="100" pointer-events="visibleFill" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 122 |
<text x="140" y="100" pointer-events="visibleStroke" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 123 |
<text x="170" y="100" pointer-events="visible" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 124 |
<text x="200" y="100" pointer-events="painted" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 125 |
<text x="230" y="100" pointer-events="fill" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 126 |
<text x="260" y="100" pointer-events="stroke" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 127 |
<text x="290" y="100" pointer-events="all" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 128 |
<text x="320" y="100" pointer-events="none" onmouseover="fail_in(evt.target)" onmouseout="fail_out(evt.target)">O</text> |
| 129 |
|
| 130 |
<g pointer-events="none"> |
| 131 |
<rect x="50" y="65" height="40" width="270" fill="green" fill-opacity="0.5" visibility="visible" stroke="none"/> |
| 132 |
|
| 133 |
<rect x="50" y="65" height="40" width="300" fill="none" stroke="black" visibility="visible"/> |
| 134 |
</g> |
| 135 |
</g> |
| 136 |
|
| 137 |
<g id="third-line" transform="translate(0 120)" visibility="hidden"> |
| 138 |
<text x="50" y="100" onmouseover="fail_in(evt.target)" onmouseout="fail_out(evt.target)">O</text> |
| 139 |
<text x="80" y="100" pointer-events="visiblePainted" onmouseover="fail_in(evt.target)" onmouseout="fail_out(evt.target)">O</text> |
| 140 |
<text x="110" y="100" pointer-events="visibleFill" onmouseover="fail_in(evt.target)" onmouseout="fail_out(evt.target)">O</text> |
| 141 |
<text x="140" y="100" pointer-events="visibleStroke" onmouseover="fail_in(evt.target)" onmouseout="fail_out(evt.target)">O</text> |
| 142 |
<text x="170" y="100" pointer-events="visible" onmouseover="fail_in(evt.target)" onmouseout="fail_out(evt.target)">O</text> |
| 143 |
<text x="200" y="100" pointer-events="painted" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 144 |
<text x="230" y="100" pointer-events="fill" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 145 |
<text x="260" y="100" pointer-events="stroke" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 146 |
<text x="290" y="100" pointer-events="all" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 147 |
<text x="320" y="100" pointer-events="none" onmouseover="fail_in(evt.target)" onmouseout="fail_out(evt.target)">O</text> |
| 148 |
|
| 149 |
<g pointer-events="none"> |
| 150 |
<rect x="200" y="65" height="40" width="120" fill="green" fill-opacity="0.5" visibility="visible"/> |
| 151 |
|
| 152 |
<rect x="50" y="65" height="40" width="300" fill="none" stroke="black" visibility="visible"/> |
| 153 |
</g> |
| 154 |
</g> |
| 155 |
|
| 156 |
<g id="fourth-line" transform="translate(0 180)" fill="none" stroke="none"> |
| 157 |
<text x="50" y="100" onmouseover="fail_in(evt.target)" onmouseout="fail_out(evt.target)">O</text> |
| 158 |
<text x="80" y="100" pointer-events="visiblePainted" onmouseover="fail_in(evt.target)" onmouseout="fail_out(evt.target)">O</text> |
| 159 |
|
| 160 |
<text x="110" y="100" pointer-events="visibleFill" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 161 |
<text x="140" y="100" pointer-events="visibleStroke" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 162 |
<text x="170" y="100" pointer-events="visible" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 163 |
|
| 164 |
<text x="200" y="100" pointer-events="painted" onmouseover="fail_in(evt.target)" onmouseout="fail_out(evt.target)">O</text> |
| 165 |
|
| 166 |
<text x="230" y="100" pointer-events="fill" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 167 |
<text x="260" y="100" pointer-events="stroke" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 168 |
<text x="290" y="100" pointer-events="all" onmouseover="pass_in(evt.target)" onmouseout="pass_out(evt.target)">O</text> |
| 169 |
|
| 170 |
<text x="320" y="100" pointer-events="none" onmouseover="fail_in(evt.target)" onmouseout="fail_out(evt.target)">O</text> |
| 171 |
|
| 172 |
<g pointer-events="none"> |
| 173 |
<rect x="110" y="65" height="40" width="90" fill="green" fill-opacity="0.5" visibility="visible"/> |
| 174 |
<rect x="230" y="65" height="40" width="90" fill="green" fill-opacity="0.5" visibility="visible"/> |
| 175 |
|
| 176 |
<rect x="50" y="65" height="40" width="300" fill="none" stroke="black" visibility="visible"/> |
| 177 |
</g> |
| 178 |
</g> |
| 179 |
|
| 180 |
<g transform="translate(275, 300) scale(0.5)" onclick="toggle_freeze();"> |
| 181 |
<rect id="button" width="150" height="26" fill="blue"/> |
| 182 |
<text x="75" y="19" text-anchor="middle" font-size="20" fill="white">Toggle freeze</text> |
| 183 |
</g> |
| 184 |
</g> |
| 185 |
</g> |
| 186 |
</g> |
| 187 |
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> |
| 188 |
<text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.6 $</text> |
| 189 |
</g> |
| 190 |
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/> |
| 191 |
<!-- comment out this watermark once the test is approved --> |
| 192 |
<!--<g id="draft-watermark"> |
| 193 |
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> |
| 194 |
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" |
| 195 |
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> |
| 196 |
</g>--> |
| 197 |
</svg> |