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

Side by Side Diff: LayoutTests/fast/dom/geometry-interfaces-dom-matrix-multiply.html

Issue 485523002: Implement *multiply*() methods in DOMMatrix. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: pdr's comment 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 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 assert_false(matrix.isIdentity);
21 assert_array_equals(matrix.toFloat64Array(), [ 1, 2, 0, 0, 3, 4, 0, 0, 0, 0, 1 , 0, 5, 6, 0, 1 ]);
22 var other = new DOMMatrix();
23 other.m11 = 6;
24 other.m21 = 5;
25 other.m31 = 4;
26 other.m33 = 3;
27 other.m41 = 2;
28 other.m43 = 1;
29 assert_false(other.is2D);
30 assert_false(other.isIdentity);
31 assert_array_equals(other.toFloat64Array(), [ 6, 0, 0, 0, 5, 1, 0, 0, 4, 0, 3, 0, 2, 0, 1, 1 ]);
32 var result = matrix.multiply(other);
33 assert_false(result.is2D);
34 assert_false(result.isIdentity);
35 assert_array_equals(result.toFloat64Array(), [ 6, 12, 0, 0, 8, 14, 0, 0, 4, 8, 3, 0, 7, 10, 1, 1 ]);
36 matrix.multiplySelf(other);
37 assert_false(matrix.is2D);
38 assert_false(matrix.isIdentity);
39 assert_array_equals(matrix.toFloat64Array(), result.toFloat64Array());
40 }, "DOMMatrix.multiply(other) and DOMMatrix.multiplySelf(other)");
41
42 test(function() {
43 var matrix = new DOMMatrix();
44 matrix.a = 1;
45 matrix.b = 2;
46 matrix.c = 3;
47 matrix.d = 4;
48 matrix.e = 5;
49 matrix.f = 6;
50 assert_true(matrix.is2D);
51 assert_false(matrix.isIdentity);
52 assert_array_equals(matrix.toFloat64Array(), [ 1, 2, 0, 0, 3, 4, 0, 0, 0, 0, 1 , 0, 5, 6, 0, 1 ]);
53 var other = new DOMMatrix();
54 other.m11 = 6;
55 other.m21 = 5;
56 other.m31 = 4;
57 other.m33 = 3;
58 other.m41 = 2;
59 other.m43 = 1;
60 assert_false(other.is2D);
61 assert_false(other.isIdentity);
62 assert_array_equals(other.toFloat64Array(), [ 6, 0, 0, 0, 5, 1, 0, 0, 4, 0, 3, 0, 2, 0, 1, 1 ]);
63 var result = matrix.preMultiplySelf(other);
64 assert_false(result.is2D);
65 assert_false(result.isIdentity);
66 assert_array_equals(result.toFloat64Array(), [ 16, 2, 0, 0, 38, 4, 0, 0, 4, 0, 3, 0, 62, 6, 1, 1 ]);
67 assert_array_equals(matrix.toFloat64Array(), result.toFloat64Array());
68 }, "DOMMatrix.preMultiplySelf(other)");
69
70 </script>
71 </body>
72 </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