zherczeg@webkit.org | 7c3ba63 | 2010-07-28 08:03:57 +0000 | [diff] [blame] | 1 | // [Name] SVGFEDiffuseLightingElement-dom-surfaceScale-attr.js |
| 2 | // [Expected rendering result] A shining circle (performed by diffuse lighting) - and a series of PASS messages |
| 3 | |
| 4 | description("Tests dynamic updates of the 'surfaceScale' attribute of the SVGFEDiffuseLightingElement object") |
| 5 | createSVGTestCase(); |
| 6 | |
| 7 | var pointLight = createSVGElement("fePointLight"); |
| 8 | pointLight.setAttribute("x", "100"); |
| 9 | pointLight.setAttribute("y", "180"); |
| 10 | pointLight.setAttribute("z", "30"); |
| 11 | |
| 12 | var blurElement = createSVGElement("feGaussianBlur"); |
| 13 | blurElement.setAttribute("in", "SourceGraphic"); |
| 14 | blurElement.setAttribute("stdDeviation", "2"); |
| 15 | blurElement.setAttribute("result", "blur"); |
| 16 | |
| 17 | var gradientElement = createSVGElement("feDiffuseLighting"); |
| 18 | gradientElement.setAttribute("in", "blur"); |
| 19 | gradientElement.setAttribute("surfaceScale", "0"); |
| 20 | gradientElement.setAttribute("diffuseConstant", "1"); |
| 21 | gradientElement.setAttribute("lighting-color", "yellow"); |
| 22 | gradientElement.appendChild(pointLight); |
| 23 | |
| 24 | var filterElement = createSVGElement("filter"); |
| 25 | filterElement.setAttribute("id", "myFilter"); |
| 26 | filterElement.setAttribute("filterUnits", "userSpaceOnUse"); |
| 27 | filterElement.setAttribute("x", "0"); |
| 28 | filterElement.setAttribute("y", "0"); |
| 29 | filterElement.setAttribute("width", "200"); |
| 30 | filterElement.setAttribute("height", "200"); |
| 31 | filterElement.appendChild(blurElement); |
| 32 | filterElement.appendChild(gradientElement); |
| 33 | |
| 34 | var defsElement = createSVGElement("defs"); |
| 35 | defsElement.appendChild(filterElement); |
| 36 | |
| 37 | rootSVGElement.appendChild(defsElement); |
| 38 | |
| 39 | var rectElement = createSVGElement("circle"); |
| 40 | rectElement.setAttribute("width", 200); |
| 41 | rectElement.setAttribute("height", 200); |
| 42 | rectElement.setAttribute("cx", "100"); |
| 43 | rectElement.setAttribute("cy", "60"); |
| 44 | rectElement.setAttribute("r", "50"); |
| 45 | rectElement.setAttribute("filter", "url(#myFilter)"); |
| 46 | rootSVGElement.appendChild(rectElement); |
| 47 | |
| 48 | shouldBeEqualToString("gradientElement.getAttribute('surfaceScale')", "0"); |
| 49 | |
zimmermann@webkit.org | 8567f8d | 2012-02-15 10:48:58 +0000 | [diff] [blame] | 50 | function repaintTest() { |
zherczeg@webkit.org | 7c3ba63 | 2010-07-28 08:03:57 +0000 | [diff] [blame] | 51 | gradientElement.setAttribute("surfaceScale", "1"); |
| 52 | shouldBeEqualToString("gradientElement.getAttribute('surfaceScale')", "1"); |
| 53 | |
| 54 | completeTest(); |
| 55 | } |
| 56 | |
zherczeg@webkit.org | 7c3ba63 | 2010-07-28 08:03:57 +0000 | [diff] [blame] | 57 | var successfullyParsed = true; |