OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Geometry Interfaces: DOMMatrix</title> |
| 5 <script src="../../resources/js-test.js"></script> |
| 6 </head> |
| 7 <body> |
| 8 <script> |
| 9 |
| 10 debug("# DOMMatrix()"); |
| 11 var matrix = new DOMMatrix(); |
| 12 shouldBe("matrix.a", "matrix.m11"); |
| 13 shouldBe("matrix.b", "matrix.m12"); |
| 14 shouldBe("matrix.c", "matrix.m21"); |
| 15 shouldBe("matrix.d", "matrix.m22"); |
| 16 shouldBe("matrix.e", "matrix.m41"); |
| 17 shouldBe("matrix.f", "matrix.m42"); |
| 18 shouldBe("matrix.m11", "1"); |
| 19 shouldBe("matrix.m12", "0"); |
| 20 shouldBe("matrix.m13", "0"); |
| 21 shouldBe("matrix.m14", "0"); |
| 22 shouldBe("matrix.m21", "0"); |
| 23 shouldBe("matrix.m22", "1"); |
| 24 shouldBe("matrix.m23", "0"); |
| 25 shouldBe("matrix.m24", "0"); |
| 26 shouldBe("matrix.m31", "0"); |
| 27 shouldBe("matrix.m32", "0"); |
| 28 shouldBe("matrix.m33", "1"); |
| 29 shouldBe("matrix.m34", "0"); |
| 30 shouldBe("matrix.m41", "0"); |
| 31 shouldBe("matrix.m42", "0"); |
| 32 shouldBe("matrix.m43", "0"); |
| 33 shouldBe("matrix.m44", "1"); |
| 34 shouldBeTrue("matrix.is2D"); |
| 35 shouldBeTrue("matrix.isIdentity"); |
| 36 debug(""); |
| 37 |
| 38 debug("# DOMMatrix set attributes"); |
| 39 matrix.a = 10; |
| 40 matrix.b = 20; |
| 41 matrix.m24 = 2; |
| 42 matrix.m33 = 3; |
| 43 matrix.m42 = 3; |
| 44 matrix.m44 = 9; |
| 45 shouldBe("matrix.a", "matrix.m11"); |
| 46 shouldBe("matrix.b", "matrix.m12"); |
| 47 shouldBe("matrix.c", "matrix.m21"); |
| 48 shouldBe("matrix.d", "matrix.m22"); |
| 49 shouldBe("matrix.e", "matrix.m41"); |
| 50 shouldBe("matrix.f", "matrix.m42"); |
| 51 shouldBe("matrix.m11", "10"); |
| 52 shouldBe("matrix.m12", "20"); |
| 53 shouldBe("matrix.m13", "0"); |
| 54 shouldBe("matrix.m14", "0"); |
| 55 shouldBe("matrix.m21", "0"); |
| 56 shouldBe("matrix.m22", "1"); |
| 57 shouldBe("matrix.m23", "0"); |
| 58 shouldBe("matrix.m24", "2"); |
| 59 shouldBe("matrix.m31", "0"); |
| 60 shouldBe("matrix.m32", "0"); |
| 61 shouldBe("matrix.m33", "3"); |
| 62 shouldBe("matrix.m34", "0"); |
| 63 shouldBe("matrix.m41", "0"); |
| 64 shouldBe("matrix.m42", "3"); |
| 65 shouldBe("matrix.m43", "0"); |
| 66 shouldBe("matrix.m44", "9"); |
| 67 shouldBeFalse("matrix.is2D"); |
| 68 shouldBeFalse("matrix.isIdentity"); |
| 69 debug(""); |
| 70 |
| 71 debug("# DOMMatrix(other)"); |
| 72 var other = matrix; |
| 73 matrix = new DOMMatrix(other); |
| 74 shouldBe("matrix.a", "matrix.m11"); |
| 75 shouldBe("matrix.b", "matrix.m12"); |
| 76 shouldBe("matrix.c", "matrix.m21"); |
| 77 shouldBe("matrix.d", "matrix.m22"); |
| 78 shouldBe("matrix.e", "matrix.m41"); |
| 79 shouldBe("matrix.f", "matrix.m42"); |
| 80 shouldBe("matrix.m11", "10"); |
| 81 shouldBe("matrix.m12", "20"); |
| 82 shouldBe("matrix.m13", "0"); |
| 83 shouldBe("matrix.m14", "0"); |
| 84 shouldBe("matrix.m21", "0"); |
| 85 shouldBe("matrix.m22", "1"); |
| 86 shouldBe("matrix.m23", "0"); |
| 87 shouldBe("matrix.m24", "2"); |
| 88 shouldBe("matrix.m31", "0"); |
| 89 shouldBe("matrix.m32", "0"); |
| 90 shouldBe("matrix.m33", "3"); |
| 91 shouldBe("matrix.m34", "0"); |
| 92 shouldBe("matrix.m41", "0"); |
| 93 shouldBe("matrix.m42", "3"); |
| 94 shouldBe("matrix.m43", "0"); |
| 95 shouldBe("matrix.m44", "9"); |
| 96 shouldBeFalse("matrix.is2D"); |
| 97 shouldBeFalse("matrix.isIdentity"); |
| 98 debug(""); |
| 99 |
| 100 debug("# DOMMatrix.is2D can never be set to 'true' when it was set to 'false' be
fore calling setMatrixValue()."); |
| 101 matrix = new DOMMatrix(); |
| 102 shouldBeTrue("matrix.is2D"); |
| 103 shouldBeTrue("matrix.isIdentity"); |
| 104 matrix.m31 = 1; |
| 105 matrix.m33 = 0; |
| 106 shouldBeFalse("matrix.is2D"); |
| 107 shouldBeFalse("matrix.isIdentity"); |
| 108 matrix.m31 = 0; |
| 109 matrix.m33 = 1; |
| 110 shouldBeFalse("matrix.is2D"); |
| 111 shouldBeTrue("matrix.isIdentity"); |
| 112 debug(""); |
| 113 |
| 114 </script> |
| 115 </body> |
| 116 </html> |
OLD | NEW |