blob: 00b2c05f3ad512e1e7dde661b76a327339d8f40e [file] [log] [blame]
commit-queue@webkit.org4a006f02010-09-30 17:21:18 +00001<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2<html>
3<head>
commit-queue@webkit.org4a006f02010-09-30 17:21:18 +00004<script src="resources/SVGTestCase.js"></script>
mark.lam@apple.com1ca737d2013-09-08 05:29:22 +00005<script src="../../resources/js-test-pre.js"></script>
zimmermann@webkit.org8567f8d2012-02-15 10:48:58 +00006<script src="../../fast/repaint/resources/repaint.js"></script>
commit-queue@webkit.org4a006f02010-09-30 17:21:18 +00007</head>
zimmermann@webkit.org8567f8d2012-02-15 10:48:58 +00008<body onload="runRepaintTest()">
commit-queue@webkit.org4a006f02010-09-30 17:21:18 +00009<h1>SVG 1.1 dynamic update tests</h1>
10<p id="description"></p>
11<div id="console"></div>
ap@apple.com92352d02017-05-24 22:53:00 +000012<script>
13// [Name] SVGFECompositeElement-dom-k1-attr.js
14// [Expected rendering result] Four circle with different opacity merged with feComposite filter - and a series of PASS messages
15
16description("Tests dynamic updates of the 'k1' attribute of the SVGFECompositeElement object")
17createSVGTestCase();
18
19var defsElement = createSVGElement("defs");
20rootSVGElement.appendChild(defsElement);
21
22var off1 = createSVGElement("feOffset");
23off1.setAttribute("dx", "35");
24off1.setAttribute("dy", "25");
25off1.setAttribute("result", "off1");
26
27var flood1 = createSVGElement("feFlood");
28flood1.setAttribute("flood-color", "#408067");
29flood1.setAttribute("flood-opacity", ".8");
30flood1.setAttribute("result", "F1");
31
32var overComposite1 = createSVGElement("feComposite");
33overComposite1.setAttribute("in", "F1");
34overComposite1.setAttribute("in2", "off1");
35overComposite1.setAttribute("operator", "arithmetic");
36overComposite1.setAttribute("k1", "1.9");
37overComposite1.setAttribute("k2", ".1");
38overComposite1.setAttribute("k3", ".5");
39overComposite1.setAttribute("k4", ".3");
40overComposite1.setAttribute("result", "C1");
41
42var off2 = createSVGElement("feOffset");
43off2.setAttribute("in", "SourceGraphic");
44off2.setAttribute("dx", "60");
45off2.setAttribute("dy", "50");
46off2.setAttribute("result", "off2");
47
48var flood2 = createSVGElement("feFlood");
49flood2.setAttribute("flood-color", "#408067");
50flood2.setAttribute("flood-opacity", ".6");
51flood2.setAttribute("result", "F2");
52
53var overComposite2 = createSVGElement("feComposite");
54overComposite2.setAttribute("in", "F2");
55overComposite2.setAttribute("in2", "off2");
56overComposite2.setAttribute("operator", "in");
57overComposite2.setAttribute("result", "C2");
58
59var off3 = createSVGElement("feOffset");
60off3.setAttribute("in", "SourceGraphic");
61off3.setAttribute("dx", "85");
62off3.setAttribute("dy", "75");
63off3.setAttribute("result", "off3");
64
65var flood3 = createSVGElement("feFlood");
66flood3.setAttribute("flood-color", "#408067");
67flood3.setAttribute("flood-opacity", ".4");
68flood3.setAttribute("result", "F3");
69
70var overComposite3 = createSVGElement("feComposite");
71overComposite3.setAttribute("in2", "off3");
72overComposite3.setAttribute("operator", "in");
73overComposite3.setAttribute("result", "C3");
74
75var merge = createSVGElement("feMerge");
76
77var mergeNode1 = createSVGElement("feMergeNode");
78mergeNode1.setAttribute("in", "C1");
79
80var mergeNode2 = createSVGElement("feMergeNode");
81mergeNode2.setAttribute("in", "C2");
82
83var mergeNode3 = createSVGElement("feMergeNode");
84mergeNode3.setAttribute("in", "C3");
85
86var mergeNode4 = createSVGElement("feMergeNode");
87mergeNode4.setAttribute("in", "SourceGraphic");
88
89merge.appendChild(mergeNode3);
90merge.appendChild(mergeNode2);
91merge.appendChild(mergeNode1);
92merge.appendChild(mergeNode4);
93
94var overFilter = createSVGElement("filter");
95overFilter.setAttribute("id", "overFilter");
96overFilter.setAttribute("filterUnits", "objectBoundingBox");
97overFilter.setAttribute("x", "0");
98overFilter.setAttribute("y", "0");
99overFilter.setAttribute("width", "3.5");
100overFilter.setAttribute("height", "4");
101overFilter.appendChild(off1);
102overFilter.appendChild(flood1);
103overFilter.appendChild(overComposite1);
104overFilter.appendChild(off2);
105overFilter.appendChild(flood2);
106overFilter.appendChild(overComposite2);
107overFilter.appendChild(off3);
108overFilter.appendChild(flood3);
109overFilter.appendChild(overComposite3);
110overFilter.appendChild(merge);
111
112defsElement.appendChild(overFilter);
113
114rootSVGElement.setAttribute("height", "200");
115
116var rect1 = createSVGElement("circle");
117rect1.setAttribute("cx", "100");
118rect1.setAttribute("cy", "50");
119rect1.setAttribute("r", "50");
120rect1.setAttribute("fill", "#408067");
121rect1.setAttribute("filter", "url(#overFilter)");
122
123rootSVGElement.appendChild(rect1);
124
125shouldBeEqualToString("overComposite1.getAttribute('k1')", "1.9");
126
127function repaintTest() {
128 overComposite1.setAttribute("k1", ".5");
129 shouldBeEqualToString("overComposite1.getAttribute('k1')", ".5");
130
131 completeTest();
132}
133
134var successfullyParsed = true;
135</script>
commit-queue@webkit.org4a006f02010-09-30 17:21:18 +0000136</body>
137</html>