summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/svg/whitespace-angle.html
blob: b8d1b929a6056a1d89ff71152fad88b165322da1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!doctype html> 
<title>Whitespace in <angle> attribute values</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/>
	</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("<angle>",
		 document.querySelector("marker"),
		 "orient",
		 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
		 [ "", "deg", "rad", "grad" ], // valid units
		 garbage,
		 function(elm, value) { assert_approx_equals(elm.orientAngle.baseVal.valueInSpecifiedUnits, parseFloat(value), EPSILON); },
		 function(elm, expected) { assert_approx_equals(elm.orientAngle.baseVal.value, expected, EPSILON); } );


</script>