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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-readonly.html

Issue 2516973002: [GeometryInferface] add Constructor(DOMString transformList). (Closed)
Patch Set: [GeometryInferface] add Constructor(DOMString transformList). Created 4 years 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/fast/dom/geometry-interfaces-dom-matrix-readonly.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-readonly.html b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-readonly.html
index 49f861b47afe345396103c7c160ee9bb66abb561..72c1c8fb4ac58d9478838dd64638fb56790436f2 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-readonly.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-readonly.html
@@ -46,6 +46,20 @@ test(() => {
}, "DOMMatrixReadOnly fromFloat64Array - 3D matrix");
test(() => {
+ var matrix = new DOMMatrixReadOnly("");
+ assert_identity_2d_matrix(matrix);
+}, "DOMMatrixReadOnly(transformList) - emptyString");
+
+test(() => {
+ var matrix = new DOMMatrixReadOnly("matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0) translate(44px, 55px) skewX(30deg)");
+ var expectedMatrix = new DOMMatrixReadOnly();
+ expectedMatrix = expectedMatrix.multiply(new DOMMatrixReadOnly([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]))
+ expectedMatrix = expectedMatrix.translate(44, 55)
+ expectedMatrix = expectedMatrix.skewX(30);
+ assert_matrix_almost_equals(matrix, expectedMatrix);
+}, "DOMMatrixReadOnly(transformList) - transformList");
+
+test(() => {
var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 3.1, 2, 1]);
assert_true(matrix2d.is2D);
assert_equals(matrix2d.toString(), "matrix(1, 2, 3, 3.1, 2, 1)");
@@ -94,85 +108,109 @@ test(() => {
}, "DOMMatrixReadOnly toJSON() - 3D matrix");
test(() => {
- assert_throws(new TypeError(), () => { new DOMMatrixReadOnly(1, 2, 3, 4, 5, 6); },
- "DOMMatrixReadOnly constructor only accepts 1 argument");
- assert_throws(new TypeError(), () => { new DOMMatrixReadOnly("myString"); },
- "DOMMatrixReadOnly constructor only accepts 1 number sequence");
+ assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly(1, 2, 3, 4, 5, 6); },
+ "DOMMatrixReadOnly(transformList) can't parse unknown keyword - DOMMatrixReadOnly(1, 2, 3, 4, 5, 6) is same with DOMMatrixReadOnly('1')");
+ assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("myString"); },
+ "DOMMatrixReadOnly(transformList) can't parse unknown keyword");
+ assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("initial");},
+ "CSS-wide keywords are disallowed");
+ assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("notExistFunction()"); },
+ "can't parse not exist function");
+ assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateY(50%)"); },
+ "using relative units should throw a SyntaxError");
+ assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateX(1.2em)"); },
+ "using relative units should throw a SyntaxError");
+ assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateX(10ex)"); },
+ "using relative units should throw a SyntaxError");
+ assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateX(10ch)"); },
+ "using relative units should throw a SyntaxError");
+ assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateX(10rem)"); },
+ "using relative units should throw a SyntaxError");
+ assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateX(10vw)"); },
+ "using relative units should throw a SyntaxError");
+ assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateX(10vh)"); },
+ "using relative units should throw a SyntaxError");
+ assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateX(10vmin)"); },
+ "using relative units should throw a SyntaxError");
+ assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateX(10vmax)"); },
+ "using relative units should throw a SyntaxError");
+ assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateX(calc(10px + 1em))"); },
+ "using relative units should throw a SyntaxError");
assert_throws(new TypeError(), () => { new DOMMatrixReadOnly([1, 2, 3]); },
- "DOMMatrixReadOnly constructor only accepts 1 number sequence with 6 or 16 elements.");
+ "DOMMatrixReadOnly constructor only accepts 1 number sequence with 6 or 16 elements");
}, "DOMMatrixReadOnly constructor - invalid arguments");
test(() => {
assert_throws(new TypeError(), () => { DOMMatrixReadOnly.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(), () => { DOMMatrixReadOnly.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(), () => { DOMMatrixReadOnly.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(), () => { DOMMatrixReadOnly.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");
}, "DOMMatrixReadOnly fromFloat*Array - invalid array size of nearby 6");
test(() => {
assert_throws(new TypeError(), () => { DOMMatrixReadOnly.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(), () => { DOMMatrixReadOnly.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(), () => { DOMMatrixReadOnly.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(), () => { DOMMatrixReadOnly.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");
}, "DOMMatrixReadOnly fromFloat*Array - invalid array size of nearby 16");
test(() => {
assert_throws(new TypeError(), () => { DOMMatrixReadOnly.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(), () => { DOMMatrixReadOnly.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(), () => { DOMMatrixReadOnly.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(), () => { DOMMatrixReadOnly.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(), () => { DOMMatrixReadOnly.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(), () => { DOMMatrixReadOnly.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");
}, "DOMMatrixReadOnly fromFloat*Array - invalid array size");
test(() => {
var matrix = DOMMatrixReadOnly.fromMatrix();
assert_identity_2d_matrix(matrix);
-}, "DOMMatrixReadOnly.fromMatrix() with no parameter.");
+}, "DOMMatrixReadOnly.fromMatrix() with no parameter");
test(() => {
var matrix = DOMMatrixReadOnly.fromMatrix(null);
assert_identity_2d_matrix(matrix);
-}, "DOMMatrixReadOnly.fromMatrix() with null.");
+}, "DOMMatrixReadOnly.fromMatrix() with null");
test(() => {
var matrix = DOMMatrixReadOnly.fromMatrix(undefined);
assert_identity_2d_matrix(matrix);
-}, "DOMMatrixReadOnly.fromMatrix() with undefined.");
+}, "DOMMatrixReadOnly.fromMatrix() with undefined");
test(() => {
var matrix = DOMMatrixReadOnly.fromMatrix({});
assert_identity_2d_matrix(matrix);
-}, "DOMMatrixReadOnly.fromMatrix() with empty object.");
+}, "DOMMatrixReadOnly.fromMatrix() with empty object");
test(() => {
var matrix = DOMMatrixReadOnly.fromMatrix({a: 1, b: 2, c: 3, d: 4, e: 5, f: 6});
assert_2d_matrix_equals(matrix, [1, 2, 3, 4, 5, 6]);
-}, "DOMMatrixReadOnly.fromMatrix({a: 1, b: 2, c: 3, d: 4, e: 5, f: 6}) should create a 2D DOMMatrixReadOnly.");
+}, "DOMMatrixReadOnly.fromMatrix({a: 1, b: 2, c: 3, d: 4, e: 5, f: 6}) should create a 2D DOMMatrixReadOnly");
test(() => {
var matrix = DOMMatrixReadOnly.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]);
-}, "DOMMatrixReadOnly.fromMatrix({m11: 1, m22: 2, m33: 3, m44: 4, m23: 5, m43: 6}) should create a 3D DOMMatrixReadOnly.");
+}, "DOMMatrixReadOnly.fromMatrix({m11: 1, m22: 2, m33: 3, m44: 4, m23: 5, m43: 6}) should create a 3D DOMMatrixReadOnly");
test(() => {
var matrix = DOMMatrixReadOnly.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 = DOMMatrixReadOnly.fromMatrix({
@@ -188,10 +226,10 @@ test(() => {
test(() => {
assert_throws(new TypeError(), () => {
DOMMatrixReadOnly.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(), () => {
DOMMatrixReadOnly.fromMatrix({a: 1, b: 2, m11: 3});
- }, "The 'a' property should equal the 'm11' property.");
-}, "DOMMatrixReadOnly.fromMatrix(): Exception test.");
+ }, "The 'a' property should equal the 'm11' property");
+}, "DOMMatrixReadOnly.fromMatrix(): Exception test");
</script>

Powered by Google App Engine
This is Rietveld 408576698