OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <title>Use of SVGAnimatedEnumeration within SVGFEConvolveMatrixElement</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 SVGFEConvolveMatr
ixElement. |
8 <div id="console"></div> | 8 |
9 <script src="script-tests/SVGAnimatedEnumeration-SVGFEConvolveMatrixElement.js">
</script> | 9 var feConvolveMatrixElement = document.createElementNS("http://www.w3.org/2000
/svg", "feConvolveMatrix"); |
10 </body> | 10 feConvolveMatrixElement.setAttribute("edgeMode", "duplicate"); |
11 </html> | 11 |
| 12 // Check initial 'edgeMode' value. |
| 13 assert_true(feConvolveMatrixElement.edgeMode instanceof SVGAnimatedEnumeration
); |
| 14 assert_equals(typeof(feConvolveMatrixElement.edgeMode.baseVal), "number"); |
| 15 assert_equals(feConvolveMatrixElement.edgeMode.baseVal, SVGFEConvolveMatrixEle
ment.SVG_EDGEMODE_DUPLICATE); |
| 16 |
| 17 // Switch to 'wrap'. |
| 18 feConvolveMatrixElement.edgeMode.baseVal = SVGFEConvolveMatrixElement.SVG_EDGE
MODE_WRAP; |
| 19 assert_equals(feConvolveMatrixElement.edgeMode.baseVal, SVGFEConvolveMatrixEle
ment.SVG_EDGEMODE_WRAP); |
| 20 assert_equals(feConvolveMatrixElement.getAttribute('edgeMode'), "wrap"); |
| 21 |
| 22 // Switch to 'none'. |
| 23 feConvolveMatrixElement.edgeMode.baseVal = SVGFEConvolveMatrixElement.SVG_EDGE
MODE_NONE; |
| 24 assert_equals(feConvolveMatrixElement.edgeMode.baseVal, SVGFEConvolveMatrixEle
ment.SVG_EDGEMODE_NONE); |
| 25 assert_equals(feConvolveMatrixElement.getAttribute('edgeMode'), "none"); |
| 26 |
| 27 // Try setting invalid values. |
| 28 assert_throws(new TypeError(), function() { feConvolveMatrixElement.edgeMode.b
aseVal = 4; }); |
| 29 assert_equals(feConvolveMatrixElement.edgeMode.baseVal, SVGFEConvolveMatrixEle
ment.SVG_EDGEMODE_NONE); |
| 30 assert_equals(feConvolveMatrixElement.getAttribute('edgeMode'), "none"); |
| 31 |
| 32 assert_throws(new TypeError(), function() { feConvolveMatrixElement.edgeMode.b
aseVal = -1; }); |
| 33 assert_equals(feConvolveMatrixElement.edgeMode.baseVal, SVGFEConvolveMatrixEle
ment.SVG_EDGEMODE_NONE); |
| 34 assert_equals(feConvolveMatrixElement.getAttribute('edgeMode'), "none"); |
| 35 |
| 36 assert_throws(new TypeError(), function() { feConvolveMatrixElement.edgeMode.b
aseVal = 0; }); |
| 37 assert_equals(feConvolveMatrixElement.edgeMode.baseVal, SVGFEConvolveMatrixEle
ment.SVG_EDGEMODE_NONE); |
| 38 assert_equals(feConvolveMatrixElement.getAttribute('edgeMode'), "none"); |
| 39 |
| 40 // Switch to 'duplicate'. |
| 41 feConvolveMatrixElement.edgeMode.baseVal = SVGFEConvolveMatrixElement.SVG_EDGE
MODE_DUPLICATE; |
| 42 assert_equals(feConvolveMatrixElement.edgeMode.baseVal, SVGFEConvolveMatrixEle
ment.SVG_EDGEMODE_DUPLICATE); |
| 43 assert_equals(feConvolveMatrixElement.getAttribute('edgeMode'), "duplicate"); |
| 44 }); |
| 45 </script> |
OLD | NEW |