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

Unified Diff: third_party/WebKit/LayoutTests/svg/dom/SVGTransform.html

Issue 2362653002: Convert LayoutTests/svg/dom/SVGTransform*.html js-tests.js to testharness.js based tests (Closed)
Patch Set: Align with review comments Created 4 years, 3 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/svg/dom/SVGTransform-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/svg/dom/SVGTransform.html
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGTransform.html b/third_party/WebKit/LayoutTests/svg/dom/SVGTransform.html
index cf50fcf67e3cc42bb7797a128a8b2a52de3f084d..f1c2248d80345a016193062d14526022bf22ee58 100644
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGTransform.html
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGTransform.html
@@ -1,11 +1,139 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src="../../resources/js-test.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
-<script src="script-tests/SVGTransform.js"></script>
-</body>
-</html>
+<!DOCTYPE HTML>
+<title>SVGTransform interface</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ // This test checks the SVGTransform API.
+
+ var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
+ var transform = svgElement.createSVGTransform();
+
+ // Check initial transform values.
+ assert_equals(transform.type, SVGTransform.SVG_TRANSFORM_MATRIX);
+ assert_equals(transform.angle, 0);
+ assert_equals(transform.matrix.a, 1);
+ assert_equals(transform.matrix.b, 0);
+ assert_equals(transform.matrix.c, 0);
+ assert_equals(transform.matrix.d, 1);
+ assert_equals(transform.matrix.e, 0);
+ assert_equals(transform.matrix.f, 0);
+
+ // Change to skewX transformation.
+ transform.setSkewX(45);
+ assert_equals(transform.type, SVGTransform.SVG_TRANSFORM_SKEWX);
+ assert_equals(transform.angle, 45);
+ assert_equals(transform.matrix.a, 1);
+ assert_equals(transform.matrix.b, 0);
+ assert_equals(transform.matrix.c.toFixed(1), "1.0");
+ assert_equals(transform.matrix.d, 1);
+ assert_equals(transform.matrix.e, 0);
+ assert_equals(transform.matrix.f, 0);
+
+ // Changing matrix.e to 100, should reset transformation type to MATRIX, and angle should be 0.
+ transform.matrix.e = 100;
+ assert_equals(transform.matrix.e, 100);
+ assert_equals(transform.type, SVGTransform.SVG_TRANSFORM_MATRIX);
+ assert_equals(transform.angle, 0);
+ assert_equals(transform.matrix.a, 1);
+ assert_equals(transform.matrix.b, 0);
+ assert_equals(transform.matrix.c.toFixed(1), "1.0");
+ assert_equals(transform.matrix.d, 1);
+ assert_equals(transform.matrix.e, 100);
+ assert_equals(transform.matrix.f, 0);
+
+ // Now revert to initial matrix.
+ transform.matrix.c = 0;
+ transform.matrix.e = 0;
+ assert_equals(transform.matrix.c, 0);
+ assert_equals(transform.matrix.e, 0);
+ assert_equals(transform.type, SVGTransform.SVG_TRANSFORM_MATRIX);
+ assert_equals(transform.angle, 0);
+ assert_equals(transform.matrix.a, 1);
+ assert_equals(transform.matrix.b, 0);
+ assert_equals(transform.matrix.c, 0);
+ assert_equals(transform.matrix.d, 1);
+ assert_equals(transform.matrix.e, 0);
+ assert_equals(transform.matrix.f, 0);
+
+ // Check passing invalid arguments to 'setMatrix'.
+ assert_throws(new TypeError(), function() { transform.setMatrix(); });
+ assert_throws(new TypeError(), function() { transform.setMatrix(transform); });
+ assert_throws(new TypeError(), function() { transform.setMatrix(svgElement); });
+ assert_throws(new TypeError(), function() { transform.setMatrix('aString'); });
+ assert_throws(new TypeError(), function() { transform.setMatrix(1); });
+ assert_throws(new TypeError(), function() { transform.setMatrix(false); });
+
+ // Check passing invalid arguments to 'setTranslate'.
+ assert_throws(new TypeError(), function() { transform.setTranslate(); });
+ assert_throws(new TypeError(), function() { transform.setTranslate(transform); });
+ assert_throws(new TypeError(), function() { transform.setTranslate(svgElement); });
+ assert_throws(new TypeError(), function() { transform.setTranslate('aString'); });
+ assert_throws(new TypeError(), function() { transform.setTranslate(1, transform); });
+ assert_throws(new TypeError(), function() { transform.setTranslate(1, svgElement); });
+ assert_throws(new TypeError(), function() { transform.setTranslate(1, 'aString'); });
+ assert_throws(new TypeError(), function() { transform.setTranslate(transform, 1); });
+ assert_throws(new TypeError(), function() { transform.setTranslate(svgElement, 1); });
+ assert_throws(new TypeError(), function() { transform.setTranslate('aString', 1); });
+ assert_throws(new TypeError(), function() { transform.setTranslate(transform, transform); });
+ assert_throws(new TypeError(), function() { transform.setTranslate(svgElement, svgElement); });
+ assert_throws(new TypeError(), function() { transform.setTranslate('aString', 'aString'); });
+ assert_throws(new TypeError(), function() { transform.setTranslate(NaN, 1); });
+ assert_throws(new TypeError(), function() { transform.setTranslate(Infinity, 1); });
+ assert_throws(new TypeError(), function() { transform.setTranslate(1, NaN); });
+ assert_throws(new TypeError(), function() { transform.setTranslate(1, Infinity); });
+
+ // Check passing invalid arguments to 'setScale'.
+ assert_throws(new TypeError(), function() { transform.setScale(); });
+ assert_throws(new TypeError(), function() { transform.setScale(transform); });
+ assert_throws(new TypeError(), function() { transform.setScale(svgElement); });
+ assert_throws(new TypeError(), function() { transform.setScale('aString'); });
+ assert_throws(new TypeError(), function() { transform.setScale(1, transform); });
+ assert_throws(new TypeError(), function() { transform.setScale(1, svgElement); });
+ assert_throws(new TypeError(), function() { transform.setScale(1, 'aString'); });
+ assert_throws(new TypeError(), function() { transform.setScale(transform, 1); });
+ assert_throws(new TypeError(), function() { transform.setScale(svgElement, 1); });
+ assert_throws(new TypeError(), function() { transform.setScale('aString', 1); });
+ assert_throws(new TypeError(), function() { transform.setScale(transform, transform); });
+ assert_throws(new TypeError(), function() { transform.setScale(svgElement, svgElement); });
+ assert_throws(new TypeError(), function() { transform.setScale('aString', 'aString'); });
+ assert_throws(new TypeError(), function() { transform.setScale(NaN, 1); });
+ assert_throws(new TypeError(), function() { transform.setScale(Infinity, 1); });
+ assert_throws(new TypeError(), function() { transform.setScale(1, NaN); });
+ assert_throws(new TypeError(), function() { transform.setScale(1, Infinity); });
+
+ // Check passing invalid arguments to 'setRotate'.
+ assert_throws(new TypeError(), function() { transform.setRotate(); });
+ assert_throws(new TypeError(), function() { transform.setRotate(transform); });
+ assert_throws(new TypeError(), function() { transform.setRotate(svgElement); });
+ assert_throws(new TypeError(), function() { transform.setRotate('aString'); });
+ assert_throws(new TypeError(), function() { transform.setRotate(1, transform); });
+ assert_throws(new TypeError(), function() { transform.setRotate(1, svgElement); });
+ assert_throws(new TypeError(), function() { transform.setRotate(1, 'aString'); });
+ assert_throws(new TypeError(), function() { transform.setRotate(1, 1, transform); });
+ assert_throws(new TypeError(), function() { transform.setRotate(1, 1, svgElement); });
+ assert_throws(new TypeError(), function() { transform.setRotate(1, 1, 'aString'); });
+ assert_throws(new TypeError(), function() { transform.setRotate(NaN, 1, 1); });
+ assert_throws(new TypeError(), function() { transform.setRotate(Infinity, 1, 1); });
+ assert_throws(new TypeError(), function() { transform.setRotate(1, NaN, 1); });
+ assert_throws(new TypeError(), function() { transform.setRotate(1, Infinity, 1); });
+ assert_throws(new TypeError(), function() { transform.setRotate(1, 1, NaN); });
+ assert_throws(new TypeError(), function() { transform.setRotate(1, 1, Infinity); });
+
+ // Check passing invalid arguments to 'setSkewX'.
+ assert_throws(new TypeError(), function() { transform.setSkewX(); });
+ assert_throws(new TypeError(), function() { transform.setSkewX(transform); });
+ assert_throws(new TypeError(), function() { transform.setSkewX(svgElement); });
+ assert_throws(new TypeError(), function() { transform.setSkewX('aString'); });
+ assert_throws(new TypeError(), function() { transform.setSkewX(NaN); });
+ assert_throws(new TypeError(), function() { transform.setSkewX(Infinity); });
+
+ // Check passing invalid arguments to 'setSkewY'.
+ assert_throws(new TypeError(), function() { transform.setSkewY(); });
+ assert_throws(new TypeError(), function() { transform.setSkewY(transform); });
+ assert_throws(new TypeError(), function() { transform.setSkewY(svgElement); });
+ assert_throws(new TypeError(), function() { transform.setSkewY('aString'); });
+ assert_throws(new TypeError(), function() { transform.setSkewY(NaN); });
+ assert_throws(new TypeError(), function() { transform.setSkewY(Infinity); });
+});
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/svg/dom/SVGTransform-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698