OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
4 | 4 |
5 <script> | 5 <script> |
6 var EPSILON = 1e-6; // float epsilon | 6 var EPSILON = 1e-6; // float epsilon |
7 var values = [ | 7 var values = [ |
8 {input: new CSSScale(0, 0), x: 0, y: 0, z: 1, is2D: true, | 8 {input: new CSSScale(0, 0), x: 0, y: 0, z: 1, is2D: true, |
9 cssText: "scale(0, 0)"}, | 9 cssText: "scale(0, 0)"}, |
10 {input: new CSSScale(1, 2), x: 1, y: 2, z: 1, is2D: true, | 10 {input: new CSSScale(1, 2), x: 1, y: 2, z: 1, is2D: true, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 assert_throws(null, () => { new CSSScale({}, {}, {}); }); | 72 assert_throws(null, () => { new CSSScale({}, {}, {}); }); |
73 assert_throws(null, () => { new CSSScale(NaN, NaN, NaN); }); | 73 assert_throws(null, () => { new CSSScale(NaN, NaN, NaN); }); |
74 }, "Test that invalid input throws an exception."); | 74 }, "Test that invalid input throws an exception."); |
75 | 75 |
76 test(function() { | 76 test(function() { |
77 for (var i = 0; i < values.length; ++i) { | 77 for (var i = 0; i < values.length; ++i) { |
78 var input = values[i].input; | 78 var input = values[i].input; |
79 var inputAsMatrix = input.asMatrix(); | 79 var inputAsMatrix = input.asMatrix(); |
80 assert_equals(inputAsMatrix.is2D(), input.is2D()); | 80 assert_equals(inputAsMatrix.is2D(), input.is2D()); |
81 | 81 |
82 var expectedMatrix = input.is2D() ? new CSSMatrixTransformComponent(input.x,
0, 0, input.y, 0, 0) : | 82 var expectedMatrix = input.is2D() ? new CSSMatrixComponent(input.x, 0, 0, in
put.y, 0, 0) : |
83 new CSSMatrixTransformComponent(input.x, 0, 0, 0, 0, input.y, 0, 0, 0, 0
, input.z, 0, 0, 0, 0, 1); | 83 new CSSMatrixComponent(input.x, 0, 0, 0, 0, input.y, 0, 0, 0, 0, input.z
, 0, 0, 0, 0, 1); |
84 for (var attribute in expectedMatrix) { | 84 for (var attribute in expectedMatrix) { |
85 if (typeof expectedMatrix[attribute] === "number") { | 85 if (typeof expectedMatrix[attribute] === "number") { |
86 assert_approx_equals(inputAsMatrix[attribute], expectedMatrix[attribute]
, EPSILON); | 86 assert_approx_equals(inputAsMatrix[attribute], expectedMatrix[attribute]
, EPSILON); |
87 } else { | 87 } else { |
88 assert_equals(inputAsMatrix[attribute], expectedMatrix[attribute]); | 88 assert_equals(inputAsMatrix[attribute], expectedMatrix[attribute]); |
89 } | 89 } |
90 } | 90 } |
91 } | 91 } |
92 }, "Test that asMatrix is constructed correctly for CSSScale."); | 92 }, "Test that asMatrix is constructed correctly for CSSScale."); |
93 | 93 |
94 </script> | 94 </script> |
OLD | NEW |