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> |