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

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: rebase 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 | « LayoutTests/TestExpectations ('k') | 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>
pdr. 2014/08/25 03:13:01 This should not be a pixel test. Please change thi
zino 2014/08/25 12:24:11 Done.
2 <html>
3 <head>
4 <title>Geometry Interfaces: DOMMatrix scale</title>
5 <script src="../../resources/testharness.js"></script>
6 </head>
7 <body>
8 <script>
9
10 test(function() {
11 var matrix = new DOMMatrix();
12 matrix.a = 1;
13 matrix.b = 2;
14 matrix.c = 3;
15 matrix.d = 4;
16 matrix.e = 5;
17 matrix.f = 6;
18 assert_true(matrix.is2D);
19 assert_false(matrix.isIdentity);
20 assert_array_equals(matrix.toFloat64Array(), [ 1, 2, 0, 0, 3, 4, 0, 0, 0, 0, 1 , 0, 5, 6, 0, 1 ]);
21 var other = new DOMMatrix();
22 other.m11 = 6;
23 other.m21 = 5;
24 other.m31 = 4;
25 other.m33 = 3;
26 other.m41 = 2;
27 other.m43 = 1;
28 assert_false(other.is2D);
29 assert_false(other.isIdentity);
30 assert_array_equals(other.toFloat64Array(), [ 6, 0, 0, 0, 5, 1, 0, 0, 4, 0, 3, 0, 2, 0, 1, 1 ]);
31 var result = matrix.multiply(other);
32 assert_false(result.is2D);
33 assert_false(result.isIdentity);
34 assert_array_equals(result.toFloat64Array(), [ 6, 12, 0, 0, 8, 14, 0, 0, 4, 8, 3, 0, 7, 10, 1, 1 ]);
35 matrix.multiplySelf(other);
36 assert_false(matrix.is2D);
37 assert_false(matrix.isIdentity);
38 assert_array_equals(matrix.toFloat64Array(), result.toFloat64Array());
39 }, "DOMMatrix.multiply(other) and DOMMatrix.multiplySelf(other)");
40
41 test(function() {
42 var matrix = new DOMMatrix();
43 matrix.a = 1;
44 matrix.b = 2;
45 matrix.c = 3;
46 matrix.d = 4;
47 matrix.e = 5;
48 matrix.f = 6;
49 assert_true(matrix.is2D);
50 assert_false(matrix.isIdentity);
51 assert_array_equals(matrix.toFloat64Array(), [ 1, 2, 0, 0, 3, 4, 0, 0, 0, 0, 1 , 0, 5, 6, 0, 1 ]);
52 var other = new DOMMatrix();
53 other.m11 = 6;
54 other.m21 = 5;
55 other.m31 = 4;
56 other.m33 = 3;
57 other.m41 = 2;
58 other.m43 = 1;
59 assert_false(other.is2D);
60 assert_false(other.isIdentity);
61 assert_array_equals(other.toFloat64Array(), [ 6, 0, 0, 0, 5, 1, 0, 0, 4, 0, 3, 0, 2, 0, 1, 1 ]);
62 var result = matrix.preMultiplySelf(other);
63 assert_false(result.is2D);
64 assert_false(result.isIdentity);
65 assert_array_equals(result.toFloat64Array(), [ 16, 2, 0, 0, 38, 4, 0, 0, 4, 0, 3, 0, 62, 6, 1, 1 ]);
66 assert_array_equals(matrix.toFloat64Array(), result.toFloat64Array());
67 }, "DOMMatrix.preMultiplySelf(other)");
68
69 </script>
70 </body>
71 </html>
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | Source/core/dom/DOMMatrix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698