Revision control
Copy as Markdown
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.2" baseProfile="tiny" xml:id="svg-root" width="100%" height="100%"
<!--======================================================================-->
<!--= Copyright 2008 World Wide Web Consortium, (Massachusetts =-->
<!--= Institute of Technology, European Research Consortium for =-->
<!--= Informatics and Mathematics (ERCIM), Keio University). =-->
<!--= All Rights Reserved. =-->
<!--======================================================================-->
reviewer="AG" owner="VH" desc="This test validates the processing rules for converting coordinates and length defined in fractions of the current object's bounding box to user space coordinates and length. Note that this test assumes that linear and radial gradients are implemented." status="accepted"
approved="yes"
version="$Revision: 1.10 $" testname="$RCSfile: coords-units-01-t.svg,v $">
<d:OperatorScript xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/" xmlns="http://www.w3.org/1999/xhtml">
<p>
Verify the conversion processing of percentage and fraction values relative to object bounding boxes.
This is used when defining linear and radial gradients.
</p>
<p>
The test validates conversion for coordinates, width, height and length. The first test defines two
corresponding linear gradients, which specify coordinates using fractions for the first and user
coordinates for the second. The second test defines two corresponding radial gradients, which specify
a length (radius) using fractions for the first and user space for the second.
</p>
<p>
The rendered image should match the reference image.
</p>
<p>
The test also assumes that linear and radial gradients are implemented.
</p>
</d:OperatorScript>
</SVGTestCase>
<title xml:id="test-title">$RCSfile: coords-units-01-t.svg,v $</title>
<defs>
<font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F">
<font-face-src>
<font-face-uri xlink:href="../images/SVGFreeSans.svg#ascii" />
</font-face-src>
</font-face>
</defs>
<g xml:id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
<g font-size="14">
<!-- ==================================================================== -->
<!-- The following gradients will be used to fill a rectangle with the -->
<!-- following geometry in User space: x=0, y=0, width=50 height=20 -->
<!-- The gradient vector, in linearBoundingBoxFraction, is defined as: -->
<!-- (0, 0) to (1, 0). -->
<!-- According to the spec, for our rectangle, this corresponds to the -->
<!-- following user space coordinates: -->
<!-- (0, 0) becomes (0, 0) and (1, 0) becomes (50, 0) -->
<!-- These values are used to define the linearUserSpace gradient. -->
<!-- If the test succeeds, all the gradient should fill the rectangles -->
<!-- the same way -->
<!-- ==================================================================== -->
<linearGradient xml:id="linearBoundingBoxFraction" gradientUnits="objectBoundingBox" x1="0" y1="0" x2="1" y2="0">
<stop stop-color="red" offset="0" />
<stop stop-color="blue" offset="1" />
</linearGradient>
<linearGradient xml:id="linearUserSpace" gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="50" y2="0">
<stop stop-color="red" offset="0" />
<stop stop-color="blue" offset="1" />
</linearGradient>
<!-- Draw Text Comment -->
<text x="30" y="30">Bounding box relative coordinates</text>
<g transform="translate(30, 40)">
<rect x="0" y="0" width="50" height="20" transform="translate(0, 20)" fill="url(#linearBoundingBoxFraction)" />
<rect x="0" y="0" width="50" height="20" transform="translate(0, 40)" fill="url(#linearUserSpace)" />
<line x1="0" y1="20" x2="50" y2="20" stroke="#cccccc" stroke-width="1" />
<line x1="0" y1="40" x2="50" y2="40" stroke="#cccccc" stroke-width="1" />
<text x="60" y="35">Fraction</text>
<text x="60" y="55">User Space</text>
</g>
<!-- ==================================================================== -->
<!-- The following gradients will be used to fill a rectangle with the -->
<!-- following geometry in User space: x=0, y=0, width=60 height=60 -->
<!-- The radial gradient in radialBoundingBoxFraction is -->
<!-- defined as: cx=0.25 cy=0.25 and r=0.25 -->
<!-- These two definition, for our rectangle, should be identical to the -->
<!-- following radial gradient in radialUserSpace: -->
<!-- cx=15 cy=15 r=15 -->
<!-- ==================================================================== -->
<radialGradient xml:id="radialBoundingBoxFraction" gradientUnits="objectBoundingBox" cx="0.25" cy="0.25" r="0.25">
<stop stop-color="red" offset="0" />
<stop stop-color="blue" offset="1" />
</radialGradient>
<radialGradient xml:id="radialUserSpace" gradientUnits="userSpaceOnUse" cx="15" cy="15" r="15">
<stop stop-color="red" offset="0" />
<stop stop-color="blue" offset="1" />
</radialGradient>
<!-- Draw Text Comment -->
<text x="30" y="130">Bounding box relative length (percentage and fraction)</text>
<g transform="translate(30, 140)">
<rect x="0" y="0" width="60" height="60" transform="translate(61, 0)" fill="url(#radialBoundingBoxFraction)" />
<rect x="0" y="0" width="60" height="60" transform="translate(122, 0)" fill="url(#radialUserSpace)" />
<text x="61" y="73">Fraction</text>
<text x="122" y="73">User Space</text>
</g>
</g>
</g>
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
<text xml:id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.10 $</text>
</g>
<rect xml: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 xml: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>