Index: third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-setMatrixValue.html |
diff --git a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-setMatrixValue.html b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-setMatrixValue.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..63164ddf908d9b65ffc2e9fcb4643af5f0ee1035 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-setMatrixValue.html |
@@ -0,0 +1,140 @@ |
+<!DOCTYPE HTML> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script src="./resources/geometry-interfaces-test-helpers.js"></script> |
+<script> |
+ |
+test(function() { |
+ var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
meade_UTC10
2016/10/13 04:18:50
This seems suspicious - from reading your CL descr
Hwanseung Lee
2016/10/13 17:05:10
Done.
|
+ matrix2d.setMatrixValue(""); |
+ assert_true(matrix2d.is2D); |
+ assert_array_almost_equals(matrix2d.toFloat64Array(), expectedMatrix.toFloat64Array()); |
+}, "DOMMatrix setMatrix(EmptyString)"); |
+ |
+test(function() { |
+ var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ matrix2d.setMatrixValue("matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0)"); |
+ assert_true(matrix2d.is2D); |
+ expectedMatrix.multiplySelf(new DOMMatrix([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])) |
+ assert_array_almost_equals(matrix2d.toFloat64Array(), expectedMatrix.toFloat64Array()); |
+}, "DOMMatrix setMatrix('matrix2d')"); |
+ |
+test(function() { |
+ var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ matrix2d.setMatrixValue("translate(44px, 55px)"); |
+ assert_true(matrix2d.is2D); |
+ expectedMatrix.translateSelf(44, 55) |
+ assert_array_almost_equals(matrix2d.toFloat64Array(), expectedMatrix.toFloat64Array()); |
+}, "DOMMatrix setMatrix('translate')"); |
+ |
+test(function() { |
+ var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ matrix2d.setMatrixValue("translateX(35px)"); |
+ assert_true(matrix2d.is2D); |
+ expectedMatrix.translateSelf(35, 0) |
+ assert_array_almost_equals(matrix2d.toFloat64Array(), expectedMatrix.toFloat64Array()); |
+}, "DOMMatrix setMatrix('translateX')"); |
+ |
+test(function() { |
+ var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ matrix2d.setMatrixValue("translateY(77px)"); |
+ assert_true(matrix2d.is2D); |
+ expectedMatrix.translateSelf(0, 77) |
+ assert_array_almost_equals(matrix2d.toFloat64Array(), expectedMatrix.toFloat64Array()); |
+}, "DOMMatrix setMatrix('translateY')"); |
+ |
+// TODO(hs1217.lee) : should be add test about scale function. |
+// parameter of DOMMatrix scale function is not matched with parameter of CSS Transform scale function. |
+// it was reported at crbug(https://bugs.chromium.org/p/chromium/issues/detail?id=645887) |
+ |
+// TODO(hs1217.lee) : should be remove annotation. |
+// rotateAxisAngleSelf method is not implementation not yet. |
+// test(function() { |
+// var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+// var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+// matrix2d.setMatrixValue("rotate(90deg)"); |
+// assert_true(matrix2d.is2D); |
+// expectedMatrix.rotateAxisAngleSelf(0, 0, 1, 90); |
+// assert_array_almost_equals(matrix2d.toFloat64Array(), expectedMatrix.toFloat64Array()); |
+// }, "DOMMatrix setMatrix('rotate')"); |
+ |
+test(function() { |
+ var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ matrix2d.setMatrixValue("skewX(30deg)"); |
+ assert_true(matrix2d.is2D); |
+ expectedMatrix.skewXSelf(30); |
+ assert_array_almost_equals(matrix2d.toFloat64Array(), expectedMatrix.toFloat64Array()); |
+}, "DOMMatrix setMatrix('skewX')"); |
+ |
+test(function() { |
+ var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ matrix2d.setMatrixValue("skewY(40deg)"); |
+ assert_true(matrix2d.is2D); |
+ expectedMatrix.skewYSelf(40); |
+ assert_array_almost_equals(matrix2d.toFloat64Array(), expectedMatrix.toFloat64Array()); |
+}, "DOMMatrix setMatrix('skewY')"); |
+ |
+test(function() { |
+ var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ matrix2d.setMatrixValue("matrix3d(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0)"); |
+ assert_false(matrix2d.is2D); |
+ expectedMatrix.multiplySelf(new DOMMatrix([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0])) |
+ assert_array_almost_equals(matrix2d.toFloat64Array(), expectedMatrix.toFloat64Array()); |
+}, "DOMMatrix setMatrix(matrix3d)"); |
+ |
+test(function() { |
+ var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ matrix2d.setMatrixValue("translate3d(10px, 20px, 30px)"); |
+ assert_false(matrix2d.is2D); |
+ expectedMatrix.translateSelf(10, 20, 30) |
+ assert_array_almost_equals(matrix2d.toFloat64Array(), expectedMatrix.toFloat64Array()); |
+}, "DOMMatrix setMatrix(translate3d)"); |
+ |
+test(function() { |
+ var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ matrix2d.setMatrixValue("translateZ(88px)"); |
+ assert_false(matrix2d.is2D); |
+ expectedMatrix.translateSelf(0, 0, 88) |
+ assert_array_almost_equals(matrix2d.toFloat64Array(), expectedMatrix.toFloat64Array()); |
+}, "DOMMatrix setMatrix('translateY')"); |
+ |
+test(function() { |
+ var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ matrix2d.setMatrixValue("matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0) translate(44px, 55px) skewX(30deg)"); |
+ assert_true(matrix2d.is2D); |
+ expectedMatrix.multiplySelf(new DOMMatrix([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])) |
+ expectedMatrix.translateSelf(44, 55) |
+ expectedMatrix.skewXSelf(30); |
+ assert_array_almost_equals(matrix2d.toFloat64Array(), expectedMatrix.toFloat64Array()); |
+}, "DOMMatrix setMatrix(multiple value)"); |
+ |
+test(() => { |
+ assert_throws(new SyntaxError(), () => { |
+ var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ matrix2d.setMatrixValue("none"); |
+ }, "can't parsing none."); |
+ |
+ assert_throws(new SyntaxError(), () => { |
+ var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ matrix2d.setMatrixValue("notExistFunction()"); |
+ }, "can't parsing not exist function keyword."); |
+ |
+ assert_throws(new SyntaxError(), () => { |
+ var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ matrix2d.setMatrixValue("translateY(50%)"); |
+ }, "can't parsing without absolute unit."); |
+ |
+}, "DOMMatrix.setMatrix(): Exception test."); |
+ |
+</script> |