OLD | NEW |
| (Empty) |
1 description("This test checks the use of SVGAnimatedEnumeration within SVGFEDisp
lacementMapElement"); | |
2 | |
3 var feDisplacementMapElement = document.createElementNS("http://www.w3.org/2000/
svg", "feDisplacementMap"); | |
4 feDisplacementMapElement.setAttribute("xChannelSelector", "R"); | |
5 feDisplacementMapElement.setAttribute("yChannelSelector", "R"); | |
6 | |
7 // xChannelSelector | |
8 debug(""); | |
9 debug("Check initial 'xChannelSelector' value"); | |
10 shouldBeEqualToString("feDisplacementMapElement.xChannelSelector.toString()", "[
object SVGAnimatedEnumeration]"); | |
11 shouldBeEqualToString("typeof(feDisplacementMapElement.xChannelSelector.baseVal)
", "number"); | |
12 shouldBe("feDisplacementMapElement.xChannelSelector.baseVal", "SVGFEDisplacement
MapElement.SVG_CHANNEL_R"); | |
13 | |
14 debug(""); | |
15 debug("Switch to 'G'"); | |
16 shouldBe("feDisplacementMapElement.xChannelSelector.baseVal = SVGFEDisplacementM
apElement.SVG_CHANNEL_G", "SVGFEDisplacementMapElement.SVG_CHANNEL_G"); | |
17 shouldBe("feDisplacementMapElement.xChannelSelector.baseVal", "SVGFEDisplacement
MapElement.SVG_CHANNEL_G"); | |
18 shouldBeEqualToString("feDisplacementMapElement.getAttribute('xChannelSelector')
", "G"); | |
19 | |
20 debug(""); | |
21 debug("Switch to 'B'"); | |
22 shouldBe("feDisplacementMapElement.xChannelSelector.baseVal = SVGFEDisplacementM
apElement.SVG_CHANNEL_B", "SVGFEDisplacementMapElement.SVG_CHANNEL_B"); | |
23 shouldBe("feDisplacementMapElement.xChannelSelector.baseVal", "SVGFEDisplacement
MapElement.SVG_CHANNEL_B"); | |
24 shouldBeEqualToString("feDisplacementMapElement.getAttribute('xChannelSelector')
", "B"); | |
25 | |
26 debug(""); | |
27 debug("Switch to 'A'"); | |
28 shouldBe("feDisplacementMapElement.xChannelSelector.baseVal = SVGFEDisplacementM
apElement.SVG_CHANNEL_A", "SVGFEDisplacementMapElement.SVG_CHANNEL_A"); | |
29 shouldBe("feDisplacementMapElement.xChannelSelector.baseVal", "SVGFEDisplacement
MapElement.SVG_CHANNEL_A"); | |
30 shouldBeEqualToString("feDisplacementMapElement.getAttribute('xChannelSelector')
", "A"); | |
31 | |
32 debug(""); | |
33 debug("Try setting invalid values"); | |
34 shouldThrow("feDisplacementMapElement.xChannelSelector.baseVal = 5"); | |
35 shouldBe("feDisplacementMapElement.xChannelSelector.baseVal", "SVGFEDisplacement
MapElement.SVG_CHANNEL_A"); | |
36 shouldBeEqualToString("feDisplacementMapElement.getAttribute('xChannelSelector')
", "A"); | |
37 | |
38 shouldThrow("feDisplacementMapElement.xChannelSelector.baseVal = -1"); | |
39 shouldBe("feDisplacementMapElement.xChannelSelector.baseVal", "SVGFEDisplacement
MapElement.SVG_CHANNEL_A"); | |
40 shouldBeEqualToString("feDisplacementMapElement.getAttribute('xChannelSelector')
", "A"); | |
41 | |
42 shouldThrow("feDisplacementMapElement.xChannelSelector.baseVal = 0"); | |
43 shouldBe("feDisplacementMapElement.xChannelSelector.baseVal", "SVGFEDisplacement
MapElement.SVG_CHANNEL_A"); | |
44 shouldBeEqualToString("feDisplacementMapElement.getAttribute('xChannelSelector')
", "A"); | |
45 | |
46 debug(""); | |
47 debug("Switch to 'R'"); | |
48 shouldBe("feDisplacementMapElement.xChannelSelector.baseVal = SVGFEDisplacementM
apElement.SVG_CHANNEL_R", "SVGFEDisplacementMapElement.SVG_CHANNEL_R"); | |
49 shouldBe("feDisplacementMapElement.xChannelSelector.baseVal", "SVGFEDisplacement
MapElement.SVG_CHANNEL_R"); | |
50 shouldBeEqualToString("feDisplacementMapElement.getAttribute('xChannelSelector')
", "R"); | |
51 | |
52 // yChannelSelector | |
53 debug(""); | |
54 debug("Check initial 'yChannelSelector' value"); | |
55 shouldBeEqualToString("feDisplacementMapElement.yChannelSelector.toString()", "[
object SVGAnimatedEnumeration]"); | |
56 shouldBeEqualToString("typeof(feDisplacementMapElement.yChannelSelector.baseVal)
", "number"); | |
57 shouldBe("feDisplacementMapElement.yChannelSelector.baseVal", "SVGFEDisplacement
MapElement.SVG_CHANNEL_R"); | |
58 | |
59 debug(""); | |
60 debug("Switch to 'G'"); | |
61 shouldBe("feDisplacementMapElement.yChannelSelector.baseVal = SVGFEDisplacementM
apElement.SVG_CHANNEL_G", "SVGFEDisplacementMapElement.SVG_CHANNEL_G"); | |
62 shouldBe("feDisplacementMapElement.yChannelSelector.baseVal", "SVGFEDisplacement
MapElement.SVG_CHANNEL_G"); | |
63 shouldBeEqualToString("feDisplacementMapElement.getAttribute('yChannelSelector')
", "G"); | |
64 | |
65 debug(""); | |
66 debug("Switch to 'B'"); | |
67 shouldBe("feDisplacementMapElement.yChannelSelector.baseVal = SVGFEDisplacementM
apElement.SVG_CHANNEL_B", "SVGFEDisplacementMapElement.SVG_CHANNEL_B"); | |
68 shouldBe("feDisplacementMapElement.yChannelSelector.baseVal", "SVGFEDisplacement
MapElement.SVG_CHANNEL_B"); | |
69 shouldBeEqualToString("feDisplacementMapElement.getAttribute('yChannelSelector')
", "B"); | |
70 | |
71 debug(""); | |
72 debug("Switch to 'A'"); | |
73 shouldBe("feDisplacementMapElement.yChannelSelector.baseVal = SVGFEDisplacementM
apElement.SVG_CHANNEL_A", "SVGFEDisplacementMapElement.SVG_CHANNEL_A"); | |
74 shouldBe("feDisplacementMapElement.yChannelSelector.baseVal", "SVGFEDisplacement
MapElement.SVG_CHANNEL_A"); | |
75 shouldBeEqualToString("feDisplacementMapElement.getAttribute('yChannelSelector')
", "A"); | |
76 | |
77 debug(""); | |
78 debug("Try setting invalid values"); | |
79 shouldThrow("feDisplacementMapElement.yChannelSelector.baseVal = 5"); | |
80 shouldBe("feDisplacementMapElement.yChannelSelector.baseVal", "SVGFEDisplacement
MapElement.SVG_CHANNEL_A"); | |
81 shouldBeEqualToString("feDisplacementMapElement.getAttribute('yChannelSelector')
", "A"); | |
82 | |
83 shouldThrow("feDisplacementMapElement.yChannelSelector.baseVal = -1"); | |
84 shouldBe("feDisplacementMapElement.yChannelSelector.baseVal", "SVGFEDisplacement
MapElement.SVG_CHANNEL_A"); | |
85 shouldBeEqualToString("feDisplacementMapElement.getAttribute('yChannelSelector')
", "A"); | |
86 | |
87 shouldThrow("feDisplacementMapElement.yChannelSelector.baseVal = 0"); | |
88 shouldBe("feDisplacementMapElement.yChannelSelector.baseVal", "SVGFEDisplacement
MapElement.SVG_CHANNEL_A"); | |
89 shouldBeEqualToString("feDisplacementMapElement.getAttribute('yChannelSelector')
", "A"); | |
90 | |
91 debug(""); | |
92 debug("Switch to 'R'"); | |
93 shouldBe("feDisplacementMapElement.yChannelSelector.baseVal = SVGFEDisplacementM
apElement.SVG_CHANNEL_R", "SVGFEDisplacementMapElement.SVG_CHANNEL_R"); | |
94 shouldBe("feDisplacementMapElement.yChannelSelector.baseVal", "SVGFEDisplacement
MapElement.SVG_CHANNEL_R"); | |
95 shouldBeEqualToString("feDisplacementMapElement.getAttribute('yChannelSelector')
", "R"); | |
96 | |
97 successfullyParsed = true; | |
OLD | NEW |