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

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

Issue 2389803004: Convert LayoutTests/svg/dom/SVGAnimatedEnumeration*.html js-tests.js to testharness.js based tests. (Closed)
Patch Set: Align with review comments 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-SVGClipPathElement.html
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGClipPathElement.html b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGClipPathElement.html
index 347f9b4913c3f3757767d8633a85640ec993f707..28a2fb6377ca4a5ee20540e19a391e7ca320ea81 100644
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGClipPathElement.html
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGClipPathElement.html
@@ -1,11 +1,40 @@
-<!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-SVGClipPathElement.js"></script>
-</body>
-</html>
+<!DOCTYPE HTML>
+<title>Use of SVGAnimatedEnumeration within SVGClipPathElement</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ // This test checks the use of SVGAnimatedEnumeration within SVGClipPathElement.
+
+ var clipPathElement = document.createElementNS("http://www.w3.org/2000/svg", "clipPath");
+ clipPathElement.setAttribute("clipPathUnits", "userSpaceOnUse");
+
+ // Check initial 'clipPathUnits' value.
+ assert_true(clipPathElement.clipPathUnits instanceof SVGAnimatedEnumeration);
+ assert_equals(typeof(clipPathElement.clipPathUnits.baseVal), "number");
+ assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE);
+
+ // Switch to 'objectBoundingBox'.
+ clipPathElement.clipPathUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
+ assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(clipPathElement.getAttribute('clipPathUnits'), "objectBoundingBox");
+
+ // Try setting invalid values.
+ assert_throws(new TypeError(), function() { clipPathElement.clipPathUnits.baseVal = 3; });
+ assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(clipPathElement.getAttribute('clipPathUnits'), "objectBoundingBox");
+
+ assert_throws(new TypeError(), function() { clipPathElement.clipPathUnits.baseVal = -1; });
+ assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(clipPathElement.getAttribute('clipPathUnits'), "objectBoundingBox");
+
+ assert_throws(new TypeError(), function() { clipPathElement.clipPathUnits.baseVal = 0; });
+ assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(clipPathElement.getAttribute('clipPathUnits'), "objectBoundingBox");
+
+ // Switch to 'userSpaceOnUse'.
+ clipPathElement.clipPathUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE;
+ assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE);
+ assert_equals(clipPathElement.getAttribute('clipPathUnits'), "userSpaceOnUse");
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698