tor-browser

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

2d.pattern.paint.orientation.image.worker.js (1090B)


      1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
      2 // OffscreenCanvas test in a worker:2d.pattern.paint.orientation.image
      3 // Description:Image patterns do not get flipped when painted
      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 = '#f00';
     14  ctx.fillRect(0, 0, 100, 50);
     15 
     16  var response = await fetch('/images/rrgg-256x256.png')
     17  var blob = await response.blob();
     18  var img = await createImageBitmap(blob);
     19  var pattern = ctx.createPattern(img, 'no-repeat');
     20  ctx.fillStyle = pattern;
     21  ctx.save();
     22  ctx.translate(0, -103);
     23  ctx.fillRect(0, 103, 100, 50);
     24  ctx.restore();
     25 
     26  ctx.fillStyle = '#0f0';
     27  ctx.fillRect(0, 0, 100, 25);
     28 
     29  _assertPixel(canvas, 1,1, 0,255,0,255);
     30  _assertPixel(canvas, 98,1, 0,255,0,255);
     31  _assertPixel(canvas, 1,48, 0,255,0,255);
     32  _assertPixel(canvas, 98,48, 0,255,0,255);
     33 }, "Image patterns do not get flipped when painted");
     34 done();