1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
<!DOCTYPE html>
<html>
<head>
<title>Geometry Interfaces: DOMMatrix scale</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
</head>
<body>
<script>
test(function() {
var matrix = new DOMMatrix();
assert_true(matrix.is2D);
assert_true(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
var result = matrix.scale(3);
assert_true(result.is2D);
assert_false(result.isIdentity);
assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
assert_true(matrix.is2D);
assert_true(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
}, "DOMMatrix.scale(scale)");
test(function() {
var matrix = new DOMMatrix();
assert_true(matrix.is2D);
assert_true(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
var result = matrix.scale(3, 4, 2);
assert_true(result.is2D);
assert_false(result.isIdentity);
assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 0, -8, -4, 0, 1 ]);
assert_true(matrix.is2D);
assert_true(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
}, "DOMMatrix.scale(scale, ox, oy)");
test(function() {
var matrix = new DOMMatrix();
assert_true(matrix.is2D);
assert_true(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
var result = matrix.scale3d(3);
assert_false(result.is2D);
assert_false(result.isIdentity);
assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 ]);
assert_true(matrix.is2D);
assert_true(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
}, "DOMMatrix.scale3d(scale)");
test(function() {
var matrix = new DOMMatrix();
assert_true(matrix.is2D);
assert_true(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
var result = matrix.scale3d(3, 2, 7, -1);
assert_false(result.is2D);
assert_false(result.isIdentity);
assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, -4, -14, 2, 1 ]);
assert_true(matrix.is2D);
assert_true(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
}, "DOMMatrix.scale3d(scale, ox, oy, oz)");
test(function() {
var matrix = new DOMMatrix();
assert_true(matrix.is2D);
assert_true(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
var result = matrix.scaleNonUniform(2, 3, 0.5, 2, -4, -1);
assert_false(result.is2D);
assert_false(result.isIdentity);
assert_array_equals(result.toFloat64Array(), [ 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8, -0.5, 1 ]);
assert_true(matrix.is2D);
assert_true(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
}, "DOMMatrix.scaleNonUniform(sx, sy, sz, ox, oy, oz)");
test(function() {
var matrix = new DOMMatrix();
assert_true(matrix.is2D);
assert_true(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
var result = matrix.scaleSelf(3);
assert_true(result.is2D);
assert_false(result.isIdentity);
assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
assert_true(matrix.is2D);
assert_false(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
}, "DOMMatrix.scaleSelf(scale)");
test(function() {
var matrix = new DOMMatrix();
assert_true(matrix.is2D);
assert_true(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
var result = matrix.scaleSelf(3, 4, 2);
assert_true(result.is2D);
assert_false(result.isIdentity);
assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 0, -8, -4, 0, 1 ]);
assert_true(matrix.is2D);
assert_false(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 0, -8, -4, 0, 1 ]);
}, "DOMMatrix.scaleSelf(scale)");
test(function() {
var matrix = new DOMMatrix();
assert_true(matrix.is2D);
assert_true(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
var result = matrix.scale3dSelf(3);
assert_false(result.is2D);
assert_false(result.isIdentity);
assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 ]);
assert_false(matrix.is2D);
assert_false(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 ]);
}, "DOMMatrix.scale3dSelf(scale)");
test(function() {
var matrix = new DOMMatrix();
assert_true(matrix.is2D);
assert_true(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
var result = matrix.scale3dSelf(3, 2, 7, -1);
assert_false(result.is2D);
assert_false(result.isIdentity);
assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, -4, -14, 2, 1 ]);
assert_false(matrix.is2D);
assert_false(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, -4, -14, 2, 1 ]);
}, "DOMMatrix.scale3dSelf(scale, ox, oy, oz)");
test(function() {
var matrix = new DOMMatrix();
assert_true(matrix.is2D);
assert_true(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
var result = matrix.scaleNonUniformSelf(2, 3, 0.5, 2, -4, -1);
assert_false(result.is2D);
assert_false(result.isIdentity);
assert_array_equals(result.toFloat64Array(), [ 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8, -0.5, 1 ]);
assert_false(matrix.is2D);
assert_false(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8, -0.5, 1 ]);
}, "DOMMatrix.scaleNonUniformSelf(sx, sy, sz, ox, oy, oz)");
test(function() {
var matrix = new DOMMatrix();
assert_true(matrix.is2D);
assert_true(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
var result = matrix.scaleNonUniformSelf(1, 1, 1, 2, -4, -1);
assert_false(result.is2D);
assert_true(result.isIdentity);
assert_array_equals(result.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
assert_false(matrix.is2D);
assert_true(matrix.isIdentity);
assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
}, "DOMMatrix.scaleNonUniformSelf(1, 1, 1, ox, oy, oz)");
</script>
</body>
</html>
|