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

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

Issue 2482743002: [GeometryInterface] add toJson() function in DOMMatrixReadOnly. (Closed)
Patch Set: add test for DOMMatrix Created 4 years, 1 month 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-readonly.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-readonly.html b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-readonly.html
index ed4dcf582b98529a3cd3d0d35cae1e23e50ce795..0019e14e50103dc6b8bf3ef7a2ad98b883eacd5c 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-readonly.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-readonly.html
@@ -52,6 +52,42 @@ test(() => {
}, "DOMMatrixReadOnly toString() - 3D matrix");
test(() => {
+ var identity_matrix = DOMMatrixReadOnly.fromMatrix();
+ assert_true(identity_matrix.is2D);
+ assert_object_equals(identity_matrix.toJSON(),
+ { a : 1, b : 0, c : 0, d : 1, e : 0, f : 0,
+ is2D : true, isIdentity : true,
+ 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});
+}, "DOMMatrixReadOnly toJSON() - identity matrix");
+
+test(() => {
+ var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 3.1, 2, 1]);
+ assert_true(matrix2d.is2D);
+ assert_object_equals(matrix2d.toJSON(),
+ { a : 1, b : 2, c : 3, d : 3.1, e : 2, f : 1,
+ is2D : true, isIdentity : false,
+ m11 : 1, m12 : 2, m13 : 0, m14 : 0,
+ m21 : 3, m22 : 3.1, m23 : 0, m24 : 0,
+ m31 : 0, m32 : 0, m33 : 1, m34 : 0,
+ m41 : 2, m42 : 1, m43 : 0, m44 : 1});
+}, "DOMMatrixReadOnly toJSON() - 2D matrix");
+
+test(() => {
+ var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.6]);
+ assert_false(matrix3d.is2D);
+ assert_object_equals(matrix3d.toJSON(),
+ { a : 1, b : 2, c : 5, d : 6, e : 13, f : 14,
+ is2D : false, isIdentity : false,
+ m11 : 1, m12 : 2, m13 : 3, m14 : 4,
+ m21 : 5, m22 : 6, m23 : 7, m24 : 8,
+ m31 : 9, m32 : 10.1, m33 : 11, m34 : 12,
+ m41 : 13, m42 : 14, m43 : 15, m44 : 16.6});
+}, "DOMMatrixReadOnly toJSON() - 3D matrix");
+
+test(() => {
assert_throws(new TypeError(), () => { new DOMMatrixReadOnly(1, 2, 3, 4, 5, 6); },
"DOMMatrixReadOnly constructor only accepts 1 argument");
assert_throws(new TypeError(), () => { new DOMMatrixReadOnly("myString"); },

Powered by Google App Engine
This is Rietveld 408576698