1 // Force activating pixel tests - this variable is used in resources/js-test.js, when calling setDumpAsText().
2 window
.enablePixelTesting
= true;
4 var svgNS
= "http://www.w3.org/2000/svg";
5 var xlinkNS
= "http://www.w3.org/1999/xlink";
6 var xhtmlNS
= "http://www.w3.org/1999/xhtml";
11 function createSVGElement(name
) {
12 return document
.createElementNS(svgNS
, "svg:" + name
);
15 function shouldHaveBBox(element
, width
, height
)
17 shouldBe(element
+ ".getBBox().width", width
);
18 shouldBe(element
+ ".getBBox().height", height
);
21 function createSVGTestCase() {
22 window
.jsTestIsAsync
= true;
23 rootSVGElement
= createSVGElement("svg");
24 rootSVGElement
.setAttribute("width", "300");
25 rootSVGElement
.setAttribute("height", "300");
27 var bodyElement
= document
.documentElement
.lastChild
;
28 bodyElement
.insertBefore(rootSVGElement
, document
.getElementById("description"));
31 function embedSVGTestCase(uri
) {
32 window
.jsTestIsAsync
= true;
33 iframeElement
= document
.createElement("iframe");
34 iframeElement
.setAttribute("style", "width: 300px; height: 300px;");
35 iframeElement
.setAttribute("src", uri
);
36 iframeElement
.setAttribute("onload", "iframeLoaded()");
38 var bodyElement
= document
.documentElement
.lastChild
;
39 bodyElement
.insertBefore(iframeElement
, document
.getElementById("description"));
42 function iframeLoaded() {
43 rootSVGElement
= iframeElement
.getSVGDocument().rootElement
;
46 function clickAt(x
, y
) {
47 // Translation due to <h1> above us
48 x
= x
+ rootSVGElement
.offsetLeft
;
49 y
= y
+ rootSVGElement
.offsetTop
;
51 if (window
.eventSender
) {
52 eventSender
.mouseMoveTo(x
, y
);
53 eventSender
.mouseDown();
54 eventSender
.mouseUp();
58 function completeTest() {