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

Unified Diff: LayoutTests/fast/svg/whitespace-number.html

Issue 302643004: [SVG2] Allow leading and trailing whitespace in svg attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@relax_todouble_wtf
Patch Set: split tests to combat slow xp trybots Created 6 years, 6 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
Index: LayoutTests/fast/svg/whitespace-number.html
diff --git a/LayoutTests/fast/svg/whitespace-number.html b/LayoutTests/fast/svg/whitespace-number.html
new file mode 100644
index 0000000000000000000000000000000000000000..6031381cf250d7c648507278a806dacc55fa7c5a
--- /dev/null
+++ b/LayoutTests/fast/svg/whitespace-number.html
@@ -0,0 +1,49 @@
+<!doctype html>
+<title>Whitespace in attribute values tests</title>
+<script src=../../resources/testharness.js></script>
+<script src=../../resources/testharnessreport.js></script>
+<script src=resources/whitespace-helper.js></script>
+<svg id="testcontainer">
+ <defs>
+ <marker/>
+ <stop/>
+ <filter>
+ <feTurbulence></feTurbulence>
+ </filter>
+ </defs>
+</svg>
+<div id=log></div>
+<script>
+var svg = document.querySelector("svg");
+
+// test length values
+var EPSILON = Math.pow(2, -24); // float epsilon
+var whitespace = [ "", " ", " ", "\r\n\t ", "\f" ];
+var garbage = [ "a", "e", "foo", ")90" ];
+var validunits = [ "", "em", "ex", "px", "in", "cm", "mm", "pt", "pc", "%" ];
+
+testType("<number>",
+ document.querySelector("stop"),
+ "offset",
+ 0, // expected default value
+ whitespace,
+ [ "-47", ".1", "0.35", "1e-10", "+32", "+17E-1", "17e+2" ], // valid
+ [ Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, "fnord", "E", "e", "e+", "E-", "-", "+", "-.", ".-", ".", "+.", ".E0", "e1" ], // invalid
+ [ "" ], // valid units
+ garbage,
+ function(elm, value) { assert_approx_equals(elm.offset.baseVal, parseFloat(value), EPSILON); },
+ function(elm, expected) { assert_approx_equals(elm.offset.baseVal, expected, EPSILON); } );
+
+testType("<percentage>",
+ document.querySelector("stop"),
+ "offset",
+ 0, // expected default value
+ whitespace,
+ [ "-47", ".1", "0.35", "1e-10", "+32", "+17E-1", "17e+2" ], // valid
+ [ Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, "fnord", "E", "e", "e+", "E-", "-", "+", "-.", ".-", ".", "+.", ".E0", "e1" ], // invalid
+ [ "%" ], // valid units
+ garbage,
+ function(elm, value) { assert_approx_equals(elm.offset.baseVal, parseFloat(value)/ 100, EPSILON); },
+ function(elm, expected) { assert_approx_equals(elm.offset.baseVal, expected, EPSILON); } );
+
+</script>
« no previous file with comments | « LayoutTests/fast/svg/whitespace-length-invalid-expected.txt ('k') | LayoutTests/fast/svg/whitespace-number-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698