73 lines
2.5 KiB
HTML
73 lines
2.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
|
<html>
|
|
<head>
|
|
<script src="resources/SVGTestCase.js"></script>
|
|
<script src="../../resources/js-test-pre.js"></script>
|
|
<script src="../../fast/repaint/resources/repaint.js"></script>
|
|
</head>
|
|
<body onload="runRepaintTest()">
|
|
<h1>SVG 1.1 dynamic update tests</h1>
|
|
<p id="description"></p>
|
|
<div id="console"></div>
|
|
<script>
|
|
// [Name] SVGFEDisplacementMapElement-svgdom-in2-attr.js
|
|
// [Expected rendering result] A rectangle with displacementMap filter - and a series of PASS messages
|
|
|
|
description("Tests dynamic updates of the 'in2' property of the SVGFEDisplacementMapElement object")
|
|
createSVGTestCase();
|
|
|
|
var defsElement = createSVGElement("defs");
|
|
rootSVGElement.appendChild(defsElement);
|
|
|
|
var image1 = createSVGElement("feImage");
|
|
image1.setAttribute("result", "Map");
|
|
image1.setAttributeNS(xlinkNS, "xlink:href", "../W3C-SVG-1.1/resources/sphere.png");
|
|
|
|
var image2 = createSVGElement("feImage");
|
|
image2.setAttribute("result", "Texture");
|
|
image2.setAttributeNS(xlinkNS, "xlink:href", "../W3C-SVG-1.1/resources/DisplaceChecker.png");
|
|
|
|
var displacementMap = createSVGElement("feDisplacementMap");
|
|
displacementMap.setAttribute("in", "Texture");
|
|
displacementMap.setAttribute("in2", "Texture");
|
|
displacementMap.setAttribute("scale", "64");
|
|
displacementMap.setAttribute("xChannelSelector", "R");
|
|
displacementMap.setAttribute("yChannelSelector", "G");
|
|
|
|
var displacemenMapFilter = createSVGElement("filter");
|
|
displacemenMapFilter.setAttribute("id", "myFilter");
|
|
displacemenMapFilter.setAttribute("filterUnit", "objectBoundingBox");
|
|
displacemenMapFilter.setAttribute("x", "0");
|
|
displacemenMapFilter.setAttribute("y", "0");
|
|
displacemenMapFilter.setAttribute("width", "1");
|
|
displacemenMapFilter.setAttribute("height", "1");
|
|
displacemenMapFilter.appendChild(image1);
|
|
displacemenMapFilter.appendChild(image2);
|
|
displacemenMapFilter.appendChild(displacementMap);
|
|
|
|
defsElement.appendChild(displacemenMapFilter);
|
|
|
|
var myRect = createSVGElement("rect");
|
|
myRect.setAttribute("x", "15");
|
|
myRect.setAttribute("y", "15");
|
|
myRect.setAttribute("width", "128");
|
|
myRect.setAttribute("height", "128");
|
|
myRect.setAttribute("filter", "url(#myFilter)");
|
|
|
|
rootSVGElement.setAttribute("height", "200");
|
|
rootSVGElement.appendChild(myRect);
|
|
|
|
shouldBeEqualToString("displacementMap.in2.baseVal", "Texture");
|
|
|
|
function repaintTest() {
|
|
displacementMap.in2.baseVal = "Map";
|
|
shouldBeEqualToString("displacementMap.in2.baseVal", "Map");
|
|
|
|
completeTest();
|
|
}
|
|
|
|
var successfullyParsed = true;
|
|
</script>
|
|
</body>
|
|
</html>
|