OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <title>Use of SVGAnimatedEnumeration within SVGComponentTransferFunctionElement<
/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 SVGComponentTrans
ferFunctionElement. |
8 <div id="console"></div> | 8 |
9 <script src="script-tests/SVGAnimatedEnumeration-SVGComponentTransferFunctionEle
ment.js"></script> | 9 var feFuncRElement = document.createElementNS("http://www.w3.org/2000/svg", "f
eFuncR"); |
10 </body> | 10 feFuncRElement.setAttribute("type", "identity"); |
11 </html> | 11 |
| 12 // Check initial 'type' value. |
| 13 assert_true(feFuncRElement.type instanceof SVGAnimatedEnumeration); |
| 14 assert_equals(typeof(feFuncRElement.type.baseVal), "number"); |
| 15 assert_equals(feFuncRElement.type.baseVal, SVGComponentTransferFunctionElement
.SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY); |
| 16 |
| 17 // Switch to 'table'. |
| 18 feFuncRElement.type.baseVal = SVGComponentTransferFunctionElement.SVG_FECOMPON
ENTTRANSFER_TYPE_TABLE; |
| 19 assert_equals(feFuncRElement.type.baseVal, SVGComponentTransferFunctionElement
.SVG_FECOMPONENTTRANSFER_TYPE_TABLE); |
| 20 assert_equals(feFuncRElement.getAttribute('type'), "table"); |
| 21 |
| 22 // Switch to 'discrete'. |
| 23 feFuncRElement.type.baseVal = SVGComponentTransferFunctionElement.SVG_FECOMPON
ENTTRANSFER_TYPE_DISCRETE; |
| 24 assert_equals(feFuncRElement.type.baseVal, SVGComponentTransferFunctionElement
.SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE); |
| 25 assert_equals(feFuncRElement.getAttribute('type'), "discrete"); |
| 26 |
| 27 // Switch to 'linear'. |
| 28 feFuncRElement.type.baseVal = SVGComponentTransferFunctionElement.SVG_FECOMPON
ENTTRANSFER_TYPE_LINEAR; |
| 29 assert_equals(feFuncRElement.type.baseVal, SVGComponentTransferFunctionElement
.SVG_FECOMPONENTTRANSFER_TYPE_LINEAR); |
| 30 assert_equals(feFuncRElement.getAttribute('type'), "linear"); |
| 31 |
| 32 // Switch to 'gamma'. |
| 33 feFuncRElement.type.baseVal = SVGComponentTransferFunctionElement.SVG_FECOMPON
ENTTRANSFER_TYPE_GAMMA; |
| 34 assert_equals(feFuncRElement.type.baseVal, SVGComponentTransferFunctionElement
.SVG_FECOMPONENTTRANSFER_TYPE_GAMMA); |
| 35 assert_equals(feFuncRElement.getAttribute('type'), "gamma"); |
| 36 |
| 37 // Try setting invalid values. |
| 38 assert_throws(new TypeError(), function() { feFuncRElement.type.baseVal = 6; }
); |
| 39 assert_equals(feFuncRElement.type.baseVal, SVGComponentTransferFunctionElement
.SVG_FECOMPONENTTRANSFER_TYPE_GAMMA); |
| 40 assert_equals(feFuncRElement.getAttribute('type'), "gamma"); |
| 41 |
| 42 assert_throws(new TypeError(), function() { feFuncRElement.type.baseVal = -1;
}); |
| 43 assert_equals(feFuncRElement.type.baseVal, SVGComponentTransferFunctionElement
.SVG_FECOMPONENTTRANSFER_TYPE_GAMMA); |
| 44 assert_equals(feFuncRElement.getAttribute('type'), "gamma"); |
| 45 |
| 46 assert_throws(new TypeError(), function() { feFuncRElement.type.baseVal = 0; }
); |
| 47 assert_equals(feFuncRElement.type.baseVal, SVGComponentTransferFunctionElement
.SVG_FECOMPONENTTRANSFER_TYPE_GAMMA); |
| 48 assert_equals(feFuncRElement.getAttribute('type'), "gamma"); |
| 49 |
| 50 // Switch to 'identity'. |
| 51 feFuncRElement.type.baseVal = SVGComponentTransferFunctionElement.SVG_FECOMPON
ENTTRANSFER_TYPE_IDENTITY; |
| 52 assert_equals(feFuncRElement.type.baseVal, SVGComponentTransferFunctionElement
.SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY); |
| 53 assert_equals(feFuncRElement.getAttribute('type'), "identity"); |
| 54 }); |
| 55 </script> |
OLD | NEW |