OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <title>Use of SVGAnimatedEnumeration within SVGClipPathElement</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 SVGClipPathElemen
t. |
8 <div id="console"></div> | 8 |
9 <script src="script-tests/SVGAnimatedEnumeration-SVGClipPathElement.js"></script
> | 9 var clipPathElement = document.createElementNS("http://www.w3.org/2000/svg", "
clipPath"); |
10 </body> | 10 clipPathElement.setAttribute("clipPathUnits", "userSpaceOnUse"); |
11 </html> | 11 |
| 12 // Check initial 'clipPathUnits' value. |
| 13 assert_true(clipPathElement.clipPathUnits instanceof SVGAnimatedEnumeration); |
| 14 assert_equals(typeof(clipPathElement.clipPathUnits.baseVal), "number"); |
| 15 assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYP
E_USERSPACEONUSE); |
| 16 |
| 17 // Switch to 'objectBoundingBox'. |
| 18 clipPathElement.clipPathUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUND
INGBOX; |
| 19 assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYP
E_OBJECTBOUNDINGBOX); |
| 20 assert_equals(clipPathElement.getAttribute('clipPathUnits'), "objectBoundingBo
x"); |
| 21 |
| 22 // Try setting invalid values. |
| 23 assert_throws(new TypeError(), function() { clipPathElement.clipPathUnits.base
Val = 3; }); |
| 24 assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYP
E_OBJECTBOUNDINGBOX); |
| 25 assert_equals(clipPathElement.getAttribute('clipPathUnits'), "objectBoundingBo
x"); |
| 26 |
| 27 assert_throws(new TypeError(), function() { clipPathElement.clipPathUnits.base
Val = -1; }); |
| 28 assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYP
E_OBJECTBOUNDINGBOX); |
| 29 assert_equals(clipPathElement.getAttribute('clipPathUnits'), "objectBoundingBo
x"); |
| 30 |
| 31 assert_throws(new TypeError(), function() { clipPathElement.clipPathUnits.base
Val = 0; }); |
| 32 assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYP
E_OBJECTBOUNDINGBOX); |
| 33 assert_equals(clipPathElement.getAttribute('clipPathUnits'), "objectBoundingBo
x"); |
| 34 |
| 35 // Switch to 'userSpaceOnUse'. |
| 36 clipPathElement.clipPathUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEON
USE; |
| 37 assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYP
E_USERSPACEONUSE); |
| 38 assert_equals(clipPathElement.getAttribute('clipPathUnits'), "userSpaceOnUse")
; |
| 39 }); |
| 40 </script> |
OLD | NEW |