OLD | NEW |
---|---|
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <title>Use of SVGAnimatedEnumeration within SVGFECompositeElement</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 SVGFECompositeEle ment. |
8 <div id="console"></div> | 8 |
9 <script src="script-tests/SVGAnimatedEnumeration-SVGFECompositeElement.js"></scr ipt> | 9 var feCompositeElement = document.createElementNS("http://www.w3.org/2000/svg" , "feComposite"); |
10 </body> | 10 feCompositeElement.setAttribute("operator", "over"); |
11 </html> | 11 |
12 // Check initial 'operator' value. | |
13 assert_equals(feCompositeElement.operator.toString(), "[object SVGAnimatedEnum eration]"); | |
Srirama
2016/10/04 09:32:04
ditto
Shanmuga Pandi
2016/10/05 06:53:10
Done.
| |
14 assert_equals(typeof(feCompositeElement.operator.baseVal), "number"); | |
15 assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_F ECOMPOSITE_OPERATOR_OVER); | |
16 | |
17 // Switch to 'in'. | |
18 feCompositeElement.operator.baseVal = SVGFECompositeElement.SVG_FECOMPOSITE_OP ERATOR_IN; | |
19 assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_F ECOMPOSITE_OPERATOR_IN); | |
20 assert_equals(feCompositeElement.getAttribute('operator'), "in"); | |
21 | |
22 // Switch to 'out'. | |
23 feCompositeElement.operator.baseVal = SVGFECompositeElement.SVG_FECOMPOSITE_OP ERATOR_OUT; | |
24 assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_F ECOMPOSITE_OPERATOR_OUT); | |
25 assert_equals(feCompositeElement.getAttribute('operator'), "out"); | |
26 | |
27 // Switch to 'atop'. | |
28 feCompositeElement.operator.baseVal = SVGFECompositeElement.SVG_FECOMPOSITE_OP ERATOR_ATOP; | |
29 assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_F ECOMPOSITE_OPERATOR_ATOP); | |
30 assert_equals(feCompositeElement.getAttribute('operator'), "atop"); | |
31 | |
32 // Switch to 'xor' | |
33 feCompositeElement.operator.baseVal = SVGFECompositeElement.SVG_FECOMPOSITE_OP ERATOR_XOR; | |
34 assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_F ECOMPOSITE_OPERATOR_XOR); | |
35 assert_equals(feCompositeElement.getAttribute('operator'), "xor"); | |
36 | |
37 // Switch to 'arithmetic'. | |
38 feCompositeElement.operator.baseVal = SVGFECompositeElement.SVG_FECOMPOSITE_OP ERATOR_ARITHMETIC; | |
39 assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_F ECOMPOSITE_OPERATOR_ARITHMETIC); | |
40 assert_equals(feCompositeElement.getAttribute('operator'), "arithmetic"); | |
41 | |
42 // Try setting invalid values. | |
43 assert_throws(new TypeError(), function() { feCompositeElement.operator.baseVa l = 7; }); | |
44 assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_F ECOMPOSITE_OPERATOR_ARITHMETIC); | |
45 assert_equals(feCompositeElement.getAttribute('operator'), "arithmetic"); | |
46 | |
47 assert_throws(new TypeError(), function() { feCompositeElement.operator.baseVa l = -1; }); | |
48 assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_F ECOMPOSITE_OPERATOR_ARITHMETIC); | |
49 assert_equals(feCompositeElement.getAttribute('operator'), "arithmetic"); | |
50 | |
51 assert_throws(new TypeError(), function() { feCompositeElement.operator.baseVa l = 0; }); | |
52 assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_F ECOMPOSITE_OPERATOR_ARITHMETIC); | |
53 assert_equals(feCompositeElement.getAttribute('operator'), "arithmetic"); | |
54 | |
55 // Switch to 'over'. | |
56 feCompositeElement.operator.baseVal = SVGFECompositeElement.SVG_FECOMPOSITE_OP ERATOR_OVER; | |
57 assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_F ECOMPOSITE_OPERATOR_OVER); | |
58 assert_equals(feCompositeElement.getAttribute('operator'), "over"); | |
59 | |
60 // Switch to 'lighter'. | |
61 assert_equals(SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_LIGHTER, undefine d); | |
62 feCompositeElement.setAttribute("operator", "lighter"); | |
63 assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_F ECOMPOSITE_OPERATOR_UNKNOWN); | |
64 }); | |
65 </script> | |
OLD | NEW |