Index: third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGMaskElement.html |
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGMaskElement.html b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGMaskElement.html |
index 25c258bce50396ef81612864d49f93ab04027837..003c2a6d89642d5ba425d866150340fc39a1828d 100644 |
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGMaskElement.html |
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGMaskElement.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-SVGPatternElement.js"></script> |
Srirama
2016/10/27 11:12:17
It is referring SVGPatterElement here instead of S
fs
2016/10/27 13:07:07
Probably a copy'n'paste related mistake in the ini
|
-</body> |
-</html> |
+<!DOCTYPE HTML> |
+<title>Use of SVGAnimatedEnumeration within SVGMaskElement</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script> |
+test(function() { |
+ // This test checks the use of SVGAnimatedEnumeration within SVGMaskElement. |
+ |
+ var maskElement = document.createElementNS("http://www.w3.org/2000/svg", "mask"); |
+ maskElement.setAttribute("maskUnits", "userSpaceOnUse"); |
+ maskElement.setAttribute("maskContentUnits", "userSpaceOnUse"); |
+ |
+ // maskUnits |
+ // Check initial 'maskUnits' value. |
+ assert_true(maskElement.maskUnits instanceof SVGAnimatedEnumeration); |
+ assert_equals(typeof(maskElement.maskUnits.baseVal), "number"); |
+ assert_equals(maskElement.maskUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE); |
+ |
+ // Switch to 'objectBoundingBox'. |
+ maskElement.maskUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX; |
+ assert_equals(maskElement.maskUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); |
+ assert_equals(maskElement.getAttribute('maskUnits'), "objectBoundingBox"); |
+ |
+ // Try setting invalid values. |
+ assert_throws(new TypeError(), function() { maskElement.maskUnits.baseVal = 3; }); |
+ assert_equals(maskElement.maskUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); |
+ assert_equals(maskElement.getAttribute('maskUnits'), "objectBoundingBox"); |
+ |
+ assert_throws(new TypeError(), function() { maskElement.maskUnits.baseVal = -1; }); |
+ assert_equals(maskElement.maskUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); |
+ assert_equals(maskElement.getAttribute('maskUnits'), "objectBoundingBox"); |
+ |
+ assert_throws(new TypeError(), function() { maskElement.maskUnits.baseVal = 0; }); |
+ assert_equals(maskElement.maskUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); |
+ assert_equals(maskElement.getAttribute('maskUnits'), "objectBoundingBox"); |
+ |
+ // Switch to 'userSpaceOnUse'. |
+ maskElement.maskUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE; |
+ assert_equals(maskElement.maskUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE); |
+ assert_equals(maskElement.getAttribute('maskUnits'), "userSpaceOnUse"); |
+ |
+ // maskContentUnits |
+ // Check initial 'maskContentUnits' value. |
+ assert_true(maskElement.maskContentUnits instanceof SVGAnimatedEnumeration); |
+ assert_equals(typeof(maskElement.maskContentUnits.baseVal), "number"); |
+ assert_equals(maskElement.maskContentUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE); |
+ |
+ // Switch to 'objectBoundingBox'. |
+ maskElement.maskContentUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX; |
+ assert_equals(maskElement.maskContentUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); |
+ assert_equals(maskElement.getAttribute('maskContentUnits'), "objectBoundingBox"); |
+ |
+ // Try setting invalid values. |
+ assert_throws(new TypeError(), function() { maskElement.maskContentUnits.baseVal = 3; }); |
+ assert_equals(maskElement.maskContentUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); |
+ assert_equals(maskElement.getAttribute('maskContentUnits'), "objectBoundingBox"); |
+ |
+ assert_throws(new TypeError(), function() { maskElement.maskContentUnits.baseVal = -1; }); |
+ assert_equals(maskElement.maskContentUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); |
+ assert_equals(maskElement.getAttribute('maskContentUnits'), "objectBoundingBox"); |
+ |
+ assert_throws(new TypeError(), function() { maskElement.maskContentUnits.baseVal = 0; }); |
+ assert_equals(maskElement.maskContentUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); |
+ assert_equals(maskElement.getAttribute('maskContentUnits'), "objectBoundingBox"); |
+ |
+ // Switch to 'userSpaceOnUse'. |
+ maskElement.maskContentUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE; |
+ assert_equals(maskElement.maskContentUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE); |
+ assert_equals(maskElement.getAttribute('maskContentUnits'), "userSpaceOnUse"); |
+}); |
+</script> |