OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <script src="../../resources/testharness.js"></script> |
2 <html> | 2 <script src="../../resources/testharnessreport.js"></script> |
3 <head> | |
4 <script src="../../resources/js-test.js"></script> | |
5 </head> | |
6 <body> | 3 <body> |
7 <script src="script-tests/canvas-closePath-single-point.js"></script> | 4 <script> |
| 5 test(function(t) { |
| 6 var ctx = document.createElement('canvas').getContext('2d'); |
| 7 |
| 8 document.body.appendChild(ctx.canvas); |
| 9 |
| 10 ctx.strokeStyle = '#f00'; |
| 11 ctx.lineWidth = 20; |
| 12 |
| 13 ctx.fillStyle = '#0f0'; |
| 14 ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height); |
| 15 |
| 16 ctx.beginPath(); |
| 17 ctx.moveTo(10, 10); |
| 18 ctx.lineTo(100, 100); |
| 19 ctx.closePath(); |
| 20 ctx.stroke(); |
| 21 |
| 22 var imageData = ctx.getImageData(0, 0, 1, 1); |
| 23 var imgdata = imageData.data; |
| 24 assert_equals(imgdata[0], 0); |
| 25 assert_equals(imgdata[1], 255); |
| 26 assert_equals(imgdata[2], 0); |
| 27 assert_equals(imgdata[3], 255); |
| 28 }, "Test the behavior of closePath on a path with a single point"); |
| 29 </script> |
8 </body> | 30 </body> |
9 </html> | |
OLD | NEW |