Index: third_party/WebKit/LayoutTests/typedcssom/cssRotation.html |
diff --git a/third_party/WebKit/LayoutTests/typedcssom/cssRotation.html b/third_party/WebKit/LayoutTests/typedcssom/cssRotation.html |
index f1857ec5b65655376615a9f205d366bae5bbadb0..3baa2e73998ce9ed6f06fe984ad5b504c85da7a3 100644 |
--- a/third_party/WebKit/LayoutTests/typedcssom/cssRotation.html |
+++ b/third_party/WebKit/LayoutTests/typedcssom/cssRotation.html |
@@ -7,37 +7,38 @@ var EPSILON = 1e-6; // float epsilon |
function angle(deg) { |
return new CSSAngleValue(deg, 'deg'); |
} |
+ |
var values = [ |
{input: new CSSRotation(angle(0)), angle: 0, x: 0, y: 0, z: 1, |
is2D: true, cssText: "rotate(0deg)", |
- asMatrix: new CSSMatrixComponent(1, 0, 0, 1, 0, 0)}, |
+ asMatrix: new CSSMatrixComponent(new DOMMatrixReadOnly([1, 0, 0, 1, 0, 0]))}, |
{input: new CSSRotation(angle(10)), angle: 10, x: 0, y: 0, z: 1, |
is2D: true, cssText: "rotate(10deg)", |
- asMatrix: new CSSMatrixComponent(0.9848077, 0.1736481, -0.1736481, 0.9848077, 0, 0)}, |
+ asMatrix: new CSSMatrixComponent(new DOMMatrixReadOnly([0.9848077, 0.1736481, -0.1736481, 0.9848077, 0, 0]))}, |
{input: new CSSRotation(angle(-21)), angle: -21, x: 0, y: 0, z: 1, |
is2D: true, cssText: "rotate(-21deg)", |
- asMatrix: new CSSMatrixComponent(0.9335804, -0.3583679, 0.3583679, 0.9335804, 0, 0)}, |
+ asMatrix: new CSSMatrixComponent(new DOMMatrixReadOnly([0.9335804, -0.3583679, 0.3583679, 0.9335804, 0, 0]))}, |
{input: new CSSRotation(angle(3.2)), angle: 3.2, x: 0, y: 0, z: 1, |
is2D: true, cssText: "rotate(3.2deg)", |
- asMatrix: new CSSMatrixComponent(0.9984407, 0.0558215, -0.0558215, 0.9984407, 0, 0)}, |
+ asMatrix: new CSSMatrixComponent(new DOMMatrixReadOnly([0.9984407, 0.0558215, -0.0558215, 0.9984407, 0, 0]))}, |
{input: new CSSRotation(0, 0, 1, angle(90)), angle: 90, x: 0, y: 0, z: 1, |
is2D: false, cssText: "rotate3d(0, 0, 1, 90deg)", |
- asMatrix: new CSSMatrixComponent(0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)}, |
+ asMatrix: new CSSMatrixComponent(new DOMMatrixReadOnly([0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]))}, |
{input: new CSSRotation(2.7, -3, 4.4, angle(0)), angle: 0, x: 2.7, y: -3, z: 4.4, |
is2D: false, cssText: "rotate3d(2.7, -3, 4.4, 0deg)", |
- asMatrix: new CSSMatrixComponent(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)}, |
+ asMatrix: new CSSMatrixComponent(new DOMMatrixReadOnly([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]))}, |
{input: new CSSRotation(2, 3, 4, angle(10)), angle: 10, x: 2, y: 3, z: 4, |
is2D: false, cssText: "rotate3d(2, 3, 4, 10deg)", |
- asMatrix: new CSSMatrixComponent(0.9869032, 0.1321258, -0.0925460, 0, -0.1258394, |
- 0.9895225, 0.0707777, 0, 0.1009279, -0.0582048, 0.9931896, 0, 0, 0, 0, 1)}, |
+ asMatrix: new CSSMatrixComponent(new DOMMatrixReadOnly([0.9869032, 0.1321258, -0.0925460, 0, -0.1258394, |
+ 0.9895225, 0.0707777, 0, 0.1009279, -0.0582048, 0.9931896, 0, 0, 0, 0, 1]))}, |
{input: new CSSRotation(2, 3.7, -4, angle(-1.2)), angle: -1.2, x: 2, y: 3.7, z: -4, |
is2D: false, cssText: "rotate3d(2, 3.7, -4, -1.2deg)", |
- asMatrix: new CSSMatrixComponent(0.9998067, 0.01448049, 0.0132978, 0, -0.0143841, |
- 0.9998698, -0.0073125, 0, -0.0134019, 0.0071198, 0.9998848, 0, 0, 0, 0, 1)}, |
+ asMatrix: new CSSMatrixComponent(new DOMMatrixReadOnly([0.9998067, 0.01448049, 0.0132978, 0, -0.0143841, |
+ 0.9998698, -0.0073125, 0, -0.0134019, 0.0071198, 0.9998848, 0, 0, 0, 0, 1]))}, |
{input: new CSSRotation(1, 0, 0, new CSSAngleValue(0.5, 'turn')), angle: 180, x: 1, y: 0, z: 0, |
is2D: false, cssText: "rotate3d(1, 0, 0, 0.5turn)", |
- asMatrix: new CSSMatrixComponent(1, 0, 0, 0, 0, -1, 1.2246467991473532e-16, 0, 0, |
- -1.2246467991473532e-16, -1, 0, 0, 0, 0, 1)} |
+ asMatrix: new CSSMatrixComponent(new DOMMatrixReadOnly([1, 0, 0, 0, 0, -1, 1.2246467991473532e-16, 0, 0, |
+ -1.2246467991473532e-16, -1, 0, 0, 0, 0, 1]))} |
]; |
test(function() { |
@@ -68,8 +69,8 @@ test(function() { |
assert_equals(inputAsMatrix.is2D(), input.is2D()); |
var expectedMatrix = values[i].asMatrix; |
for (var attribute in expectedMatrix) { |
- if (typeof expectedMatrix[attribute] === "number") { |
- assert_approx_equals(inputAsMatrix[attribute], expectedMatrix[attribute], EPSILON); |
+ if (attribute == "matrix") { |
+ assert_matrix_approx_equals(inputAsMatrix[attribute], expectedMatrix[attribute]); |
} else if (attribute != "cssText") { |
// Due to the complex trigonometric calculations required for a CSSRotation matrix, |
// the 6 significant figures of each value in the cssText might be different. |
@@ -80,4 +81,14 @@ test(function() { |
} |
}, "Test that asMatrix is constructed correctly for CSSRotation."); |
+function assert_array_approx_equals(actual, expected) { |
+ for (var i = 0; i < actual.length; i++) { |
+ assert_approx_equals(actual[i], expected[i], EPSILON); |
+ } |
+} |
+ |
+function assert_matrix_approx_equals(actual, expected) { |
+ assert_array_approx_equals(actual.toFloat64Array(), expected.toFloat64Array()); |
+} |
+ |
</script> |