blob: 7f4ea9ab461194125ed177c42b7ba6af8f4efea0 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
<svg version="1.1" baseProfile="basic" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" onload="runTest()">
<script type="text/ecmascript"><![CDATA[
var states = [];
var clicked;
function testClickAt(x, y) {
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
eventSender.mouseUp();
states.push(clicked);
clicked = false;
}
function checkResults() {
var testAgainst = [true, false];
for (var i = 0; i < testAgainst.length; i++) {
if (testAgainst[i] != states[i]) {
alert("was: " + states);
alert("shouldBe: " + testAgainst);
return false;
}
}
return true;
}
function runTest() {
if (window.eventSender) {
testClickAt(105, 55);
testClickAt(95, 55);
document.getElementById("status").textContent = "Failed";
if (checkResults())
document.getElementById("status").textContent = "Passed";
} else {
// in manual mode
alert("Please use run-webkit-tests.");
}
}
]]></script>
<defs>
<symbol id="buttonRect" overflow="hidden">
<rect x="-70" y="-10" width="140" height="20" fill="gainsboro" stroke="dimgray" stroke-width="1" />
</symbol>
</defs>
<use x="100" y="50" onmousedown="clicked=true;" xlink:href="#buttonRect"/>
<text id="status" x="90" y="130">Unknown</text>
</svg>