Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / animations / script-tests / svgenum-animation-13.js
blobb0973c7263e06f289b6d21a43f87f111291f2479
1 description("Test ChannelSelectorType enumeration animations");
2 createSVGTestCase();
4 // Setup test document
5 var defsElement = createSVGElement("defs");
6 rootSVGElement.appendChild(defsElement);
8 var feImage1 = createSVGElement("feImage");
9 feImage1.setAttribute("result", "Map");
10 feImage1.setAttributeNS(xlinkNS, "xlink:href", "../W3C-SVG-1.1/resources/sphere.png");
12 var feImage2 = createSVGElement("feImage");
13 feImage2.setAttribute("result", "Texture");
14 feImage2.setAttributeNS(xlinkNS, "xlink:href", "../W3C-SVG-1.1/resources/DisplaceChecker.png");
16 var displacementMap = createSVGElement("feDisplacementMap");
17 displacementMap.setAttribute("in", "Texture");
18 displacementMap.setAttribute("in2", "Map");
19 displacementMap.setAttribute("scale", "64");
20 displacementMap.setAttribute("xChannelSelector", "B");
21 displacementMap.setAttribute("yChannelSelector", "G");
23 var filter = createSVGElement("filter");
24 filter.setAttribute("id", "filter");
25 filter.setAttribute("filterUnit", "objectBoundingBox");
26 filter.setAttribute("x", "0");
27 filter.setAttribute("y", "0");
28 filter.setAttribute("width", "1");
29 filter.setAttribute("height", "1");
30 filter.appendChild(feImage1);
31 filter.appendChild(feImage2);
32 filter.appendChild(displacementMap);
33 defsElement.appendChild(filter);
35 var rect = createSVGElement("rect");
36 rect.setAttribute("id", "rect");
37 rect.setAttribute("onclick", "executeTest()");
38 rect.setAttribute("width", "100");
39 rect.setAttribute("height", "100");
40 rect.setAttribute("filter", "url(#filter)");
41 rootSVGElement.appendChild(rect);
43 var animate1 = createSVGElement("animate");
44 animate1.setAttribute("id", "animation");
45 animate1.setAttribute("attributeName", "xChannelSelector");
46 animate1.setAttribute("begin", "rect.click");
47 animate1.setAttribute("dur", "4s");
48 animate1.setAttribute("values", "R;G;B;A");
49 animate1.setAttribute("fill", "freeze");
50 displacementMap.appendChild(animate1);
52 // Setup animation test
53 function sample1() {
54 shouldBe("displacementMap.xChannelSelector.animVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_B");
55 shouldBe("displacementMap.xChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_B");
58 function sample2() {
59 shouldBe("displacementMap.xChannelSelector.animVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_R");
60 shouldBe("displacementMap.xChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_B");
63 function sample3() {
64 shouldBe("displacementMap.xChannelSelector.animVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_G");
65 shouldBe("displacementMap.xChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_B");
68 function sample4() {
69 shouldBe("displacementMap.xChannelSelector.animVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_A");
70 shouldBe("displacementMap.xChannelSelector.baseVal", "SVGFEDisplacementMapElement.SVG_CHANNEL_B");
73 function executeTest() {
74 const expectedValues = [
75 // [animationId, time, sampleCallback]
76 ["animation", 0.0, sample1],
77 ["animation", 0.001, sample2],
78 ["animation", 0.999, sample2],
79 ["animation", 1.001, sample3],
80 ["animation", 1.999, sample3],
81 ["animation", 2.001, sample1],
82 ["animation", 2.999, sample1],
83 ["animation", 3.001, sample4],
84 ["animation", 3.999, sample4],
85 ["animation", 4.001, sample4]
88 runAnimationTest(expectedValues);
91 var successfullyParsed = true;