Merge "[Release] Webkit2-efl-123997_0.11.51" into tizen_2.1
[framework/web/webkit-efl.git] / LayoutTests / accessibility / canvas.html
1 <html>
2 <script type="text/javascript">
3
4     function drawCanvas(context) {
5         context.lineWidth = 10.0;
6         context.lineCap = "round";
7
8         context.beginPath();
9
10         // Draw a bounds rect (default color is black)
11         context.strokeRect(0, 0, 300, 300);
12
13         context.strokeStyle = "#808080";
14
15         // Draw a vertical line
16         context.moveTo(150, 100);
17         context.lineTo(150, 200);
18         context.stroke();
19
20         // Draw a horizontal line
21         context.moveTo(100, 150);
22         context.lineTo(200, 150);
23         context.stroke();
24     }
25
26     function _onload() {
27         var context = document.getElementById("myCanvas").getContext("2d");
28         drawCanvas(context);
29     }
30 </script>
31 <script>
32     if (window.testRunner)
33         testRunner.dumpAsText();
34 </script>
35 <body id="body" onload="_onload()">
36
37 <html>
38  
39     <!-- This test makes sure that a canvas element shows up as an image -->
40  
41     <canvas id="myCanvas" style="width:300px;height:300px;"  width='300' height='300' alt="canvas 1"></canvas>
42
43     <div id="result"></div>
44      
45     <script>
46         if (window.accessibilityController) {
47             var result = document.getElementById("result");
48
49             var body = document.getElementById("body");
50             body.focus();
51             var canvasElement = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(0);
52             
53             var pattern = "AXRole: AXImage";
54             if (canvasElement.allAttributes().indexOf(pattern) != -1) {
55                 result.innerText += "Test passed\n";
56             }
57             else {
58                  result.innerText += "Test failed\n" + canvasElement.allAttributes();
59             }
60         }
61     </script>
62 </body>
63 </html>