tor-browser

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

2d.path.stroke.scale1.worker.js (1387B)


      1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
      2 // OffscreenCanvas test in a worker:2d.path.stroke.scale1
      3 // Description:Stroke line widths are scaled by the current transformation matrix
      4 // Note:
      5 
      6 importScripts("/resources/testharness.js");
      7 importScripts("/html/canvas/resources/canvas-tests.js");
      8 
      9 var t = async_test("Stroke line widths are scaled by the current transformation matrix");
     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 
     22  ctx.beginPath();
     23  ctx.rect(25, 12.5, 50, 25);
     24  ctx.save();
     25  ctx.scale(50, 25);
     26  ctx.strokeStyle = '#0f0';
     27  ctx.stroke();
     28  ctx.restore();
     29 
     30  ctx.beginPath();
     31  ctx.rect(-25, -12.5, 150, 75);
     32  ctx.save();
     33  ctx.scale(50, 25);
     34  ctx.strokeStyle = '#f00';
     35  ctx.stroke();
     36  ctx.restore();
     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();