Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGTextPathElement.html

Issue 2447633002: Convert LayoutTests/svg/dom/SVGAnimatedEnumeration*.html js-tests.js to testharness.js based tests. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML>
2 <html> 2 <title>Use of SVGAnimatedEnumeration within SVGTextPathElement</title>
3 <head> 3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/testharnessreport.js"></script>
5 </head> 5 <script>
6 <body> 6 test(function() {
7 <p id="description"></p> 7 // This test checks the use of SVGAnimatedEnumeration within SVGTextPathElemen t.
8 <div id="console"></div> 8
9 <script src="script-tests/SVGAnimatedEnumeration-SVGTextPathElement.js"></script > 9 var textPathElement = document.createElementNS("http://www.w3.org/2000/svg", " textPath");
10 </body> 10 textPathElement.setAttribute("method", "align");
11 </html> 11 textPathElement.setAttribute("spacing", "auto");
12
13 // method
14 // Check initial 'method' value.
15 assert_true(textPathElement.method instanceof SVGAnimatedEnumeration);
16 assert_equals(typeof(textPathElement.method.baseVal), "number");
17 assert_equals(textPathElement.method.baseVal, SVGTextPathElement.TEXTPATH_METH ODTYPE_ALIGN);
18
19 // Switch to 'stretch'.
20 textPathElement.method.baseVal = SVGTextPathElement.TEXTPATH_METHODTYPE_STRETC H;
21 assert_equals(textPathElement.method.baseVal, SVGTextPathElement.TEXTPATH_METH ODTYPE_STRETCH);
22 assert_equals(textPathElement.getAttribute('method'), "stretch");
23
24 // Try setting invalid values.
25 assert_throws(new TypeError(), function() { textPathElement.method.baseVal = 3 ; });
26 assert_equals(textPathElement.method.baseVal, SVGTextPathElement.TEXTPATH_METH ODTYPE_STRETCH);
27 assert_equals(textPathElement.getAttribute('method'), "stretch");
28
29 assert_throws(new TypeError(), function() { textPathElement.method.baseVal = - 1; });
30 assert_equals(textPathElement.method.baseVal, SVGTextPathElement.TEXTPATH_METH ODTYPE_STRETCH);
31 assert_equals(textPathElement.getAttribute('method'), "stretch");
32
33 assert_throws(new TypeError(), function() { textPathElement.method.baseVal = 0 ; });
34 assert_equals(textPathElement.method.baseVal, SVGTextPathElement.TEXTPATH_METH ODTYPE_STRETCH);
35 assert_equals(textPathElement.getAttribute('method'), "stretch");
36
37 // Switch to 'align'.
38 textPathElement.method.baseVal = SVGTextPathElement.TEXTPATH_METHODTYPE_ALIGN;
39 assert_equals(textPathElement.method.baseVal, SVGTextPathElement.TEXTPATH_METH ODTYPE_ALIGN);
40 assert_equals(textPathElement.getAttribute('method'), "align");
41
42 // spacing
43 // Check initial 'spacing' value.
44 assert_true(textPathElement.spacing instanceof SVGAnimatedEnumeration);
45 assert_equals(typeof(textPathElement.spacing.baseVal), "number");
46 assert_equals(textPathElement.spacing.baseVal, SVGTextPathElement.TEXTPATH_SPA CINGTYPE_AUTO);
47
48 // Switch to 'exact'.
49 textPathElement.spacing.baseVal = SVGTextPathElement.TEXTPATH_SPACINGTYPE_EXAC T;
50 assert_equals(textPathElement.spacing.baseVal, SVGTextPathElement.TEXTPATH_SPA CINGTYPE_EXACT);
51 assert_equals(textPathElement.getAttribute('spacing'), "exact");
52
53 // Try setting invalid values.
54 assert_throws(new TypeError(), function() { textPathElement.spacing.baseVal = 3; });
55 assert_equals(textPathElement.spacing.baseVal, SVGTextPathElement.TEXTPATH_SPA CINGTYPE_EXACT);
56 assert_equals(textPathElement.getAttribute('spacing'), "exact");
57
58 assert_throws(new TypeError(), function() { textPathElement.spacing.baseVal = -1; });
59 assert_equals(textPathElement.spacing.baseVal, SVGTextPathElement.TEXTPATH_SPA CINGTYPE_EXACT);
60 assert_equals(textPathElement.getAttribute('spacing'), "exact");
61
62 assert_throws(new TypeError(), function() { textPathElement.spacing.baseVal = 0; });
63 assert_equals(textPathElement.spacing.baseVal, SVGTextPathElement.TEXTPATH_SPA CINGTYPE_EXACT);
64 assert_equals(textPathElement.getAttribute('spacing'), "exact");
65
66 // Switch to 'auto'.
67 textPathElement.spacing.baseVal = SVGTextPathElement.TEXTPATH_SPACINGTYPE_AUTO ;
68 assert_equals(textPathElement.spacing.baseVal, SVGTextPathElement.TEXTPATH_SPA CINGTYPE_AUTO);
69 assert_equals(textPathElement.getAttribute('spacing'), "auto");
70 });
71 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698