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

Side by Side Diff: third_party/WebKit/LayoutTests/typedcssom/cssScale.html

Issue 2096893002: [Typed OM] Rename is2DComponent to is2D in TransformComponents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync to head Created 4 years, 5 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 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 4
5 <script> 5 <script>
6 var EPSILON = 1e-6; // float epsilon 6 var EPSILON = 1e-6; // float epsilon
7 var values = [ 7 var values = [
8 {input: new CSSScale(0, 0), x: 0, y: 0, z: 1, is2DComponent: true, 8 {input: new CSSScale(0, 0), x: 0, y: 0, z: 1, is2D: true,
9 cssText: "scale(0, 0)"}, 9 cssText: "scale(0, 0)"},
10 {input: new CSSScale(1, 2), x: 1, y: 2, z: 1, is2DComponent: true, 10 {input: new CSSScale(1, 2), x: 1, y: 2, z: 1, is2D: true,
11 cssText: "scale(1, 2)"}, 11 cssText: "scale(1, 2)"},
12 {input: new CSSScale(-2, -4), x: -2, y: -4, z: 1, is2DComponent: true, 12 {input: new CSSScale(-2, -4), x: -2, y: -4, z: 1, is2D: true,
13 cssText: "scale(-2, -4)"}, 13 cssText: "scale(-2, -4)"},
14 {input: new CSSScale(3.4, 2.7), x: 3.4, y: 2.7, z: 1, is2DComponent: true, 14 {input: new CSSScale(3.4, 2.7), x: 3.4, y: 2.7, z: 1, is2D: true,
15 cssText: "scale(3.4, 2.7)"}, 15 cssText: "scale(3.4, 2.7)"},
16 {input: new CSSScale(0, 0, 0), x: 0, y: 0, z: 0, is2DComponent: false, 16 {input: new CSSScale(0, 0, 0), x: 0, y: 0, z: 0, is2D: false,
17 cssText: "scale3d(0, 0, 0)"}, 17 cssText: "scale3d(0, 0, 0)"},
18 {input: new CSSScale(1, 2, 3), x: 1, y: 2, z: 3, is2DComponent: false, 18 {input: new CSSScale(1, 2, 3), x: 1, y: 2, z: 3, is2D: false,
19 cssText: "scale3d(1, 2, 3)"}, 19 cssText: "scale3d(1, 2, 3)"},
20 {input: new CSSScale(3.5, -2.7, -2), x: 3.5, y: -2.7, z: -2, is2DComponent: fa lse, 20 {input: new CSSScale(3.5, -2.7, -2), x: 3.5, y: -2.7, z: -2, is2D: false,
21 cssText: "scale3d(3.5, -2.7, -2)"} 21 cssText: "scale3d(3.5, -2.7, -2)"}
22 ]; 22 ];
23 23
24 test(function() { 24 test(function() {
25 for (var i = 0; i < values.length; ++i) { 25 for (var i = 0; i < values.length; ++i) {
26 assert_equals(values[i].input.x, values[i].x); 26 assert_equals(values[i].input.x, values[i].x);
27 assert_equals(values[i].input.y, values[i].y); 27 assert_equals(values[i].input.y, values[i].y);
28 assert_equals(values[i].input.z, values[i].z); 28 assert_equals(values[i].input.z, values[i].z);
29 } 29 }
30 }, "Test that the (x, y, z) values for CSSScale are correct."); 30 }, "Test that the (x, y, z) values for CSSScale are correct.");
31 31
32 test(function() { 32 test(function() {
33 for (var i = 0; i < values.length; ++i) { 33 for (var i = 0; i < values.length; ++i) {
34 assert_equals(values[i].input.is2DComponent(), values[i].is2DComponent); 34 assert_equals(values[i].input.is2D(), values[i].is2D);
35 } 35 }
36 }, "Test that the is2DComponent values for CSSScale is correct."); 36 }, "Test that the is2D values for CSSScale is correct.");
37 37
38 test(function() { 38 test(function() {
39 for (var i = 0; i < values.length; ++i) { 39 for (var i = 0; i < values.length; ++i) {
40 assert_equals(values[i].input.cssText, values[i].cssText); 40 assert_equals(values[i].input.cssText, values[i].cssText);
41 } 41 }
42 }, "Test that the cssText for CSSScale is correct."); 42 }, "Test that the cssText for CSSScale is correct.");
43 43
44 test(function() { 44 test(function() {
45 assert_throws(null, () => { new CSSScale(); }); 45 assert_throws(null, () => { new CSSScale(); });
46 assert_throws(null, () => { new CSSScale(1); }); 46 assert_throws(null, () => { new CSSScale(1); });
(...skipping 23 matching lines...) Expand all
70 assert_throws(null, () => { new CSSScale(0, "hello", "world"); }); 70 assert_throws(null, () => { new CSSScale(0, "hello", "world"); });
71 assert_throws(null, () => { new CSSScale(0, {}, {}); }); 71 assert_throws(null, () => { new CSSScale(0, {}, {}); });
72 assert_throws(null, () => { new CSSScale({}, {}, {}); }); 72 assert_throws(null, () => { new CSSScale({}, {}, {}); });
73 assert_throws(null, () => { new CSSScale(NaN, NaN, NaN); }); 73 assert_throws(null, () => { new CSSScale(NaN, NaN, NaN); });
74 }, "Test that invalid input throws an exception."); 74 }, "Test that invalid input throws an exception.");
75 75
76 test(function() { 76 test(function() {
77 for (var i = 0; i < values.length; ++i) { 77 for (var i = 0; i < values.length; ++i) {
78 var input = values[i].input; 78 var input = values[i].input;
79 var inputAsMatrix = input.asMatrix(); 79 var inputAsMatrix = input.asMatrix();
80 assert_equals(inputAsMatrix.is2DComponent(), input.is2DComponent()); 80 assert_equals(inputAsMatrix.is2D(), input.is2D());
81 81
82 var expectedMatrix = input.is2DComponent() ? new CSSMatrix(input.x, 0, 0, in put.y, 0, 0) : 82 var expectedMatrix = input.is2D() ? new CSSMatrix(input.x, 0, 0, input.y, 0, 0) :
83 new CSSMatrix(input.x, 0, 0, 0, 0, input.y, 0, 0, 0, 0, input.z, 0, 0, 0 , 0, 1); 83 new CSSMatrix(input.x, 0, 0, 0, 0, input.y, 0, 0, 0, 0, input.z, 0, 0, 0 , 0, 1);
84 for (var attribute in expectedMatrix) { 84 for (var attribute in expectedMatrix) {
85 if (typeof expectedMatrix[attribute] === "number") { 85 if (typeof expectedMatrix[attribute] === "number") {
86 assert_approx_equals(inputAsMatrix[attribute], expectedMatrix[attribute] , EPSILON); 86 assert_approx_equals(inputAsMatrix[attribute], expectedMatrix[attribute] , EPSILON);
87 } else { 87 } else {
88 assert_equals(inputAsMatrix[attribute], expectedMatrix[attribute]); 88 assert_equals(inputAsMatrix[attribute], expectedMatrix[attribute]);
89 } 89 }
90 } 90 }
91 } 91 }
92 }, "Test that asMatrix is constructed correctly for CSSScale."); 92 }, "Test that asMatrix is constructed correctly for CSSScale.");
93 93
94 </script> 94 </script>
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/typedcssom/cssRotation.html ('k') | third_party/WebKit/LayoutTests/typedcssom/cssSkew.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698