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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix.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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-readonly.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 3d230cbcce9281e274f8fd4b33b7f384477ccef9..c5f5672829f49b9455ff2ea5df138f5f6d180b41 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
@@ -161,6 +161,42 @@ test(() => {
}, "DOMMatrix.fromMatrix(): NaN test");
test(() => {
+ var identity_matrix = DOMMatrix.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});
+}, "DOMMatrix toJSON() - identity matrix");
+
+test(() => {
+ var matrix2d = new DOMMatrix([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});
+}, "DOMMatrix toJSON() - 2D matrix");
+
+test(() => {
+ var matrix3d = new DOMMatrix([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});
+}, "DOMMatrix toJSON() - 3D matrix");
+
+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.");
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-readonly.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698