Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix.html

Issue 2374773002: [GeometryInterface] Add DOMMatrix(numberSequence) constructor. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <script src="./resources/geometry-interfaces-test-helpers.js"></script> 4 <script src="./resources/geometry-interfaces-test-helpers.js"></script>
5 <script> 5 <script>
6 test(() => { 6 test(() => {
7 var matrix = new DOMMatrix(); 7 var matrix = new DOMMatrix();
8 assert_identity_2d_matrix(matrix); 8 assert_identity_2d_matrix(matrix);
9 }, "DOMMatrix() constructor"); 9 }, "DOMMatrix() constructor");
10 10
(...skipping 29 matching lines...) Expand all
40 }, "DOMMatrix fromFloat32Array - 3D matrix"); 40 }, "DOMMatrix fromFloat32Array - 3D matrix");
41 41
42 test(() => { 42 test(() => {
43 // 10.1 and 16.6 are not representable as a 32-bit float 43 // 10.1 and 16.6 are not representable as a 32-bit float
44 var float64Array = new Float64Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.6]); 44 var float64Array = new Float64Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.6]);
45 var matrix3d = DOMMatrix.fromFloat64Array(float64Array); 45 var matrix3d = DOMMatrix.fromFloat64Array(float64Array);
46 assert_3d_matrix_equals(matrix3d, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13 , 14, 15, 16.6]); 46 assert_3d_matrix_equals(matrix3d, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13 , 14, 15, 16.6]);
47 }, "DOMMatrix fromFloat64Array - 3D matrix"); 47 }, "DOMMatrix fromFloat64Array - 3D matrix");
48 48
49 test(() => { 49 test(() => {
50 var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6]);
51 assert_2d_matrix_equals(matrix, [1, 2, 3, 4, 5, 6]);
52 }, "DOMMatrix(numberSequence) constructor");
53
54 test(() => {
55 var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
56 assert_3d_matrix_equals(matrix, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 , 15, 16]);
57 }, "DOMMatrix(numberSequence) constructor");
58
59 test(() => {
50 var matrix = new DOMMatrix(); 60 var matrix = new DOMMatrix();
51 matrix.a = 10; 61 matrix.a = 10;
52 matrix.b = 20; 62 matrix.b = 20;
53 matrix.m24 = 2; 63 matrix.m24 = 2;
54 matrix.m33 = 3; 64 matrix.m33 = 3;
55 matrix.m42 = 3; 65 matrix.m42 = 3;
56 matrix.m44 = 9; 66 matrix.m44 = 9;
57 assert_3d_matrix_equals(matrix, [10, 20, 0, 0, 0, 1, 0, 2, 0, 0, 3, 0, 0, 3, 0 , 9]); 67 assert_3d_matrix_equals(matrix, [10, 20, 0, 0, 0, 1, 0, 2, 0, 0, 3, 0, 0, 3, 0 , 9]);
58 }, "DOMMatrix attributes"); 68 }, "DOMMatrix attributes");
59 69
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 162
153 test(() => { 163 test(() => {
154 assert_throws(new TypeError(), () => { 164 assert_throws(new TypeError(), () => {
155 var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m33: 3, m44: 4, is2D: true}); 165 var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m33: 3, m44: 4, is2D: true});
156 }, "The 'is2D' property is set to true but the input matrix is 3d matrix."); 166 }, "The 'is2D' property is set to true but the input matrix is 3d matrix.");
157 assert_throws(new TypeError(), () => { 167 assert_throws(new TypeError(), () => {
158 var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m11: 3}); 168 var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m11: 3});
159 }, "The 'a' property should equal the 'm11' property."); 169 }, "The 'a' property should equal the 'm11' property.");
160 }, "DOMMatrix.fromMatrix(): Exception test."); 170 }, "DOMMatrix.fromMatrix(): Exception test.");
161 </script> 171 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698