103 lines
4.8 KiB
XML
103 lines
4.8 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">
|
|
<!--======================================================================-->
|
|
<!--= Copyright 2000 World Wide Web Consortium, (Massachusetts =-->
|
|
<!--= Institute of Technology, Institut National de Recherche en =-->
|
|
<!--= Informatique et en Automatique, Keio University). All Rights =-->
|
|
<!--= Reserved. See http://www.w3.org/Consortium/Legal/. =-->
|
|
<!--======================================================================-->
|
|
<!-- ===================================================================== -->
|
|
<!-- dom-featureString-BE-03.svg -->
|
|
<!-- renamed for 1.1 suite to struct-dom-03-b -->
|
|
<!-- Author : Vincent Hardy 06-08-2000 -->
|
|
<!-- Revised for 1.1 : Chris Lilley, 15-Mar-2002 -->
|
|
<!-- Revised for 1.1 : Darryl Fuller, 27-Jun-2002 -->
|
|
<!--======================================================================-->
|
|
<svg version="1.1" baseProfile="basic" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" viewBox="0 0 480 360" onload="domTest(evt)">
|
|
<SVGTestCase xmlns="http://www.w3.org/2000/02/svg/testsuite/description/">
|
|
<OperatorScript version="$Revision: 1.1 $" testname="struct-dom-03-b.svg">
|
|
<Paragraph>Verify the basic capability to handle the hasFeature DOMImplementation method.
|
|
The DOMImplementation instance is retreived from the Document instance. Then,
|
|
its hasFeature method is invoked on the various SVG feature strings.
|
|
</Paragraph>
|
|
<Paragraph>The test displays the set of SVG feature strings and, next to them, a text
|
|
string that shows whether the feature is supported or not.
|
|
</Paragraph>
|
|
<Paragraph>Note that the test passes whether or not the feature is supported (i.e., true or
|
|
false are valid). The test fails if no value (true or false) appears next to the feature string
|
|
value.
|
|
</Paragraph>
|
|
<Paragraph>Note that this test uses the 'onload' event on the root svg element.
|
|
</Paragraph>
|
|
<Paragraph>The rendered picture should match the reference image, except for the yes and
|
|
no values which may differ depending on the implementation.
|
|
</Paragraph>
|
|
</OperatorScript>
|
|
</SVGTestCase>
|
|
<title id="test-title">struct-dom-03-b</title>
|
|
<desc id="test-desc">Checks if DOM/ECMA Script binding is supported. Checks support for the
|
|
hasFeature method on the DOMImplementation.
|
|
</desc>
|
|
<!--======================================================================-->
|
|
<!--Content of Test Case follows... =====================-->
|
|
<!--======================================================================-->
|
|
<g id="test-body-content">
|
|
<script type="text/ecmascript"><![CDATA[
|
|
|
|
var featureStrings = new Array();
|
|
var length = 0;
|
|
featureStrings[length++] = "uievents ";
|
|
featureStrings[length++] = "mouseevents";
|
|
featureStrings[length++] = "mutationevents";
|
|
featureStrings[length++] = "traversal";
|
|
featureStrings[length++] = "org.w3c.svg";
|
|
var svg_ns = "http://www.w3.org/2000/svg"
|
|
function domTest(evt) {
|
|
// Get Document
|
|
var target = evt.target;
|
|
var doc = target.ownerDocument;
|
|
|
|
// Get DOMImplementation
|
|
var domImpl = doc.implementation;
|
|
|
|
//
|
|
// Iterate through the feature strings
|
|
//
|
|
for(var i=0; i<featureStrings.length; i++){
|
|
var supports = domImpl.hasFeature(featureStrings[i], '2.0');
|
|
//
|
|
// if time, pretty up by putting xml to traveral in a left column and
|
|
// org.w3c.svg to org.w3c.dom.svg.all in a right column; add an extra
|
|
// parameter to addTextElemen t for x coord, and test if i < 9
|
|
//
|
|
addTextElement(featureStrings[i], supports, doc, target, (50 + 50*i));
|
|
}
|
|
}
|
|
|
|
function addTextElement(label, value, doc, svg, y){
|
|
var newText = doc.createElementNS(svg_ns, 'text');
|
|
newText.setAttribute('font-size', '30');
|
|
newText.setAttribute('x', '10');
|
|
newText.setAttribute('y', y);
|
|
var textValue = label;
|
|
var textContent = doc.createTextNode(textValue);
|
|
newText.appendChild(textContent);
|
|
svg.appendChild(newText);
|
|
|
|
newText = doc.createElementNS(svg_ns, 'text');
|
|
newText.setAttribute('font-size', '30');
|
|
newText.setAttribute('x', '370');
|
|
newText.setAttribute('y', y);
|
|
textValue = value;
|
|
textContent = doc.createTextNode(textValue);
|
|
newText.appendChild(textContent);
|
|
svg.appendChild(newText);
|
|
}
|
|
|
|
]]></script>
|
|
</g>
|
|
<text id="revision" x="10" y="340" font-size="30" stroke="none" fill="black">$Revision: 1.1 $</text>
|
|
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
|
|
</svg>
|
|
|