blob: 7b461f243ad961676d9f0a1f49744feda1ca550c [file] [log] [blame]
This test ensures that a focus ring is drawn.
<canvas id="canvas" class="output" width="30" height="30">
<button id="button1"></button>
</canvas>
<div id="console"></div>
<script>
if (window.testRunner)
testRunner.dumpAsText();
var button1 = document.getElementById("button1");
var canvas = document.getElementById("canvas").getContext("2d");
var path = new Path2D();
path.rect(10, 10, 10, 10);
canvas.drawFocusIfNeeded(path, button1);
var imagedata = canvas.getImageData(0, 0, 30, 30);
var total = 0;
for(var x = 0; x < 30 * 30 * 4; x++)
total += imagedata.data[x];
if (total != 0)
document.getElementById("console").innerHTML = "TEST PASSED";
else
{
button1.focus();
canvas.drawFocusIfNeeded(path, button1);
imagedata = canvas.getImageData(0, 0, 30, 30);
for(var x = 0; x < 30 * 30* 4; x++)
total += imagedata.data[x];
if (total != 0)
document.getElementById("console").innerHTML = "TEST PASSED";
else
document.getElementById("console").innerHTML = "TEST FAILED";
}
</script>