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