4 <title>Geometry Interfaces: DOMMatrix
</title>
5 <script src=
"../../resources/testharness.js"></script>
6 <script src=
"../../resources/testharnessreport.js"></script>
12 var matrix
= new DOMMatrix();
13 assert_equals(matrix
.m11
, 1);
14 assert_equals(matrix
.m12
, 0);
15 assert_equals(matrix
.m13
, 0);
16 assert_equals(matrix
.m14
, 0);
17 assert_equals(matrix
.m21
, 0);
18 assert_equals(matrix
.m22
, 1);
19 assert_equals(matrix
.m23
, 0);
20 assert_equals(matrix
.m24
, 0);
21 assert_equals(matrix
.m31
, 0);
22 assert_equals(matrix
.m32
, 0);
23 assert_equals(matrix
.m33
, 1);
24 assert_equals(matrix
.m34
, 0);
25 assert_equals(matrix
.m41
, 0);
26 assert_equals(matrix
.m42
, 0);
27 assert_equals(matrix
.m43
, 0);
28 assert_equals(matrix
.m44
, 1);
29 assert_true(matrix
.is2D
);
30 assert_true(matrix
.isIdentity
);
31 }, "DOMMatrix() constructor");
34 var other
= new DOMMatrix();
42 var matrix
= new DOMMatrix(other
);
43 assert_equals(matrix
.m11
, 10);
44 assert_equals(matrix
.m12
, 20);
45 assert_equals(matrix
.m13
, 0);
46 assert_equals(matrix
.m14
, 0);
47 assert_equals(matrix
.m21
, 0);
48 assert_equals(matrix
.m22
, 1);
49 assert_equals(matrix
.m23
, 0);
50 assert_equals(matrix
.m24
, 2);
51 assert_equals(matrix
.m31
, 0);
52 assert_equals(matrix
.m32
, 0);
53 assert_equals(matrix
.m33
, 3);
54 assert_equals(matrix
.m34
, 0);
55 assert_equals(matrix
.m41
, 0);
56 assert_equals(matrix
.m42
, 3);
57 assert_equals(matrix
.m43
, 0);
58 assert_equals(matrix
.m44
, 9);
59 assert_false(matrix
.is2D
);
60 assert_false(matrix
.isIdentity
);
61 }, "DOMMatrix(other) constructor");
64 var matrix
= new DOMMatrix();
71 assert_equals(matrix
.a
, matrix
.m11
);
72 assert_equals(matrix
.b
, matrix
.m12
);
73 assert_equals(matrix
.c
, matrix
.m21
);
74 assert_equals(matrix
.d
, matrix
.m22
);
75 assert_equals(matrix
.e
, matrix
.m41
);
76 assert_equals(matrix
.f
, matrix
.m42
);
77 assert_equals(matrix
.m11
, 10);
78 assert_equals(matrix
.m12
, 20);
79 assert_equals(matrix
.m13
, 0);
80 assert_equals(matrix
.m14
, 0);
81 assert_equals(matrix
.m21
, 0);
82 assert_equals(matrix
.m22
, 1);
83 assert_equals(matrix
.m23
, 0);
84 assert_equals(matrix
.m24
, 2);
85 assert_equals(matrix
.m31
, 0);
86 assert_equals(matrix
.m32
, 0);
87 assert_equals(matrix
.m33
, 3);
88 assert_equals(matrix
.m34
, 0);
89 assert_equals(matrix
.m41
, 0);
90 assert_equals(matrix
.m42
, 3);
91 assert_equals(matrix
.m43
, 0);
92 assert_equals(matrix
.m44
, 9);
93 assert_false(matrix
.is2D
);
94 assert_false(matrix
.isIdentity
);
95 }, "DOMMatrix attributes");
98 var matrix
= new DOMMatrix();
99 assert_true(matrix
.is2D
);
100 assert_true(matrix
.isIdentity
);
103 assert_false(matrix
.is2D
);
104 assert_false(matrix
.isIdentity
);
107 assert_false(matrix
.is2D
);
108 assert_true(matrix
.isIdentity
);
109 }, "DOMMatrix.is2D can never be set to 'true' when it was set to 'false' before calling setMatrixValue().");