OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <title>Use of SVGAnimatedEnumeration within SVGFEMorphologyElement</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 SVGFEMorphologyEl
ement. |
8 <div id="console"></div> | 8 |
9 <script src="script-tests/SVGAnimatedEnumeration-SVGFEMorphologyElement.js"></sc
ript> | 9 var feMorphologyElement = document.createElementNS("http://www.w3.org/2000/svg
", "feMorphology"); |
10 </body> | 10 feMorphologyElement.setAttribute("operator", "erode"); |
11 </html> | 11 |
| 12 // Check initial 'operator' value. |
| 13 assert_true(feMorphologyElement.operator instanceof SVGAnimatedEnumeration); |
| 14 assert_equals(typeof(feMorphologyElement.operator.baseVal), "number"); |
| 15 assert_equals(feMorphologyElement.operator.baseVal, SVGFEMorphologyElement.SVG
_MORPHOLOGY_OPERATOR_ERODE); |
| 16 |
| 17 // Switch to 'dilate'. |
| 18 feMorphologyElement.operator.baseVal = SVGFEMorphologyElement.SVG_MORPHOLOGY_O
PERATOR_DILATE; |
| 19 assert_equals(feMorphologyElement.operator.baseVal, SVGFEMorphologyElement.SVG
_MORPHOLOGY_OPERATOR_DILATE); |
| 20 assert_equals(feMorphologyElement.getAttribute('operator'), "dilate"); |
| 21 |
| 22 // Try setting invalid values. |
| 23 assert_throws(new TypeError(), function() { feMorphologyElement.operator.baseV
al = 4; }); |
| 24 assert_equals(feMorphologyElement.operator.baseVal, SVGFEMorphologyElement.SVG
_MORPHOLOGY_OPERATOR_DILATE); |
| 25 assert_equals(feMorphologyElement.getAttribute('operator'), "dilate"); |
| 26 |
| 27 assert_throws(new TypeError(), function() { feMorphologyElement.operator.baseV
al = -1; }); |
| 28 assert_equals(feMorphologyElement.operator.baseVal, SVGFEMorphologyElement.SVG
_MORPHOLOGY_OPERATOR_DILATE); |
| 29 assert_equals(feMorphologyElement.getAttribute('operator'), "dilate"); |
| 30 |
| 31 assert_throws(new TypeError(), function() { feMorphologyElement.operator.baseV
al = 0; }); |
| 32 assert_equals(feMorphologyElement.operator.baseVal, SVGFEMorphologyElement.SVG
_MORPHOLOGY_OPERATOR_DILATE); |
| 33 assert_equals(feMorphologyElement.getAttribute('operator'), "dilate"); |
| 34 |
| 35 // Switch to 'erode'. |
| 36 feMorphologyElement.operator.baseVal = SVGFEMorphologyElement.SVG_MORPHOLOGY_O
PERATOR_ERODE; |
| 37 assert_equals(feMorphologyElement.operator.baseVal, SVGFEMorphologyElement.SVG
_MORPHOLOGY_OPERATOR_ERODE); |
| 38 assert_equals(feMorphologyElement.getAttribute('operator'), "erode"); |
| 39 }); |
| 40 </script> |
OLD | NEW |