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

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

Issue 504623003: Implement skew*() methods in DOMMatrix. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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-skew.html
diff --git a/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-skew.html b/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-skew.html
new file mode 100644
index 0000000000000000000000000000000000000000..0db9021b5d3e6b8d35afbc62b2eb60204064e834
--- /dev/null
+++ b/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-skew.html
@@ -0,0 +1,117 @@
+<!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);
+ var result = matrix.skewX(32);
+ var expected = new DOMMatrix();
+ expected.m21 = Math.tan(Math.PI / 180 * 32);
+ expected.preMultiplySelf(matrix);
+ 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 ]);
+ assert_array_equals(result.toFloat64Array(), expected.toFloat64Array());
+ matrix.skewXSelf(32);
+ assert_array_equals(matrix.toFloat64Array(), expected.toFloat64Array());
+}, "DOMMatrix.skewX(sx) and DOMMatrix.skewXSelf(sx) for 2D Matrix");
+
+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);
+ var result = matrix.skewY(25);
+ var expected = new DOMMatrix();
+ expected.m12 = Math.tan(Math.PI / 180 * 25);
+ expected.preMultiplySelf(matrix);
+ 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 ]);
+ assert_array_equals(result.toFloat64Array(), expected.toFloat64Array());
+ matrix.skewYSelf(25);
+ assert_array_equals(matrix.toFloat64Array(), expected.toFloat64Array());
+}, "DOMMatrix.skewY(sy) and DOMMatrix.skewYSelf(sy) for 2D Matrix");
+
+test(function() {
+ var matrix = new DOMMatrix();
+ matrix.m11 = 1;
+ matrix.m12 = 2;
+ matrix.m13 = 3;
+ matrix.m14 = 4;
+ matrix.m21 = 5;
+ matrix.m22 = 6;
+ matrix.m23 = 7;
+ matrix.m24 = 8;
+ matrix.m31 = 9;
+ matrix.m32 = 10;
+ matrix.m33 = 11;
+ matrix.m34 = 12;
+ matrix.m41 = 13;
+ matrix.m42 = 14;
+ matrix.m43 = 15;
+ matrix.m44 = 16;
+ assert_false(matrix.is2D);
+ var result = matrix.skewX(32);
+ var expected = new DOMMatrix();
+ expected.m21 = Math.tan(Math.PI / 180 * 32);
+ expected.preMultiplySelf(matrix);
+ assert_false(matrix.is2D);
+ assert_false(matrix.isIdentity);
+ assert_array_equals(matrix.toFloat64Array(), [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ]);
+ assert_array_equals(result.toFloat64Array(), expected.toFloat64Array());
+ matrix.skewXSelf(32);
+ assert_array_equals(matrix.toFloat64Array(), expected.toFloat64Array());
+}, "DOMMatrix.skewX(sx) and DOMMatrix.skewXSelf(sx) for 3D Matrix");
+
+test(function() {
+ var matrix = new DOMMatrix();
+ matrix.m11 = 1;
+ matrix.m12 = 2;
+ matrix.m13 = 3;
+ matrix.m14 = 4;
+ matrix.m21 = 5;
+ matrix.m22 = 6;
+ matrix.m23 = 7;
+ matrix.m24 = 8;
+ matrix.m31 = 9;
+ matrix.m32 = 10;
+ matrix.m33 = 11;
+ matrix.m34 = 12;
+ matrix.m41 = 13;
+ matrix.m42 = 14;
+ matrix.m43 = 15;
+ matrix.m44 = 16;
+ assert_false(matrix.is2D);
+ var result = matrix.skewY(25);
+ var expected = new DOMMatrix();
+ expected.m12 = Math.tan(Math.PI / 180 * 25);
+ expected.preMultiplySelf(matrix);
+ assert_false(matrix.is2D);
+ assert_false(matrix.isIdentity);
+ assert_array_equals(matrix.toFloat64Array(), [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ]);
+ assert_array_equals(result.toFloat64Array(), expected.toFloat64Array());
+ matrix.skewYSelf(25);
+ assert_array_equals(matrix.toFloat64Array(), expected.toFloat64Array());
+}, "DOMMatrix.skewY(sy) and DOMMatrix.skewYSelf(sy) for 3D Matrix");
+
+</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