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

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

Issue 2389803004: Convert LayoutTests/svg/dom/SVGAnimatedEnumeration*.html js-tests.js to testharness.js based tests. (Closed)
Patch Set: Align with review comments 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 SVGFEBlendElement</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 SVGFEBlendElement .
8 <div id="console"></div> 8
9 <script src="script-tests/SVGAnimatedEnumeration-SVGFEBlendElement.js"></script> 9 var feBlendElement = document.createElementNS("http://www.w3.org/2000/svg", "f eBlend");
10 </body> 10 feBlendElement.setAttribute("mode", "normal");
11 </html> 11
12 // Check initial 'mode' value.
13 assert_true(feBlendElement.mode instanceof SVGAnimatedEnumeration);
14 assert_equals(typeof(feBlendElement.mode.baseVal), "number");
15 assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_ NORMAL);
16
17 // Switch to 'multiply'.
18 feBlendElement.mode.baseVal = SVGFEBlendElement.SVG_FEBLEND_MODE_MULTIPLY;
19 assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_ MULTIPLY);
20 assert_equals(feBlendElement.getAttribute('mode'), "multiply");
21
22 // Switch to 'screen'.
23 feBlendElement.mode.baseVal = SVGFEBlendElement.SVG_FEBLEND_MODE_SCREEN;
24 assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_ SCREEN);
25 assert_equals(feBlendElement.getAttribute('mode'), "screen");
26
27 // Switch to 'darken';
28 feBlendElement.mode.baseVal = SVGFEBlendElement.SVG_FEBLEND_MODE_DARKEN;
29 assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_ DARKEN);
30 assert_equals(feBlendElement.getAttribute('mode'), "darken");
31
32 // Switch to 'lighten'
33 feBlendElement.mode.baseVal = SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN;
34 assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_ LIGHTEN);
35 assert_equals(feBlendElement.getAttribute('mode'), "lighten");
36
37 // Try setting invalid values.
38 assert_throws(new TypeError(), function() { feBlendElement.mode.baseVal = 6; } );
39 assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_ LIGHTEN);
40 assert_equals(feBlendElement.getAttribute('mode'), "lighten");
41
42 assert_throws(new TypeError(), function() { feBlendElement.mode.baseVal = -1; });
43 assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_ LIGHTEN);
44 assert_equals(feBlendElement.getAttribute('mode'), "lighten");
45
46 assert_throws(new TypeError(), function() { feBlendElement.mode.baseVal = 0; } );
47 assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_ LIGHTEN);
48 assert_equals(feBlendElement.getAttribute('mode'), "lighten");
49
50 // Switch to 'normal'.
51 feBlendElement.mode.baseVal = SVGFEBlendElement.SVG_FEBLEND_MODE_NORMAL;
52 assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_ NORMAL);
53 assert_equals(feBlendElement.getAttribute('mode'), "normal");
54
55 // baseVal access when mode is set to a value not in SVGFEBlendElement.SVG_FEB LEND_MODE_*. .
56 feBlendElement.setAttribute("mode", "color-dodge");
57 assert_equals(feBlendElement.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_ UNKNOWN);
58 assert_throws(new TypeError(), function() { feBlendElement.mode.baseVal = 13; });
59 assert_equals(feBlendElement.getAttribute('mode'), "color-dodge");
60 });
61 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698