Index: third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-invert.html |
diff --git a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-invert.html b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-invert.html |
index 390b70d9890034d618556d83612ca3d020906076..b4a8df54933f116cdc861634d546598d421f2cbe 100644 |
--- a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-invert.html |
+++ b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-invert.html |
@@ -1,85 +1,35 @@ |
<!DOCTYPE HTML> |
-<html> |
-<head> |
-<title>Geometry Interfaces: DOMMatrix invert</title> |
<script src="../../resources/testharness.js"></script> |
<script src="../../resources/testharnessreport.js"></script> |
-</head> |
-<body> |
+<script src="./resources/geometry-interfaces-test-helpers.js"></script> |
<script> |
- |
// TODO(hs1217.lee): create the DOMMatrix directly when the sequence constructor is supported. |
function initMatrix(values) { |
return new DOMMatrixReadOnly(values); |
} |
test(function() { |
- var matrix2d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6])); |
- matrix2d.invertSelf(); |
- assert_true(matrix2d.is2D); |
- assert_equals(matrix2d.a, -2); |
- assert_equals(matrix2d.b, 1); |
- assert_equals(matrix2d.c, 1.5); |
- assert_equals(matrix2d.d, -0.5); |
- assert_equals(matrix2d.e, 1); |
- assert_equals(matrix2d.f, -2); |
+ var matrix2d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6])); |
+ matrix2d.invertSelf(); |
+ assert_2d_matrix_equals(matrix2d, [-2, 1, 1.5, -0.5, 1, -2]); |
}, "DOMMatrix invertSelf() - invertible - 2D matrix"); |
test(function() { |
- var matrix2d = new DOMMatrix(initMatrix([1, 1, 1, 1, 1, 1])); |
- matrix2d.invertSelf(); |
- assert_false(matrix2d.is2D); |
- assert_equals(matrix2d.a, NaN); |
- assert_equals(matrix2d.b, NaN); |
- assert_equals(matrix2d.c, NaN); |
- assert_equals(matrix2d.d, NaN); |
- assert_equals(matrix2d.e, NaN); |
- assert_equals(matrix2d.f, NaN); |
-}, "DOMMatrix invertSelf() - uninvertible - 2D matrix"); |
+ var matrix2d = new DOMMatrix(initMatrix([1, 1, 1, 1, 1, 1])); |
+ matrix2d.invertSelf(); |
+ //when non invertible matrix execute invertSelf(), result matrix is not 2d. |
+ assert_3d_matrix_equals(matrix2d, [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN]); |
+}, "DOMMatrix invertSelf() - non-invertible - 2D matrix"); |
test(function() { |
- var matrix3d = new DOMMatrix(initMatrix([10, 20, 30, 40, 40, 40, 30, 20, 10, 20, 40, 30, 20, 40, 50, 100])); |
- matrix3d.invertSelf(); |
- assert_false(matrix3d.is2D); |
- assert_equals(matrix3d.m11, -1.6); |
- assert_equals(matrix3d.m12, 0.05); |
- assert_equals(matrix3d.m13, 0.6); |
- assert_equals(matrix3d.m14, 0.45); |
- assert_equals(matrix3d.m21, 2.05); |
- assert_equals(matrix3d.m22, -0.025); |
- assert_equals(matrix3d.m23, -0.8); |
- assert_equals(matrix3d.m24, -0.575); |
- assert_equals(matrix3d.m31, -0.4); |
- assert_equals(matrix3d.m32, 0); |
- assert_equals(matrix3d.m33, 0.2); |
- assert_equals(matrix3d.m34, 0.1); |
- assert_equals(matrix3d.m41, -0.3); |
- assert_equals(matrix3d.m42, -0); |
- assert_equals(matrix3d.m43, 0.1); |
- assert_equals(matrix3d.m44, 0.1); |
+ var matrix3d = new DOMMatrix(initMatrix([10, 20, 30, 40, 40, 40, 30, 20, 10, 20, 40, 30, 20, 40, 50, 100])); |
+ matrix3d.invertSelf(); |
+ assert_3d_matrix_equals(matrix3d, [-1.6, 0.05, 0.6, 0.45, 2.05, -0.025, -0.8, -0.575, -0.4, 0, 0.2, 0.1, -0.3, 0, 0.1, 0.1]); |
}, "DOMMatrix invertSelf() - 3D matrix"); |
test(function() { |
- var matrix3d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])); |
- matrix3d.invertSelf(); |
- assert_false(matrix3d.is2D); |
- assert_equals(matrix3d.m11, NaN); |
- assert_equals(matrix3d.m12, NaN); |
- assert_equals(matrix3d.m13, NaN); |
- assert_equals(matrix3d.m14, NaN); |
- assert_equals(matrix3d.m21, NaN); |
- assert_equals(matrix3d.m22, NaN); |
- assert_equals(matrix3d.m23, NaN); |
- assert_equals(matrix3d.m24, NaN); |
- assert_equals(matrix3d.m31, NaN); |
- assert_equals(matrix3d.m32, NaN); |
- assert_equals(matrix3d.m33, NaN); |
- assert_equals(matrix3d.m34, NaN); |
- assert_equals(matrix3d.m41, NaN); |
- assert_equals(matrix3d.m42, NaN); |
- assert_equals(matrix3d.m43, NaN); |
- assert_equals(matrix3d.m44, NaN); |
-}, "DOMMatrix invertSelf() - uninvertible - 3D matrix"); |
+ var matrix3d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])); |
+ matrix3d.invertSelf(); |
+ assert_3d_matrix_equals(matrix3d, [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN]); |
+}, "DOMMatrix invertSelf() - non-invertible - 3D matrix"); |
</script> |
-</body> |
-</html> |