2d.path.closed.arc.html (1151B)
1 <!DOCTYPE html> 2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> 3 <meta charset="UTF-8"> 4 <title>OffscreenCanvas test: 2d.path.closed.arc</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/html/canvas/resources/canvas-tests.js"></script> 8 9 <h1>2d.path.closed.arc</h1> 10 <p class="desc">line caps should not be drawn on closed arcs</p> 11 12 13 <script> 14 var t = async_test("line caps should not be drawn on closed arcs"); 15 var t_pass = t.done.bind(t); 16 var t_fail = t.step_func(function(reason) { 17 throw reason; 18 }); 19 t.step(function() { 20 21 var canvas = new OffscreenCanvas(300, 300); 22 var ctx = canvas.getContext('2d'); 23 24 ctx.beginPath(); 25 ctx.strokeStyle = 'red'; 26 ctx.lineWidth = 20; 27 ctx.lineCap = 'square'; 28 ctx.arc(150, 150, 50, 0, 2 * Math.PI); 29 ctx.closePath(); 30 ctx.stroke(); 31 // The pixel (209, 148) is part of the line cap, but not part of the circle. 32 // Linecap is not drawn if the circle is closed, so the pixel is not red. 33 assert_not_equals(ctx.getImageData(209, 148, 1, 1).data, [255, 0, 0, 255]) 34 t.done(); 35 36 }); 37 </script>