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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <script src="./resources/geometry-interfaces-test-helpers.js"></script>
5 <script>
6
7 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.
8 if (matrix.is2D && point.z == 0 && point.w == 1) {
9 var x = point.x * matrix.m11 + point.y * matrix.m12 + matrix.m41;
10 var y = point.x * matrix.m12 + point.y * matrix.m22 + matrix.m42;
11 return new DOMPoint(x, y, 0, 1);
12 }
13 var x = point.x * matrix.m11 + point.y * matrix.m21 + point.z * matrix.m31 + p oint.w * matrix.m41;
14 var y = point.x * matrix.m12 + point.y * matrix.m22 + point.z * matrix.m32 + p oint.w * matrix.m42;
15 var z = point.x * matrix.m13 + point.y * matrix.m23 + point.z * matrix.m33 + p oint.w * matrix.m43;
16 var w = point.x * matrix.m14 + point.y * matrix.m24 + point.z * matrix.m34 + p oint.w * matrix.m44;
17 return new DOMPoint(x, y, z, w);
18 }
19
20 test(function() {
21 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);
22 var point = matrix2d.transformPoint();
23 var expected = transformPoint(new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]), new D OMPoint());
24 assert_point_equals(point, expected);
25 }, "DOMMatrixReadOnly transformPoint() - 2d matrix ");
26
27 test(function() {
28 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1 3, 14, 15, 16]);
29 var point = matrix3d.transformPoint();
30 var expected = transformPoint(new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9 , 10, 11, 12, 13, 14, 15, 16]), new DOMPoint());
31 assert_point_equals(point, expected);
32 }, "DOMMatrixReadOnly transformPoint() - 3d matrix");
33
34 test(function() {
35 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);
36 var point = matrix2d.transformPoint(new DOMPoint(1, 2, 3, 4));
37 var expected = transformPoint(new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]), new D OMPoint(1, 2, 3, 4))
38 assert_point_equals(point, expected);
39 }, "DOMMatrixReadOnly transformPoint(DOMPoint(x, y, z, w)) - 2d matrix");
40
41 test(function() {
42 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1 3, 14, 15, 16]);
43 var point = matrix3d.transformPoint(new DOMPoint(1, 2, 3, 4));
44 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));
45 assert_point_equals(point, expected);
46 }, "DOMMatrixReadOnly transformPoint(DOMPoint(x, y, z, w)) - 3d matrix");
47
48 test(function() {
49 var matrix2d = new DOMMatrixReadOnly([2, 0, 0, 2, 10, 10]);
50 var point = matrix2d.transformPoint(new DOMPoint(5));
51 var expected = transformPoint(new DOMMatrixReadOnly([2, 0, 0, 2, 10, 10]), new DOMPoint(5));
52 assert_point_equals(point, expected);
53 }, "DOMMatrixReadOnly transformPoint(DOMPoint(x)) - 2d matrix");
54
55 test(function() {
56 var matrix2d = new DOMMatrixReadOnly([2, 0, 0, 2, 10, 10]);
57 var point = matrix2d.transformPoint(new DOMPoint(5, 4));
58 var expected = transformPoint(new DOMMatrixReadOnly([2, 0, 0, 2, 10, 10]), new DOMPoint(5, 4));
59 assert_point_equals(point, expected);
60 }, "DOMMatrixReadOnly transformPoint(DOMPoint(x, y)) - 2d matrix");
61
62 test(function() {
63 var matrix2d = new DOMMatrixReadOnly([2, 0, 0, 2, 10, 10]);
64 var point = matrix2d.transformPoint(new DOMPoint(5, 4, 1));
65 var expected = transformPoint(new DOMMatrixReadOnly([2, 0, 0, 2, 10, 10]), new DOMPoint(5, 4, 1));
66 assert_point_equals(point, expected);
67 }, "DOMMatrixReadOnly transformPoint(DOMPoint(x, y, z)) - 2d matrix");
68
69 test(function() {
70 var matrix2d = new DOMMatrixReadOnly([2, 0, 0, 2, 10, 10]);
71 var point = matrix2d.transformPoint(new DOMPoint(5, 4, 0, 1));
72 var expected = transformPoint(new DOMMatrixReadOnly([2, 0, 0, 2, 10, 10]), new DOMPoint(5, 4, 0, 1));
73 assert_point_equals(point, expected);
74 }, "DOMMatrixReadOnly transformPoint(DOMPoint(x, y, z, w)) - 2d matrix");
75
76 </script>
OLDNEW
« 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