blob: 09ed98f785d6c40a4e9e08d145d67d4f355da253 [file] [log] [blame]
<svg id="svg-root" width="100%" height="100%"
viewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" onload="runtest()">
<!--======================================================================-->
<!--= Copyright 2008 World Wide Web Consortium, (Massachusetts =-->
<!--= Institute of Technology, European Research Consortium for =-->
<!--= Informatics and Mathematics (ERCIM), Keio University). =-->
<!--= All Rights Reserved. =-->
<!--= See http://www.w3.org/Consortium/Legal/. =-->
<!--======================================================================-->
<d:SVGTestCase xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/"
template-version="1.4" reviewer="CM" author="ED" status="accepted"
version="$Revision: 1.6 $" testname="$RCSfile: types-dom-06-f.svg,v $">
<d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/types.html#InterfaceSVGStringList">
<p>
This tests parts of the SVGStringList interface. Particularly it tests that
strings that are taken from one SVGStringList and then inserted into another
SVGStringList duplicates the value instead of removing the value from the
first list when it's inserted into the second list.
</p>
</d:testDescription>
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml">
<p>
Run the test. No interaction required.
</p>
</d:operatorScript>
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml">
<p>
The test has passed if there are three green rectangles visible and no red. Red is an indication that the test failed.
</p>
</d:passCriteria>
</d:SVGTestCase>
<title id="test-title">$RCSfile: types-dom-06-f.svg,v $</title>
<defs>
<font-face
font-family="SVGFreeSansASCII"
unicode-range="U+0-7F">
<font-face-src>
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/>
</font-face-src>
</font-face>
</defs>
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
<defs>
<script type="application/ecmascript">
function runtest()
{
try {
var r1 = document.getElementById("r1");
var r2 = document.getElementById("r2");
var r3 = document.getElementById("r3");
var i0 = r1.requiredFeatures.getItem(0);
var i1 = r1.requiredFeatures.getItem(1);
if(i0 != "http://www.w3.org/TR/SVG11/feature#Shape")
{
r1.removeAttribute("requiredFeatures");
return;
}
if(i1 != "this.is.a.bogus.feature.string")
{
r1.removeAttribute("requiredFeatures");
return;
}
if(r1.requiredFeatures.numberOfItems != 2)
{
r1.removeAttribute("requiredFeatures");
return;
}
r2.requiredFeatures.appendItem(i1);
if(r1.requiredFeatures.numberOfItems != 2)
{
r1.removeAttribute("requiredFeatures");
return;
}
if(r2.requiredFeatures.numberOfItems != 1)
{
r1.removeAttribute("requiredFeatures");
return;
}
r3.requiredFeatures.insertItemBefore(i0,0);
if(r3.requiredFeatures.numberOfItems != 2)
{
r3.setAttribute("fill", "red");
return;
}
if(r1.requiredFeatures.numberOfItems != 2)
{
r1.removeAttribute("requiredFeatures");
return;
}
}
catch(e)
{
var f = document.getElementById("fail");
f.setAttribute("fill", "red");
}
}
</script>
</defs>
<text x="50%" y="70" text-anchor="middle">SVGStringList DOM</text>
<!-- background images -->
<g>
<rect width="100" height="100" fill="lime" transform="translate(80 100)"/>
<rect width="100" height="100" fill="lime" transform="translate(190 100)"/>
<rect width="100" height="100" fill="red" transform="translate(300 100)"/>
</g>
<!-- tests -->
<rect id="r1" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Shape this.is.a.bogus.feature.string" width="100" height="100" fill="red" transform="translate(100 100)"/>
<rect id="r2" width="100" height="100" fill="red" transform="translate(190 100)"/>
<rect id="r3" width="100" height="100" fill="lime" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Shape" transform="translate(300 100)"/>
<rect id="fail" width="100%" height="100%" fill="none"/>
</g>
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
<text id="revision" x="10" y="340" stroke="none"
fill="black">$Revision: 1.6 $</text>
</g>
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/>
<!-- comment out this watermark once the test is approved --><!--
<g id="draft-watermark">
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/>
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240"
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text>
</g>-->
</svg>