| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <script src="../resources/testharness.js"></script> | |
| 3 <script src="../resources/testharnessreport.js"></script> | |
| 4 | |
| 5 <script> | |
| 6 var values = [ | |
| 7 {input: new CSSMatrixTransformComponent(0, 0, 0, 0, 0, 0), | |
| 8 a: 0, b: 0, c: 0, d: 0, e: 0, f: 0, | |
| 9 is2D: true, cssText: "matrix(0, 0, 0, 0, 0, 0)"}, | |
| 10 {input: new CSSMatrixTransformComponent(2, 4, 6, 8, 10, 12), | |
| 11 a: 2, b: 4, c: 6, d: 8, e: 10, f: 12, | |
| 12 is2D: true, cssText: "matrix(2, 4, 6, 8, 10, 12)"}, | |
| 13 {input: new CSSMatrixTransformComponent(-2, -4, -6, -8, -10, -12), | |
| 14 a: -2, b: -4, c: -6, d: -8, e: -10, f: -12, | |
| 15 is2D: true, cssText: "matrix(-2, -4, -6, -8, -10, -12)"}, | |
| 16 {input: new CSSMatrixTransformComponent(1.1, -2.2, 3.3, -4.4, 5.5, 0.6), | |
| 17 a: 1.1, b: -2.2, c: 3.3, d: -4.4, e: 5.5, f: 0.6, | |
| 18 is2D: true, cssText: "matrix(1.1, -2.2, 3.3, -4.4, 5.5, 0.6)"}, | |
| 19 {input: new CSSMatrixTransformComponent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0), | |
| 20 m11: 0, m12: 0, m13: 0, m14: 0, m21: 0, m22: 0, m23: 0, m24: 0, | |
| 21 m31: 0, m32: 0, m33: 0, m34: 0, m41: 0, m42: 0, m43: 0, m44: 0, | |
| 22 is2D: false, cssText: "matrix3d(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0)"}, | |
| 23 {input: new CSSMatrixTransformComponent(11, 12, 13, 14, 21, 22, 23, 24, 31, 32
, 33, 34, 41, 42, 43, 44), | |
| 24 m11: 11, m12: 12, m13: 13, m14: 14, m21: 21, m22: 22, m23: 23, m24: 24, | |
| 25 m31: 31, m32: 32, m33: 33, m34: 34, m41: 41, m42: 42, m43: 43, m44: 44, | |
| 26 is2D: false, cssText: "matrix3d(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33,
34, 41, 42, 43, 44)"}, | |
| 27 {input: new CSSMatrixTransformComponent(1.1, 1.2, -13, -1.4, 2, 0, -2, 4, 3.1,
3, 3, 3.4, -4.1, 42, 43, 4.4), | |
| 28 m11: 1.1, m12: 1.2, m13: -13, m14: -1.4, m21: 2, m22: 0, m23: -2, m24: 4, | |
| 29 m31: 3.1, m32: 3, m33: 3, m34: 3.4, m41: -4.1, m42: 42, m43: 43, m44: 4.4, | |
| 30 is2D: false, cssText: "matrix3d(1.1, 1.2, -13, -1.4, 2, 0, -2, 4, 3.1, 3, 3,
3.4, -4.1, 42, 43, 4.4)"} | |
| 31 ]; | |
| 32 | |
| 33 var attributeValues2D = ["a", "b", "c", "d", "e", "f"]; | |
| 34 var attributeValues3D = ["m11", "m12", "m13", "m14", "m21", "m22", "m23", "m24"
, | |
| 35 "m31", "m32", "m33", "m34", "m41", "m42", "m43", "m44"]; | |
| 36 | |
| 37 test(function() { | |
| 38 for (var i = 0; i < values.length; ++i) { | |
| 39 var attributeValues = values[i].is2D ? attributeValues2D : attributeValues3D
; | |
| 40 for (var j = 0; j < attributeValues.length; ++j) { | |
| 41 var attribute = attributeValues[j]; | |
| 42 assert_equals(values[i].input[attribute], values[i][attribute]); | |
| 43 } | |
| 44 } | |
| 45 }, "Test that the (a, ... , f) and (m11, ... , m44) attributes for CSSMatrixTran
sformComponent are correct."); | |
| 46 | |
| 47 test(function() { | |
| 48 for (var i = 0; i < values.length; ++i) { | |
| 49 assert_equals(values[i].input.is2D(), values[i].is2D); | |
| 50 } | |
| 51 }, "Test that the is2D values for CSSMatrixTransformComponent are correct."); | |
| 52 | |
| 53 test(function() { | |
| 54 for (var i = 0; i < values.length; ++i) { | |
| 55 assert_equals(values[i].input.cssText, values[i].cssText); | |
| 56 } | |
| 57 }, "Test that the cssText for CSSMatrixTransformComponent is correct."); | |
| 58 | |
| 59 test(function() { | |
| 60 assert_throws(null, function() { new CSSMatrixTransformComponent(); }); | |
| 61 assert_throws(null, function() { new CSSMatrixTransformComponent(0); }); | |
| 62 assert_throws(null, function() { new CSSMatrixTransformComponent(0, 1, 2, 3, 4
); }); | |
| 63 assert_throws(null, function() { new CSSMatrixTransformComponent(0, 1, 2, 3, 4
, 5, 6); }); | |
| 64 assert_throws(null, function() { new CSSMatrixTransformComponent(0, 1, 2, 3, 4
, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14); }); | |
| 65 }, "Test that invalid number of arguments for CSSMatrixTransformComponent throws
an exception."); | |
| 66 | |
| 67 test(function() { | |
| 68 var attributeValues = attributeValues2D.concat(attributeValues3D); | |
| 69 for (var i = 0; i < values.length; ++i) { | |
| 70 var inputAsMatrix = values[i].input.asMatrix(); | |
| 71 for (var j = 0; j < attributeValues.length; ++j) { | |
| 72 var attribute = attributeValues[j]; | |
| 73 assert_equals(inputAsMatrix[attribute], values[i].input[attribute]); | |
| 74 } | |
| 75 assert_equals(inputAsMatrix.is2D(), values[i].input.is2D()); | |
| 76 assert_equals(inputAsMatrix.cssText, values[i].input.cssText); | |
| 77 } | |
| 78 }, "Test that asMatrix has all the same properties as the original CSSMatrixTran
sformComponent."); | |
| 79 | |
| 80 </script> | |
| OLD | NEW |