1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/elm/test_canvas.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,55 @@ 1.4 +<!DOCTYPE html> 1.5 +<html> 1.6 +<head> 1.7 + <title>Accessible boundaries for hit regions</title> 1.8 + <link rel="stylesheet" type="text/css" 1.9 + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 1.10 + 1.11 + <script type="application/javascript" 1.12 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <script type="application/javascript" 1.14 + src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> 1.15 + 1.16 + <script type="application/javascript" 1.17 + src="../common.js"></script> 1.18 + <script type="application/javascript" 1.19 + src="../role.js"></script> 1.20 + <script type="application/javascript" 1.21 + src="../layout.js"></script> 1.22 + 1.23 + <script type="application/javascript"> 1.24 + SpecialPowers.setBoolPref("canvas.hitregions.enabled", true); 1.25 + 1.26 + function doTest() 1.27 + { 1.28 + var canv = document.getElementById("c"); 1.29 + var context = canv.getContext('2d'); 1.30 + var element = document.getElementById("showA"); 1.31 + context.beginPath(); 1.32 + context.rect(10, 10, 150, 100); 1.33 + context.addHitRegion({control: element}); 1.34 + var input = getAccessible("showA"); 1.35 + var input = getAccessible("showA"); 1.36 + var [cnvX, cnvY, cnvWidth, cnvHeight] = getBoundsForDOMElm(canv); 1.37 + var [accX, accY, accWidth, accHeight] = getBounds(input); 1.38 + is(accX, cnvX + 10, "accX should be 10 and not " + accX); 1.39 + is(accY, cnvY + 10, "accY should be 10 and not " + accY); 1.40 + is(accWidth, 150, "accWidth should be 150 and not " + accWidth); 1.41 + is(accHeight, 100, "accHeight should be 100 and not " + accHeight); 1.42 + 1.43 + SpecialPowers.setBoolPref("canvas.hitregions.enabled", false); 1.44 + SimpleTest.finish(); 1.45 + } 1.46 + 1.47 + SimpleTest.waitForExplicitFinish(); 1.48 + addA11yLoadEvent(doTest); 1.49 + </script> 1.50 +</head> 1.51 +<body> 1.52 + 1.53 + <canvas id="c"> 1.54 + <input id="showA" type="checkbox"><label for="showA"> Show As </label> 1.55 + </canvas> 1.56 + 1.57 +</body> 1.58 +</html>