| 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> | |
| 7 <canvas id="canvas" width="100" height="100"></canvas> | 3 <canvas id="canvas" width="100" height="100"></canvas> |
| 4 |
| 8 <script> | 5 <script> |
| 9 description("Bug 55696: Series of tests to ensure zero-length arc extends curren
t subpath"); | 6 function shouldBeBlackPixel(ctx, x, y) |
| 10 var ctx = document.getElementById('canvas').getContext('2d'); | |
| 11 ctx.lineWidth = 4; | |
| 12 | |
| 13 function shouldBeBlackPixel(x,y) | |
| 14 { | 7 { |
| 15 var data = ctx.getImageData(x, y, 1, 1).data; | 8 var data = ctx.getImageData(x, y, 1, 1).data; |
| 16 if (data[0] != 0 || data[1] != 0 || data[2] != 0 || data[3] != 255) { | 9 assert_equals(data[0], 0); |
| 17 testFailed("Pixel (" + x + "," + y + ") should be black; " + | 10 assert_equals(data[1], 0); |
| 18 "was [" + data[0] + "," + data[1] + "," + data[2] + "," + dat
a[3] + "]"); | 11 assert_equals(data[2], 0); |
| 19 } else { | 12 assert_equals(data[3], 255); |
| 20 testPassed("Pixel (" + x + "," + y + ") is black."); | |
| 21 } | |
| 22 } | 13 } |
| 23 | 14 |
| 24 // moveTo + empty arc (swing == 0) | 15 test(function(t) { |
| 25 ctx.beginPath(); | 16 var ctx = document.getElementById('canvas').getContext('2d'); |
| 26 ctx.moveTo(20, 20); | 17 ctx.lineWidth = 4; |
| 27 ctx.arc(80, 30, 10, -Math.PI/2, -Math.PI/2, true); | 18 |
| 28 ctx.stroke(); | 19 // moveTo + empty arc (swing == 0) |
| 29 shouldBeBlackPixel(50, 20); | 20 ctx.beginPath(); |
| 30 | 21 ctx.moveTo(20, 20); |
| 31 // moveTo + empty arc (radius == 0) | 22 ctx.arc(80, 30, 10, -Math.PI/2, -Math.PI/2, true); |
| 32 ctx.beginPath(); | 23 ctx.stroke(); |
| 33 ctx.moveTo(20, 40); | 24 shouldBeBlackPixel(ctx, 50, 20); |
| 34 ctx.arc(80, 40, 0, 0, 6, false); | 25 |
| 35 ctx.stroke(); | 26 // moveTo + empty arc (radius == 0) |
| 36 shouldBeBlackPixel(50, 40) | 27 ctx.beginPath(); |
| 37 | 28 ctx.moveTo(20, 40); |
| 38 // empty arc (swing == 0) + lineTo | 29 ctx.arc(80, 40, 0, 0, 6, false); |
| 39 ctx.beginPath(); | 30 ctx.stroke(); |
| 40 ctx.arc(20, 50, 10, Math.PI/2, Math.PI/2, false); | 31 shouldBeBlackPixel(ctx, 50, 40) |
| 41 ctx.lineTo(80, 60); | 32 |
| 42 ctx.stroke(); | 33 // empty arc (swing == 0) + lineTo |
| 43 shouldBeBlackPixel(50, 60); | 34 ctx.beginPath(); |
| 44 | 35 ctx.arc(20, 50, 10, Math.PI/2, Math.PI/2, false); |
| 45 // empty arc (radius == 0) + lineTo | 36 ctx.lineTo(80, 60); |
| 46 ctx.beginPath(); | 37 ctx.stroke(); |
| 47 ctx.arc(20, 80, 0, 0, 6, false); | 38 shouldBeBlackPixel(ctx, 50, 60); |
| 48 ctx.lineTo(80, 80); | 39 |
| 49 ctx.stroke(); | 40 // empty arc (radius == 0) + lineTo |
| 50 shouldBeBlackPixel(50, 80); | 41 ctx.beginPath(); |
| 42 ctx.arc(20, 80, 0, 0, 6, false); |
| 43 ctx.lineTo(80, 80); |
| 44 ctx.stroke(); |
| 45 shouldBeBlackPixel(ctx, 50, 80); |
| 46 }, 'Series of tests to ensure zero-length arc extends current subpath (bug 55696
)'); |
| 51 </script> | 47 </script> |
| 52 </body> | |
| 53 </html> | |
| OLD | NEW |