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

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

Issue 2018313003: Typed CSSOM: Rename Skew and SkewTransformComponent to CSSSkew (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | third_party/WebKit/LayoutTests/typedcssom/skewTransformComponent.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 Skew(0, 0), ax: 0, ay: 0, cssString: "skew(0, 0)"}, 8 {input: new CSSSkew(0, 0), ax: 0, ay: 0, cssString: "skew(0, 0)"},
9 {input: new Skew(1, 2), ax: 1, ay: 2, cssString: "skew(1, 2)"}, 9 {input: new CSSSkew(1, 2), ax: 1, ay: 2, cssString: "skew(1, 2)"},
10 {input: new Skew(-2, -4), ax: -2, ay: -4, cssString: "skew(-2, -4)"}, 10 {input: new CSSSkew(-2, -4), ax: -2, ay: -4, cssString: "skew(-2, -4)"},
11 {input: new Skew(3.4, 2.7), ax: 3.4, ay: 2.7, cssString: "skew(3.4, 2.7)"} 11 {input: new CSSSkew(3.4, 2.7), ax: 3.4, ay: 2.7, cssString: "skew(3.4, 2.7)"}
12 ]; 12 ];
13 13
14 test(function() { 14 test(function() {
15 for (var i = 0; i < values.length; ++i) { 15 for (var i = 0; i < values.length; ++i) {
16 assert_equals(values[i].input.ax, values[i].ax); 16 assert_equals(values[i].input.ax, values[i].ax);
17 assert_equals(values[i].input.ay, values[i].ay); 17 assert_equals(values[i].input.ay, values[i].ay);
18 } 18 }
19 }, "Test that the (ax, ay) values for Skew are correct."); 19 }, "Test that the (ax, ay) values for CSSSkew are correct.");
20 20
21 test(function() { 21 test(function() {
22 for (var i = 0; i < values.length; ++i) { 22 for (var i = 0; i < values.length; ++i) {
23 assert_true(values[i].input.is2DComponent()); 23 assert_true(values[i].input.is2DComponent());
24 } 24 }
25 }, "Test that the is2DComponent values for Skew is correct."); 25 }, "Test that the is2DComponent values for CSSSkew is correct.");
26 26
27 test(function() { 27 test(function() {
28 for (var i = 0; i < values.length; ++i) { 28 for (var i = 0; i < values.length; ++i) {
29 assert_equals(values[i].input.cssString, values[i].cssString); 29 assert_equals(values[i].input.cssString, values[i].cssString);
30 } 30 }
31 }, "Test that the cssString for Skew is correct."); 31 }, "Test that the cssString for CSSSkew is correct.");
32 32
33 test(function() { 33 test(function() {
34 assert_throws(null, function() { new Skew(); }); 34 assert_throws(null, function() { new CSSSkew(); });
35 assert_throws(null, function() { new Skew(1); }); 35 assert_throws(null, function() { new CSSSkew(1); });
36 }, "Test that invalid number of arguments for Skew throws an exception."); 36 }, "Test that invalid number of arguments for CSSSkew throws an exception.");
37 37
38 function tanDegrees(degrees) { 38 function tanDegrees(degrees) {
39 var radians = degrees * Math.PI / 180; 39 var radians = degrees * Math.PI / 180;
40 return Math.tan(radians); 40 return Math.tan(radians);
41 } 41 }
42 42
43 test(function() { 43 test(function() {
44 for (var i = 0; i < values.length; ++i) { 44 for (var i = 0; i < values.length; ++i) {
45 var input = values[i].input; 45 var input = values[i].input;
46 var inputAsMatrix = input.asMatrix(); 46 var inputAsMatrix = input.asMatrix();
47 assert_true(inputAsMatrix.is2DComponent()); 47 assert_true(inputAsMatrix.is2DComponent());
48 var tanAx = tanDegrees(input.ax); 48 var tanAx = tanDegrees(input.ax);
49 var tanAy = tanDegrees(input.ay); 49 var tanAy = tanDegrees(input.ay);
50 var expectedMatrix = new Matrix(1, tanAy, tanAx, 1, 0, 0); 50 var expectedMatrix = new Matrix(1, tanAy, tanAx, 1, 0, 0);
51 for (var attribute in expectedMatrix) { 51 for (var attribute in expectedMatrix) {
52 if (typeof expectedMatrix[attribute] === "number") { 52 if (typeof expectedMatrix[attribute] === "number") {
53 assert_approx_equals(inputAsMatrix[attribute], expectedMatrix[attribute] , EPSILON); 53 assert_approx_equals(inputAsMatrix[attribute], expectedMatrix[attribute] , EPSILON);
54 } else { 54 } else {
55 assert_equals(inputAsMatrix[attribute], expectedMatrix[attribute]); 55 assert_equals(inputAsMatrix[attribute], expectedMatrix[attribute]);
56 } 56 }
57 } 57 }
58 } 58 }
59 }, "Test that asMatrix is constructed correctly for Skew."); 59 }, "Test that asMatrix is constructed correctly for CSSSkew.");
60 60
61 </script> 61 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/typedcssom/skewTransformComponent.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698