| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <title>Whitespace in attribute values tests</title> | 2 <title>Whitespace in attribute values tests</title> |
| 3 <script src=../../resources/testharness.js></script> | 3 <script src=../../resources/testharness.js></script> |
| 4 <script src=../../resources/testharnessreport.js></script> | 4 <script src=../../resources/testharnessreport.js></script> |
| 5 <script src=resources/whitespace-helper.js></script> | 5 <script src=resources/whitespace-helper.js></script> |
| 6 <svg id="testcontainer"> | 6 <svg id="testcontainer"> |
| 7 <defs> | 7 <defs> |
| 8 <marker/> | 8 <marker/> |
| 9 <stop/> | 9 <stop/> |
| 10 <filter> | 10 <filter> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 var whitespace = [ "", " ", " ", "\r\n\t ", "\f" ]; | 21 var whitespace = [ "", " ", " ", "\r\n\t ", "\f" ]; |
| 22 var garbage = [ "a", "e", "foo", ")90" ]; | 22 var garbage = [ "a", "e", "foo", ")90" ]; |
| 23 var validunits = [ "", "em", "ex", "px", "in", "cm", "mm", "pt", "pc", "%" ]; | 23 var validunits = [ "", "em", "ex", "px", "in", "cm", "mm", "pt", "pc", "%" ]; |
| 24 | 24 |
| 25 testType("<number>", | 25 testType("<number>", |
| 26 document.querySelector("stop"), | 26 document.querySelector("stop"), |
| 27 "offset", | 27 "offset", |
| 28 0, // expected default value | 28 0, // expected default value |
| 29 whitespace, | 29 whitespace, |
| 30 [ "-47", ".1", "0.35", "1e-10", "+32", "+17E-1", "17e+2" ], //
valid | 30 [ "-47", ".1", "0.35", "1e-10", "+32", "+17E-1", "17e+2" ], //
valid |
| 31 [ Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINIT
Y, "fnord", "E", "e", "e+", "E-", "-", "+", "-.", ".-", ".", "+.", ".E0", "e1" ]
, // invalid | |
| 32 [ "" ], // valid units | 31 [ "" ], // valid units |
| 33 garbage, | 32 garbage, |
| 34 function(elm, value) { assert_approx_equals(elm.offset.baseVal,
parseFloat(value), EPSILON); }, | 33 function(elm, value) { assert_approx_equals(elm.offset.baseVal,
parseFloat(value), EPSILON); }, |
| 35 function(elm, expected) { assert_approx_equals(elm.offset.baseV
al, expected, EPSILON); } ); | 34 function(elm, expected) { assert_approx_equals(elm.offset.baseV
al, expected, EPSILON); } ); |
| 36 | 35 |
| 37 testType("<percentage>", | 36 testType("<percentage>", |
| 38 document.querySelector("stop"), | 37 document.querySelector("stop"), |
| 39 "offset", | 38 "offset", |
| 40 0, // expected default value | 39 0, // expected default value |
| 41 whitespace, | 40 whitespace, |
| 42 [ "-47", ".1", "0.35", "1e-10", "+32", "+17E-1", "17e+2" ], //
valid | 41 [ "-47", ".1", "0.35", "1e-10", "+32", "+17E-1", "17e+2" ], //
valid |
| 43 [ Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINIT
Y, "fnord", "E", "e", "e+", "E-", "-", "+", "-.", ".-", ".", "+.", ".E0", "e1" ]
, // invalid | |
| 44 [ "%" ], // valid units | 42 [ "%" ], // valid units |
| 45 garbage, | 43 garbage, |
| 46 function(elm, value) { assert_approx_equals(elm.offset.baseVal,
parseFloat(value)/ 100, EPSILON); }, | 44 function(elm, value) { assert_approx_equals(elm.offset.baseVal,
parseFloat(value)/ 100, EPSILON); }, |
| 47 function(elm, expected) { assert_approx_equals(elm.offset.baseV
al, expected, EPSILON); } ); | 45 function(elm, expected) { assert_approx_equals(elm.offset.baseV
al, expected, EPSILON); } ); |
| 48 | 46 |
| 47 testInvalidType("<number>", |
| 48 document.querySelector("stop"), |
| 49 "offset", |
| 50 0, // expected default value |
| 51 whitespace, |
| 52 [ Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, "fnor
d", "E", "e", "e+", "E-", "-", "+", "-.", ".-", ".", "+.", ".E0", "e1" ], // inv
alid |
| 53 [ "" ], // valid units |
| 54 function(elm, value) { assert_approx_equals(elm.offset.baseVal, parseFl
oat(value), EPSILON); }, |
| 55 function(elm, expected) { assert_approx_equals(elm.offset.baseVal, expe
cted, EPSILON); } ); |
| 56 |
| 57 testInvalidType("<percentage>", |
| 58 document.querySelector("stop"), |
| 59 "offset", |
| 60 0, // expected default value |
| 61 whitespace, |
| 62 [ Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, "fnor
d", "E", "e", "e+", "E-", "-", "+", "-.", ".-", ".", "+.", ".E0", "e1" ], // inv
alid |
| 63 [ "%" ], // valid units |
| 64 function(elm, value) { assert_approx_equals(elm.offset.baseVal, parseFl
oat(value)/ 100, EPSILON); }, |
| 65 function(elm, expected) { assert_approx_equals(elm.offset.baseVal, expe
cted, EPSILON); } ); |
| 66 |
| 67 |
| 49 </script> | 68 </script> |
| OLD | NEW |