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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/resources/geometry-interfaces-test-helpers.js

Issue 2283363003: GeometryInterface: Add DOMMatrixInit and fromMatrix(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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/resources/geometry-interfaces-test-helpers.js
diff --git a/third_party/WebKit/LayoutTests/fast/dom/resources/geometry-interfaces-test-helpers.js b/third_party/WebKit/LayoutTests/fast/dom/resources/geometry-interfaces-test-helpers.js
new file mode 100644
index 0000000000000000000000000000000000000000..f6d2d28c73b09e7a120532f91aa22fb62626f8ce
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/dom/resources/geometry-interfaces-test-helpers.js
@@ -0,0 +1,62 @@
+function assert_identity_2d_matrix(actual, description) {
+ assert_matrix_equals(actual, {
+ m11: 1, m12: 0, m13: 0, m14: 0,
+ m21: 0, m22: 1, m23: 0, m24: 0,
+ m31: 0, m32: 0, m33: 1, m34: 0,
+ m41: 0, m42: 0, m43: 0, m44: 1,
+ is2D: true, isIdentity: true
+ }, description);
+}
+
+function assert_identity_3d_matrix(actual, description) {
+ assert_matrix_equals(actual, {
+ m11: 1, m12: 0, m13: 0, m14: 0,
+ m21: 0, m22: 1, m23: 0, m24: 0,
+ m31: 0, m32: 0, m33: 1, m34: 0,
+ m41: 0, m42: 0, m43: 0, m44: 1,
+ is2D: false, isIdentity: true
+ }, description);
+}
+
+function assert_2d_matrix_equals(actual, expected, description) {
+ var full_expected = {
+ m11: expected.m11, m12: expected.m12, m13: 0, m14: 0,
+ m21: expected.m21, m22: expected.m22, m23: 0, m24: 0,
+ m31: 0, m32: 0, m33: 1, m34: 0,
+ m41: expected.m41, m42: expected.m42, m43: 0, m44: 1,
+ is2D: true, isIdentity: expected.isIdentity
+ };
+ assert_matrix_equals(actual, full_expected, description);
+}
+
+function assert_3d_matrix_equals(actual, expected, description){
+ expected['is2D'] = false;
+ assert_matrix_equals(actual, expected, description);
+}
+
+function assert_matrix_equals(actual, expected, description) {
+ assert_equals(actual.isIdentity, expected.isIdentity, description);
+ assert_equals(actual.is2D, expected.is2D, description);
+ assert_equals(actual.m11, expected.m11, description);
+ assert_equals(actual.m12, expected.m12, description);
+ assert_equals(actual.m13, expected.m13, description);
+ assert_equals(actual.m14, expected.m14, description);
+ assert_equals(actual.m21, expected.m21, description);
+ assert_equals(actual.m22, expected.m22, description);
+ assert_equals(actual.m23, expected.m23, description);
+ assert_equals(actual.m24, expected.m24, description);
+ assert_equals(actual.m31, expected.m31, description);
+ assert_equals(actual.m32, expected.m32, description);
+ assert_equals(actual.m33, expected.m33, description);
+ assert_equals(actual.m34, expected.m34, description);
+ assert_equals(actual.m41, expected.m41, description);
+ assert_equals(actual.m42, expected.m42, description);
+ assert_equals(actual.m43, expected.m43, description);
+ assert_equals(actual.m44, expected.m44, description);
+ assert_equals(actual.m11, actual.a, description);
+ assert_equals(actual.m12, actual.b, description);
+ assert_equals(actual.m21, actual.c, description);
+ assert_equals(actual.m22, actual.d, description);
+ assert_equals(actual.m41, actual.e, description);
+ assert_equals(actual.m42, actual.f, description);
+}

Powered by Google App Engine
This is Rietveld 408576698