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

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

Issue 485523002: Implement *multiply*() methods in DOMMatrix. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: pdr's comment Created 6 years, 4 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 | Source/core/dom/DOMMatrix.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/geometry-interfaces-dom-matrix-multiply.html
diff --git a/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-multiply.html b/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-multiply.html
new file mode 100644
index 0000000000000000000000000000000000000000..b65d8000249f53cbdb738b5f00026452cb887a94
--- /dev/null
+++ b/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-multiply.html
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Geometry Interfaces: DOMMatrix scale</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+</head>
+<body>
+<script>
+
+test(function() {
+ var matrix = new DOMMatrix();
+ matrix.a = 1;
+ matrix.b = 2;
+ matrix.c = 3;
+ matrix.d = 4;
+ matrix.e = 5;
+ matrix.f = 6;
+ assert_true(matrix.is2D);
+ assert_false(matrix.isIdentity);
+ assert_array_equals(matrix.toFloat64Array(), [ 1, 2, 0, 0, 3, 4, 0, 0, 0, 0, 1, 0, 5, 6, 0, 1 ]);
+ var other = new DOMMatrix();
+ other.m11 = 6;
+ other.m21 = 5;
+ other.m31 = 4;
+ other.m33 = 3;
+ other.m41 = 2;
+ other.m43 = 1;
+ assert_false(other.is2D);
+ assert_false(other.isIdentity);
+ assert_array_equals(other.toFloat64Array(), [ 6, 0, 0, 0, 5, 1, 0, 0, 4, 0, 3, 0, 2, 0, 1, 1 ]);
+ var result = matrix.multiply(other);
+ assert_false(result.is2D);
+ assert_false(result.isIdentity);
+ assert_array_equals(result.toFloat64Array(), [ 6, 12, 0, 0, 8, 14, 0, 0, 4, 8, 3, 0, 7, 10, 1, 1 ]);
+ matrix.multiplySelf(other);
+ assert_false(matrix.is2D);
+ assert_false(matrix.isIdentity);
+ assert_array_equals(matrix.toFloat64Array(), result.toFloat64Array());
+}, "DOMMatrix.multiply(other) and DOMMatrix.multiplySelf(other)");
+
+test(function() {
+ var matrix = new DOMMatrix();
+ matrix.a = 1;
+ matrix.b = 2;
+ matrix.c = 3;
+ matrix.d = 4;
+ matrix.e = 5;
+ matrix.f = 6;
+ assert_true(matrix.is2D);
+ assert_false(matrix.isIdentity);
+ assert_array_equals(matrix.toFloat64Array(), [ 1, 2, 0, 0, 3, 4, 0, 0, 0, 0, 1, 0, 5, 6, 0, 1 ]);
+ var other = new DOMMatrix();
+ other.m11 = 6;
+ other.m21 = 5;
+ other.m31 = 4;
+ other.m33 = 3;
+ other.m41 = 2;
+ other.m43 = 1;
+ assert_false(other.is2D);
+ assert_false(other.isIdentity);
+ assert_array_equals(other.toFloat64Array(), [ 6, 0, 0, 0, 5, 1, 0, 0, 4, 0, 3, 0, 2, 0, 1, 1 ]);
+ var result = matrix.preMultiplySelf(other);
+ assert_false(result.is2D);
+ assert_false(result.isIdentity);
+ assert_array_equals(result.toFloat64Array(), [ 16, 2, 0, 0, 38, 4, 0, 0, 4, 0, 3, 0, 62, 6, 1, 1 ]);
+ assert_array_equals(matrix.toFloat64Array(), result.toFloat64Array());
+}, "DOMMatrix.preMultiplySelf(other)");
+
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | Source/core/dom/DOMMatrix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698