| 1 |
<svg id="svg-root" width="100%" height="100%" |
| 2 |
viewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg" |
| 3 |
xmlns:xlink="http://www.w3.org/1999/xlink"> |
| 4 |
<!--======================================================================--> |
| 5 |
<!--= Copyright 2008 World Wide Web Consortium, (Massachusetts =--> |
| 6 |
<!--= Institute of Technology, European Research Consortium for =--> |
| 7 |
<!--= Informatics and Mathematics (ERCIM), Keio University). =--> |
| 8 |
<!--= All Rights Reserved. =--> |
| 9 |
<!--= See http://www.w3.org/Consortium/Legal/. =--> |
| 10 |
<!--======================================================================--> |
| 11 |
<d:SVGTestCase xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/" |
| 12 |
template-version="1.4" reviewer="CM" author="ED" status="reviewed" |
| 13 |
version="$Revision: 1.9 $" testname="$RCSfile: svgdom-over-01-f.svg,v $"> |
| 14 |
<d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/svgdom.html#SVGDOMOverview"> |
| 15 |
<p> |
| 16 |
This tests how unspecified attributes affect the return values from the |
| 17 |
SVG DOM methods related to attributes. |
| 18 |
</p> |
| 19 |
<p> |
| 20 |
After loading the test, you should see a list of red or green rectangles followed by some text describing each subtest. |
| 21 |
</p> |
| 22 |
</d:testDescription> |
| 23 |
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
| 24 |
<p> |
| 25 |
Run the test. No interaction required. |
| 26 |
</p> |
| 27 |
</d:operatorScript> |
| 28 |
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
| 29 |
<p> |
| 30 |
The test has passed if there is a line of text saying "Test status: PASSED", and there is a green rectangle to the left of that text. |
| 31 |
</p> |
| 32 |
</d:passCriteria> |
| 33 |
</d:SVGTestCase> |
| 34 |
<title id="test-title">$RCSfile: svgdom-over-01-f.svg,v $</title> |
| 35 |
<defs> |
| 36 |
<font-face |
| 37 |
font-family="SVGFreeSansASCII" |
| 38 |
unicode-range="U+0-7F"> |
| 39 |
<font-face-src> |
| 40 |
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> |
| 41 |
</font-face-src> |
| 42 |
</font-face> |
| 43 |
</defs> |
| 44 |
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> |
| 45 |
<defs> |
| 46 |
<rect id="r" width="1" height="1"/> |
| 47 |
<stop id="s"/> |
| 48 |
<feConvolveMatrix id="c"/> |
| 49 |
<image id="i" xlink:href="http://example.org/image.jpg" width="1" height="1"/> |
| 50 |
<radialGradient id="g"/> |
| 51 |
<text id="t"/> |
| 52 |
<text id="tt">sometext</text> |
| 53 |
<marker id="m"/> |
| 54 |
<svg id="v"/> |
| 55 |
<filter id="f"/> |
| 56 |
<polygon id="p"/> |
| 57 |
</defs> |
| 58 |
|
| 59 |
<script><![CDATA[ |
| 60 |
var ypos = 50; |
| 61 |
var r = document.getElementById("r"); |
| 62 |
var s = document.getElementById("s"); |
| 63 |
var c = document.getElementById("c"); |
| 64 |
var i = document.getElementById("i"); |
| 65 |
var g = document.getElementById("g"); |
| 66 |
var t = document.getElementById("t"); |
| 67 |
var tt = document.getElementById("tt"); |
| 68 |
var m = document.getElementById("m"); |
| 69 |
var v = document.getElementById("v"); |
| 70 |
var f = document.getElementById("f"); |
| 71 |
var p = document.getElementById("p"); |
| 72 |
|
| 73 |
i.removeAttributeNS("http://www.w3.org/1999/xlink", "href"); |
| 74 |
|
| 75 |
function Subtest(str, code) |
| 76 |
{ |
| 77 |
this.str = str; |
| 78 |
this.code = code ? code : str; |
| 79 |
} |
| 80 |
|
| 81 |
Subtest.prototype.getStr = function() |
| 82 |
{ |
| 83 |
return this.str; |
| 84 |
} |
| 85 |
|
| 86 |
Subtest.prototype.getCode = function() |
| 87 |
{ |
| 88 |
return this.code; |
| 89 |
} |
| 90 |
|
| 91 |
function verify(str, result) |
| 92 |
{ |
| 93 |
var g = document.createElementNS("http://www.w3.org/2000/svg", "g"); |
| 94 |
var r = document.createElementNS("http://www.w3.org/2000/svg", "rect"); |
| 95 |
var t = document.createElementNS("http://www.w3.org/2000/svg", "text"); |
| 96 |
t.appendChild(document.createTextNode(str + ": " + (result ? "PASSED" : "FAILED"))); |
| 97 |
t.setAttribute("class", "result"); |
| 98 |
t.setAttribute("font-size", "9px"); |
| 99 |
t.setAttribute("fill", "black"); |
| 100 |
t.setAttribute("x", "10"); |
| 101 |
t.setAttribute("y", "7"); |
| 102 |
r.setAttribute("y", "1"); |
| 103 |
r.setAttribute("width", "5"); |
| 104 |
r.setAttribute("height", "5"); |
| 105 |
g.setAttribute("fill", result ? "lime" : "red"); |
| 106 |
g.appendChild(r); |
| 107 |
g.appendChild(t); |
| 108 |
g.setAttribute("transform", "translate(10 " + ypos + ")"); |
| 109 |
ypos += 10; |
| 110 |
document.getElementById("test-body-content").appendChild(g); |
| 111 |
if(result) |
| 112 |
passes++; |
| 113 |
} |
| 114 |
|
| 115 |
var passes = 0; |
| 116 |
var tests = [ |
| 117 |
// test SVGLength |
| 118 |
new Subtest("r.x.baseVal.value == 0"), |
| 119 |
new Subtest("r.x.baseVal.unitType == 1 (SVG_LENGTHTYPE_NUMBER)", "r.x.baseVal.unitType == 1"), |
| 120 |
new Subtest("v.width.baseVal.valueInSpecifiedUnits == 100"), |
| 121 |
new Subtest("v.width.baseVal.unitType == 2 (SVG_LENGTHTYPE_PERCENTAGE)", "v.width.baseVal.unitType == 2"), |
| 122 |
new Subtest("tt.textLength.baseVal.value == tt.getComputedTextLength()"), |
| 123 |
|
| 124 |
// test SVGAnimatedNumber |
| 125 |
new Subtest("s.offset.baseVal == 0"), |
| 126 |
|
| 127 |
// test SVGAnimatedBoolean |
| 128 |
new Subtest("c.preserveAlpha.baseVal == false"), |
| 129 |
|
| 130 |
// test SVGAnimatedString / DOMString |
| 131 |
new Subtest("c.className.baseVal == \"\""), |
| 132 |
new Subtest("i.href.baseVal == \"\""), |
| 133 |
|
| 134 |
// test SVGStringList |
| 135 |
new Subtest("i.requiredFeatures.numberOfItems == 0"), |
| 136 |
|
| 137 |
// SVGAnimatedNumberList |
| 138 |
new Subtest("c.kernelMatrix.baseVal.numberOfItems == 0"), |
| 139 |
|
| 140 |
// SVGAnimatedLengthList |
| 141 |
new Subtest("t.x.baseVal.numberOfItems == 0"), |
| 142 |
|
| 143 |
// SVGAnimatedPointsList / SVGPointList |
| 144 |
new Subtest("p.points.numberOfItems == 0"), |
| 145 |
|
| 146 |
// SVGAnimatedEnumeration |
| 147 |
new Subtest("g.gradientUnits.baseVal == 2 (SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)", "g.gradientUnits.baseVal == 2"), |
| 148 |
|
| 149 |
// SVGAnimatedInteger |
| 150 |
new Subtest("f.filterResX.baseVal == 0"), |
| 151 |
|
| 152 |
// SVGAnimatedAngle |
| 153 |
new Subtest("m.orientAngle.baseVal.value == 0"), |
| 154 |
new Subtest("m.orientAngle.baseVal.unitType == 1 (SVG_ANGLETYPE_UNSPECIFIED)", "m.orientAngle.baseVal.unitType == 1"), |
| 155 |
|
| 156 |
// SVGAnimatedRect / SVGRect |
| 157 |
new Subtest("v.viewBox.baseVal.[x,y,width,height] == 0", |
| 158 |
"v.viewBox.baseVal.x == 0 && v.viewBox.baseVal.y == 0 && v.viewBox.baseVal.width == 0 && v.viewBox.baseVal.height == 0"), |
| 159 |
|
| 160 |
// SVGAnimatedTransformList |
| 161 |
new Subtest("t.transform.baseVal.numberOfItems == 0"), |
| 162 |
|
| 163 |
// SVGAnimatedPreserveAspectRatio / SVGPreserveAspectRatio |
| 164 |
new Subtest("v.preserveAspectRatio.baseVal.align == 6 (SVG_PRESERVEASPECTRATIO_XMIDYMID)", "v.preserveAspectRatio.baseVal.align == 6"), |
| 165 |
new Subtest("v.preserveAspectRatio.baseVal.meetOrSlice == 1 (SVG_MEETORSLICE_MEET)", "v.preserveAspectRatio.baseVal.meetOrSlice == 1"), |
| 166 |
|
| 167 |
// SVGZoomAndPan |
| 168 |
new Subtest("v.zoomAndPan == 2 (SVG_ZOOMANDPAN_MAGNIFY)", "v.zoomAndPan == 2") |
| 169 |
]; |
| 170 |
|
| 171 |
try { |
| 172 |
for (var k = 0; k < tests.length; k++) |
| 173 |
{ |
| 174 |
try |
| 175 |
{ |
| 176 |
verify(tests[k].getStr(), eval(tests[k].getCode())); |
| 177 |
} |
| 178 |
catch(e) |
| 179 |
{ |
| 180 |
verify(tests[k].getStr(), false); |
| 181 |
} |
| 182 |
} |
| 183 |
} |
| 184 |
finally |
| 185 |
{ |
| 186 |
verify("Test status", tests.length == passes); |
| 187 |
} |
| 188 |
]]></script> |
| 189 |
|
| 190 |
</g> |
| 191 |
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> |
| 192 |
<text id="revision" x="10" y="340" stroke="none" |
| 193 |
fill="black">$Revision: 1.9 $</text> |
| 194 |
</g> |
| 195 |
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/> |
| 196 |
<!-- comment out this watermark once the test is approved --> |
| 197 |
<g id="draft-watermark"> |
| 198 |
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> |
| 199 |
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" |
| 200 |
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> |
| 201 |
</g> |
| 202 |
</svg> |