OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <title>Use of SVGAnimatedEnumeration within SVGFEDisplacementMapElement</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 SVGFEDisplacement
MapElement. |
8 <div id="console"></div> | 8 |
9 <script src="script-tests/SVGAnimatedEnumeration-SVGFEDisplacementMapElement.js"
></script> | 9 var feDisplacementMapElement = document.createElementNS("http://www.w3.org/200
0/svg", "feDisplacementMap"); |
10 </body> | 10 feDisplacementMapElement.setAttribute("xChannelSelector", "R"); |
11 </html> | 11 feDisplacementMapElement.setAttribute("yChannelSelector", "R"); |
| 12 |
| 13 // xChannelSelector |
| 14 // Check initial 'xChannelSelector' value. |
| 15 assert_true(feDisplacementMapElement.xChannelSelector instanceof SVGAnimatedEn
umeration); |
| 16 assert_equals(typeof(feDisplacementMapElement.xChannelSelector.baseVal), "numb
er"); |
| 17 assert_equals(feDisplacementMapElement.xChannelSelector.baseVal, SVGFEDisplace
mentMapElement.SVG_CHANNEL_R); |
| 18 |
| 19 // Switch to 'G'. |
| 20 feDisplacementMapElement.xChannelSelector.baseVal = SVGFEDisplacementMapElemen
t.SVG_CHANNEL_G; |
| 21 assert_equals(feDisplacementMapElement.xChannelSelector.baseVal, SVGFEDisplace
mentMapElement.SVG_CHANNEL_G); |
| 22 assert_equals(feDisplacementMapElement.getAttribute('xChannelSelector'), "G"); |
| 23 |
| 24 // Switch to 'B'. |
| 25 feDisplacementMapElement.xChannelSelector.baseVal = SVGFEDisplacementMapElemen
t.SVG_CHANNEL_B; |
| 26 assert_equals(feDisplacementMapElement.xChannelSelector.baseVal, SVGFEDisplace
mentMapElement.SVG_CHANNEL_B); |
| 27 assert_equals(feDisplacementMapElement.getAttribute('xChannelSelector'), "B"); |
| 28 |
| 29 // Switch to 'A'. |
| 30 feDisplacementMapElement.xChannelSelector.baseVal = SVGFEDisplacementMapElemen
t.SVG_CHANNEL_A; |
| 31 assert_equals(feDisplacementMapElement.xChannelSelector.baseVal, SVGFEDisplace
mentMapElement.SVG_CHANNEL_A); |
| 32 assert_equals(feDisplacementMapElement.getAttribute('xChannelSelector'), "A"); |
| 33 |
| 34 // Try setting invalid values. |
| 35 assert_throws(new TypeError(), function() { feDisplacementMapElement.xChannelS
elector.baseVal = 5; }); |
| 36 assert_equals(feDisplacementMapElement.xChannelSelector.baseVal, SVGFEDisplace
mentMapElement.SVG_CHANNEL_A); |
| 37 assert_equals(feDisplacementMapElement.getAttribute('xChannelSelector'), "A"); |
| 38 |
| 39 assert_throws(new TypeError(), function() { feDisplacementMapElement.xChannelS
elector.baseVal = -1; }); |
| 40 assert_equals(feDisplacementMapElement.xChannelSelector.baseVal, SVGFEDisplace
mentMapElement.SVG_CHANNEL_A); |
| 41 assert_equals(feDisplacementMapElement.getAttribute('xChannelSelector'), "A"); |
| 42 |
| 43 assert_throws(new TypeError(), function() { feDisplacementMapElement.xChannelS
elector.baseVal = 0; }); |
| 44 assert_equals(feDisplacementMapElement.xChannelSelector.baseVal, SVGFEDisplace
mentMapElement.SVG_CHANNEL_A); |
| 45 assert_equals(feDisplacementMapElement.getAttribute('xChannelSelector'), "A"); |
| 46 |
| 47 // Switch to 'R'. |
| 48 feDisplacementMapElement.xChannelSelector.baseVal = SVGFEDisplacementMapElemen
t.SVG_CHANNEL_R; |
| 49 assert_equals(feDisplacementMapElement.xChannelSelector.baseVal, SVGFEDisplace
mentMapElement.SVG_CHANNEL_R); |
| 50 assert_equals(feDisplacementMapElement.getAttribute('xChannelSelector'), "R"); |
| 51 |
| 52 // yChannelSelector |
| 53 // Check initial 'yChannelSelector' value. |
| 54 assert_true(feDisplacementMapElement.yChannelSelector instanceof SVGAnimatedEn
umeration); |
| 55 assert_equals(typeof(feDisplacementMapElement.yChannelSelector.baseVal), "numb
er"); |
| 56 assert_equals(feDisplacementMapElement.yChannelSelector.baseVal, SVGFEDisplace
mentMapElement.SVG_CHANNEL_R); |
| 57 |
| 58 // Switch to 'G'. |
| 59 feDisplacementMapElement.yChannelSelector.baseVal = SVGFEDisplacementMapElemen
t.SVG_CHANNEL_G; |
| 60 assert_equals(feDisplacementMapElement.yChannelSelector.baseVal, SVGFEDisplace
mentMapElement.SVG_CHANNEL_G); |
| 61 assert_equals(feDisplacementMapElement.getAttribute('yChannelSelector'), "G"); |
| 62 |
| 63 // Switch to 'B'. |
| 64 feDisplacementMapElement.yChannelSelector.baseVal = SVGFEDisplacementMapElemen
t.SVG_CHANNEL_B; |
| 65 assert_equals(feDisplacementMapElement.yChannelSelector.baseVal, SVGFEDisplace
mentMapElement.SVG_CHANNEL_B); |
| 66 assert_equals(feDisplacementMapElement.getAttribute('yChannelSelector'), "B"); |
| 67 |
| 68 // Switch to 'A'. |
| 69 feDisplacementMapElement.yChannelSelector.baseVal = SVGFEDisplacementMapElemen
t.SVG_CHANNEL_A; |
| 70 assert_equals(feDisplacementMapElement.yChannelSelector.baseVal, SVGFEDisplace
mentMapElement.SVG_CHANNEL_A); |
| 71 assert_equals(feDisplacementMapElement.getAttribute('yChannelSelector'), "A"); |
| 72 |
| 73 // Try setting invalid values. |
| 74 assert_throws(new TypeError(), function() { feDisplacementMapElement.yChannelS
elector.baseVal = 5; }); |
| 75 assert_equals(feDisplacementMapElement.yChannelSelector.baseVal, SVGFEDisplace
mentMapElement.SVG_CHANNEL_A); |
| 76 assert_equals(feDisplacementMapElement.getAttribute('yChannelSelector'), "A"); |
| 77 |
| 78 assert_throws(new TypeError(), function() { feDisplacementMapElement.yChannelS
elector.baseVal = -1; }); |
| 79 assert_equals(feDisplacementMapElement.yChannelSelector.baseVal, SVGFEDisplace
mentMapElement.SVG_CHANNEL_A); |
| 80 assert_equals(feDisplacementMapElement.getAttribute('yChannelSelector'), "A"); |
| 81 |
| 82 assert_throws(new TypeError(), function() { feDisplacementMapElement.yChannelS
elector.baseVal = 0; }); |
| 83 assert_equals(feDisplacementMapElement.yChannelSelector.baseVal, SVGFEDisplace
mentMapElement.SVG_CHANNEL_A); |
| 84 assert_equals(feDisplacementMapElement.getAttribute('yChannelSelector'), "A"); |
| 85 |
| 86 // Switch to 'R'. |
| 87 feDisplacementMapElement.yChannelSelector.baseVal = SVGFEDisplacementMapElemen
t.SVG_CHANNEL_R; |
| 88 assert_equals(feDisplacementMapElement.yChannelSelector.baseVal, SVGFEDisplace
mentMapElement.SVG_CHANNEL_R); |
| 89 assert_equals(feDisplacementMapElement.getAttribute('yChannelSelector'), "R"); |
| 90 }); |
| 91 </script> |
OLD | NEW |