OLD | NEW |
---|---|
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <title>Use of SVGAnimatedEnumeration within SVGFEColorMatrixElement</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 SVGFEColorMatrixE lement. |
8 <div id="console"></div> | 8 |
9 <script src="script-tests/SVGAnimatedEnumeration-SVGFEColorMatrixElement.js"></s cript> | 9 var feColorMatrixElement = document.createElementNS("http://www.w3.org/2000/sv g", "feColorMatrix"); |
10 </body> | 10 feColorMatrixElement.setAttribute("type", "matrix"); |
11 </html> | 11 |
12 // Check initial 'type' value. | |
13 assert_equals(feColorMatrixElement.type.toString(), "[object SVGAnimatedEnumer ation]"); | |
Srirama
2016/10/04 09:32:04
ditto
Shanmuga Pandi
2016/10/05 06:53:10
Done.
| |
14 assert_equals(typeof(feColorMatrixElement.type.baseVal), "number"); | |
15 assert_equals(feColorMatrixElement.type.baseVal, SVGFEColorMatrixElement.SVG_F ECOLORMATRIX_TYPE_MATRIX); | |
16 | |
17 // Switch to 'saturate'. | |
18 feColorMatrixElement.type.baseVal = SVGFEColorMatrixElement.SVG_FECOLORMATRIX_ TYPE_SATURATE; | |
19 assert_equals(feColorMatrixElement.type.baseVal, SVGFEColorMatrixElement.SVG_F ECOLORMATRIX_TYPE_SATURATE); | |
20 assert_equals(feColorMatrixElement.getAttribute('type'), "saturate"); | |
21 | |
22 // Switch to 'hueRotate'. | |
23 feColorMatrixElement.type.baseVal = SVGFEColorMatrixElement.SVG_FECOLORMATRIX_ TYPE_HUEROTATE; | |
24 assert_equals(feColorMatrixElement.type.baseVal, SVGFEColorMatrixElement.SVG_F ECOLORMATRIX_TYPE_HUEROTATE); | |
25 assert_equals(feColorMatrixElement.getAttribute('type'), "hueRotate"); | |
26 | |
27 // Switch to 'luminanceToAlpha'. | |
28 feColorMatrixElement.type.baseVal = SVGFEColorMatrixElement.SVG_FECOLORMATRIX_ TYPE_LUMINANCETOALPHA; | |
29 assert_equals(feColorMatrixElement.type.baseVal, SVGFEColorMatrixElement.SVG_F ECOLORMATRIX_TYPE_LUMINANCETOALPHA); | |
30 assert_equals(feColorMatrixElement.getAttribute('type'), "luminanceToAlpha"); | |
31 | |
32 // Try setting invalid values. | |
33 assert_throws(new TypeError(), function() { feColorMatrixElement.type.baseVal = 5; }); | |
34 assert_equals(feColorMatrixElement.type.baseVal, SVGFEColorMatrixElement.SVG_F ECOLORMATRIX_TYPE_LUMINANCETOALPHA); | |
35 assert_equals(feColorMatrixElement.getAttribute('type'), "luminanceToAlpha"); | |
36 | |
37 assert_throws(new TypeError(), function() { feColorMatrixElement.type.baseVal = -1; }); | |
38 assert_equals(feColorMatrixElement.type.baseVal, SVGFEColorMatrixElement.SVG_F ECOLORMATRIX_TYPE_LUMINANCETOALPHA); | |
39 assert_equals(feColorMatrixElement.getAttribute('type'), "luminanceToAlpha"); | |
40 | |
41 assert_throws(new TypeError(), function() { feColorMatrixElement.type.baseVal = 0; }); | |
42 assert_equals(feColorMatrixElement.type.baseVal, SVGFEColorMatrixElement.SVG_F ECOLORMATRIX_TYPE_LUMINANCETOALPHA); | |
43 assert_equals(feColorMatrixElement.getAttribute('type'), "luminanceToAlpha"); | |
44 | |
45 // Switch to 'matrix'. | |
46 feColorMatrixElement.type.baseVal = SVGFEColorMatrixElement.SVG_FECOLORMATRIX_ TYPE_MATRIX; | |
47 assert_equals(feColorMatrixElement.type.baseVal, SVGFEColorMatrixElement.SVG_F ECOLORMATRIX_TYPE_MATRIX); | |
48 assert_equals(feColorMatrixElement.getAttribute('type'), "matrix"); | |
49 }); | |
50 </script> | |
OLD | NEW |