tor-browser

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

2d.pattern.paint.repeatx.basic.worker.js (932B)


      1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
      2 // OffscreenCanvas test in a worker:2d.pattern.paint.repeatx.basic
      3 // Description:
      4 // Note:
      5 
      6 importScripts("/resources/testharness.js");
      7 importScripts("/html/canvas/resources/canvas-tests.js");
      8 
      9 promise_test(async t => {
     10  var canvas = new OffscreenCanvas(100, 50);
     11  var ctx = canvas.getContext('2d');
     12 
     13  ctx.fillStyle = '#0f0';
     14  ctx.fillRect(0, 0, 100, 50);
     15  ctx.fillStyle = '#f00';
     16  ctx.fillRect(0, 0, 100, 16);
     17 
     18  var response = await fetch('/images/green-16x16.png')
     19  var blob = await response.blob();
     20  var img = await createImageBitmap(blob);
     21  var pattern = ctx.createPattern(img, 'repeat-x');
     22  ctx.fillStyle = pattern;
     23  ctx.fillRect(0, 0, 100, 50);
     24 
     25  _assertPixel(canvas, 1,1, 0,255,0,255);
     26  _assertPixel(canvas, 98,1, 0,255,0,255);
     27  _assertPixel(canvas, 1,48, 0,255,0,255);
     28  _assertPixel(canvas, 98,48, 0,255,0,255);
     29 }, "");
     30 done();