Rubber-stamped by Brady Eidson.
[webbrowser.git] / LayoutTests / accessibility / canvas.html
blob7432fe143f1feb9179bcdf4f7e22649b4db77992
1 <html>
2 <script type="text/javascript">
4 function drawCanvas(context) {
5 context.lineWidth = 10.0;
6 context.lineCap = "round";
8 context.beginPath();
10 // Draw a bounds rect (default color is black)
11 context.strokeRect(0, 0, 300, 300);
13 context.strokeStyle = "#808080";
15 // Draw a vertical line
16 context.moveTo(150, 100);
17 context.lineTo(150, 200);
18 context.stroke();
20 // Draw a horizontal line
21 context.moveTo(100, 150);
22 context.lineTo(200, 150);
23 context.stroke();
26 function _onload() {
27 var context = document.getElementById("myCanvas").getContext("2d");
28 drawCanvas(context);
30 </script>
31 <script>
32 if (window.layoutTestController)
33 layoutTestController.dumpAsText();
34 </script>
35 <body id="body" onload="_onload()">
37 <html>
39 <!-- This test makes sure that a canvas element shows up as an image -->
41 <canvas id="myCanvas" style="width:300px;height:300px;" width='300' height='300' alt="canvas 1"></canvas>
43 <div id="result"></div>
45 <script>
46 if (window.accessibilityController) {
47 var result = document.getElementById("result");
49 var body = document.getElementById("body");
50 body.focus();
51 var canvasElement = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(0);
53 var pattern = "AXRole: AXImage";
54 if (canvasElement.allAttributes().indexOf(pattern) != -1) {
55 result.innerText += "Test passed\n";
57 else {
58 result.innerText += "Test failed\n" + canvasElement.allAttributes();
61 </script>
62 </body>
63 </html>