blob: 53e3d4ec278b4efbd089ab2b96d38513f7568853 [file] [log] [blame]
<?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.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="tiny" id="svg-root" width="100%" height="100%" viewBox="0 0 480 360">
<title id="test-title">gradient stop corner cases</title>
<g id="test-body-content">
<!-- No stops, like fill = none -->
<linearGradient id="defs1" gradientUnits="objectBoundingBox" x1="0" y1="0" x2="1" y2="0">
</linearGradient>
<!-- One stop, like fill = black -->
<linearGradient id="defs2" gradientUnits="objectBoundingBox" x1="0" y1="0" x2="1" y2="0">
<stop stop-color="black" offset="1"/>
</linearGradient>
<!-- If a stop less than all previous stops, it is set equal to the largest stop-->
<!-- This also tests if two stops are equal the last stop controls the color at the overlap point-->
<linearGradient id="defs3" gradientUnits="objectBoundingBox" x1="0" y1="0" x2="1" y2="0">
<stop stop-color="yellow" offset="0"/>
<stop stop-color="red" offset=".25"/>
<stop stop-color="green" offset=".5"/>
<stop stop-color="blue" offset=".1"/>
</linearGradient>
<!-- a stop less than 0 is clamped to 0; leftmost color should match stroke color -->
<linearGradient id="defs4" gradientUnits="objectBoundingBox" x1="0" y1="0" x2="1" y2="0">
<stop stop-color="green" offset="-10"/>
<stop stop-color="red" offset="1"/>
</linearGradient>
<!-- a stop more than 1 is clamped to 1; rightmost color should match strole color -->
<linearGradient id="defs5" gradientUnits="objectBoundingBox" x1="0" y1="0" x2="1" y2="0">
<stop stop-color="red" offset="0"/>
<stop stop-color="green" offset="10"/>
</linearGradient>
<!-- if 2 stop share the same value, the last one owns the value; there should be no red
in the gradient -->
<linearGradient id="defs6" gradientUnits="objectBoundingBox" x1="0" y1="0" x2="1" y2="0">
<stop stop-color="blue" offset="0"/>
<stop stop-color="green" offset=".5"/>
<stop stop-color="red" offset=".5"/>
<stop stop-color="green" offset=".5"/>
<stop stop-color="blue" offset="1"/>
</linearGradient>
<rect x="20" y="10" width="440" height="30" fill="url(#defs1)" stroke="red"/>
<rect x="20" y="60" width="440" height="30" fill="url(#defs2)" />
<rect x="20" y="110" width="440" height="30" fill="url(#defs3)" />
<rect x="20" y="160" width="440" height="30" fill="url(#defs4)" stroke="green"/>
<rect x="20" y="210" width="440" height="30" fill="url(#defs5)" stroke="green"/>
<rect x="20" y="260" width="440" height="30" fill="url(#defs6)"/>
</g>
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
</svg>