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

Side by Side 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, 3 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 | Source/core/dom/DOMMatrix.h » ('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 <html>
3 <head>
4 <title>Geometry Interfaces: DOMMatrix scale</title>
5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script>
7 </head>
8 <body>
9 <script>
10
11 test(function() {
12 var matrix = new DOMMatrix();
13 matrix.a = 1;
14 matrix.b = 2;
15 matrix.c = 3;
16 matrix.d = 4;
17 matrix.e = 5;
18 matrix.f = 6;
19 assert_true(matrix.is2D);
20 var result = matrix.skewX(32);
21 var expected = new DOMMatrix();
22 expected.m21 = Math.tan(Math.PI / 180 * 32);
23 expected.preMultiplySelf(matrix);
24 assert_true(matrix.is2D);
25 assert_false(matrix.isIdentity);
26 assert_array_equals(matrix.toFloat64Array(), [ 1, 2, 0, 0, 3, 4, 0, 0, 0, 0, 1 , 0, 5, 6, 0, 1 ]);
27 assert_array_equals(result.toFloat64Array(), expected.toFloat64Array());
28 matrix.skewXSelf(32);
29 assert_array_equals(matrix.toFloat64Array(), expected.toFloat64Array());
30 }, "DOMMatrix.skewX(sx) and DOMMatrix.skewXSelf(sx) for 2D Matrix");
31
32 test(function() {
33 var matrix = new DOMMatrix();
34 matrix.a = 1;
35 matrix.b = 2;
36 matrix.c = 3;
37 matrix.d = 4;
38 matrix.e = 5;
39 matrix.f = 6;
40 assert_true(matrix.is2D);
41 var result = matrix.skewY(25);
42 var expected = new DOMMatrix();
43 expected.m12 = Math.tan(Math.PI / 180 * 25);
44 expected.preMultiplySelf(matrix);
45 assert_true(matrix.is2D);
46 assert_false(matrix.isIdentity);
47 assert_array_equals(matrix.toFloat64Array(), [ 1, 2, 0, 0, 3, 4, 0, 0, 0, 0, 1 , 0, 5, 6, 0, 1 ]);
48 assert_array_equals(result.toFloat64Array(), expected.toFloat64Array());
49 matrix.skewYSelf(25);
50 assert_array_equals(matrix.toFloat64Array(), expected.toFloat64Array());
51 }, "DOMMatrix.skewY(sy) and DOMMatrix.skewYSelf(sy) for 2D Matrix");
52
53 test(function() {
54 var matrix = new DOMMatrix();
55 matrix.m11 = 1;
56 matrix.m12 = 2;
57 matrix.m13 = 3;
58 matrix.m14 = 4;
59 matrix.m21 = 5;
60 matrix.m22 = 6;
61 matrix.m23 = 7;
62 matrix.m24 = 8;
63 matrix.m31 = 9;
64 matrix.m32 = 10;
65 matrix.m33 = 11;
66 matrix.m34 = 12;
67 matrix.m41 = 13;
68 matrix.m42 = 14;
69 matrix.m43 = 15;
70 matrix.m44 = 16;
71 assert_false(matrix.is2D);
72 var result = matrix.skewX(32);
73 var expected = new DOMMatrix();
74 expected.m21 = Math.tan(Math.PI / 180 * 32);
75 expected.preMultiplySelf(matrix);
76 assert_false(matrix.is2D);
77 assert_false(matrix.isIdentity);
78 assert_array_equals(matrix.toFloat64Array(), [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ]);
79 assert_array_equals(result.toFloat64Array(), expected.toFloat64Array());
80 matrix.skewXSelf(32);
81 assert_array_equals(matrix.toFloat64Array(), expected.toFloat64Array());
82 }, "DOMMatrix.skewX(sx) and DOMMatrix.skewXSelf(sx) for 3D Matrix");
83
84 test(function() {
85 var matrix = new DOMMatrix();
86 matrix.m11 = 1;
87 matrix.m12 = 2;
88 matrix.m13 = 3;
89 matrix.m14 = 4;
90 matrix.m21 = 5;
91 matrix.m22 = 6;
92 matrix.m23 = 7;
93 matrix.m24 = 8;
94 matrix.m31 = 9;
95 matrix.m32 = 10;
96 matrix.m33 = 11;
97 matrix.m34 = 12;
98 matrix.m41 = 13;
99 matrix.m42 = 14;
100 matrix.m43 = 15;
101 matrix.m44 = 16;
102 assert_false(matrix.is2D);
103 var result = matrix.skewY(25);
104 var expected = new DOMMatrix();
105 expected.m12 = Math.tan(Math.PI / 180 * 25);
106 expected.preMultiplySelf(matrix);
107 assert_false(matrix.is2D);
108 assert_false(matrix.isIdentity);
109 assert_array_equals(matrix.toFloat64Array(), [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ]);
110 assert_array_equals(result.toFloat64Array(), expected.toFloat64Array());
111 matrix.skewYSelf(25);
112 assert_array_equals(matrix.toFloat64Array(), expected.toFloat64Array());
113 }, "DOMMatrix.skewY(sy) and DOMMatrix.skewYSelf(sy) for 3D Matrix");
114
115 </script>
116 </body>
117 </html>
OLDNEW
« 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