| 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 105650: Test correct rendering of quadratic and bezier curves w
ith coincident endpoints"); | 6 test(function(t) { |
| 10 var ctx = document.getElementById('canvas').getContext('2d'); | 7 var ctx = document.getElementById('canvas').getContext('2d'); |
| 11 var data; | 8 var data; |
| 12 | 9 |
| 13 function shouldBeYellow(x,y) | 10 function shouldBeYellow(x,y) |
| 14 { | 11 { |
| 15 » blue_value = ctx.getImageData(x, y, 1, 1).data[2]; | 12 blue_value = ctx.getImageData(x, y, 1, 1).data[2]; |
| 16 » shouldBe("blue_value", "0"); | 13 assert_equals(blue_value, 0); |
| 17 } | 14 } |
| 18 | 15 |
| 19 function shouldBeBlue(x,y) | 16 function shouldBeBlue(x,y) |
| 20 { | 17 { |
| 21 » blue_value = ctx.getImageData(x, y, 1, 1).data[2]; | 18 blue_value = ctx.getImageData(x, y, 1, 1).data[2]; |
| 22 » shouldBe("blue_value", "255"); | 19 assert_equals(blue_value, 255); |
| 23 } | 20 } |
| 24 | 21 |
| 25 ctx.fillStyle = '#00f'; | 22 ctx.fillStyle = '#00f'; |
| 26 ctx.strokeStyle = '#ff0'; | 23 ctx.strokeStyle = '#ff0'; |
| 27 ctx.lineWidth = 30; | 24 ctx.lineWidth = 30; |
| 28 | 25 |
| 29 ctx.beginPath(); | 26 ctx.beginPath(); |
| 30 ctx.fillRect(0,0,100,100); | 27 ctx.fillRect(0,0,100,100); |
| 31 ctx.moveTo(0,0); | 28 ctx.moveTo(0,0); |
| 32 | 29 |
| 33 // bezier curve with coincident endpoints, horizontal line | 30 // bezier curve with coincident endpoints, horizontal line |
| 34 ctx.bezierCurveTo(0,0,200,0,0,0); | 31 ctx.bezierCurveTo(0,0,200,0,0,0); |
| 35 shouldBeBlue(50,0); | 32 shouldBeBlue(50,0); |
| 36 ctx.stroke(); | 33 ctx.stroke(); |
| 37 shouldBeYellow(50,0); | 34 shouldBeYellow(50,0); |
| 38 shouldBeBlue(0,50); | 35 shouldBeBlue(0,50); |
| 39 shouldBeBlue(70,70); | 36 shouldBeBlue(70,70); |
| 40 | 37 |
| 41 // bezier curve with coincident endpoints, vertical line | 38 // bezier curve with coincident endpoints, vertical line |
| 42 ctx.bezierCurveTo(0,200,0,0,0,0); | 39 ctx.bezierCurveTo(0,200,0,0,0,0); |
| 43 ctx.stroke(); | 40 ctx.stroke(); |
| 44 shouldBeYellow(50,0); | 41 shouldBeYellow(50,0); |
| 45 shouldBeBlue(75,75); | 42 shouldBeBlue(75,75); |
| 46 | 43 |
| 47 // bezier curve with coincident endpoints | 44 // bezier curve with coincident endpoints |
| 48 ctx.bezierCurveTo(200,0,0,200,0,0); | 45 ctx.bezierCurveTo(200,0,0,200,0,0); |
| 49 ctx.stroke(); | 46 ctx.stroke(); |
| 50 shouldBeYellow(75,75); | 47 shouldBeYellow(75,75); |
| 51 | 48 }, 'Test correct rendering of quadratic and bezier curves with coincident endpoi
nts (bug 105650)'); |
| 52 | |
| 53 </script> | 49 </script> |
| 54 </body> | |
| 55 </html> | |
| OLD | NEW |