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

Unified Diff: LayoutTests/fast/dom/geometry-interfaces-dom-matrix-scale.html

Issue 450533006: Implement scale*() methods in DOMMatrix. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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: LayoutTests/fast/dom/geometry-interfaces-dom-matrix-scale.html
diff --git a/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-scale.html b/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-scale.html
new file mode 100644
index 0000000000000000000000000000000000000000..6b014fcedab9775bb5ba7397f89abff5fab950ef
--- /dev/null
+++ b/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-scale.html
@@ -0,0 +1,186 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Geometry Interfaces: DOMMatrix scale</title>
+<script src="../../resources/js-test.js"></script>
krit 2014/08/08 05:47:33 Could you instead use resources/testharness.js? Th
zino 2014/08/17 11:35:25 Done.
+</head>
+<body>
+<script>
+
+function compareMatrix(matrixObject, matrixValue)
+{
+ return matrixObject.m11 == matrixValue[0] &&
+ matrixObject.m21 == matrixValue[1] &&
+ matrixObject.m31 == matrixValue[2] &&
+ matrixObject.m41 == matrixValue[3] &&
+ matrixObject.m12 == matrixValue[4] &&
+ matrixObject.m22 == matrixValue[5] &&
+ matrixObject.m32 == matrixValue[6] &&
+ matrixObject.m42 == matrixValue[7] &&
+ matrixObject.m13 == matrixValue[8] &&
+ matrixObject.m23 == matrixValue[9] &&
+ matrixObject.m33 == matrixValue[10] &&
+ matrixObject.m43 == matrixValue[11] &&
+ matrixObject.m14 == matrixValue[12] &&
+ matrixObject.m24 == matrixValue[13] &&
+ matrixObject.m34 == matrixValue[14] &&
+ matrixObject.m44 == matrixValue[15];
+}
+
+debug("# DOMMatrix.scale(scale)");
+var matrix = new DOMMatrix();
+shouldBeTrue("matrix.is2D");
+shouldBeTrue("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+var result = matrix.scale(3);
+shouldBeTrue("result.is2D");
+shouldBeFalse("result.isIdentity");
+shouldBeTrue("compareMatrix(result, [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+shouldBeTrue("matrix.is2D");
+shouldBeTrue("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+debug("");
+
+debug("# DOMMatrix.scale(scale, ox, oy)");
+matrix = new DOMMatrix();
+shouldBeTrue("matrix.is2D");
+shouldBeTrue("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+result = matrix.scale(3, 4, 2);
+shouldBeTrue("result.is2D");
+shouldBeFalse("result.isIdentity");
+shouldBeTrue("compareMatrix(result, [ 3, 0, 0, -8, 0, 3, 0, -4, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+shouldBeTrue("matrix.is2D");
+shouldBeTrue("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+debug("");
+
+debug("# DOMMatrix.scale3d(scale)");
+matrix = new DOMMatrix();
+shouldBeTrue("matrix.is2D");
+shouldBeTrue("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+result = matrix.scale3d(3);
+shouldBeFalse("result.is2D");
+shouldBeFalse("result.isIdentity");
+shouldBeTrue("compareMatrix(result, [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 ])");
+shouldBeTrue("matrix.is2D");
+shouldBeTrue("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+debug("");
+
+debug("# DOMMatrix.scale3d(scale, ox, oy, oz)");
+matrix = new DOMMatrix();
+shouldBeTrue("matrix.is2D");
+shouldBeTrue("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+result = matrix.scale3d(3, 2, 7, -1);
+shouldBeFalse("result.is2D");
+shouldBeFalse("result.isIdentity");
+shouldBeTrue("compareMatrix(result, [ 3, 0, 0, -4, 0, 3, 0, -14, 0, 0, 3, 2, 0, 0, 0, 1 ])");
+shouldBeTrue("matrix.is2D");
+shouldBeTrue("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+debug("");
+
+debug("# DOMMatrix.scaleNonUniform(sx, sy, sz, ox, oy, oz)");
+matrix = new DOMMatrix();
+shouldBeTrue("matrix.is2D");
+shouldBeTrue("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+result = matrix.scaleNonUniform(2, 3, 0.5, 2, -4, -1);
+shouldBeFalse("result.is2D");
+shouldBeFalse("result.isIdentity");
+shouldBeTrue("compareMatrix(result, [ 2, 0, 0, -2, 0, 3, 0, 8, 0, 0, 0.5, -0.5, 0, 0, 0, 1 ])");
+shouldBeTrue("matrix.is2D");
+shouldBeTrue("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+debug("");
+
+debug("# DOMMatrix.scaleSelf(scale)");
+var matrix = new DOMMatrix();
+shouldBeTrue("matrix.is2D");
+shouldBeTrue("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+var result = matrix.scaleSelf(3);
+shouldBeTrue("result.is2D");
+shouldBeFalse("result.isIdentity");
+shouldBeTrue("compareMatrix(result, [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+shouldBeTrue("matrix.is2D");
+shouldBeFalse("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+debug("");
+
+debug("# DOMMatrix.scaleSelf(scaleSelf, ox, oy)");
+matrix = new DOMMatrix();
+shouldBeTrue("matrix.is2D");
+shouldBeTrue("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+result = matrix.scaleSelf(3, 4, 2);
+shouldBeTrue("result.is2D");
+shouldBeFalse("result.isIdentity");
+shouldBeTrue("compareMatrix(result, [ 3, 0, 0, -8, 0, 3, 0, -4, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+shouldBeTrue("matrix.is2D");
+shouldBeFalse("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 3, 0, 0, -8, 0, 3, 0, -4, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+debug("");
+
+debug("# DOMMatrix.scale3dSelf(scale)");
+matrix = new DOMMatrix();
+shouldBeTrue("matrix.is2D");
+shouldBeTrue("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+result = matrix.scale3dSelf(3);
+shouldBeFalse("result.is2D");
+shouldBeFalse("result.isIdentity");
+shouldBeTrue("compareMatrix(result, [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 ])");
+shouldBeFalse("matrix.is2D");
+shouldBeFalse("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 ])");
+debug("");
+
+debug("# DOMMatrix.scale3dSelf(scale, ox, oy, oz)");
+matrix = new DOMMatrix();
+shouldBeTrue("matrix.is2D");
+shouldBeTrue("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+result = matrix.scale3dSelf(3, 2, 7, -1);
+shouldBeFalse("result.is2D");
+shouldBeFalse("result.isIdentity");
+shouldBeTrue("compareMatrix(result, [ 3, 0, 0, -4, 0, 3, 0, -14, 0, 0, 3, 2, 0, 0, 0, 1 ])");
+shouldBeFalse("matrix.is2D");
+shouldBeFalse("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 3, 0, 0, -4, 0, 3, 0, -14, 0, 0, 3, 2, 0, 0, 0, 1 ])");
+debug("");
+
+debug("# DOMMatrix.scaleNonUniformSelf(sx, sy, sz, ox, oy, oz)");
+matrix = new DOMMatrix();
+shouldBeTrue("matrix.is2D");
+shouldBeTrue("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+result = matrix.scaleNonUniformSelf(2, 3, 0.5, 2, -4, -1);
+shouldBeFalse("result.is2D");
+shouldBeFalse("result.isIdentity");
+shouldBeTrue("compareMatrix(result, [ 2, 0, 0, -2, 0, 3, 0, 8, 0, 0, 0.5, -0.5, 0, 0, 0, 1 ])");
+shouldBeFalse("matrix.is2D");
+shouldBeFalse("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 2, 0, 0, -2, 0, 3, 0, 8, 0, 0, 0.5, -0.5, 0, 0, 0, 1 ])");
+debug("");
+
+debug("# DOMMatrix.scaleNonUniformSelf(1, 1, 1, ox, oy, oz)");
+matrix = new DOMMatrix();
+shouldBeTrue("matrix.is2D");
+shouldBeTrue("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+result = matrix.scaleNonUniformSelf(1, 1, 1, 2, -4, -1);
+shouldBeFalse("result.is2D");
+shouldBeTrue("result.isIdentity");
+shouldBeTrue("compareMatrix(result, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+shouldBeFalse("matrix.is2D");
+shouldBeTrue("matrix.isIdentity");
+shouldBeTrue("compareMatrix(matrix, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ])");
+debug("");
+
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/geometry-interfaces-dom-matrix-scale-expected.txt » ('j') | Source/core/dom/DOMMatrix.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698