| 1 |
<svg version="1.1" baseProfile="basic" onload="domTest(evt)" 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="ED" author="Vincent Hardy" status="accepted" |
| 15 |
version="$Revision: 1.9 $" testname="$RCSfile: struct-dom-02-b.svg,v $"> |
| 16 |
<d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/struct.html#DOMInterfaces"> |
| 17 |
<p> |
| 18 |
Verify the basic capability to handle the hasFeature DOMImplementation method. |
| 19 |
The DOMImplementation instance is retrieved from the Document instance. Then, |
| 20 |
its hasFeature method is invoked on the various SVG feature strings. |
| 21 |
</p> |
| 22 |
<p> |
| 23 |
The test displays the set of SVG feature strings and, next to them, a text |
| 24 |
string that shows whether the feature is supported or not. |
| 25 |
</p> |
| 26 |
<p> |
| 27 |
Note that this test uses the 'onload' event on the root svg element. |
| 28 |
</p> |
| 29 |
</d:testDescription> |
| 30 |
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
| 31 |
<p> |
| 32 |
Run the test. No interaction required. |
| 33 |
</p> |
| 34 |
</d:operatorScript> |
| 35 |
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
| 36 |
<p> |
| 37 |
The rendered picture should match the reference image, except for the true and |
| 38 |
false values which may differ depending on the implementation. |
| 39 |
</p> |
| 40 |
<p> |
| 41 |
Note that the test passes whether or not the feature is supported (i.e., true or |
| 42 |
false are valid). The test fails if no value (true or false) appears next to the feature string |
| 43 |
value. |
| 44 |
</p> |
| 45 |
</d:passCriteria> |
| 46 |
</d:SVGTestCase> |
| 47 |
<title id="test-title">$RCSfile: struct-dom-02-b.svg,v $</title> |
| 48 |
<defs> |
| 49 |
<font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F"> |
| 50 |
<font-face-src> |
| 51 |
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> |
| 52 |
</font-face-src> |
| 53 |
</font-face> |
| 54 |
</defs> |
| 55 |
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> |
| 56 |
<script type="text/ecmascript"><![CDATA[ |
| 57 |
|
| 58 |
var featureStrings = new Array(); |
| 59 |
var length = 0; |
| 60 |
featureStrings[length++] = "xml"; |
| 61 |
featureStrings[length++] = "stylesheets"; |
| 62 |
featureStrings[length++] = "views"; |
| 63 |
featureStrings[length++] = "css2"; |
| 64 |
featureStrings[length++] = "events"; |
| 65 |
var svg_ns = "http://www.w3.org/2000/svg" |
| 66 |
function domTest(evt) { |
| 67 |
// Get Document |
| 68 |
var target = evt.target; |
| 69 |
var doc = target.ownerDocument; |
| 70 |
|
| 71 |
// Get DOMImplementation |
| 72 |
var domImpl = doc.implementation; |
| 73 |
|
| 74 |
// |
| 75 |
// Iterate through the feature strings |
| 76 |
// |
| 77 |
for(var i=0; i<featureStrings.length; i++){ |
| 78 |
var supports = domImpl.hasFeature(featureStrings[i], '2.0'); |
| 79 |
// |
| 80 |
// if time, pretty up by putting xml to traveral in a left column and |
| 81 |
// org.w3c.svg to org.w3c.dom.svg.all in a right column; add an extra |
| 82 |
// parameter to addTextElemen t for x coord, and test if i < 9 |
| 83 |
// |
| 84 |
addTextElement(featureStrings[i], supports, doc, doc.getElementById("test-body-content"), (55 + 55*i)); |
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
function addTextElement(label, value, doc, svg, y){ |
| 89 |
var newText = doc.createElementNS(svg_ns, 'text'); |
| 90 |
newText.setAttribute('font-size', '30'); |
| 91 |
newText.setAttribute('x', '10'); |
| 92 |
newText.setAttribute('y', y); |
| 93 |
var textValue = label; |
| 94 |
var textContent = doc.createTextNode(textValue); |
| 95 |
newText.appendChild(textContent); |
| 96 |
svg.appendChild(newText); |
| 97 |
|
| 98 |
newText = doc.createElementNS(svg_ns, 'text'); |
| 99 |
newText.setAttribute('font-size', '30'); |
| 100 |
newText.setAttribute('x', '340'); |
| 101 |
newText.setAttribute('y', y); |
| 102 |
textValue = value; |
| 103 |
textContent = doc.createTextNode(textValue); |
| 104 |
newText.appendChild(textContent); |
| 105 |
svg.appendChild(newText); |
| 106 |
} |
| 107 |
|
| 108 |
]]></script> |
| 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.9 $</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> |