| 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="Haroon Sheikh" status="accepted" |
| 15 |
version="$Revision: 1.9 $" testname="$RCSfile: pservers-grad-09-b.svg,v $"> |
| 16 |
<d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/pservers.html#Gradients"> |
| 17 |
<p> |
| 18 |
Test that the viewer can handle the gradientUnits attribute on linear gradients. |
| 19 |
It tests the following values of gradientUnits: default (userSpace), objectBoundingBox, |
| 20 |
and userSpaceOnUse. |
| 21 |
</p> |
| 22 |
<p> |
| 23 |
From top-down the appearance of objects is as follows. |
| 24 |
</p> |
| 25 |
<p> |
| 26 |
The first rectangle uses the default attributes on the linearGradient element. |
| 27 |
Therefore the linear gradient should default to objectBoundingBox. It should appear |
| 28 |
from the left edge of the rectangle (blue) to the right edge of the rectangle (lime). |
| 29 |
The rectangle is smaller than the viewport, because a previous version of the SVG spec had the default value be 'viewport'. |
| 30 |
The test fails if only a portion of the gradient is shown. |
| 31 |
</p> |
| 32 |
<p> |
| 33 |
The next rectangle uses gradientUnits=objectBoundingBox. The linear gradient should |
| 34 |
travel from blue (top) to lime (bottom). |
| 35 |
</p> |
| 36 |
<p> |
| 37 |
The last rectangle uses gradientUnits=userSpaceOnUse. The rectangle element is given it's |
| 38 |
own transformation and the gradient is assumed to be in this user space. |
| 39 |
The gradient should appear as a linear gradient from lime (left) to blue (right). |
| 40 |
</p> |
| 41 |
</d:testDescription> |
| 42 |
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
| 43 |
<p>Run the test. No interaction required.</p> |
| 44 |
</d:operatorScript> |
| 45 |
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
| 46 |
<p>The test passes if the rendering matches the reference image, apart |
| 47 |
from any differences in font choice due to CSS2 rules. Specifically:</p> |
| 48 |
<ul> |
| 49 |
<li>The top rectangle is filled with a linear gradient from lime on the left to blue on the right.</li> |
| 50 |
<li>The middle rectangle is filled with a linear gradient from blue on the top to lime on the bottom.</li> |
| 51 |
<li>The bottom rectangle is filled with a linear gradient from lime on the left to blue on the right.</li> |
| 52 |
</ul> |
| 53 |
</d:passCriteria> |
| 54 |
</d:SVGTestCase> |
| 55 |
<title id="test-title">$RCSfile: pservers-grad-09-b.svg,v $</title> |
| 56 |
<defs> |
| 57 |
<font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F"> |
| 58 |
<font-face-src> |
| 59 |
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> |
| 60 |
</font-face-src> |
| 61 |
</font-face> |
| 62 |
</defs> |
| 63 |
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> |
| 64 |
<text font-size="15" x="10" y="25">Testing gradientUnits attribute</text> |
| 65 |
<!-- ====================================================================== --> |
| 66 |
<!-- Linear gradient with default attributes on <linear gradient> element. --> |
| 67 |
<!-- ====================================================================== --> |
| 68 |
<linearGradient id="Grad1"> |
| 69 |
<stop stop-color="lime" offset="0"/> |
| 70 |
<stop stop-color="blue" offset="1"/> |
| 71 |
</linearGradient> |
| 72 |
<rect x="125" y="35" width="200" height="50" fill="url(#Grad1)"/> |
| 73 |
<!--<text font-size="12" x="10" y="100">Linear gradient with default attributes (thus, same as objectBoundingBox)</text>--> |
| 74 |
<!--text font-size="12" x="10" y="125">Gradient is from the viewport left edge (lime) to viewport right edge (blue)</text--> |
| 75 |
<!--<text font-size="12" x="10" y="115">Gradient is from the object left edge (lime) to object right edge (blue)</text>--> |
| 76 |
<!-- ====================================================================== --> |
| 77 |
<!-- Linear gradient with gradientUnits=objectBoundingBox ======== --> |
| 78 |
<!-- ====================================================================== --> |
| 79 |
<linearGradient id="Grad2" gradientUnits="objectBoundingBox" x1="0" y1="0" x2="0" y2="1"> |
| 80 |
<stop stop-color="blue" offset="0"/> |
| 81 |
<stop stop-color="lime" offset="1"/> |
| 82 |
</linearGradient> |
| 83 |
<rect x="10" y="125" width="430" height="50" fill="url(#Grad2)"/> |
| 84 |
<!--<text font-size="12" x="10" y="190">gradientUnits=objectBoundingBox</text>--> |
| 85 |
<!--<text font-size="12" x="10" y="205">Gradient is from the object top edge (blue) to object bottom edge (lime)</text>--> |
| 86 |
<!-- ====================================================================== --> |
| 87 |
<!-- Gradient using gradientUnits="userSpaceOnUse" --> |
| 88 |
<!-- ====================================================================== --> |
| 89 |
<linearGradient id="Grad3" x1="0" y1="0" x2="0" y2="430" gradientUnits="userSpaceOnUse"> |
| 90 |
<stop stop-color="lime" offset="0"/> |
| 91 |
<stop stop-color="blue" offset="1"/> |
| 92 |
</linearGradient> |
| 93 |
<rect transform="translate(10, 260) rotate(-90)" x="0" y="0" width="50" height="430" fill="url(#Grad3)"/> |
| 94 |
<!--<text font-size="12" x="10" y="275">gradientUnits=userSpaceOnUse</text>--> |
| 95 |
<!--<text font-size="12" x="10" y="290">Gradient is from the object left edge (lime) to object right edge (blue)</text>--> |
| 96 |
</g> |
| 97 |
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> |
| 98 |
<text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.9 $</text> |
| 99 |
</g> |
| 100 |
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/> |
| 101 |
<!-- comment out this watermark once the test is approved --> |
| 102 |
<!--<g id="draft-watermark"> |
| 103 |
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> |
| 104 |
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" |
| 105 |
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> |
| 106 |
</g>--> |
| 107 |
</svg> |