tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

2d.path.arcTo.shape.curve2.worker.js (1640B)


      1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
      2 // OffscreenCanvas test in a worker:2d.path.arcTo.shape.curve2
      3 // Description:arcTo() curves in the right kind of shape
      4 // Note:
      5 
      6 importScripts("/resources/testharness.js");
      7 importScripts("/html/canvas/resources/canvas-tests.js");
      8 
      9 var t = async_test("arcTo() curves in the right kind of shape");
     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(100, 50);
     17  var ctx = canvas.getContext('2d');
     18 
     19  var tol = 1.5; // tolerance to avoid antialiasing artifacts
     20 
     21  ctx.fillStyle = '#0f0';
     22  ctx.fillRect(0, 0, 100, 50);
     23 
     24  ctx.fillStyle = '#f00';
     25  ctx.beginPath();
     26  ctx.rect(10, 20, 45, 10);
     27  ctx.moveTo(80, 45);
     28  ctx.arc(55, 45, 25-tol, 0, -Math.PI/2, true);
     29  ctx.arc(55, 45, 15+tol, -Math.PI/2, 0, false);
     30  ctx.fill();
     31 
     32  ctx.strokeStyle = '#0f0';
     33  ctx.lineWidth = 10;
     34  ctx.beginPath();
     35  ctx.moveTo(10, 25);
     36  ctx.arcTo(75, 25, 75, 60, 20);
     37  ctx.stroke();
     38 
     39  _assertPixel(canvas, 50,25, 0,255,0,255);
     40  _assertPixel(canvas, 55,19, 0,255,0,255);
     41  _assertPixel(canvas, 55,20, 0,255,0,255);
     42  _assertPixel(canvas, 55,21, 0,255,0,255);
     43  _assertPixel(canvas, 64,22, 0,255,0,255);
     44  _assertPixel(canvas, 65,21, 0,255,0,255);
     45  _assertPixel(canvas, 72,28, 0,255,0,255);
     46  _assertPixel(canvas, 73,27, 0,255,0,255);
     47  _assertPixel(canvas, 78,36, 0,255,0,255);
     48  _assertPixel(canvas, 79,35, 0,255,0,255);
     49  _assertPixel(canvas, 80,44, 0,255,0,255);
     50  _assertPixel(canvas, 80,45, 0,255,0,255);
     51  _assertPixel(canvas, 80,46, 0,255,0,255);
     52  t.done();
     53 });
     54 done();