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