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: third_party/WebKit/LayoutTests/fast/dom/resources/geometry-interfaces-test-helpers.js

Issue 2364393002: assert_*d_matrix_equals fuction can accept array as expected parameter. (Closed)
Patch Set: assert_*d_matrix_equals fuction can accept array as expected parameter. 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 | « third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 function assert_identity_2d_matrix(actual, description) { 1 function assert_identity_2d_matrix(actual, description) {
2 assert_matrix_equals(actual, { 2 assert_matrix_equals(actual, {
3 m11: 1, m12: 0, m13: 0, m14: 0, 3 m11: 1, m12: 0, m13: 0, m14: 0,
4 m21: 0, m22: 1, m23: 0, m24: 0, 4 m21: 0, m22: 1, m23: 0, m24: 0,
5 m31: 0, m32: 0, m33: 1, m34: 0, 5 m31: 0, m32: 0, m33: 1, m34: 0,
6 m41: 0, m42: 0, m43: 0, m44: 1, 6 m41: 0, m42: 0, m43: 0, m44: 1,
7 is2D: true, isIdentity: true 7 is2D: true, isIdentity: true
8 }, description); 8 }, description);
9 } 9 }
10 10
11 function assert_identity_3d_matrix(actual, description) { 11 function assert_identity_3d_matrix(actual, description) {
12 assert_matrix_equals(actual, { 12 assert_matrix_equals(actual, {
13 m11: 1, m12: 0, m13: 0, m14: 0, 13 m11: 1, m12: 0, m13: 0, m14: 0,
14 m21: 0, m22: 1, m23: 0, m24: 0, 14 m21: 0, m22: 1, m23: 0, m24: 0,
15 m31: 0, m32: 0, m33: 1, m34: 0, 15 m31: 0, m32: 0, m33: 1, m34: 0,
16 m41: 0, m42: 0, m43: 0, m44: 1, 16 m41: 0, m42: 0, m43: 0, m44: 1,
17 is2D: false, isIdentity: true 17 is2D: false, isIdentity: true
18 }, description); 18 }, description);
19 } 19 }
20 20
21 function assert_2d_matrix_equals(actual, expected, description) { 21 function assert_2d_matrix_equals(actual, expected, description) {
22 var full_expected = { 22 if (Array.isArray(expected)) {
23 m11: expected.m11, m12: expected.m12, m13: 0, m14: 0, 23 assert_equals(6, expected.length);
24 m21: expected.m21, m22: expected.m22, m23: 0, m24: 0, 24 var full_expected = {
25 m31: 0, m32: 0, m33: 1, m34: 0, 25 m11: expected[0], m12: expected[1], m13: 0, m14: 0,
26 m41: expected.m41, m42: expected.m42, m43: 0, m44: 1, 26 m21: expected[2], m22: expected[3], m23: 0, m24: 0,
27 is2D: true, isIdentity: expected.isIdentity 27 m31: 0, m32: 0, m33: 1, m34: 0,
28 }; 28 m41: expected[4], m42: expected[5], m43: 0, m44: 1,
29 assert_matrix_equals(actual, full_expected, description); 29 is2D: true, isIdentity: false
30 };
31 assert_matrix_equals(actual, full_expected, description);
32 } else {
33 var full_expected = {
34 m11: expected.m11, m12: expected.m12, m13: 0, m14: 0,
35 m21: expected.m21, m22: expected.m22, m23: 0, m24: 0,
36 m31: 0, m32: 0, m33: 1, m34: 0,
37 m41: expected.m41, m42: expected.m42, m43: 0, m44: 1,
38 is2D: true, isIdentity: false
39 };
40 assert_matrix_equals(actual, full_expected, description);
41 }
30 } 42 }
31 43
32 function assert_3d_matrix_equals(actual, expected, description){ 44 function assert_3d_matrix_equals(actual, expected, description){
33 expected['is2D'] = false; 45 if (Array.isArray(expected)) {
34 assert_matrix_equals(actual, expected, description); 46 assert_equals(16, expected.length);
47 var full_expected = {
48 m11: expected[0], m12: expected[1], m13: expected[2], m14: expected[3],
49 m21: expected[4], m22: expected[5], m23: expected[6], m24: expected[7],
50 m31: expected[8], m32: expected[9], m33: expected[10], m34: expected[11] ,
51 m41: expected[12], m42: expected[13], m43: expected[14], m44: expected[1 5],
52 is2D: false, isIdentity: false
53 };
54 assert_matrix_equals(actual, full_expected, description);
55 } else {
56 expected['is2D'] = false;
57 expected['isIdentity'] = false;
58 assert_matrix_equals(actual, expected, description);
59 }
35 } 60 }
36 61
37 function assert_matrix_equals(actual, expected, description) { 62 function assert_matrix_equals(actual, expected, description) {
38 assert_equals(actual.isIdentity, expected.isIdentity, description); 63 assert_equals(actual.isIdentity, expected.isIdentity, description);
39 assert_equals(actual.is2D, expected.is2D, description); 64 assert_equals(actual.is2D, expected.is2D, description);
40 assert_equals(actual.m11, expected.m11, description); 65 assert_equals(actual.m11, expected.m11, description);
41 assert_equals(actual.m12, expected.m12, description); 66 assert_equals(actual.m12, expected.m12, description);
42 assert_equals(actual.m13, expected.m13, description); 67 assert_equals(actual.m13, expected.m13, description);
43 assert_equals(actual.m14, expected.m14, description); 68 assert_equals(actual.m14, expected.m14, description);
44 assert_equals(actual.m21, expected.m21, description); 69 assert_equals(actual.m21, expected.m21, description);
45 assert_equals(actual.m22, expected.m22, description); 70 assert_equals(actual.m22, expected.m22, description);
46 assert_equals(actual.m23, expected.m23, description); 71 assert_equals(actual.m23, expected.m23, description);
47 assert_equals(actual.m24, expected.m24, description); 72 assert_equals(actual.m24, expected.m24, description);
48 assert_equals(actual.m31, expected.m31, description); 73 assert_equals(actual.m31, expected.m31, description);
49 assert_equals(actual.m32, expected.m32, description); 74 assert_equals(actual.m32, expected.m32, description);
50 assert_equals(actual.m33, expected.m33, description); 75 assert_equals(actual.m33, expected.m33, description);
51 assert_equals(actual.m34, expected.m34, description); 76 assert_equals(actual.m34, expected.m34, description);
52 assert_equals(actual.m41, expected.m41, description); 77 assert_equals(actual.m41, expected.m41, description);
53 assert_equals(actual.m42, expected.m42, description); 78 assert_equals(actual.m42, expected.m42, description);
54 assert_equals(actual.m43, expected.m43, description); 79 assert_equals(actual.m43, expected.m43, description);
55 assert_equals(actual.m44, expected.m44, description); 80 assert_equals(actual.m44, expected.m44, description);
56 assert_equals(actual.m11, actual.a, description); 81 assert_equals(actual.m11, actual.a, description);
57 assert_equals(actual.m12, actual.b, description); 82 assert_equals(actual.m12, actual.b, description);
58 assert_equals(actual.m21, actual.c, description); 83 assert_equals(actual.m21, actual.c, description);
59 assert_equals(actual.m22, actual.d, description); 84 assert_equals(actual.m22, actual.d, description);
60 assert_equals(actual.m41, actual.e, description); 85 assert_equals(actual.m41, actual.e, description);
61 assert_equals(actual.m42, actual.f, description); 86 assert_equals(actual.m42, actual.f, description);
62 } 87 }
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698