2d.path.open.arc.worker.js (933B)
1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. 2 // OffscreenCanvas test in a worker:2d.path.open.arc 3 // Description:line caps should be drawn on open 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 be drawn on open 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.stroke(); 25 // The pixel (209, 148) is part of the line cap, but not part of the circle. 26 // Linecap is drawn with 360 degree arc, so the pixel is red. 27 _assertPixelApprox(canvas, 209,148, 255,0,0,255, 1); 28 t.done(); 29 }); 30 done();