Index: third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix.html |
diff --git a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix.html b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix.html |
index ee37c502e139f7c5ff40109b24d97a618d258e47..998c3daa58a1dfba068d886cfb2e3a135fc72a91 100644 |
--- a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix.html |
+++ b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix.html |
@@ -35,6 +35,20 @@ test(() => { |
}, "DOMMatrix fromFloat64Array - 3D matrix"); |
test(() => { |
+ var matrix = new DOMMatrix(""); |
+ assert_identity_2d_matrix(matrix); |
+}, "DOMMatrix(transformList) - emptyString"); |
+ |
+test(() => { |
+ var matrix = new DOMMatrix("matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0) translate(44px, 55px) skewX(30deg)"); |
+ var expectedMatrix = new DOMMatrix(); |
+ expectedMatrix.multiplySelf(new DOMMatrix([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])) |
+ expectedMatrix.translateSelf(44, 55) |
+ expectedMatrix.skewXSelf(30); |
+ assert_matrix_almost_equals(matrix, expectedMatrix); |
+}, "DOMMatrix(transformList) - transformList"); |
+ |
+test(() => { |
var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
assert_2d_matrix_equals(matrix, [1, 2, 3, 4, 5, 6]); |
}, "DOMMatrix(numberSequence) constructor"); |
@@ -67,75 +81,75 @@ test(() => { |
matrix.m33 = 1; |
assert_false(matrix.is2D); |
assert_true(matrix.isIdentity); |
-}, "DOMMatrix.is2D can never be set to 'true' when it was set to 'false' before calling setMatrixValue()."); |
+}, "DOMMatrix.is2D can never be set to 'true' when it was set to 'false' before calling setMatrixValue()"); |
test(() => { |
assert_throws(new TypeError(), () => { DOMMatrix.fromFloat32Array(new Float32Array([1, 2, 3, 4, 5])); }, |
- "fromFloat32Array function only accepts 1 Float32Array with 6 or 16 elements."); |
+ "fromFloat32Array function only accepts 1 Float32Array with 6 or 16 elements"); |
assert_throws(new TypeError(), () => { DOMMatrix.fromFloat64Array(new Float64Array([1, 2, 3, 4, 5])); }, |
- "fromFloat64Array function only accepts 1 Float64Array with 6 or 16 elements."); |
+ "fromFloat64Array function only accepts 1 Float64Array with 6 or 16 elements"); |
assert_throws(new TypeError(), () => { DOMMatrix.fromFloat32Array(new Float32Array([1, 2, 3, 4, 5, 6 ,7])); }, |
- "fromFloat32Array function only accepts 1 Float32Array with 6 or 16 elements."); |
+ "fromFloat32Array function only accepts 1 Float32Array with 6 or 16 elements"); |
assert_throws(new TypeError(), () => { DOMMatrix.fromFloat64Array(new Float64Array([1, 2, 3, 4, 5, 6 ,7])); }, |
- "fromFloat64Array function only accepts 1 Float64Array with 6 or 16 elements."); |
+ "fromFloat64Array function only accepts 1 Float64Array with 6 or 16 elements"); |
}, "DOMMatrix fromFloat*Array - invalid array size of nearby 6"); |
test(() => { |
assert_throws(new TypeError(), () => { DOMMatrix.fromFloat32Array(new Float32Array([1, 2, 3, 4, 5, 6 ,7, 8, 9, 10, 11, 12, 13, 14, 15])); }, |
- "fromFloat32Array function only accepts 1 Float32Array with 6 or 16 elements."); |
+ "fromFloat32Array function only accepts 1 Float32Array with 6 or 16 elements"); |
assert_throws(new TypeError(), () => { DOMMatrix.fromFloat64Array(new Float64Array([1, 2, 3, 4, 5, 6 ,7, 8, 9, 10, 11, 12, 13, 14, 15])); }, |
- "fromFloat64Array function only accepts 1 Float64Array with 6 or 16 elements."); |
+ "fromFloat64Array function only accepts 1 Float64Array with 6 or 16 elements"); |
assert_throws(new TypeError(), () => { DOMMatrix.fromFloat32Array(new Float32Array([1, 2, 3, 4, 5, 6 ,7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17])); }, |
- "fromFloat32Array function only accepts 1 Float32Array with 6 or 16 elements."); |
+ "fromFloat32Array function only accepts 1 Float32Array with 6 or 16 elements"); |
assert_throws(new TypeError(), () => { DOMMatrix.fromFloat64Array(new Float64Array([1, 2, 3, 4, 5, 6 ,7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17])); }, |
- "fromFloat64Array function only accepts 1 Float64Array with 6 or 16 elements."); |
+ "fromFloat64Array function only accepts 1 Float64Array with 6 or 16 elements"); |
}, "DOMMatrix fromFloat*Array - invalid array size of nearby 16"); |
test(() => { |
assert_throws(new TypeError(), () => { DOMMatrix.fromFloat32Array(new Float32Array([])); }, |
- "fromFloat32Array function only accepts 1 Float32Array with 6 or 16 elements."); |
+ "fromFloat32Array function only accepts 1 Float32Array with 6 or 16 elements"); |
assert_throws(new TypeError(), () => { DOMMatrix.fromFloat64Array(new Float64Array([])); }, |
- "fromFloat64Array function only accepts 1 Float64Array with 6 or 16 elements."); |
+ "fromFloat64Array function only accepts 1 Float64Array with 6 or 16 elements"); |
assert_throws(new TypeError(), () => { DOMMatrix.fromFloat32Array(new Float32Array([1])); }, |
- "fromFloat32Array function only accepts 1 Float32Array with 6 or 16 elements."); |
+ "fromFloat32Array function only accepts 1 Float32Array with 6 or 16 elements"); |
assert_throws(new TypeError(), () => { DOMMatrix.fromFloat64Array(new Float64Array([1])); }, |
- "fromFloat64Array function only accepts 1 Float64Array with 6 or 16 elements."); |
+ "fromFloat64Array function only accepts 1 Float64Array with 6 or 16 elements"); |
assert_throws(new TypeError(), () => { DOMMatrix.fromFloat32Array(new Float32Array(65536)); }, |
- "fromFloat32Array function only accepts 1 Float32Array with 6 or 16 elements."); |
+ "fromFloat32Array function only accepts 1 Float32Array with 6 or 16 elements"); |
assert_throws(new TypeError(), () => { DOMMatrix.fromFloat64Array(new Float64Array(65536)); }, |
- "fromFloat64Array function only accepts 1 Float64Array with 6 or 16 elements."); |
+ "fromFloat64Array function only accepts 1 Float64Array with 6 or 16 elements"); |
}, "DOMMatrix fromFloat*Array - invalid array size"); |
test(() => { |
assert_identity_2d_matrix(DOMMatrix.fromMatrix()); |
-}, "DOMMatrix.fromMatrix() with no parameter."); |
+}, "DOMMatrix.fromMatrix() with no parameter"); |
test(() => { |
assert_identity_2d_matrix(DOMMatrix.fromMatrix(null)); |
-}, "DOMMatrix.fromMatrix() with null."); |
+}, "DOMMatrix.fromMatrix() with null"); |
test(() => { |
assert_identity_2d_matrix(DOMMatrix.fromMatrix(undefined)); |
-}, "DOMMatrix.fromMatrix() with undefined."); |
+}, "DOMMatrix.fromMatrix() with undefined"); |
test(() => { |
assert_identity_2d_matrix(DOMMatrix.fromMatrix({})); |
-}, "DOMMatrix.fromMatrix() with empty object."); |
+}, "DOMMatrix.fromMatrix() with empty object"); |
test(() => { |
var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, c: 3, d: 4, e: 5, f: 6}); |
assert_2d_matrix_equals(matrix, [1, 2, 3, 4, 5, 6]); |
-}, "DOMMatrix.fromMatrix({a: 1, b: 2, c: 3, d: 4, e: 5, f: 6}) should create a 2D DOMMatrix."); |
+}, "DOMMatrix.fromMatrix({a: 1, b: 2, c: 3, d: 4, e: 5, f: 6}) should create a 2D DOMMatrix"); |
test(() => { |
var matrix = DOMMatrix.fromMatrix({m11: 1, m22: 2, m33: 3, m44: 4, m23: 5, m43: 6}); |
assert_3d_matrix_equals(matrix, [1, 0, 0, 0, 0, 2, 5, 0, 0, 0, 3, 0, 0, 0, 6, 4]); |
-}, "DOMMatrix.fromMatrix({m11: 1, m22: 2, m33: 3, m44: 4, m23: 5, m43: 6}) should create a 3D DOMMatrix."); |
+}, "DOMMatrix.fromMatrix({m11: 1, m22: 2, m33: 3, m44: 4, m23: 5, m43: 6}) should create a 3D DOMMatrix"); |
test(() => { |
var matrix = DOMMatrix.fromMatrix({a: 7, c: 9}); |
assert_2d_matrix_equals(matrix, [7, 0, 9, 1, 0, 0]); |
-}, "If 2d related properties don't be set, should set to fallback."); |
+}, "If 2d related properties don't be set, should set to fallback"); |
test(() => { |
var matrix = DOMMatrix.fromMatrix({ |
@@ -185,11 +199,40 @@ test(() => { |
}, "DOMMatrix toJSON() - 3D matrix"); |
test(() => { |
+ assert_throws(new SyntaxError(), () => { new DOMMatrix(1, 2, 3, 4, 5, 6); }, |
+ "DOMMatrix(transformList) can't parse unknown keyword - DOMMatrixReadOnly(1, 2, 3, 4, 5, 6) is same with DOMMatrixReadOnly('1')"); |
+ assert_throws(new SyntaxError(), () => { new DOMMatrix("myString"); }, |
+ "DOMMatrix(transformList) can't parse unknown keyword"); |
+ assert_throws(new SyntaxError(), () => { new DOMMatrix("initial");}, |
+ "CSS-wide keywords are disallowed"); |
+ assert_throws(new SyntaxError(), () => { new DOMMatrix("notExistFunction()"); }, |
+ "can't parse not exist function"); |
+ assert_throws(new SyntaxError(), () => { new DOMMatrix("translateY(50%)"); }, |
+ "using relative units should throw a SyntaxError"); |
+ assert_throws(new SyntaxError(), () => { new DOMMatrix("translateX(1.2em)"); }, |
+ "using relative units should throw a SyntaxError"); |
+ assert_throws(new SyntaxError(), () => { new DOMMatrix("translateX(10ex)"); }, |
+ "using relative units should throw a SyntaxError"); |
+ assert_throws(new SyntaxError(), () => { new DOMMatrix("translateX(10ch)"); }, |
+ "using relative units should throw a SyntaxError"); |
+ assert_throws(new SyntaxError(), () => { new DOMMatrix("translateX(10rem)"); }, |
+ "using relative units should throw a SyntaxError"); |
+ assert_throws(new SyntaxError(), () => { new DOMMatrix("translateX(10vw)"); }, |
+ "using relative units should throw a SyntaxError"); |
+ assert_throws(new SyntaxError(), () => { new DOMMatrix("translateX(10vh)"); }, |
+ "using relative units should throw a SyntaxError"); |
+ assert_throws(new SyntaxError(), () => { new DOMMatrix("translateX(10vmin)"); }, |
+ "using relative units should throw a SyntaxError"); |
+ assert_throws(new SyntaxError(), () => { new DOMMatrix("translateX(10vmax)"); }, |
+ "using relative units should throw a SyntaxError"); |
+ assert_throws(new SyntaxError(), () => { new DOMMatrix("translateX(calc(10px + 1em))"); }, |
+ "using relative units should throw a SyntaxError"); |
assert_throws(new TypeError(), () => { |
var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m33: 3, m44: 4, is2D: true}); |
- }, "The 'is2D' property is set to true but the input matrix is 3d matrix."); |
+ }, "The 'is2D' property is set to true but the input matrix is 3d matrix"); |
assert_throws(new TypeError(), () => { |
var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m11: 3}); |
- }, "The 'a' property should equal the 'm11' property."); |
-}, "DOMMatrix.fromMatrix(): Exception test."); |
+ }, "The 'a' property should equal the 'm11' property"); |
+}, "DOMMatrix.fromMatrix(): Exception test"); |
+ |
</script> |