OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Test that when image map areas have their shape or coordinate dynamically
altered, the clickable region changes.</title> |
3 <head> | 3 <script src="../../resources/testharness.js"></script> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
5 </head> | 5 <img usemap="#m" style="height:400px; width:400px; border:1px solid red; positio
n:absolute; left:0; right:0" > |
6 <body> | 6 <map name="m"> |
7 <script src="script-tests/imagemap-dynamic-area-updates.js"></script> | 7 <area href="#" onclick="areaClicked = true; return false;"> |
8 </body> | 8 </map> |
9 </html> | 9 <script> |
| 10 test(function() { |
| 11 var area = document.querySelector('area'); |
| 12 function checkPointInArea(shape, coords, x, y) { |
| 13 area.setAttribute('shape', shape); |
| 14 area.setAttribute('coords', coords); |
| 15 areaClicked = false; |
| 16 // TODO(siva.gunturi): Use elementFromPoint here. |
| 17 eventSender.mouseMoveTo(x, y); |
| 18 eventSender.mouseDown(); |
| 19 eventSender.mouseUp(); |
| 20 return areaClicked; |
| 21 } |
| 22 assert_true(checkPointInArea('default', '', 50, 50)); |
| 23 assert_true(checkPointInArea('default', '', 50, 50)); |
| 24 assert_true(checkPointInArea('rect', '0, 0, 100, 100', 50, 50)); |
| 25 assert_false(checkPointInArea('rect', '0, 0, 100, 100', 150, 150)); |
| 26 assert_false(checkPointInArea('rect', '200, 200, 300, 300', 50, 50)); |
| 27 assert_true(checkPointInArea('rect', '200, 200, 300, 300', 250, 250)); |
| 28 assert_true(checkPointInArea('circle', '100, 100, 50', 100, 100)); |
| 29 assert_true(checkPointInArea('circle', '100, 100, 50', 120, 100)); |
| 30 assert_false(checkPointInArea('circle', '100, 100, 50', 200, 100)); |
| 31 assert_false(checkPointInArea('circle', '300, 300, 50', 100, 100)); |
| 32 assert_true(checkPointInArea('circle', '300, 300, 50', 300, 300)); |
| 33 assert_true(checkPointInArea('circle', '300, 300, 50', 320, 300)); |
| 34 assert_true(checkPointInArea('poly', '100, 100, 200, 100, 200, 200', 150, 15
0)); |
| 35 assert_false(checkPointInArea('poly', '100, 100, 200, 100, 200, 200', 100, 1
50)); |
| 36 assert_false(checkPointInArea('poly', '100, 100, 200, 100, 200, 200', 300, 3
00)); |
| 37 assert_true(checkPointInArea('default', '', 300, 300)); |
| 38 }); |
| 39 </script> |
OLD | NEW |