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

Unified Diff: third_party/WebKit/LayoutTests/typedcssom/scaleTransformComponent.html

Issue 1648853002: Typed CSS OM: implement TransformComponent::asMatrix (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@asMatrixTransformMethod
Patch Set: Use TransformationMatrix::create Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/typedcssom/scaleTransformComponent.html
diff --git a/third_party/WebKit/LayoutTests/typedcssom/scaleTransformComponent.html b/third_party/WebKit/LayoutTests/typedcssom/scaleTransformComponent.html
index aa76be067e5713cfa5f20d0aa3db3167ff32c0e0..29e332354b461e898dc9e6b222079fb8f7a400dd 100644
--- a/third_party/WebKit/LayoutTests/typedcssom/scaleTransformComponent.html
+++ b/third_party/WebKit/LayoutTests/typedcssom/scaleTransformComponent.html
@@ -3,6 +3,7 @@
<script src="../resources/testharnessreport.js"></script>
<script>
+var EPSILON = 1e-6; // float epsilon
var values = [
{input: new Scale(0, 0), x: 0, y: 0, z: 1, is2DComponent: true,
cssString: "scale(0, 0)"},
@@ -72,7 +73,22 @@ test(function() {
assert_throws(null, () => { new Scale(NaN, NaN, NaN); });
}, "Test that invalid input throws an exception.");
-</script>
+test(function() {
+ for (var i = 0; i < values.length; ++i) {
+ var input = values[i].input;
+ var inputAsMatrix = input.asMatrix();
+ assert_equals(inputAsMatrix.is2DComponent(), input.is2DComponent());
-<body>
-</body>
+ var expectedMatrix = input.is2DComponent() ? new Matrix(input.x, 0, 0, input.y, 0, 0) :
+ new Matrix(input.x, 0, 0, 0, 0, input.y, 0, 0, 0, 0, input.z, 0, 0, 0, 0, 1);
+ for (var attribute in expectedMatrix) {
+ if (typeof expectedMatrix[attribute] === "number") {
+ assert_approx_equals(inputAsMatrix[attribute], expectedMatrix[attribute], EPSILON);
+ } else {
+ assert_equals(inputAsMatrix[attribute], expectedMatrix[attribute]);
+ }
+ }
+ }
+}, "Test that asMatrix is constructed correctly for Scale.");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698