OLD | NEW |
---|---|
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <title>Use of SVGAnimatedEnumeration within SVGPatternElement</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 SVGPatternElement . |
8 <div id="console"></div> | 8 |
9 <script src="script-tests/SVGAnimatedEnumeration-SVGMaskElement.js"></script> | 9 var patternElement = document.createElementNS("http://www.w3.org/2000/svg", "p attern"); |
Srirama
2016/10/27 11:12:17
hmm, it is opposite here.
fs
2016/10/27 13:07:07
Ok, so bug not fixed then. But confusion averted!
| |
10 </body> | 10 patternElement.setAttribute("patternUnits", "userSpaceOnUse"); |
11 </html> | 11 patternElement.setAttribute("patternContentUnits", "userSpaceOnUse"); |
12 | |
13 // patternUnits | |
14 // Check initial 'patternUnits' value. | |
15 assert_true(patternElement.patternUnits instanceof SVGAnimatedEnumeration); | |
16 assert_equals(typeof(patternElement.patternUnits.baseVal), "number"); | |
17 assert_equals(patternElement.patternUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_ USERSPACEONUSE); | |
18 | |
19 // Switch to 'objectBoundingBox'. | |
20 patternElement.patternUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDIN GBOX; | |
21 assert_equals(patternElement.patternUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_ OBJECTBOUNDINGBOX); | |
22 assert_equals(patternElement.getAttribute('patternUnits'), "objectBoundingBox" ); | |
23 | |
24 // Try setting invalid values. | |
25 assert_throws(new TypeError(), function() { patternElement.patternUnits.baseVa l = 3; }); | |
26 assert_equals(patternElement.patternUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_ OBJECTBOUNDINGBOX); | |
27 assert_equals(patternElement.getAttribute('patternUnits'), "objectBoundingBox" ); | |
28 | |
29 assert_throws(new TypeError(), function() { patternElement.patternUnits.baseVa l = -1; }); | |
30 assert_equals(patternElement.patternUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_ OBJECTBOUNDINGBOX); | |
31 assert_equals(patternElement.getAttribute('patternUnits'), "objectBoundingBox" ); | |
32 | |
33 assert_throws(new TypeError(), function() { patternElement.patternUnits.baseVa l = 0; }); | |
34 assert_equals(patternElement.patternUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_ OBJECTBOUNDINGBOX); | |
35 assert_equals(patternElement.getAttribute('patternUnits'), "objectBoundingBox" ); | |
36 | |
37 // Switch to 'userSpaceOnUse'. | |
38 patternElement.patternUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUS E; | |
39 assert_equals(patternElement.patternUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_ USERSPACEONUSE); | |
40 assert_equals(patternElement.getAttribute('patternUnits'), "userSpaceOnUse"); | |
41 | |
42 // patternContentUnits | |
43 // Check initial 'patternContentUnits' value. | |
44 assert_true(patternElement.patternContentUnits instanceof SVGAnimatedEnumerati on); | |
45 assert_equals(typeof(patternElement.patternContentUnits.baseVal), "number"); | |
46 assert_equals(patternElement.patternContentUnits.baseVal, SVGUnitTypes.SVG_UNI T_TYPE_USERSPACEONUSE); | |
47 | |
48 // Switch to 'objectBoundingBox'. | |
49 patternElement.patternContentUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_OBJECT BOUNDINGBOX; | |
50 assert_equals(patternElement.patternContentUnits.baseVal, SVGUnitTypes.SVG_UNI T_TYPE_OBJECTBOUNDINGBOX); | |
51 assert_equals(patternElement.getAttribute('patternContentUnits'), "objectBound ingBox"); | |
52 | |
53 // Try setting invalid values. | |
54 assert_throws(new TypeError(), function() { patternElement.patternContentUnits .baseVal = 3; }); | |
55 assert_equals(patternElement.patternContentUnits.baseVal, SVGUnitTypes.SVG_UNI T_TYPE_OBJECTBOUNDINGBOX); | |
56 assert_equals(patternElement.getAttribute('patternContentUnits'), "objectBound ingBox"); | |
57 | |
58 assert_throws(new TypeError(), function() { patternElement.patternContentUnits .baseVal = -1; }); | |
59 assert_equals(patternElement.patternContentUnits.baseVal, SVGUnitTypes.SVG_UNI T_TYPE_OBJECTBOUNDINGBOX); | |
60 assert_equals(patternElement.getAttribute('patternContentUnits'), "objectBound ingBox"); | |
61 | |
62 assert_throws(new TypeError(), function() { patternElement.patternContentUnits .baseVal = 0; }); | |
63 assert_equals(patternElement.patternContentUnits.baseVal, SVGUnitTypes.SVG_UNI T_TYPE_OBJECTBOUNDINGBOX); | |
64 assert_equals(patternElement.getAttribute('patternContentUnits'), "objectBound ingBox"); | |
65 | |
66 // Switch to 'userSpaceOnUse'. | |
67 patternElement.patternContentUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSP ACEONUSE; | |
68 assert_equals(patternElement.patternContentUnits.baseVal, SVGUnitTypes.SVG_UNI T_TYPE_USERSPACEONUSE); | |
69 assert_equals(patternElement.getAttribute('patternContentUnits'), "userSpaceOn Use"); | |
70 }); | |
71 </script> | |
OLD | NEW |