blob: cd29b0af2415a8b8224c66f6b50d88c01a7c12a5 [file] [log] [blame]
<?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 2002 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/. =-->
<!--======================================================================-->
<!-- ===================================================================== -->
<!-- -->
<!-- coords-units-01-b.svg -->
<!-- 1.1 revision by Christophe Jolif -->
<!-- -->
<!-- Validate the processing rules for converting coordinates and -->
<!-- lengths defined in fractions of the current object's bounding box -->
<!-- to user space coordinates and length. -->
<!-- -->
<!-- Author : Vincent Hardy, 29-Feb-2000 -->
<!-- -->
<!-- History: -->
<!-- 29-Feb-2000, VH: Created. Matches 20000302 SVG spec. -->
<!-- 09-Mar-2000, LH: suite integration (name, editorial, ..), ser#2 -->
<!-- 09-Mar-2000, LH: fix framing rect, ser#3. -->
<!-- 24-Apr-2000, LH: remove text-anchor, ser#4. -->
<!-- 02-Jun-2000, LH: fix fx,fy on radial grads" stroke lines; ser#5. -->
<!-- 04-Jun-2000, LH: mark "NA" (in -patch) on PNG, for patterns" ser#6 -->
<!-- 03-Aug-2000, LH: update DOCTYPE for CR DTD, 20000802" ser# . -->
<!-- 16-Aug-2000, LH: rename ser#7. -->
<!-- 29-Sep-2000, VH: fixed pattern reference problems" ser#8. -->
<!-- 07-Dec-2000, JF: update to Nov. 2 spec, fix other errors. -->
<!-- -->
<!-- ===================================================================== -->
<!--======================================================================-->
<!--= Note. After October 2000, revision history is kept as CVS 'commit' =-->
<!--= log messages, and therefore is no longer in the preceding preamble.=-->
<!--======================================================================-->
<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">
<SVGTestCase xmlns="http://www.w3.org/2000/02/svg/testsuite/description/">
<!--nav data here-->
<OperatorScript version="$Revision: 1.5 $" testname="coords-units-01-b.svg">
<Paragraph>
Verify the conversion processing of percentage and fraction values relative to
object bounding boxes. This is used when defining linear and radial gradients
as well as patterns.
</Paragraph>
<Paragraph>
The test validates conversion for coordinates, width, height and length. The first
test defines three corresponding linear gradients, which specify coordinates
using percentages for one, fractions for the second and user coordinates for the
third. The second test defines three corresponding radial gradients, which specify
a length (radius) using percentages for the first, fractions for the second and
user space for the third. Finally, the third test defines three corresponding patterns,
which specify their width and height using percentages for the first, fractions for the
second and user space coordinates for the last one.
</Paragraph>
<Paragraph>
The rendered image should match the reference image. Also, the text may
show minor differences, per CSS2 rules for font selection and matching.
</Paragraph>
<Paragraph>
The test also assumes that linear and radial gradients,
as well as patterns are implemented.
</Paragraph>
</OperatorScript>
</SVGTestCase>
<title id="test-title">coords-units-01-b</title>
<desc id="test-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, as well as patterns are implemented.</desc>
<!--======================================================================-->
<!--Content of Test Case follows... =====================-->
<!--======================================================================-->
<g id="test-body-content">
<!-- ==================================================================== -->
<!-- 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 linearBoundingBox, is defined as: (0%, 0%) -->
<!-- to (100%, 0%). -->
<!-- The gradient vector, in linearBoundingBoxFraction, is defined as: -->
<!-- (0, 0) to (1, 0), which is equivalent. -->
<!-- According to the spec, for our rectangle, this corresponds to the -->
<!-- following user space coordinates: -->
<!-- (0%, 0%) becomes (0, 0) and (100%, 0%) becomes (20, 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 id="linearBoundingBoxPercentage" gradientUnits="objectBoundingBox" x1="0%" y1="0%" x2="100%" y2="0%">
<stop stop-color="red" offset="0"/>
<stop stop-color="blue" offset="1"/>
</linearGradient>
<linearGradient 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 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 (percentage and fraction)</text>
<g transform="translate(30, 40)">
<rect x="0" y="0" width="50" height="20" fill="url(#linearBoundingBoxPercentage)"/>
<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="15">Percentage</text>
<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 outmost circle, in radialBoundingBox, is defined -->
<!-- as: cx=25% cy=25% r=25% -->
<!-- The radial gradient outmost circle, 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 outmost circle, in radialUserSpace: -->
<!-- cx=15 cy=15 r=15 -->
<!-- ==================================================================== -->
<radialGradient id="radialBoundingBoxPercentage" gradientUnits="objectBoundingBox" cx="25%" cy="25%" r="25%" fx="25%" fy="25%">
<stop stop-color="red" offset="0"/>
<stop stop-color="blue" offset="1"/>
</radialGradient>
<radialGradient id="radialBoundingBoxFraction" gradientUnits="objectBoundingBox" cx="0.25" cy="0.25" r="0.25" fx="0.25" fy="0.25">
<stop stop-color="red" offset="0"/>
<stop stop-color="blue" offset="1"/>
</radialGradient>
<radialGradient id="radialUserSpace" gradientUnits="userSpaceOnUse" cx="15" cy="15" r="15" fx="15" fy="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" fill="url(#radialBoundingBoxPercentage)"/>
<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="0" y="70">Percent.</text>
<text x="61" y="70">Fraction</text>
<text x="122" y="70">User Space</text>
</g>
<!-- ==================================================================== -->
<!-- The following patterns will be used to fill a rectangle, with the -->
<!-- following geometry in User space: x=0, y=0, width=50 height=30 -->
<!-- The pattern tile, in patterBoundingBoxPercentage, is defined as: -->
<!-- x=25% y=25% width=50% height=50% -->
<!-- The pattern tile, in patternBoundingBoxFraction, is defined as: -->
<!-- x=0.25 y=0.25 width=0.50 height=0.50 -->
<!-- For our test rectangle, both correspond to the following User space -->
<!-- coordinates: x=12.5 y=7.5 width=25 height=15 -->
<!-- These coordinates are use to define the patternUserSpace tile -->
<!-- ==================================================================== -->
<pattern id="patternBoundingBoxPercentage" patternUnits="objectBoundingBox" patternContentUnits="objectBoundingBox" x="25%" y="25%" width="50%" height="50%">
<circle cx="0.50" cy="0.50" r="0.25" fill="red"/>
<rect x="0.4" y="0.4" width=".2" height=".2" fill="blue"/>
</pattern>
<pattern id="patternBoundingBoxFraction" patternUnits="objectBoundingBox" patternContentUnits="objectBoundingBox" x="0.25" y="0.25" width="0.50" height="0.50">
<circle cx="0.50" cy="0.50" r="0.25" fill="red"/>
<rect x="0.4" y="0.4" width=".2" height=".2" fill="blue"/>
</pattern>
<pattern id="patternUserSpace" patternUnits="userSpaceOnUse" patternContentUnits="userSpaceOnUse" x="12.5" y="7.5" width="25" height="15">
<circle id="patternContent" cx="25" cy="15" r="10" fill="red"/>
<rect x="20" y="12" width="10" height="6" fill="blue"/>
</pattern>
<!-- Draw Text Comment -->
<text x="30" y="240">Bounding box relative width/height (percentage and fraction)</text>
<g transform="translate(30, 250)">
<rect x="0" y="0" width="50" height="30" fill="url(#patternBoundingBoxPercentage)" stroke="black"/>
<rect x="0" y="0" width="50" height="30" transform="translate(150, 0)" fill="url(#patternBoundingBoxFraction)" stroke="black"/>
<rect x="0" y="0" width="50" height="30" transform="translate(300, 0)" fill="url(#patternUserSpace)" stroke="black"/>
<text x="60" y="20">Percentage</text>
<text x="210" y="20">Fraction</text>
<text x="360" y="20">User Space</text>
</g>
<!-- Test framing rectangle, drawn just inside viewport boundary. -->
<rect x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
</g>
<text id="revision" x="10" y="340" font-size="40" stroke="none" fill="black">$Revision: 1.5 $</text>
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
</svg>