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

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

Issue 2370623003: [GeometryInterface] Clean-up layout tests for geometry interfaces. (Closed)
Patch Set: [GeometryInterface] Fix a indentation and clean up. 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Geometry Interfaces: DOMMatrix scale</title>
5 <script src="../../resources/testharness.js"></script> 2 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script> 3 <script src="../../resources/testharnessreport.js"></script>
7 </head> 4 <script src="./resources/geometry-interfaces-test-helpers.js"></script>
8 <body>
9 <script> 5 <script>
10
11 test(function() { 6 test(function() {
12 var matrix = new DOMMatrix(); 7 var matrix = new DOMMatrix();
13 matrix.a = 1; 8 matrix.a = 1;
14 matrix.b = 2; 9 matrix.b = 2;
15 matrix.c = 3; 10 matrix.c = 3;
16 matrix.d = 4; 11 matrix.d = 4;
17 matrix.e = 5; 12 matrix.e = 5;
18 matrix.f = 6; 13 matrix.f = 6;
19 assert_true(matrix.is2D); 14 assert_2d_matrix_equals(matrix, [1, 2, 3, 4, 5, 6]);
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(); 15 var other = new DOMMatrix();
23 other.m11 = 6; 16 other.m11 = 6;
24 other.m21 = 5; 17 other.m21 = 5;
25 other.m31 = 4; 18 other.m31 = 4;
26 other.m33 = 3; 19 other.m33 = 3;
27 other.m41 = 2; 20 other.m41 = 2;
28 other.m43 = 1; 21 other.m43 = 1;
29 assert_false(other.is2D); 22 assert_3d_matrix_equals(other, [6, 0, 0, 0, 5, 1, 0, 0, 4, 0, 3, 0, 2, 0, 1, 1 ]);
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); 23 var result = matrix.multiply(other);
33 assert_false(result.is2D); 24 assert_3d_matrix_equals(result, [6, 12, 0, 0, 8, 14, 0, 0, 4, 8, 3, 0, 7, 10, 1, 1]);
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); 25 matrix.multiplySelf(other);
37 assert_false(matrix.is2D); 26 assert_false(matrix.is2D);
38 assert_false(matrix.isIdentity); 27 assert_false(matrix.isIdentity);
39 assert_array_equals(matrix.toFloat64Array(), result.toFloat64Array()); 28 assert_array_equals(matrix.toFloat64Array(), result.toFloat64Array());
40 }, "DOMMatrix.multiply(other) and DOMMatrix.multiplySelf(other)"); 29 }, "DOMMatrix.multiply(other) and DOMMatrix.multiplySelf(other)");
41 30
42 test(function() { 31 test(function() {
43 var matrix = new DOMMatrix(); 32 var matrix = new DOMMatrix();
44 matrix.a = 1; 33 matrix.a = 1;
45 matrix.b = 2; 34 matrix.b = 2;
46 matrix.c = 3; 35 matrix.c = 3;
47 matrix.d = 4; 36 matrix.d = 4;
48 matrix.e = 5; 37 matrix.e = 5;
49 matrix.f = 6; 38 matrix.f = 6;
50 assert_true(matrix.is2D); 39 assert_2d_matrix_equals(matrix, [1, 2, 3, 4, 5, 6]);
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(); 40 var other = new DOMMatrix();
54 other.m11 = 6; 41 other.m11 = 6;
55 other.m21 = 5; 42 other.m21 = 5;
56 other.m31 = 4; 43 other.m31 = 4;
57 other.m33 = 3; 44 other.m33 = 3;
58 other.m41 = 2; 45 other.m41 = 2;
59 other.m43 = 1; 46 other.m43 = 1;
60 assert_false(other.is2D); 47 assert_3d_matrix_equals(other, [6, 0, 0, 0, 5, 1, 0, 0, 4, 0, 3, 0, 2, 0, 1, 1 ]);
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); 48 var result = matrix.preMultiplySelf(other);
64 assert_false(result.is2D); 49 assert_3d_matrix_equals(result, [16, 2, 0, 0, 38, 4, 0, 0, 4, 0, 3, 0, 62, 6, 1, 1]);
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()); 50 assert_array_equals(matrix.toFloat64Array(), result.toFloat64Array());
68 }, "DOMMatrix.preMultiplySelf(other)"); 51 }, "DOMMatrix.preMultiplySelf(other)");
69
70 </script> 52 </script>
71 </body>
72 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698