Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / custom / text-hit-test.svg
blob23824178380fd85b22c78052fa18763530c69058
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">
3 <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()">
4 <script type="text/ecmascript"><![CDATA[
5 var states = [];
6 var clicked;
7 function testClickAt(x, y) {
8 eventSender.mouseMoveTo(x, y);
9 eventSender.mouseDown();
10 eventSender.mouseUp();
11 states.push(clicked);
12 clicked = false;
14 function checkResults() {
15 var testAgainst = [true, false];
16 for (var i = 0; i < testAgainst.length; i++) {
17 if (testAgainst[i] != states[i]) {
18 alert("was: " + states);
19 alert("shouldBe: " + testAgainst);
20 return false;
23 return true;
26 function runTest() {
27 if (window.eventSender) {
28 testClickAt(91*2, 71*2);
29 testClickAt(91*2, 21*2);
30 document.getElementById("status").textContent = "Failed";
31 if (checkResults())
32 document.getElementById("status").textContent = "Passed";
33 } else {
34 // in manual mode
35 alert("Please use run-webkit-tests.");
38 ]]></script>
39 <g transform="scale(2)">
40 <text x="70" y="70" onmousedown="clicked=true;">Click me</text>
41 <text x="10" y="130" onmousedown="clicked=true;">Status:</text>
42 <text id="status" x="90" y="130" onmousedown="clicked=true;">Unknown</text>
43 </g>
44 </svg>