OLD | NEW |
1 <script src="../../resources/testharness.js"></script> | 1 <script src="../../resources/testharness.js"></script> |
2 <script src="../../resources/testharnessreport.js"></script> | 2 <script src="../../resources/testharnessreport.js"></script> |
3 | 3 |
4 <div id="testElement"></div> | 4 <div id="testElement"></div> |
5 | 5 |
6 <script> | 6 <script> |
7 | 7 |
8 var EPSILON = 1e-6; // float epsilon | 8 var EPSILON = 1e-6; // float epsilon |
9 | 9 |
10 function validateTransformWithSingleRotation(transform, x, y, z, angle, cssStrin
g) { | 10 function validateTransformWithSingleRotation(transform, x, y, z, angle, cssText)
{ |
11 assert_equals(transform.cssString, cssString); | 11 assert_equals(transform.cssText, cssText); |
12 | 12 |
13 // Shouldn't be base StyleValue as for unsupported values. | 13 // Shouldn't be base StyleValue as for unsupported values. |
14 assert_true(transform instanceof TransformValue); | 14 assert_true(transform instanceof CSSTransformValue); |
15 | 15 |
16 var components = [...transform.values()]; | 16 var components = [...transform.values()]; |
17 assert_equals(components.length, 1); | 17 assert_equals(components.length, 1); |
18 assert_true(components[0] instanceof CSSRotation); | 18 assert_true(components[0] instanceof CSSRotation); |
19 assert_equals(components[0].cssString, cssString); | 19 assert_equals(components[0].cssText, cssText); |
20 | 20 |
21 assert_approx_equals(components[0].angle, angle, EPSILON); | 21 assert_approx_equals(components[0].angle, angle, EPSILON); |
22 assert_approx_equals(components[0].x, x, EPSILON); | 22 assert_approx_equals(components[0].x, x, EPSILON); |
23 assert_approx_equals(components[0].y, y, EPSILON); | 23 assert_approx_equals(components[0].y, y, EPSILON); |
24 assert_approx_equals(components[0].z, z, EPSILON); | 24 assert_approx_equals(components[0].z, z, EPSILON); |
25 } | 25 } |
26 | 26 |
27 test(function() { | 27 test(function() { |
28 testElement.style.transform = "rotate(30deg)"; | 28 testElement.style.transform = "rotate(30deg)"; |
29 | 29 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 test(function() { | 111 test(function() { |
112 testElement.style.transform = "rotateZ(1turn)"; | 112 testElement.style.transform = "rotateZ(1turn)"; |
113 validateTransformWithSingleRotation( | 113 validateTransformWithSingleRotation( |
114 testElement.styleMap.get("transform"), | 114 testElement.styleMap.get("transform"), |
115 0, 0, 1, 360, | 115 0, 0, 1, 360, |
116 "rotate3d(0, 0, 1, 360deg)"); | 116 "rotate3d(0, 0, 1, 360deg)"); |
117 }, "rotateZ with units other than degrees"); | 117 }, "rotateZ with units other than degrees"); |
118 | 118 |
119 </script> | 119 </script> |
OLD | NEW |