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

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

Issue 2416163002: Convert LayoutTests/svg/dom/SVGAnimatedEnumeration*.html js-tests.js to testharness.js based tests. (Closed)
Patch Set: Created 4 years, 2 months 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 SVGFETurbulenceElement</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 SVGFETurbulenceEl ement.
8 <div id="console"></div> 8
9 <script src="script-tests/SVGAnimatedEnumeration-SVGFETurbulenceElement.js"></sc ript> 9 var feTurbulenceElement = document.createElementNS("http://www.w3.org/2000/svg ", "feTurbulence");
10 </body> 10 feTurbulenceElement.setAttribute("type", "fractalNoise");
11 </html> 11 feTurbulenceElement.setAttribute("stitchTiles", "stitch");
12
13 // type
14 // Check initial 'type' value.
15 assert_true(feTurbulenceElement.type instanceof SVGAnimatedEnumeration);
16 assert_equals(typeof(feTurbulenceElement.type.baseVal), "number");
17 assert_equals(feTurbulenceElement.type.baseVal, SVGFETurbulenceElement.SVG_TUR BULENCE_TYPE_FRACTALNOISE);
18
19 // Switch to 'turbulence'.
20 feTurbulenceElement.type.baseVal = SVGFETurbulenceElement.SVG_TURBULENCE_TYPE_ TURBULENCE;
21 assert_equals(feTurbulenceElement.type.baseVal, SVGFETurbulenceElement.SVG_TUR BULENCE_TYPE_TURBULENCE);
22 assert_equals(feTurbulenceElement.getAttribute('type'), "turbulence");
23
24 // Try setting invalid values.
25 assert_throws(new TypeError(), function() { feTurbulenceElement.type.baseVal = 3; });
26 assert_equals(feTurbulenceElement.type.baseVal, SVGFETurbulenceElement.SVG_TUR BULENCE_TYPE_TURBULENCE);
27 assert_equals(feTurbulenceElement.getAttribute('type'), "turbulence");
28
29 assert_throws(new TypeError(), function() { feTurbulenceElement.type.baseVal = -1; });
30 assert_equals(feTurbulenceElement.type.baseVal, SVGFETurbulenceElement.SVG_TUR BULENCE_TYPE_TURBULENCE);
31 assert_equals(feTurbulenceElement.getAttribute('type'), "turbulence");
32
33 assert_throws(new TypeError(), function() { feTurbulenceElement.type.baseVal = 0; });
34 assert_equals(feTurbulenceElement.type.baseVal, SVGFETurbulenceElement.SVG_TUR BULENCE_TYPE_TURBULENCE);
35 assert_equals(feTurbulenceElement.getAttribute('type'), "turbulence");
36
37 // Switch to 'fractalNoise'.
38 feTurbulenceElement.type.baseVal = SVGFETurbulenceElement.SVG_TURBULENCE_TYPE_ FRACTALNOISE;
39 assert_equals(feTurbulenceElement.type.baseVal, SVGFETurbulenceElement.SVG_TUR BULENCE_TYPE_FRACTALNOISE);
40 assert_equals(feTurbulenceElement.getAttribute('type'), "fractalNoise");
41
42 // stitchTiles
43 // Check initial 'stitchTiles' value.
44 assert_true(feTurbulenceElement.stitchTiles instanceof SVGAnimatedEnumeration) ;
45 assert_equals(typeof(feTurbulenceElement.stitchTiles.baseVal), "number");
46 assert_equals(feTurbulenceElement.stitchTiles.baseVal, SVGFETurbulenceElement. SVG_STITCHTYPE_STITCH);
47
48 // Switch to 'noStitch'.
49 feTurbulenceElement.stitchTiles.baseVal = SVGFETurbulenceElement.SVG_STITCHTYP E_NOSTITCH;
50 assert_equals(feTurbulenceElement.stitchTiles.baseVal, SVGFETurbulenceElement. SVG_STITCHTYPE_NOSTITCH);
51 assert_equals(feTurbulenceElement.getAttribute('stitchTiles'), "noStitch");
52
53 // Try setting invalid values.
54 assert_throws(new TypeError(), function() { feTurbulenceElement.stitchTiles.ba seVal = 3; });
55 assert_equals(feTurbulenceElement.stitchTiles.baseVal, SVGFETurbulenceElement. SVG_STITCHTYPE_NOSTITCH);
56 assert_equals(feTurbulenceElement.getAttribute('stitchTiles'), "noStitch");
57
58 assert_throws(new TypeError(), function() { feTurbulenceElement.stitchTiles.ba seVal = -1; });
59 assert_equals(feTurbulenceElement.stitchTiles.baseVal, SVGFETurbulenceElement. SVG_STITCHTYPE_NOSTITCH);
60 assert_equals(feTurbulenceElement.getAttribute('stitchTiles'), "noStitch");
61
62 assert_throws(new TypeError(), function() { feTurbulenceElement.stitchTiles.ba seVal = 0; });
63 assert_equals(feTurbulenceElement.stitchTiles.baseVal, SVGFETurbulenceElement. SVG_STITCHTYPE_NOSTITCH);
64 assert_equals(feTurbulenceElement.getAttribute('stitchTiles'), "noStitch");
65
66 // Switch to 'stitch'.
67 feTurbulenceElement.stitchTiles.baseVal = SVGFETurbulenceElement.SVG_STITCHTYP E_STITCH;
68 assert_equals(feTurbulenceElement.stitchTiles.baseVal, SVGFETurbulenceElement. SVG_STITCHTYPE_STITCH);
69 assert_equals(feTurbulenceElement.getAttribute('stitchTiles'), "stitch");
70 });
71 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698