blob: ccf63854b836e3cbe13b5c0508f40dda74f9dd14 [file] [log] [blame]
<!doctype html>
<!--
This test determines whether the feTurbulence algorithm allows zero length vectors on some particular seeds. These zero length
vectors result in large rectangular holes in the generated image.
Seed 514 is the first seed value that demonstrates the error.
Others are: 1977,2337,4777,8032,9615,14783,14862,14921,18607,19537,19852,19955,22456,23056,26678,27351,29383,29560,29929, ...
The feTurbulence algorithm in the specification uses rejection sampling to avoid generating zero length vectors and so in a
correct implementation we should not see any large holes in the image.
-->
<html>
<body>
<svg viewbox="0 0 512 256">
<desc>Test passes if there are no red squares.</desc>
<defs>
<filter id="turb1" filterUnits="objectBoundingBox" x="0" y="0" width="100%" height="100%">
<feTurbulence x="0" y="0" width="100%" height="100%" baseFrequency="0.02 0.1" numOctaves="5" seed="514" result="a" />
<feComponentTransfer in="a">
<!-- set colour to black everywhere and set opacity to full if alpha > 0 -->
<feFuncR type="linear" slope="-10000" intercept="0"/><feFuncG type="linear" slope="-10000" intercept="0"/><feFuncB type="linear" slope="-10000" intercept="0"/>
<feFuncA type="linear" slope="10000" intercept="0"/>
</feComponentTransfer>
</filter>
<filter id="turb2" filterUnits="objectBoundingBox" x="0" y="0" width="100%" height="100%">
<feTurbulence x="0" y="0" width="100%" height="100%" baseFrequency="0.02 0.1" numOctaves="5" seed="14783" result="a" />
<feComponentTransfer in="a">
<feFuncR type="linear" slope="-10000" intercept="0"/><feFuncG type="linear" slope="-10000" intercept="0"/><feFuncB type="linear" slope="-10000" intercept="0"/>
<feFuncA type="linear" slope="10000" intercept="0"/>
</feComponentTransfer>
</filter>
<filter id="turb3" filterUnits="objectBoundingBox" x="0" y="0" width="100%" height="100%">
<feTurbulence x="0" y="0" width="100%" height="100%" baseFrequency="0.02 0.1" numOctaves="5" seed="23056" result="a" />
<feComponentTransfer in="a">
<feFuncR type="linear" slope="-10000" intercept="0"/><feFuncG type="linear" slope="-10000" intercept="0"/><feFuncB type="linear" slope="-10000" intercept="0"/>
<feFuncA type="linear" slope="10000" intercept="0"/>
</feComponentTransfer>
</filter>
<filter id="turb4" filterUnits="objectBoundingBox" x="0" y="0" width="100%" height="100%">
<feTurbulence x="0" y="0" width="100%" height="100%" baseFrequency="0.02 0.1" numOctaves="5" seed="9615" result="a" />
<feComponentTransfer in="a">
<feFuncR type="linear" slope="-10000" intercept="0"/><feFuncG type="linear" slope="-10000" intercept="0"/><feFuncB type="linear" slope="-10000" intercept="0"/>
<feFuncA type="linear" slope="10000" intercept="0"/>
</feComponentTransfer>
</filter>
</defs>
<rect x="0" y="0" width="256" height="128" fill="red" />
<rect x="0" y="0" width="64" height="128" fill="black" filter="url(#turb1)"/>
<rect x="64" y="0" width="64" height="128" fill="blue" filter="url(#turb2)"/>
<rect x="128" y="0" width="64" height="128" fill="black" filter="url(#turb3)"/>
<rect x="192" y="0" width="64" height="128" fill="blue" filter="url(#turb4)"/>
</svg>
</body>
</html>