| <!DOCTYPE html> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script src="./resources/geometry-interfaces-test-helpers.js"></script> |
| <script> |
| |
| test(function() { |
| var matrix = new DOMMatrix(); |
| assert_identity_2d_matrix(matrix); |
| var result = matrix.scale(); |
| assert_identity_2d_matrix(result); |
| assert_identity_2d_matrix(matrix); |
| assert_not_equals(result, matrix, 'result and matrix should be different object'); |
| }, "DOMMatrix.scale()"); |
| |
| test(function() { |
| var matrix = new DOMMatrix(); |
| assert_identity_2d_matrix(matrix); |
| var result = matrix.scale(3); |
| assert_2d_matrix_equals(result, [3, 0, 0, 3, 0, 0]); |
| assert_identity_2d_matrix(matrix); |
| }, "DOMMatrix.scale(sx)"); |
| |
| test(function() { |
| var matrix = new DOMMatrix(); |
| assert_identity_2d_matrix(matrix); |
| var result = matrix.scale(3, 3); |
| assert_2d_matrix_equals(result, [3, 0, 0, 3, 0, 0]); |
| assert_identity_2d_matrix(matrix); |
| }, "DOMMatrix.scale(sx, sy)"); |
| |
| test(function() { |
| var matrix = new DOMMatrix(); |
| assert_identity_2d_matrix(matrix); |
| var result = matrix.scale(3, 8); |
| assert_2d_matrix_equals(result, [3, 0, 0, 8, 0, 0]); |
| assert_identity_2d_matrix(matrix); |
| }, "DOMMatrix.scale(sx, sy)"); |
| |
| test(function() { |
| var matrix = new DOMMatrix(); |
| assert_identity_2d_matrix(matrix); |
| var result = matrix.scale(3, 3, 1, 4, 2); |
| assert_2d_matrix_equals(result, [3, 0, 0, 3, -8, -4]); |
| assert_identity_2d_matrix(matrix); |
| }, "DOMMatrix.scale(sx, sy, sz, ox, oy)"); |
| |
| test(function() { |
| var matrix = new DOMMatrix(); |
| assert_identity_2d_matrix(matrix); |
| var result = matrix.scale(2, 3, 0.5, 2, -4, -1); |
| assert_3d_matrix_equals(result, [2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8, -0.5, 1]); |
| assert_identity_2d_matrix(matrix); |
| }, "DOMMatrix.scale(sx, sy, sz, ox, oy, oz)"); |
| |
| test(function() { |
| var matrix = new DOMMatrix(); |
| assert_identity_2d_matrix(matrix); |
| var result = matrix.scale3d(); |
| assert_identity_2d_matrix(result); |
| assert_identity_2d_matrix(matrix); |
| }, "DOMMatrix.scale3d()"); |
| |
| test(function() { |
| var matrix = new DOMMatrix(); |
| assert_identity_2d_matrix(matrix); |
| var result = matrix.scale3d(3); |
| assert_3d_matrix_equals(result, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1]); |
| assert_identity_2d_matrix(matrix); |
| }, "DOMMatrix.scale3d(scale)"); |
| |
| test(function() { |
| var matrix = new DOMMatrix(); |
| assert_identity_2d_matrix(matrix); |
| var result = matrix.scale3d(3, 2, 7, -1); |
| assert_3d_matrix_equals(result, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, -4, -14, 2, 1]); |
| assert_identity_2d_matrix(matrix); |
| }, "DOMMatrix.scale3d(scale, ox, oy, oz)"); |
| |
| test(function() { |
| var matrix = new DOMMatrix(); |
| assert_identity_2d_matrix(matrix); |
| var result = matrix.scaleSelf(); |
| assert_identity_2d_matrix(result); |
| assert_equals(result, matrix, 'result and matrix should be the exact same object'); |
| }, "DOMMatrix.scaleSelf()"); |
| |
| test(function() { |
| var matrix = new DOMMatrix(); |
| assert_identity_2d_matrix(matrix); |
| var result = matrix.scaleSelf(3); |
| assert_2d_matrix_equals(result, [3, 0, 0, 3, 0, 0]); |
| assert_equals(result, matrix, 'result and matrix should be the exact same object'); |
| }, "DOMMatrix.scaleSelf(sx)"); |
| |
| test(function() { |
| var matrix = new DOMMatrix(); |
| assert_identity_2d_matrix(matrix); |
| var result = matrix.scaleSelf(3, 3); |
| assert_2d_matrix_equals(result, [3, 0, 0, 3, 0, 0]); |
| assert_equals(result, matrix, 'result and matrix should be the exact same object'); |
| }, "DOMMatrix.scaleSelf(sx, sy)"); |
| |
| test(function() { |
| var matrix = new DOMMatrix(); |
| assert_identity_2d_matrix(matrix); |
| var result = matrix.scaleSelf(3, 7); |
| assert_2d_matrix_equals(result, [3, 0, 0, 7, 0, 0]); |
| assert_equals(result, matrix, 'result and matrix should be the exact same object'); |
| }, "DOMMatrix.scaleSelf(sx, sy)"); |
| |
| test(function() { |
| var matrix = new DOMMatrix(); |
| assert_identity_2d_matrix(matrix); |
| var result = matrix.scaleSelf(3, 3, 1, 4, 2); |
| assert_2d_matrix_equals(result, [3, 0, 0, 3, -8, -4]); |
| assert_equals(result, matrix, 'result and matrix should be the exact same object'); |
| }, "DOMMatrix.scaleSelf(sx, sy, sz, ox, oy)"); |
| |
| test(function() { |
| var matrix = new DOMMatrix(); |
| assert_identity_2d_matrix(matrix); |
| var result = matrix.scaleSelf(2, 3, 0.5, 2, -4, -1); |
| assert_3d_matrix_equals(result, [2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8, -0.5, 1]); |
| assert_equals(result, matrix, 'result and matrix should be the exact same object'); |
| }, "DOMMatrix.scaleSelf(sx, sy, sz, ox, oy, oz)"); |
| |
| // origin value is used to move base point before scale. |
| // after scale, base point is return to negative origin value. |
| // if scale value were 1, value of matrix should be same before scale. |
| test(function() { |
| var matrix = new DOMMatrix(); |
| assert_identity_2d_matrix(matrix); |
| var result = matrix.scaleSelf(1, 1, 1, 2, -4, -1); |
| assert_identity_3d_matrix(result); |
| assert_equals(result, matrix, 'result and matrix should be the exact same object'); |
| }, "DOMMatrix.scaleSelf(1, 1, 1, ox, oy, oz)"); |
| |
| test(function() { |
| var matrix = new DOMMatrix(); |
| assert_identity_2d_matrix(matrix); |
| var result = matrix.scale3dSelf(3); |
| assert_3d_matrix_equals(result, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1]); |
| assert_equals(result, matrix, 'result and matrix should be the exact same object'); |
| }, "DOMMatrix.scale3dSelf(scale)"); |
| |
| test(function() { |
| var matrix = new DOMMatrix(); |
| assert_identity_2d_matrix(matrix); |
| var result = matrix.scale3dSelf(3, 2, 7, -1); |
| assert_3d_matrix_equals(result, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, -4, -14, 2, 1]); |
| assert_equals(result, matrix, 'result and matrix should be the exact same object'); |
| }, "DOMMatrix.scale3dSelf(scale, ox, oy, oz)"); |
| |
| </script> |