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 <canvas id="canvas" width="100" height="100"></canvas> | 4 <canvas id="canvas" width="100" height="100"></canvas> |
8 <script> | 5 <script> |
9 description("Bug 105650: Test correct rendering of quadratic and bezier curves w
ith coincident endpoints"); | |
10 var ctx = document.getElementById('canvas').getContext('2d'); | 6 var ctx = document.getElementById('canvas').getContext('2d'); |
11 var data; | |
12 | 7 |
13 function shouldBeYellow(x,y) | 8 function shouldBeYellow(x, y) |
14 { | 9 { |
15 » blue_value = ctx.getImageData(x, y, 1, 1).data[2]; | 10 blue_value = ctx.getImageData(x, y, 1, 1).data[2]; |
16 » shouldBe("blue_value", "0"); | 11 assert_equals(blue_value, 0); |
17 } | 12 } |
18 | 13 |
19 function shouldBeBlue(x,y) | 14 function shouldBeBlue(x, y) |
20 { | 15 { |
21 » blue_value = ctx.getImageData(x, y, 1, 1).data[2]; | 16 blue_value = ctx.getImageData(x, y, 1, 1).data[2]; |
22 » shouldBe("blue_value", "255"); | 17 assert_equals(blue_value, 255); |
23 } | 18 } |
24 | 19 |
25 ctx.fillStyle = '#00f'; | 20 test(function(t) { |
26 ctx.strokeStyle = '#ff0'; | 21 ctx.fillStyle = '#00f'; |
27 ctx.lineWidth = 30; | 22 ctx.strokeStyle = '#ff0'; |
28 | 23 ctx.lineWidth = 30; |
29 ctx.beginPath(); | 24 |
30 ctx.fillRect(0,0,100,100); | 25 ctx.beginPath(); |
31 | 26 ctx.fillRect(0, 0, 100, 100); |
32 // quadratic with coincident endpoint | 27 |
33 ctx.moveTo(20,20); | 28 // quadratic with coincident endpoint |
34 | 29 ctx.moveTo(20, 20); |
35 //Next line should be close to ctx.bezierCurveTo(81,80,80,80,20,20); | 30 |
36 ctx.quadraticCurveTo(110,110,20,20); | 31 //Next line should be close to ctx.bezierCurveTo(81, 80, 80, 80, 20, 20); |
37 | 32 ctx.quadraticCurveTo(110, 110, 20, 20); |
38 shouldBeBlue(70,70); | 33 |
39 ctx.stroke(); | 34 shouldBeBlue(70, 70); |
40 shouldBeYellow(70,70); | 35 ctx.stroke(); |
| 36 shouldBeYellow(70, 70); |
| 37 }, "Bug 105650: Test correct rendering of quadratic and bezier curves with coinc
ident endpoints"); |
41 | 38 |
42 </script> | 39 </script> |
43 </body> | 40 </body> |
44 </html> | |
OLD | NEW |