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

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

Issue 2423753002: [GeometryInterface] add transformPoint(point) function. (Closed)
Patch Set: [GeometryInterface] add transformPoint(point) method. Created 4 years, 2 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 | third_party/WebKit/LayoutTests/fast/dom/resources/geometry-interfaces-test-helpers.js » ('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-transformPoint.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-transformPoint.html b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-transformPoint.html
new file mode 100644
index 0000000000000000000000000000000000000000..b1fbfd3ac93c3aecee82163d7ade09158a086424
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-transformPoint.html
@@ -0,0 +1,76 @@
+<!DOCTYPE HTML>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="./resources/geometry-interfaces-test-helpers.js"></script>
+<script>
+
+function transformPoint(matrix, point) {
dominicc (has gone to gerrit) 2016/10/28 02:25:19 I think this test strategy of having two implement
Hwanseung Lee 2016/10/29 12:11:08 i just removed if statement. it is same with below
Hwanseung Lee 2016/10/31 12:23:02 sorry. i had been misunderstood.
+ if (matrix.is2D && point.z == 0 && point.w == 1) {
+ var x = point.x * matrix.m11 + point.y * matrix.m12 + matrix.m41;
+ var y = point.x * matrix.m12 + point.y * matrix.m22 + matrix.m42;
+ return new DOMPoint(x, y, 0, 1);
+ }
+ var x = point.x * matrix.m11 + point.y * matrix.m21 + point.z * matrix.m31 + point.w * matrix.m41;
+ var y = point.x * matrix.m12 + point.y * matrix.m22 + point.z * matrix.m32 + point.w * matrix.m42;
+ var z = point.x * matrix.m13 + point.y * matrix.m23 + point.z * matrix.m33 + point.w * matrix.m43;
+ var w = point.x * matrix.m14 + point.y * matrix.m24 + point.z * matrix.m34 + point.w * matrix.m44;
+ return new DOMPoint(x, y, z, w);
+}
+
+test(function() {
+ var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);
+ var point = matrix2d.transformPoint();
+ var expected = transformPoint(new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]), new DOMPoint());
+ assert_point_equals(point, expected);
+}, "DOMMatrixReadOnly transformPoint() - 2d matrix ");
+
+test(function() {
+ var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+ var point = matrix3d.transformPoint();
+ var expected = transformPoint(new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]), new DOMPoint());
+ assert_point_equals(point, expected);
+}, "DOMMatrixReadOnly transformPoint() - 3d matrix");
+
+test(function() {
+ var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);
+ var point = matrix2d.transformPoint(new DOMPoint(1, 2, 3, 4));
+ var expected = transformPoint(new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]), new DOMPoint(1, 2, 3, 4))
+ assert_point_equals(point, expected);
+}, "DOMMatrixReadOnly transformPoint(DOMPoint(x, y, z, w)) - 2d matrix");
+
+test(function() {
+ var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+ var point = matrix3d.transformPoint(new DOMPoint(1, 2, 3, 4));
+ var expected = transformPoint(new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]), new DOMPoint(1, 2, 3, 4));
+ assert_point_equals(point, expected);
+}, "DOMMatrixReadOnly transformPoint(DOMPoint(x, y, z, w)) - 3d matrix");
+
+test(function() {
+ var matrix2d = new DOMMatrixReadOnly([2, 0, 0, 2, 10, 10]);
+ var point = matrix2d.transformPoint(new DOMPoint(5));
+ var expected = transformPoint(new DOMMatrixReadOnly([2, 0, 0, 2, 10, 10]), new DOMPoint(5));
+ assert_point_equals(point, expected);
+}, "DOMMatrixReadOnly transformPoint(DOMPoint(x)) - 2d matrix");
+
+test(function() {
+ var matrix2d = new DOMMatrixReadOnly([2, 0, 0, 2, 10, 10]);
+ var point = matrix2d.transformPoint(new DOMPoint(5, 4));
+ var expected = transformPoint(new DOMMatrixReadOnly([2, 0, 0, 2, 10, 10]), new DOMPoint(5, 4));
+ assert_point_equals(point, expected);
+}, "DOMMatrixReadOnly transformPoint(DOMPoint(x, y)) - 2d matrix");
+
+test(function() {
+ var matrix2d = new DOMMatrixReadOnly([2, 0, 0, 2, 10, 10]);
+ var point = matrix2d.transformPoint(new DOMPoint(5, 4, 1));
+ var expected = transformPoint(new DOMMatrixReadOnly([2, 0, 0, 2, 10, 10]), new DOMPoint(5, 4, 1));
+ assert_point_equals(point, expected);
+}, "DOMMatrixReadOnly transformPoint(DOMPoint(x, y, z)) - 2d matrix");
+
+test(function() {
+ var matrix2d = new DOMMatrixReadOnly([2, 0, 0, 2, 10, 10]);
+ var point = matrix2d.transformPoint(new DOMPoint(5, 4, 0, 1));
+ var expected = transformPoint(new DOMMatrixReadOnly([2, 0, 0, 2, 10, 10]), new DOMPoint(5, 4, 0, 1));
+ assert_point_equals(point, expected);
+}, "DOMMatrixReadOnly transformPoint(DOMPoint(x, y, z, w)) - 2d matrix");
+
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/resources/geometry-interfaces-test-helpers.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698