Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Unified Diff: LayoutTests/svg/filters/feTurbulence-bad-seeds.html

Issue 882173004: Add a regression test for feTurbulence seeds that generate zero vectors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/svg/filters/feTurbulence-bad-seeds-expected.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/svg/filters/feTurbulence-bad-seeds.html
diff --git a/LayoutTests/svg/filters/feTurbulence-bad-seeds.html b/LayoutTests/svg/filters/feTurbulence-bad-seeds.html
new file mode 100644
index 0000000000000000000000000000000000000000..ccf63854b836e3cbe13b5c0508f40dda74f9dd14
--- /dev/null
+++ b/LayoutTests/svg/filters/feTurbulence-bad-seeds.html
@@ -0,0 +1,52 @@
+<!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>
« no previous file with comments | « no previous file | LayoutTests/svg/filters/feTurbulence-bad-seeds-expected.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698