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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-translate.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
Index: third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-translate.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-translate.html b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-translate.html
index 6736a23e1d526203e55db6620821006414a38b22..e65a0eea6a51417677ce28c540a750846290ab74 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-translate.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-translate.html
@@ -1,116 +1,67 @@
<!DOCTYPE html>
-<html>
-<head>
-<title>Geometry Interfaces: DOMMatrix translate</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>
-
test(function() {
var matrix = new DOMMatrix();
- assert_true(matrix.is2D);
- assert_true(matrix.isIdentity);
- assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
+ assert_identity_2d_matrix(matrix);
var result = matrix.translate(2, 3);
- assert_true(result.is2D);
- assert_false(result.isIdentity);
- assert_array_equals(result.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2, 3, 0, 1 ]);
- assert_true(matrix.is2D);
- assert_true(matrix.isIdentity);
- assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
+ assert_2d_matrix_equals(result, [1, 0, 0, 1, 2, 3]);
+ assert_identity_2d_matrix(matrix);
}, "DOMMatrix.translate(tx, ty)");
test(function() {
var matrix = new DOMMatrix();
matrix.translateSelf(2, 3);
- assert_true(matrix.is2D);
- assert_false(matrix.isIdentity);
- assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2, 3, 0, 1 ]);
+ assert_2d_matrix_equals(matrix, [1, 0, 0, 1, 2, 3]);
var result = matrix.translate(4, 2);
- assert_true(result.is2D);
- assert_false(result.isIdentity);
- assert_array_equals(result.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 6, 5, 0, 1 ]);
- assert_true(matrix.is2D);
- assert_false(matrix.isIdentity);
- assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2, 3, 0, 1 ]);
+ assert_2d_matrix_equals(result, [1, 0, 0, 1, 6, 5]);
+ assert_2d_matrix_equals(matrix, [1, 0, 0, 1, 2, 3]);
}, "DOMMatrix.translate(tx, ty) with non-identity");
test(function() {
var matrix = new DOMMatrix();
- assert_true(matrix.is2D);
- assert_true(matrix.isIdentity);
- assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
+ assert_identity_2d_matrix(matrix);
var result = matrix.translateSelf(4, 2);
- assert_true(result.is2D);
- assert_false(result.isIdentity);
- assert_array_equals(result.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4, 2, 0, 1 ]);
- assert_true(matrix.is2D);
- assert_false(matrix.isIdentity);
- assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4, 2, 0, 1 ]);
+ assert_2d_matrix_equals(result, [1, 0, 0, 1, 4, 2]);
+ assert_2d_matrix_equals(matrix, [1, 0, 0, 1, 4, 2]);
}, "DOMMatrix.translateSelf(tx, ty)");
test(function() {
var matrix = new DOMMatrix();
- assert_true(matrix.is2D);
- assert_true(matrix.isIdentity);
- assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
+ assert_identity_2d_matrix(matrix);
var result = matrix.translate(2, 3, 4);
- assert_false(result.is2D);
- assert_false(result.isIdentity);
- assert_array_equals(result.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2, 3, 4, 1 ]);
- assert_true(matrix.is2D);
- assert_true(matrix.isIdentity);
- assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
+ assert_3d_matrix_equals(result, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2, 3, 4, 1]);
+ assert_identity_2d_matrix(matrix);
}, "DOMMatrix.translate(tx, ty, tz)");
test(function() {
var matrix = new DOMMatrix();
matrix.translateSelf(2, 3);
- assert_true(matrix.is2D);
- assert_false(matrix.isIdentity);
- assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2, 3, 0, 1 ]);
+ assert_2d_matrix_equals(matrix, [1, 0, 0, 1, 2, 3]);
var result = matrix.translate(4, 2, 3);
- assert_false(result.is2D);
- assert_false(result.isIdentity);
- assert_array_equals(result.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 6, 5, 3, 1 ]);
- assert_true(matrix.is2D);
- assert_false(matrix.isIdentity);
- assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2, 3, 0, 1 ]);
+ assert_3d_matrix_equals(result, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 6, 5, 3, 1]);
+ assert_2d_matrix_equals(matrix, [1, 0, 0, 1, 2, 3]);
}, "DOMMatrix.translate(tx, ty, tz) with non-identity");
test(function() {
var matrix = new DOMMatrix();
- assert_true(matrix.is2D);
- assert_true(matrix.isIdentity);
- assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]);
+ assert_identity_2d_matrix(matrix);
var result = matrix.translateSelf(4, 2, 3);
- assert_false(result.is2D);
- assert_false(result.isIdentity);
- assert_array_equals(result.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4, 2, 3, 1 ]);
- assert_false(matrix.is2D);
- assert_false(matrix.isIdentity);
- assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4, 2, 3, 1 ]);
+ assert_3d_matrix_equals(result, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4, 2, 3, 1]);
+ assert_3d_matrix_equals(matrix, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4, 2, 3, 1]);
}, "DOMMatrix.translateSelf(tx, ty, tz)");
test(function() {
var matrix = new DOMMatrix();
- assert_true(matrix.is2D);
- assert_true(matrix.isIdentity);
+ assert_identity_2d_matrix(matrix);
matrix.m14 = 2;
matrix.m24 = 3;
matrix.m34 = 4;
matrix.m44 = 7;
- assert_false(matrix.is2D);
- assert_false(matrix.isIdentity);
- assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 2, 0, 1, 0, 3, 0, 0, 1, 4, 0, 0, 0, 7 ]);
+ assert_3d_matrix_equals(matrix, [1, 0, 0, 2, 0, 1, 0, 3, 0, 0, 1, 4, 0, 0, 0, 7]);
matrix.translateSelf(7, -8, 2);
- assert_false(matrix.is2D);
- assert_false(matrix.isIdentity);
- assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 2, 0, 1, 0, 3, 0, 0, 1, 4, 7, -8, 2, 5 ]);
+ assert_3d_matrix_equals(matrix, [1, 0, 0, 2, 0, 1, 0, 3, 0, 0, 1, 4, 7, -8, 2, 5]);
}, "DOMMatrix.translateSelf(tx, ty, tz) Homogeneous Coordinates");
-
</script>
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698