Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix.html b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix.html |
| index f394c57d40b7fa85fa610fefe4f3edc1b449166a..cce4a5220c45633be94bebd61590013f2953ae9f 100644 |
| --- a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix.html |
| +++ b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix.html |
| @@ -61,6 +61,74 @@ test(function() { |
| }, "DOMMatrix(other) constructor"); |
| test(function() { |
| + var float32Array = new Float32Array([1, 2, 3, 3, 2, 1]); |
|
dominicc (has gone to gerrit)
2016/09/06 17:07:22
Why not use six distinct values?
Hwanseung Lee
2016/09/07 14:21:47
Done.
|
| + var matrix2d = DOMMatrix.fromFloat32Array(float32Array); |
| + assert_true(matrix2d.is2D); |
| + assert_equals(matrix2d.a, 1); |
| + assert_equals(matrix2d.b, 2); |
| + assert_equals(matrix2d.c, 3); |
| + assert_equals(matrix2d.d, 3); |
| + assert_equals(matrix2d.e, 2); |
| + assert_equals(matrix2d.f, 1); |
| +}, "DOMMatrix fromFloat32Array - 2D matrix"); |
| + |
| +test(function() { |
| + var float64Array = new Float64Array([1, 2, 3, 3.1, 2, 1]); |
|
dominicc (has gone to gerrit)
2016/09/06 17:07:22
Is there a 64-bit value you could use to verify th
Hwanseung Lee
2016/09/07 14:21:47
Done.
|
| + var matrix2d = DOMMatrix.fromFloat64Array(float64Array); |
| + assert_true(matrix2d.is2D); |
| + assert_equals(matrix2d.a, 1); |
| + assert_equals(matrix2d.b, 2); |
| + assert_equals(matrix2d.c, 3); |
| + assert_equals(matrix2d.d, 3.1); |
| + assert_equals(matrix2d.e, 2); |
| + assert_equals(matrix2d.f, 1); |
| +}, "DOMMatrix fromFloat64Array - 2D matrix"); |
| + |
| +test(function() { |
| + var float32Array = new Float32Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
| + var matrix3d = DOMMatrix.fromFloat32Array(float32Array); |
| + assert_false(matrix3d.is2D); |
| + assert_equals(matrix3d.m11, 1); |
| + assert_equals(matrix3d.m12, 2); |
| + assert_equals(matrix3d.m13, 3); |
| + assert_equals(matrix3d.m14, 4); |
| + assert_equals(matrix3d.m21, 5); |
| + assert_equals(matrix3d.m22, 6); |
| + assert_equals(matrix3d.m23, 7); |
| + assert_equals(matrix3d.m24, 8); |
| + assert_equals(matrix3d.m31, 9); |
| + assert_equals(matrix3d.m32, 10); |
| + assert_equals(matrix3d.m33, 11); |
| + assert_equals(matrix3d.m34, 12); |
| + assert_equals(matrix3d.m41, 13); |
| + assert_equals(matrix3d.m42, 14); |
| + assert_equals(matrix3d.m43, 15); |
| + assert_equals(matrix3d.m44, 16); |
| +}, "DOMMatrix fromFloat32Array - 3D matrix"); |
| + |
| +test(function() { |
| + var float64Array = new Float64Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.6]); |
| + var matrix3d = DOMMatrix.fromFloat64Array(float64Array); |
| + assert_false(matrix3d.is2D); |
| + assert_equals(matrix3d.m11, 1); |
| + assert_equals(matrix3d.m12, 2); |
| + assert_equals(matrix3d.m13, 3); |
| + assert_equals(matrix3d.m14, 4); |
| + assert_equals(matrix3d.m21, 5); |
| + assert_equals(matrix3d.m22, 6); |
| + assert_equals(matrix3d.m23, 7); |
| + assert_equals(matrix3d.m24, 8); |
| + assert_equals(matrix3d.m31, 9); |
| + assert_equals(matrix3d.m32, 10.1); |
| + assert_equals(matrix3d.m33, 11); |
| + assert_equals(matrix3d.m34, 12); |
| + assert_equals(matrix3d.m41, 13); |
| + assert_equals(matrix3d.m42, 14); |
| + assert_equals(matrix3d.m43, 15); |
| + assert_equals(matrix3d.m44, 16.6); |
| +}, "DOMMatrix fromFloat64Array - 3D matrix"); |
| + |
| +test(function() { |
| var matrix = new DOMMatrix(); |
| matrix.a = 10; |
| matrix.b = 20; |
| @@ -108,6 +176,13 @@ test(function() { |
| assert_true(matrix.isIdentity); |
| }, "DOMMatrix.is2D can never be set to 'true' when it was set to 'false' before calling setMatrixValue()."); |
| +test(function() { |
| + assert_throws(new TypeError(), function() { DOMMatrix.fromFloat32Array(new Float32Array(15)); }, |
| + "DOMMatrixReadOnly constructor only accepts 1 number sequence with 6 or 16 elements."); |
| + assert_throws(new TypeError(), function() { DOMMatrix.fromFloat64Array(new Float64Array(15)); }, |
|
dominicc (has gone to gerrit)
2016/09/06 17:07:22
Could we add tests for 0, 1, 5, 7, 15, 17 and "lar
Hwanseung Lee
2016/09/07 14:21:47
Done.
|
| + "DOMMatrixReadOnly constructor only accepts 1 number sequence with 6 or 16 elements."); |
| +}, "DOMMatrixReadOnly constructor - invalid arguments"); |
| + |
| </script> |
| </body> |
| </html> |