Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / svg / whitespace-number.html
blob6031381cf250d7c648507278a806dacc55fa7c5a
1 <!doctype html>
2 <title>Whitespace in attribute values tests</title>
3 <script src=../../resources/testharness.js></script>
4 <script src=../../resources/testharnessreport.js></script>
5 <script src=resources/whitespace-helper.js></script>
6 <svg id="testcontainer">
7 <defs>
8 <marker/>
9 <stop/>
10 <filter>
11 <feTurbulence></feTurbulence>
12 </filter>
13 </defs>
14 </svg>
15 <div id=log></div>
16 <script>
17 var svg = document.querySelector("svg");
19 // test length values
20 var EPSILON = Math.pow(2, -24); // float epsilon
21 var whitespace = [ "", " ", " ", "\r\n\t ", "\f" ];
22 var garbage = [ "a", "e", "foo", ")90" ];
23 var validunits = [ "", "em", "ex", "px", "in", "cm", "mm", "pt", "pc", "%" ];
25 testType("<number>",
26 document.querySelector("stop"),
27 "offset",
28 0, // expected default value
29 whitespace,
30 [ "-47", ".1", "0.35", "1e-10", "+32", "+17E-1", "17e+2" ], // valid
31 [ Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, "fnord", "E", "e", "e+", "E-", "-", "+", "-.", ".-", ".", "+.", ".E0", "e1" ], // invalid
32 [ "" ], // valid units
33 garbage,
34 function(elm, value) { assert_approx_equals(elm.offset.baseVal, parseFloat(value), EPSILON); },
35 function(elm, expected) { assert_approx_equals(elm.offset.baseVal, expected, EPSILON); } );
37 testType("<percentage>",
38 document.querySelector("stop"),
39 "offset",
40 0, // expected default value
41 whitespace,
42 [ "-47", ".1", "0.35", "1e-10", "+32", "+17E-1", "17e+2" ], // valid
43 [ Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, "fnord", "E", "e", "e+", "E-", "-", "+", "-.", ".-", ".", "+.", ".E0", "e1" ], // invalid
44 [ "%" ], // valid units
45 garbage,
46 function(elm, value) { assert_approx_equals(elm.offset.baseVal, parseFloat(value)/ 100, EPSILON); },
47 function(elm, expected) { assert_approx_equals(elm.offset.baseVal, expected, EPSILON); } );
49 </script>