2010-11-30 Rob Buis <rwlbuis@gmail.com>
[WebKit-https.git] / LayoutTests / svg / dynamic-updates / script-tests / SVGLineElement-dom-requiredFeatures.js
1 // [Name] SVGLineElement-dom-requiredFeatures.js
2 // [Expected rendering result] a series of PASS messages
3
4 createSVGTestCase();
5
6 var lineElement = createSVGElement("line");
7 lineElement.setAttribute("x1", "20");
8 lineElement.setAttribute("y1", "20");
9 lineElement.setAttribute("x2", "200");
10 lineElement.setAttribute("y2", "200");
11 lineElement.setAttribute("stroke", "green");
12 lineElement.setAttribute("stroke-width", "10px");
13
14 rootSVGElement.appendChild(lineElement);
15
16 function executeTest() {
17     debug("Check that SVGLineElement is initially displayed");
18     shouldBeEqualToString("document.defaultView.getComputedStyle(lineElement, null).display", "inline");
19     debug("Check that setting requiredFeatures to something invalid makes it not render");
20     lineElement.setAttribute("requiredFeatures", "foo");
21     shouldBeEqualToString("document.defaultView.getComputedStyle(lineElement, null).display", "");
22     debug("Check that setting requiredFeatures to something valid makes it render again");
23     lineElement.setAttribute("requiredFeatures", "http://www.w3.org/TR/SVG11/feature#Shape");
24     shouldBeEqualToString("document.defaultView.getComputedStyle(lineElement, null).display", "inline");
25     debug("Check that adding something valid to requiredFeatures keeps rendering the element");
26     lineElement.setAttribute("requiredFeatures", "http://www.w3.org/TR/SVG11/feature#Gradient");
27     shouldBeEqualToString("document.defaultView.getComputedStyle(lineElement, null).display", "inline");
28     debug("Check that adding something invalid to requiredFeatures makes it not render");
29     lineElement.setAttribute("requiredFeatures", "foo");
30     shouldBeEqualToString("document.defaultView.getComputedStyle(lineElement, null).display", "");
31
32     completeTest();
33 }
34
35 startTest(lineElement, 20, 20);
36
37 var successfullyParsed = true;