| Index: LayoutTests/fast/canvas/draw-system-focus-ring.html
|
| diff --git a/LayoutTests/fast/canvas/draw-system-focus-ring.html b/LayoutTests/fast/canvas/draw-system-focus-ring.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..bdfb7574df3cc6563f754ddf7b401b3fcad618d5
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/canvas/draw-system-focus-ring.html
|
| @@ -0,0 +1,52 @@
|
| +<!DOCTYPE HTML>
|
| +<head>
|
| +<title>Canvas test: drawSystemFocusRing</title>
|
| +<script src="../js/resources/js-test-pre.js"></script>
|
| +</head>
|
| +<body style="padding: 0; margin: 0">
|
| +<canvas id="canvas" class="output" width="300" height="350">
|
| + <button id="button1" style="outline: solid 10px #900"></button>
|
| + <button id="button2" style="outline: solid 10px #090"></button>
|
| +</canvas>
|
| +<script>
|
| +if (window.testRunner)
|
| + testRunner.dumpAsText();
|
| +
|
| +// Level of tolerance we expect of most pixel comparisons in this test.
|
| +function shouldBeAlmost(_a, _b)
|
| +{
|
| + shouldBeCloseTo(_a, _b, 2);
|
| +}
|
| +
|
| +document.getElementById('button1').focus();
|
| +
|
| +var canvas = document.getElementById("canvas").getContext("2d");
|
| +canvas.beginPath();
|
| +canvas.rect(50, 50, 200, 100);
|
| +canvas.fillStyle = '#fcc';
|
| +canvas.fill();
|
| +canvas.drawSystemFocusRing(document.getElementById('button1'));
|
| +
|
| +canvas.beginPath();
|
| +canvas.rect(50, 200, 200, 100);
|
| +canvas.fillStyle = '#cfc';
|
| +canvas.fill();
|
| +canvas.drawSystemFocusRing(document.getElementById('button2'));
|
| +
|
| +// The top rect's focus ring is tied to button1, which is focused.
|
| +// It should have a #900 border.
|
| +var imageData = canvas.getImageData(49, 49, 1, 1);
|
| +var data = imageData.data;
|
| +shouldBeAlmost('data[0]', 153);
|
| +shouldBeAlmost('data[1]', 0);
|
| +shouldBeAlmost('data[2]', 0);
|
| +
|
| +// The bottom rect's focus ring is tied to button2, which is not focused.
|
| +imageData = canvas.getImageData(49, 199, 1, 1);
|
| +data = imageData.data;
|
| +shouldBeAlmost('data[0]', 0);
|
| +shouldBeAlmost('data[1]', 0);
|
| +shouldBeAlmost('data[2]', 0);
|
| +</script>
|
| +<script src="../js/resources/js-test-post.js"></script>
|
| +</body>
|
|
|