| 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 function angle(deg) { | 7 function angle(deg) { |
| 8 return new CSSAngleValue(deg, 'deg'); | 8 return new CSSAngleValue(deg, 'deg'); |
| 9 } | 9 } |
| 10 var values = [ | 10 var values = [ |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 }, "Test that the (x, y, z, angle) values for CSSRotation are correct."); | 50 }, "Test that the (x, y, z, angle) values for CSSRotation are correct."); |
| 51 | 51 |
| 52 test(function() { | 52 test(function() { |
| 53 for (var i = 0; i < values.length; ++i) { | 53 for (var i = 0; i < values.length; ++i) { |
| 54 assert_equals(values[i].input.is2D(), values[i].is2D); | 54 assert_equals(values[i].input.is2D(), values[i].is2D); |
| 55 } | 55 } |
| 56 }, "Test that the is2D values for CSSRotation is correct."); | 56 }, "Test that the is2D values for CSSRotation is correct."); |
| 57 | 57 |
| 58 test(function() { | 58 test(function() { |
| 59 for (var i = 0; i < values.length; ++i) { | 59 for (var i = 0; i < values.length; ++i) { |
| 60 assert_equals(values[i].input.cssText, values[i].cssText); | 60 assert_equals(values[i].input.toString(), values[i].cssText); |
| 61 } | 61 } |
| 62 }, "Test that cssText values for CSSRotation is correct."); | 62 }, "Test that toString values for CSSRotation is correct."); |
| 63 | 63 |
| 64 test(function() { | 64 test(function() { |
| 65 for (var i = 0; i < values.length; ++i) { | 65 for (var i = 0; i < values.length; ++i) { |
| 66 var input = values[i].input; | 66 var input = values[i].input; |
| 67 var inputAsMatrix = input.asMatrix(); | 67 var inputAsMatrix = input.asMatrix(); |
| 68 assert_equals(inputAsMatrix.is2D(), input.is2D()); | 68 assert_equals(inputAsMatrix.is2D(), input.is2D()); |
| 69 var expectedMatrix = values[i].asMatrix; | 69 var expectedMatrix = values[i].asMatrix; |
| 70 for (var attribute in expectedMatrix) { | 70 for (var attribute in expectedMatrix) { |
| 71 if (typeof expectedMatrix[attribute] === "number") { | 71 if (typeof expectedMatrix[attribute] === "number") { |
| 72 assert_approx_equals(inputAsMatrix[attribute], expectedMatrix[attribute]
, EPSILON); | 72 assert_approx_equals(inputAsMatrix[attribute], expectedMatrix[attribute]
, EPSILON); |
| 73 } else if (attribute != "cssText") { | 73 } else if (attribute != "cssText") { |
| 74 // Due to the complex trigonometric calculations required for a CSSRotat
ion matrix, | 74 // Due to the complex trigonometric calculations required for a CSSRotat
ion matrix, |
| 75 // the 6 significant figures of each value in the cssText might be diffe
rent. | 75 // the 6 significant figures of each value in the cssText might be diffe
rent. |
| 76 // Hence, do not check cssText. | 76 // Hence, do not check cssText. |
| 77 assert_equals(inputAsMatrix[attribute], expectedMatrix[attribute]); | 77 assert_equals(inputAsMatrix[attribute], expectedMatrix[attribute]); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 }, "Test that asMatrix is constructed correctly for CSSRotation."); | 81 }, "Test that asMatrix is constructed correctly for CSSRotation."); |
| 82 | 82 |
| 83 </script> | 83 </script> |
| OLD | NEW |