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

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

Issue 2370623003: [GeometryInterface] Clean-up layout tests for geometry interfaces. (Closed)
Patch Set: [GeometryInterface] Fix a indentation and clean up. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-invert.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 78dd6a55a8bc4b64282754cdc22d89032c658057..f15bf5837b7f5fc4909a3be3748425de0b6781fd 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
@@ -1,34 +1,11 @@
<!DOCTYPE html>
-<html>
-<head>
-<title>Geometry Interfaces: DOMMatrix</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="./resources/geometry-interfaces-test-helpers.js"></script>
-</head>
-<body>
<script>
-
test(() => {
var matrix = new DOMMatrix();
- assert_equals(matrix.m11, 1);
- assert_equals(matrix.m12, 0);
- assert_equals(matrix.m13, 0);
- assert_equals(matrix.m14, 0);
- assert_equals(matrix.m21, 0);
- assert_equals(matrix.m22, 1);
- assert_equals(matrix.m23, 0);
- assert_equals(matrix.m24, 0);
- assert_equals(matrix.m31, 0);
- assert_equals(matrix.m32, 0);
- assert_equals(matrix.m33, 1);
- assert_equals(matrix.m34, 0);
- assert_equals(matrix.m41, 0);
- assert_equals(matrix.m42, 0);
- assert_equals(matrix.m43, 0);
- assert_equals(matrix.m44, 1);
- assert_true(matrix.is2D);
- assert_true(matrix.isIdentity);
+ assert_identity_2d_matrix(matrix);
}, "DOMMatrix() constructor");
test(() => {
@@ -39,52 +16,34 @@ test(() => {
other.m33 = 3;
other.m42 = 3;
other.m44 = 9;
-
var matrix = new DOMMatrix(other);
- assert_equals(matrix.m11, 10);
- assert_equals(matrix.m12, 20);
- assert_equals(matrix.m13, 0);
- assert_equals(matrix.m14, 0);
- assert_equals(matrix.m21, 0);
- assert_equals(matrix.m22, 1);
- assert_equals(matrix.m23, 0);
- assert_equals(matrix.m24, 2);
- assert_equals(matrix.m31, 0);
- assert_equals(matrix.m32, 0);
- assert_equals(matrix.m33, 3);
- assert_equals(matrix.m34, 0);
- assert_equals(matrix.m41, 0);
- assert_equals(matrix.m42, 3);
- assert_equals(matrix.m43, 0);
- assert_equals(matrix.m44, 9);
- assert_false(matrix.is2D);
- assert_false(matrix.isIdentity);
+ assert_3d_matrix_equals(matrix, [10, 20, 0, 0, 0, 1, 0, 2, 0, 0, 3, 0, 0, 3, 0, 9]);
}, "DOMMatrix(other) constructor");
test(() => {
var float32Array = new Float32Array([1, 2, 3, 4, 5, 6]);
var matrix2d = DOMMatrix.fromFloat32Array(float32Array);
- assert_2d_matrix_equals(matrix2d, [1, 2, 3, 4, 5, 6])
+ assert_2d_matrix_equals(matrix2d, [1, 2, 3, 4, 5, 6]);
}, "DOMMatrix fromFloat32Array - 2D matrix");
test(() => {
// 3.1 is not representable as a 32-bit float
var float64Array = new Float64Array([1, 2, 3, 3.1, 4, 5]);
var matrix2d = DOMMatrix.fromFloat64Array(float64Array);
- assert_2d_matrix_equals(matrix2d, [1, 2, 3, 3.1, 4, 5])
+ assert_2d_matrix_equals(matrix2d, [1, 2, 3, 3.1, 4, 5]);
}, "DOMMatrix fromFloat64Array - 2D matrix");
test(() => {
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_3d_matrix_equals(matrix3d, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])
+ assert_3d_matrix_equals(matrix3d, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
}, "DOMMatrix fromFloat32Array - 3D matrix");
test(() => {
// 10.1 and 16.6 are not representable as a 32-bit float
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_3d_matrix_equals(matrix3d, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.6])
+ assert_3d_matrix_equals(matrix3d, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.6]);
}, "DOMMatrix fromFloat64Array - 3D matrix");
test(() => {
@@ -95,30 +54,7 @@ test(() => {
matrix.m33 = 3;
matrix.m42 = 3;
matrix.m44 = 9;
- assert_equals(matrix.a, matrix.m11);
- assert_equals(matrix.b, matrix.m12);
- assert_equals(matrix.c, matrix.m21);
- assert_equals(matrix.d, matrix.m22);
- assert_equals(matrix.e, matrix.m41);
- assert_equals(matrix.f, matrix.m42);
- assert_equals(matrix.m11, 10);
- assert_equals(matrix.m12, 20);
- assert_equals(matrix.m13, 0);
- assert_equals(matrix.m14, 0);
- assert_equals(matrix.m21, 0);
- assert_equals(matrix.m22, 1);
- assert_equals(matrix.m23, 0);
- assert_equals(matrix.m24, 2);
- assert_equals(matrix.m31, 0);
- assert_equals(matrix.m32, 0);
- assert_equals(matrix.m33, 3);
- assert_equals(matrix.m34, 0);
- assert_equals(matrix.m41, 0);
- assert_equals(matrix.m42, 3);
- assert_equals(matrix.m43, 0);
- assert_equals(matrix.m44, 9);
- assert_false(matrix.is2D);
- assert_false(matrix.isIdentity);
+ assert_3d_matrix_equals(matrix, [10, 20, 0, 0, 0, 1, 0, 2, 0, 0, 3, 0, 0, 3, 0, 9]);
}, "DOMMatrix attributes");
test(() => {
@@ -190,63 +126,36 @@ test(() => {
test(() => {
var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, c: 3, d: 4, e: 5, f: 6});
- assert_2d_matrix_equals(matrix, {
- m11: 1, m12: 2,
- m21: 3, m22: 4,
- m41: 5, m42: 6
- });
+ assert_2d_matrix_equals(matrix, [1, 2, 3, 4, 5, 6]);
}, "DOMMatrix.fromMatrix({a: 1, b: 2, c: 3, d: 4, e: 5, f: 6}) should create a 2D DOMMatrix.");
test(() => {
var matrix = DOMMatrix.fromMatrix({m11: 1, m22: 2, m33: 3, m44: 4, m23: 5, m43: 6});
- assert_3d_matrix_equals(matrix, {
- m11: 1, m12: 0, m13: 0, m14: 0,
- m21: 0, m22: 2, m23: 5, m24: 0,
- m31: 0, m32: 0, m33: 3, m34: 0,
- m41: 0, m42: 0, m43: 6, m44: 4
- });
+ assert_3d_matrix_equals(matrix, [1, 0, 0, 0, 0, 2, 5, 0, 0, 0, 3, 0, 0, 0, 6, 4]);
}, "DOMMatrix.fromMatrix({m11: 1, m22: 2, m33: 3, m44: 4, m23: 5, m43: 6}) should create a 3D DOMMatrix.");
test(() => {
var matrix = DOMMatrix.fromMatrix({a: 7, c: 9});
- assert_2d_matrix_equals(matrix, {
- m11: 7, m12: 0,
- m21: 9, m22: 1,
- m41: 0, m42: 0
- });
+ assert_2d_matrix_equals(matrix, [7, 0, 9, 1, 0, 0]);
}, "If 2d related properties don't be set, should set to fallback.");
test(() => {
var matrix = DOMMatrix.fromMatrix({
- m11: NaN, m12: NaN, m13: NaN, m14: NaN,
- m21: NaN, m22: NaN, m23: NaN, m24: NaN,
- m31: NaN, m32: NaN, m33: NaN, m34: NaN,
- m41: NaN, m42: NaN, m43: NaN, m44: NaN,
- is2D: false
- });
- assert_equals(matrix.a, matrix.m11);
- assert_equals(matrix.b, matrix.m12);
- assert_equals(matrix.c, matrix.m21);
- assert_equals(matrix.d, matrix.m22);
- assert_equals(matrix.e, matrix.m41);
- assert_equals(matrix.f, matrix.m42);
- assert_3d_matrix_equals(matrix, {
- m11: NaN, m12: NaN, m13: NaN, m14: NaN,
- m21: NaN, m22: NaN, m23: NaN, m24: NaN,
- m31: NaN, m32: NaN, m33: NaN, m34: NaN,
- m41: NaN, m42: NaN, m43: NaN, m44: NaN
+ m11: NaN, m12: NaN, m13: NaN, m14: NaN,
+ m21: NaN, m22: NaN, m23: NaN, m24: NaN,
+ m31: NaN, m32: NaN, m33: NaN, m34: NaN,
+ m41: NaN, m42: NaN, m43: NaN, m44: NaN,
+ is2D: false
});
+ assert_3d_matrix_equals(matrix, [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN]);
}, "DOMMatrix.fromMatrix(): NaN test");
test(() => {
assert_throws(new TypeError(), () => {
- var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m33: 3, m44: 4, is2D: true});
- }, "The 'is2D' property is set to true but the input matrix is 3d matrix.");
+ var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m33: 3, m44: 4, is2D: true});
+ }, "The 'is2D' property is set to true but the input matrix is 3d matrix.");
assert_throws(new TypeError(), () => {
- var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m11: 3});
- }, "The 'a' property should equal the 'm11' property.");
+ var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m11: 3});
+ }, "The 'a' property should equal the 'm11' property.");
}, "DOMMatrix.fromMatrix(): Exception test.");
-
</script>
-</body>
-</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-invert.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698