Index: third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGComponentTransferFunctionElement.html |
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGComponentTransferFunctionElement.html b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGComponentTransferFunctionElement.html |
index 767478f57c9da0f9ae7ca0f5a2f7f7a031f8de80..2bcce6fcf566efb2961e2535af54d0614fc30292 100644 |
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGComponentTransferFunctionElement.html |
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGComponentTransferFunctionElement.html |
@@ -1,11 +1,55 @@ |
-<!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-SVGComponentTransferFunctionElement.js"></script> |
-</body> |
-</html> |
+<!DOCTYPE HTML> |
+<title>Use of SVGAnimatedEnumeration within SVGComponentTransferFunctionElement</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script> |
+test(function() { |
+ // This test checks the use of SVGAnimatedEnumeration within SVGComponentTransferFunctionElement. |
+ |
+ var feFuncRElement = document.createElementNS("http://www.w3.org/2000/svg", "feFuncR"); |
+ feFuncRElement.setAttribute("type", "identity"); |
+ |
+ // Check initial 'type' value. |
+ assert_true(feFuncRElement.type instanceof SVGAnimatedEnumeration); |
+ assert_equals(typeof(feFuncRElement.type.baseVal), "number"); |
+ assert_equals(feFuncRElement.type.baseVal, SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY); |
+ |
+ // Switch to 'table'. |
+ feFuncRElement.type.baseVal = SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_TABLE; |
+ assert_equals(feFuncRElement.type.baseVal, SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_TABLE); |
+ assert_equals(feFuncRElement.getAttribute('type'), "table"); |
+ |
+ // Switch to 'discrete'. |
+ feFuncRElement.type.baseVal = SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE; |
+ assert_equals(feFuncRElement.type.baseVal, SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE); |
+ assert_equals(feFuncRElement.getAttribute('type'), "discrete"); |
+ |
+ // Switch to 'linear'. |
+ feFuncRElement.type.baseVal = SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_LINEAR; |
+ assert_equals(feFuncRElement.type.baseVal, SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_LINEAR); |
+ assert_equals(feFuncRElement.getAttribute('type'), "linear"); |
+ |
+ // Switch to 'gamma'. |
+ feFuncRElement.type.baseVal = SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_GAMMA; |
+ assert_equals(feFuncRElement.type.baseVal, SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_GAMMA); |
+ assert_equals(feFuncRElement.getAttribute('type'), "gamma"); |
+ |
+ // Try setting invalid values. |
+ assert_throws(new TypeError(), function() { feFuncRElement.type.baseVal = 6; }); |
+ assert_equals(feFuncRElement.type.baseVal, SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_GAMMA); |
+ assert_equals(feFuncRElement.getAttribute('type'), "gamma"); |
+ |
+ assert_throws(new TypeError(), function() { feFuncRElement.type.baseVal = -1; }); |
+ assert_equals(feFuncRElement.type.baseVal, SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_GAMMA); |
+ assert_equals(feFuncRElement.getAttribute('type'), "gamma"); |
+ |
+ assert_throws(new TypeError(), function() { feFuncRElement.type.baseVal = 0; }); |
+ assert_equals(feFuncRElement.type.baseVal, SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_GAMMA); |
+ assert_equals(feFuncRElement.getAttribute('type'), "gamma"); |
+ |
+ // Switch to 'identity'. |
+ feFuncRElement.type.baseVal = SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY; |
+ assert_equals(feFuncRElement.type.baseVal, SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY); |
+ assert_equals(feFuncRElement.getAttribute('type'), "identity"); |
+}); |
+</script> |