Index: third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGTextPathElement.html |
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGTextPathElement.html b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGTextPathElement.html |
index a8afef01612845abd9794f5fd482d15713af0c8d..fab2ee79cd0261f8fac63d68f614c740db59514d 100644 |
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGTextPathElement.html |
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGTextPathElement.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-SVGTextPathElement.js"></script> |
-</body> |
-</html> |
+<!DOCTYPE HTML> |
+<title>Use of SVGAnimatedEnumeration within SVGTextPathElement</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script> |
+test(function() { |
+ // This test checks the use of SVGAnimatedEnumeration within SVGTextPathElement. |
+ |
+ var textPathElement = document.createElementNS("http://www.w3.org/2000/svg", "textPath"); |
+ textPathElement.setAttribute("method", "align"); |
+ textPathElement.setAttribute("spacing", "auto"); |
+ |
+ // method |
+ // Check initial 'method' value. |
+ assert_true(textPathElement.method instanceof SVGAnimatedEnumeration); |
+ assert_equals(typeof(textPathElement.method.baseVal), "number"); |
+ assert_equals(textPathElement.method.baseVal, SVGTextPathElement.TEXTPATH_METHODTYPE_ALIGN); |
+ |
+ // Switch to 'stretch'. |
+ textPathElement.method.baseVal = SVGTextPathElement.TEXTPATH_METHODTYPE_STRETCH; |
+ assert_equals(textPathElement.method.baseVal, SVGTextPathElement.TEXTPATH_METHODTYPE_STRETCH); |
+ assert_equals(textPathElement.getAttribute('method'), "stretch"); |
+ |
+ // Try setting invalid values. |
+ assert_throws(new TypeError(), function() { textPathElement.method.baseVal = 3; }); |
+ assert_equals(textPathElement.method.baseVal, SVGTextPathElement.TEXTPATH_METHODTYPE_STRETCH); |
+ assert_equals(textPathElement.getAttribute('method'), "stretch"); |
+ |
+ assert_throws(new TypeError(), function() { textPathElement.method.baseVal = -1; }); |
+ assert_equals(textPathElement.method.baseVal, SVGTextPathElement.TEXTPATH_METHODTYPE_STRETCH); |
+ assert_equals(textPathElement.getAttribute('method'), "stretch"); |
+ |
+ assert_throws(new TypeError(), function() { textPathElement.method.baseVal = 0; }); |
+ assert_equals(textPathElement.method.baseVal, SVGTextPathElement.TEXTPATH_METHODTYPE_STRETCH); |
+ assert_equals(textPathElement.getAttribute('method'), "stretch"); |
+ |
+ // Switch to 'align'. |
+ textPathElement.method.baseVal = SVGTextPathElement.TEXTPATH_METHODTYPE_ALIGN; |
+ assert_equals(textPathElement.method.baseVal, SVGTextPathElement.TEXTPATH_METHODTYPE_ALIGN); |
+ assert_equals(textPathElement.getAttribute('method'), "align"); |
+ |
+ // spacing |
+ // Check initial 'spacing' value. |
+ assert_true(textPathElement.spacing instanceof SVGAnimatedEnumeration); |
+ assert_equals(typeof(textPathElement.spacing.baseVal), "number"); |
+ assert_equals(textPathElement.spacing.baseVal, SVGTextPathElement.TEXTPATH_SPACINGTYPE_AUTO); |
+ |
+ // Switch to 'exact'. |
+ textPathElement.spacing.baseVal = SVGTextPathElement.TEXTPATH_SPACINGTYPE_EXACT; |
+ assert_equals(textPathElement.spacing.baseVal, SVGTextPathElement.TEXTPATH_SPACINGTYPE_EXACT); |
+ assert_equals(textPathElement.getAttribute('spacing'), "exact"); |
+ |
+ // Try setting invalid values. |
+ assert_throws(new TypeError(), function() { textPathElement.spacing.baseVal = 3; }); |
+ assert_equals(textPathElement.spacing.baseVal, SVGTextPathElement.TEXTPATH_SPACINGTYPE_EXACT); |
+ assert_equals(textPathElement.getAttribute('spacing'), "exact"); |
+ |
+ assert_throws(new TypeError(), function() { textPathElement.spacing.baseVal = -1; }); |
+ assert_equals(textPathElement.spacing.baseVal, SVGTextPathElement.TEXTPATH_SPACINGTYPE_EXACT); |
+ assert_equals(textPathElement.getAttribute('spacing'), "exact"); |
+ |
+ assert_throws(new TypeError(), function() { textPathElement.spacing.baseVal = 0; }); |
+ assert_equals(textPathElement.spacing.baseVal, SVGTextPathElement.TEXTPATH_SPACINGTYPE_EXACT); |
+ assert_equals(textPathElement.getAttribute('spacing'), "exact"); |
+ |
+ // Switch to 'auto'. |
+ textPathElement.spacing.baseVal = SVGTextPathElement.TEXTPATH_SPACINGTYPE_AUTO; |
+ assert_equals(textPathElement.spacing.baseVal, SVGTextPathElement.TEXTPATH_SPACINGTYPE_AUTO); |
+ assert_equals(textPathElement.getAttribute('spacing'), "auto"); |
+}); |
+</script> |