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

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
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..925c25bffb4785385f999e853e3ad675084b0ae1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-transformPoint.html
@@ -0,0 +1,50 @@
+<!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) {
+ 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() - 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() - 3d 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() - 2d matrix");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698