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

Unified Diff: third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFilterElement.html

Issue 2416163002: Convert LayoutTests/svg/dom/SVGAnimatedEnumeration*.html js-tests.js to testharness.js based tests. (Closed)
Patch Set: Created 4 years, 2 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: third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFilterElement.html
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFilterElement.html b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFilterElement.html
index 73d2bdad6ba38557fcf496ac0403deddbaf07a78..f1582bcd4e2f6f7f092dfe4ac8dcfc0824cc3d08 100644
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFilterElement.html
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFilterElement.html
@@ -1,11 +1,71 @@
-<!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/SVGAnimatedEnumeration-SVGFilterElement.js"></script>
-</body>
-</html>
+<!DOCTYPE HTML>
+<title>Use of SVGAnimatedEnumeration within SVGFilterElement</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ // This test checks the use of SVGAnimatedEnumeration within SVGFilterElement.
+
+ var filterElement = document.createElementNS("http://www.w3.org/2000/svg", "filter");
+ filterElement.setAttribute("filterUnits", "userSpaceOnUse");
+ filterElement.setAttribute("primitiveUnits", "userSpaceOnUse");
+
+ // filterUnits
+ // Check initial 'filterUnits' value.
+ assert_true(filterElement.filterUnits instanceof SVGAnimatedEnumeration);
+ assert_equals(typeof(filterElement.filterUnits.baseVal), "number");
+ assert_equals(filterElement.filterUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE);
+
+ // Switch to 'objectBoundingBox'.
+ filterElement.filterUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
+ assert_equals(filterElement.filterUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(filterElement.getAttribute('filterUnits'), "objectBoundingBox");
+
+ // Try setting invalid values.
+ assert_throws(new TypeError(), function() { filterElement.filterUnits.baseVal = 3; });
+ assert_equals(filterElement.filterUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(filterElement.getAttribute('filterUnits'), "objectBoundingBox");
+
+ assert_throws(new TypeError(), function() { filterElement.filterUnits.baseVal = -1; });
+ assert_equals(filterElement.filterUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(filterElement.getAttribute('filterUnits'), "objectBoundingBox");
+
+ assert_throws(new TypeError(), function() { filterElement.filterUnits.baseVal = 0; });
+ assert_equals(filterElement.filterUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(filterElement.getAttribute('filterUnits'), "objectBoundingBox");
+
+ // Switch to 'userSpaceOnUse'.
+ filterElement.filterUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE;
+ assert_equals(filterElement.filterUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE);
+ assert_equals(filterElement.getAttribute('filterUnits'), "userSpaceOnUse");
+
+ // primitiveUnits
+ // Check initial 'primitiveUnits' value.
+ assert_true(filterElement.primitiveUnits instanceof SVGAnimatedEnumeration);
+ assert_equals(typeof(filterElement.primitiveUnits.baseVal), "number");
+ assert_equals(filterElement.primitiveUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE);
+
+ // Switch to 'objectBoundingBox'.
+ filterElement.primitiveUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
+ assert_equals(filterElement.primitiveUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(filterElement.getAttribute('primitiveUnits'), "objectBoundingBox");
+
+ // Try setting invalid values.
+ assert_throws(new TypeError(), function() { filterElement.primitiveUnits.baseVal = 3; });
+ assert_equals(filterElement.primitiveUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(filterElement.getAttribute('primitiveUnits'), "objectBoundingBox");
+
+ assert_throws(new TypeError(), function() { filterElement.primitiveUnits.baseVal = -1; });
+ assert_equals(filterElement.primitiveUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(filterElement.getAttribute('primitiveUnits'), "objectBoundingBox");
+
+ assert_throws(new TypeError(), function() { filterElement.primitiveUnits.baseVal = 0; });
+ assert_equals(filterElement.primitiveUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(filterElement.getAttribute('primitiveUnits'), "objectBoundingBox");
+
+ // Switch to 'userSpaceOnUse'.
+ filterElement.primitiveUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE;
+ assert_equals(filterElement.primitiveUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE);
+ assert_equals(filterElement.getAttribute('primitiveUnits'), "userSpaceOnUse");
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698