| 1 |
<svg version="1.1" baseProfile="basic" id="svg-root" |
| 2 |
width="100%" height="100%" viewBox="0 0 480 360" |
| 3 |
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> |
| 4 |
<!--======================================================================--> |
| 5 |
<!--= SVG 1.1 2nd Edition Test Case =--> |
| 6 |
<!--======================================================================--> |
| 7 |
<!--= Copyright 2009 World Wide Web Consortium, (Massachusetts =--> |
| 8 |
<!--= Institute of Technology, European Research Consortium for =--> |
| 9 |
<!--= Informatics and Mathematics (ERCIM), Keio University). =--> |
| 10 |
<!--= All Rights Reserved. =--> |
| 11 |
<!--= See http://www.w3.org/Consortium/Legal/. =--> |
| 12 |
<!--======================================================================--> |
| 13 |
<d:SVGTestCase xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/" |
| 14 |
template-version="1.4" reviewer="SVGWG" author="Vincent Hardy" status="accepted" |
| 15 |
version="$Revision: 1.7 $" testname="$RCSfile: coords-units-01-b.svg,v $"> |
| 16 |
<d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/coords.html#Units"> |
| 17 |
<p> |
| 18 |
Verify the conversion processing of percentage and fraction values relative to |
| 19 |
object bounding boxes. This is used when defining linear and radial gradients |
| 20 |
as well as patterns. |
| 21 |
</p> |
| 22 |
<p> |
| 23 |
The test validates conversion for coordinates, width, height and length. The first |
| 24 |
test defines three corresponding linear gradients, which specify coordinates |
| 25 |
using percentages for one, fractions for the second and user coordinates for the |
| 26 |
third. The second test defines three corresponding radial gradients, which specify |
| 27 |
a length (radius) using percentages for the first, fractions for the second and |
| 28 |
user space for the third. Finally, the third test defines three corresponding patterns, |
| 29 |
which specify their width and height using percentages for the first, fractions for the |
| 30 |
second and user space coordinates for the last one. |
| 31 |
</p> |
| 32 |
<p> |
| 33 |
The test also assumes that linear and radial gradients, |
| 34 |
as well as patterns are implemented. |
| 35 |
</p> |
| 36 |
</d:testDescription> |
| 37 |
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
| 38 |
<p> |
| 39 |
Run the test. No interaction required. |
| 40 |
</p> |
| 41 |
</d:operatorScript> |
| 42 |
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
| 43 |
<p> |
| 44 |
The rendered image should match the reference image. Also, the text may |
| 45 |
show minor differences, per CSS2 rules for font selection and matching. |
| 46 |
</p> |
| 47 |
</d:passCriteria> |
| 48 |
</d:SVGTestCase> |
| 49 |
<title id="test-title">$RCSfile: coords-units-01-b.svg,v $</title> |
| 50 |
<defs> |
| 51 |
<font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F"> |
| 52 |
<font-face-src> |
| 53 |
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> |
| 54 |
</font-face-src> |
| 55 |
</font-face> |
| 56 |
</defs> |
| 57 |
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> |
| 58 |
<g font-size="14"> |
| 59 |
<!-- ==================================================================== --> |
| 60 |
<!-- The following gradients will be used to fill a rectangle with the --> |
| 61 |
<!-- following geometry in User space: x=0, y=0, width=50 height=20 --> |
| 62 |
<!-- The gradient vector, in linearBoundingBox, is defined as: (0%, 0%) --> |
| 63 |
<!-- to (100%, 0%). --> |
| 64 |
<!-- The gradient vector, in linearBoundingBoxFraction, is defined as: --> |
| 65 |
<!-- (0, 0) to (1, 0), which is equivalent. --> |
| 66 |
<!-- According to the spec, for our rectangle, this corresponds to the --> |
| 67 |
<!-- following user space coordinates: --> |
| 68 |
<!-- (0%, 0%) becomes (0, 0) and (100%, 0%) becomes (20, 0) --> |
| 69 |
<!-- These values are used to define the linearUserSpace gradient. --> |
| 70 |
<!-- If the test succeeds, all the gradient should fill the rectangles --> |
| 71 |
<!-- the same way --> |
| 72 |
<!-- ==================================================================== --> |
| 73 |
<linearGradient id="linearBoundingBoxPercentage" gradientUnits="objectBoundingBox" x1="0%" y1="0%" x2="100%" y2="0%"> |
| 74 |
<stop stop-color="fuchsia" offset="0"/> |
| 75 |
<stop stop-color="blue" offset="1"/> |
| 76 |
</linearGradient> |
| 77 |
<linearGradient id="linearBoundingBoxFraction" gradientUnits="objectBoundingBox" x1="0" y1="0" x2="1" y2="0"> |
| 78 |
<stop stop-color="fuchsia" offset="0"/> |
| 79 |
<stop stop-color="blue" offset="1"/> |
| 80 |
</linearGradient> |
| 81 |
<linearGradient id="linearUserSpace" gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="50" y2="0"> |
| 82 |
<stop stop-color="fuchsia" offset="0"/> |
| 83 |
<stop stop-color="blue" offset="1"/> |
| 84 |
</linearGradient> |
| 85 |
<!-- Draw Text Comment --> |
| 86 |
<text x="30" y="30">Bounding box relative coordinates (percentage and fraction)</text> |
| 87 |
<g transform="translate(30, 40)"> |
| 88 |
<rect x="0" y="0" width="50" height="20" fill="url(#linearBoundingBoxPercentage)"/> |
| 89 |
<rect x="0" y="0" width="50" height="20" transform="translate(0, 20)" fill="url(#linearBoundingBoxFraction)"/> |
| 90 |
<rect x="0" y="0" width="50" height="20" transform="translate(0, 40)" fill="url(#linearUserSpace)"/> |
| 91 |
<line x1="0" y1="20" x2="50" y2="20" stroke="#cccccc" stroke-width="1"/> |
| 92 |
<line x1="0" y1="40" x2="50" y2="40" stroke="#cccccc" stroke-width="1"/> |
| 93 |
<text x="60" y="15">Percentage</text> |
| 94 |
<text x="60" y="35">Fraction</text> |
| 95 |
<text x="60" y="55">User Space</text> |
| 96 |
</g> |
| 97 |
<!-- ==================================================================== --> |
| 98 |
<!-- The following gradients will be used to fill a rectangle with the --> |
| 99 |
<!-- following geometry in User space: x=0, y=0, width=60 height=60 --> |
| 100 |
<!-- The radial gradient outmost circle, in radialBoundingBox, is defined --> |
| 101 |
<!-- as: cx=25% cy=25% r=25% --> |
| 102 |
<!-- The radial gradient outmost circle, in radialBoundingBoxFraction, is --> |
| 103 |
<!-- defined as: cx=0.25 cy=0.25 and r=0.25 --> |
| 104 |
<!-- These two definition, for our rectangle, should be identical to the --> |
| 105 |
<!-- following radial gradient outmost circle, in radialUserSpace: --> |
| 106 |
<!-- cx=15 cy=15 r=15 --> |
| 107 |
<!-- ==================================================================== --> |
| 108 |
<radialGradient id="radialBoundingBoxPercentage" gradientUnits="objectBoundingBox" cx="25%" cy="25%" r="25%" fx="25%" fy="25%"> |
| 109 |
<stop stop-color="fuchsia" offset="0"/> |
| 110 |
<stop stop-color="blue" offset="1"/> |
| 111 |
</radialGradient> |
| 112 |
<radialGradient id="radialBoundingBoxFraction" gradientUnits="objectBoundingBox" cx="0.25" cy="0.25" r="0.25" fx="0.25" fy="0.25"> |
| 113 |
<stop stop-color="fuchsia" offset="0"/> |
| 114 |
<stop stop-color="blue" offset="1"/> |
| 115 |
</radialGradient> |
| 116 |
<radialGradient id="radialUserSpace" gradientUnits="userSpaceOnUse" cx="15" cy="15" r="15" fx="15" fy="15"> |
| 117 |
<stop stop-color="fuchsia" offset="0"/> |
| 118 |
<stop stop-color="blue" offset="1"/> |
| 119 |
</radialGradient> |
| 120 |
<!-- Draw Text Comment --> |
| 121 |
<text x="30" y="130">Bounding box relative length (percentage and fraction)</text> |
| 122 |
<g transform="translate(30, 140)"> |
| 123 |
<rect x="0" y="0" width="60" height="60" fill="url(#radialBoundingBoxPercentage)"/> |
| 124 |
<rect x="0" y="0" width="60" height="60" transform="translate(61, 0)" fill="url(#radialBoundingBoxFraction)"/> |
| 125 |
<rect x="0" y="0" width="60" height="60" transform="translate(122, 0)" fill="url(#radialUserSpace)"/> |
| 126 |
<text x="0" y="73">Percent.</text> |
| 127 |
<text x="61" y="73">Fraction</text> |
| 128 |
<text x="122" y="73">User Space</text> |
| 129 |
</g> |
| 130 |
<!-- ==================================================================== --> |
| 131 |
<!-- The following patterns will be used to fill a rectangle, with the --> |
| 132 |
<!-- following geometry in User space: x=0, y=0, width=50 height=30 --> |
| 133 |
<!-- The pattern tile, in patterBoundingBoxPercentage, is defined as: --> |
| 134 |
<!-- x=25% y=25% width=50% height=50% --> |
| 135 |
<!-- The pattern tile, in patternBoundingBoxFraction, is defined as: --> |
| 136 |
<!-- x=0.25 y=0.25 width=0.50 height=0.50 --> |
| 137 |
<!-- For our test rectangle, both correspond to the following User space --> |
| 138 |
<!-- coordinates: x=12.5 y=7.5 width=25 height=15 --> |
| 139 |
<!-- These coordinates are use to define the patternUserSpace tile --> |
| 140 |
<!-- ==================================================================== --> |
| 141 |
<pattern id="patternBoundingBoxPercentage" patternUnits="objectBoundingBox" patternContentUnits="objectBoundingBox" x="25%" y="25%" width="50%" height="50%"> |
| 142 |
<circle cx="0.50" cy="0.50" r="0.25" fill="fuchsia"/> |
| 143 |
<rect x="0.4" y="0.4" width=".2" height=".2" fill="blue"/> |
| 144 |
</pattern> |
| 145 |
<pattern id="patternBoundingBoxFraction" patternUnits="objectBoundingBox" patternContentUnits="objectBoundingBox" x="0.25" y="0.25" width="0.50" height="0.50"> |
| 146 |
<circle cx="0.50" cy="0.50" r="0.25" fill="fuchsia"/> |
| 147 |
<rect x="0.4" y="0.4" width=".2" height=".2" fill="blue"/> |
| 148 |
</pattern> |
| 149 |
<pattern id="patternUserSpace" patternUnits="userSpaceOnUse" patternContentUnits="userSpaceOnUse" x="12.5" y="7.5" width="25" height="15"> |
| 150 |
<circle id="patternContent" cx="25" cy="15" r="10" fill="fuchsia"/> |
| 151 |
<rect x="20" y="12" width="10" height="6" fill="blue"/> |
| 152 |
</pattern> |
| 153 |
<!-- Draw Text Comment --> |
| 154 |
<text x="30" y="240">Bounding box relative width/height (percentage and fraction)</text> |
| 155 |
<g transform="translate(30, 250)"> |
| 156 |
<rect x="0" y="0" width="50" height="30" fill="url(#patternBoundingBoxPercentage)" stroke="black"/> |
| 157 |
<rect x="0" y="0" width="50" height="30" transform="translate(150, 0)" fill="url(#patternBoundingBoxFraction)" stroke="black"/> |
| 158 |
<rect x="0" y="0" width="50" height="30" transform="translate(300, 0)" fill="url(#patternUserSpace)" stroke="black"/> |
| 159 |
<text x="60" y="20">Percentage</text> |
| 160 |
<text x="210" y="20">Fraction</text> |
| 161 |
<text x="360" y="20">User Space</text> |
| 162 |
</g> |
| 163 |
</g> |
| 164 |
</g> |
| 165 |
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> |
| 166 |
<text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.7 $</text> |
| 167 |
</g> |
| 168 |
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/> |
| 169 |
<!-- comment out this watermark once the test is approved --> |
| 170 |
<!--<g id="draft-watermark"> |
| 171 |
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> |
| 172 |
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" |
| 173 |
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> |
| 174 |
</g>--> |
| 175 |
</svg> |