Index: third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEBlendElement.html |
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEBlendElement.html b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEBlendElement.html |
index 8505d73f5c47da2f166a37b41d5b230f062fcbe8..5ea37349852a00ae10dca86e027c8711426aacab 100644 |
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEBlendElement.html |
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEBlendElement.html |
@@ -1,11 +1,61 @@ |
-<!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-SVGFEBlendElement.js"></script> |
-</body> |
-</html> |
+<!DOCTYPE HTML> |
+<title>Use of SVGAnimatedEnumeration within SVGFEBlendElement</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script> |
+test(function() { |
+ // This test checks the use of SVGAnimatedEnumeration within SVGFEBlendElement. |
+ |
+ var feBlendElement = document.createElementNS("http://www.w3.org/2000/svg", "feBlend"); |
+ feBlendElement.setAttribute("mode", "normal"); |
+ |
+ // Check initial 'mode' value. |
+ assert_true(feBlendElement.mode instanceof SVGAnimatedEnumeration); |
+ assert_equals(typeof(feBlendElement.mode.baseVal), "number"); |
+ assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_NORMAL); |
+ |
+ // Switch to 'multiply'. |
+ feBlendElement.mode.baseVal = SVGFEBlendElement.SVG_FEBLEND_MODE_MULTIPLY; |
+ assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_MULTIPLY); |
+ assert_equals(feBlendElement.getAttribute('mode'), "multiply"); |
+ |
+ // Switch to 'screen'. |
+ feBlendElement.mode.baseVal = SVGFEBlendElement.SVG_FEBLEND_MODE_SCREEN; |
+ assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_SCREEN); |
+ assert_equals(feBlendElement.getAttribute('mode'), "screen"); |
+ |
+ // Switch to 'darken'; |
+ feBlendElement.mode.baseVal = SVGFEBlendElement.SVG_FEBLEND_MODE_DARKEN; |
+ assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_DARKEN); |
+ assert_equals(feBlendElement.getAttribute('mode'), "darken"); |
+ |
+ // Switch to 'lighten' |
+ feBlendElement.mode.baseVal = SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN; |
+ assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN); |
+ assert_equals(feBlendElement.getAttribute('mode'), "lighten"); |
+ |
+ // Try setting invalid values. |
+ assert_throws(new TypeError(), function() { feBlendElement.mode.baseVal = 6; }); |
+ assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN); |
+ assert_equals(feBlendElement.getAttribute('mode'), "lighten"); |
+ |
+ assert_throws(new TypeError(), function() { feBlendElement.mode.baseVal = -1; }); |
+ assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN); |
+ assert_equals(feBlendElement.getAttribute('mode'), "lighten"); |
+ |
+ assert_throws(new TypeError(), function() { feBlendElement.mode.baseVal = 0; }); |
+ assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN); |
+ assert_equals(feBlendElement.getAttribute('mode'), "lighten"); |
+ |
+ // Switch to 'normal'. |
+ feBlendElement.mode.baseVal = SVGFEBlendElement.SVG_FEBLEND_MODE_NORMAL; |
+ assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_NORMAL); |
+ assert_equals(feBlendElement.getAttribute('mode'), "normal"); |
+ |
+ // baseVal access when mode is set to a value not in SVGFEBlendElement.SVG_FEBLEND_MODE_*. . |
+ feBlendElement.setAttribute("mode", "color-dodge"); |
+ assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_UNKNOWN); |
+ assert_throws(new TypeError(), function() { feBlendElement.mode.baseVal = 13; }); |
+ assert_equals(feBlendElement.getAttribute('mode'), "color-dodge"); |
+}); |
+</script> |