tor-browser

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

2d.path.arc.scale.1.worker.js (1501B)


      1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
      2 // OffscreenCanvas test in a worker:2d.path.arc.scale.1
      3 // Description:Non-uniformly scaled arcs are the right shape
      4 // Note:
      5 
      6 importScripts("/resources/testharness.js");
      7 importScripts("/html/canvas/resources/canvas-tests.js");
      8 
      9 var t = async_test("Non-uniformly scaled arcs are the right 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  ctx.fillStyle = '#f00';
     20  ctx.fillRect(0, 0, 100, 50);
     21  ctx.scale(2, 0.5);
     22  ctx.fillStyle = '#0f0';
     23  ctx.beginPath();
     24  ctx.arc(25, 50, 56, 0, 2*Math.PI, false);
     25  ctx.fill();
     26  ctx.fillStyle = '#f00';
     27  ctx.beginPath();
     28  ctx.moveTo(-25, 50);
     29  ctx.arc(-25, 50, 24, 0, 2*Math.PI, false);
     30  ctx.moveTo(75, 50);
     31  ctx.arc(75, 50, 24, 0, 2*Math.PI, false);
     32  ctx.moveTo(25, -25);
     33  ctx.arc(25, -25, 24, 0, 2*Math.PI, false);
     34  ctx.moveTo(25, 125);
     35  ctx.arc(25, 125, 24, 0, 2*Math.PI, false);
     36  ctx.fill();
     37 
     38  _assertPixel(canvas, 0,0, 0,255,0,255);
     39  _assertPixel(canvas, 50,0, 0,255,0,255);
     40  _assertPixel(canvas, 99,0, 0,255,0,255);
     41  _assertPixel(canvas, 0,25, 0,255,0,255);
     42  _assertPixel(canvas, 50,25, 0,255,0,255);
     43  _assertPixel(canvas, 99,25, 0,255,0,255);
     44  _assertPixel(canvas, 0,49, 0,255,0,255);
     45  _assertPixel(canvas, 50,49, 0,255,0,255);
     46  _assertPixel(canvas, 99,49, 0,255,0,255);
     47  t.done();
     48 });
     49 done();