chromium/third_party/blink/web_tests/svg/W3C-SVG-1.1/types-basicDOM-01-b.svg

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny-flat.dtd">
<svg version="1.1" baseProfile="tiny" id="svg-root" width="480" height="360" viewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="testSVGLocatable()">
  <!--======================================================================-->
  <!--=  Copyright 2006 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/.                          =-->
  <!--======================================================================-->
  <!-- NOTE:  CVS will automatically update the                             -->
  <!--        "$RCSfile: types-basicDOM-01-b.svg,v $" and "$Revision: 1.1 $"         -->
  <!--        fields in the file.                                           -->
  <!--        There is no need to update this information.                  -->
  <!-- =====================================================================-->
  <SVGTestCase xmlns="http://www.w3.org/2000/02/svg/testsuite/description/" reviewer="AE,ED" owner="AN" desc="Tests the interface SVGLocatable" status="accepted" version="$Revision: 1.1 $" testname="$RCSfile: types-basicDOM-01-b.svg,v $">
    <OperatorScript>
      <Paragraph>
        This test checks all the methods and properties of the SVGLocatable interface. Note the use of nested svg elements and testing against different elements in the hierarchy. Note that the values of .getScreenCTM() and .getCTM() can only be tested correctly if they are in the html-based test or the width and height of the root element is explicitly set to 480x360. The methods .getScreenCTM() and .getCTM() are tested from the rotated text element, the method .getBBox(), is tested between the rotated text and its parent group, the method .getBBox() and the properties .farthestViewportElement and .nearestViewportElement are tested on the red circle.
		</Paragraph>
	  <Paragraph>
		For the test to pass, the values generated by script must match the values provided in the png image. The correct values are:
	  </Paragraph>
	  <Paragraph>
		.getScreenCTM() for id "rotText": 0.42,0.42,-0.42,0.42,70.00,-60.00
	  </Paragraph>
	  <Paragraph>
		.getCTM() for id "rotText": 0.42,0.42,-0.42,0.42,70.00,-60.00
	  </Paragraph>
 	  <Paragraph>
		.getBBox() for 'redCircle': .x=-50,.y=-50,.width=100,.height=100
	  </Paragraph>
 	  <Paragraph>
		.farthestViewportElement of redCircle=svg-root
	  </Paragraph>
 	  <Paragraph>
		.nearestViewportElement of redCircle=nestedSVG
	  </Paragraph>
   </OperatorScript>
  </SVGTestCase>
  <title id="test-title">types-basicDOM-01-b.svg</title>
  <!--======================================================================-->
  <!--Content of Test Case follows...                  =====================-->
  <!--======================================================================-->
  <g id="test-body-content">
	<script type="text/ecmascript"><![CDATA[	
		function testSVGLocatable() {
			var rotText = document.getElementById("rotatedText");
			var redCircle = document.getElementById("redCircle")
			var matr = rotText.getScreenCTM();
			document.getElementById("result1").firstChild.nodeValue = ".getScreenCTM(): " + matr.a.toFixed(2) + "," + matr.b.toFixed(2) + "," + matr.c.toFixed(2) + "," + matr.d.toFixed(2) + "," + matr.e.toFixed(2) + "," + matr.f.toFixed(2);
			var matr = rotText.getCTM();
			document.getElementById("result2").firstChild.nodeValue = ".getCTM(): " + matr.a.toFixed(2) + "," + matr.b.toFixed(2) + "," + matr.c.toFixed(2) + "," + matr.d.toFixed(2) + "," + matr.e.toFixed(2) + "," + matr.f.toFixed(2);			
			var bbox = redCircle.getBBox();
			document.getElementById("result3").firstChild.nodeValue = ".getBBox() for 'redCircle': .x="+bbox.x+",.y="+bbox.y+",.width="+bbox.width+",.height="+bbox.height;
			document.getElementById("result4").firstChild.nodeValue = ".farthestViewportElement of redCircle="+redCircle.farthestViewportElement.getAttributeNS(null,"id");
			document.getElementById("result5").firstChild.nodeValue = ".nearestViewportElement of redCircle="+redCircle.nearestViewportElement.getAttributeNS(null,"id");
		}	
	]]></script>	
		<g font-family="sans-serif" font-size="12">
			<g id="parentGroup" transform="translate(70,-60)">
				<text id="rotatedText" transform="scale(0.6),rotate(45)" font-size="20" x="30" y="150">Rotated Text for testing SVGLocatable</text>
				<text id="otherText" transform="scale(0.7)" font-size="20" x="100" y="130">Some other text with id 'otherText'</text>
				<svg id="nestedSVG" x="200" y="100" width="110" height="110" viewBox="-55 -55 110 110">
					<circle id="redCircle" cx="0" cy="0" r="50" fill="red"/>
				</svg>
			</g>
			<text id="result1" x="10" y="200"> </text>
			<text id="result2" x="10" y="220"> </text>
			<text id="result3" x="10" y="240"> </text>
			<text id="result4" x="10" y="260"> </text>
			<text id="result5" x="10" y="280"> </text>
		</g>    
  </g>
  <text id="revision" x="10" y="340" font-size="40" stroke="none" fill="black">$Revision: 1.1 $</text>
  <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/>
</svg>