tor-browser

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

2d.pattern.paint.orientation.image.html (1258B)


      1 <!DOCTYPE html>
      2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
      3 <meta charset="UTF-8">
      4 <title>OffscreenCanvas test: 2d.pattern.paint.orientation.image</title>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/html/canvas/resources/canvas-tests.js"></script>
      8 
      9 <h1>2d.pattern.paint.orientation.image</h1>
     10 <p class="desc">Image patterns do not get flipped when painted</p>
     11 
     12 
     13 <script>
     14 promise_test(async t => {
     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  var response = await fetch('/images/rrgg-256x256.png')
     23  var blob = await response.blob();
     24  var img = await createImageBitmap(blob);
     25  var pattern = ctx.createPattern(img, 'no-repeat');
     26  ctx.fillStyle = pattern;
     27  ctx.save();
     28  ctx.translate(0, -103);
     29  ctx.fillRect(0, 103, 100, 50);
     30  ctx.restore();
     31 
     32  ctx.fillStyle = '#0f0';
     33  ctx.fillRect(0, 0, 100, 25);
     34 
     35  _assertPixel(canvas, 1,1, 0,255,0,255);
     36  _assertPixel(canvas, 98,1, 0,255,0,255);
     37  _assertPixel(canvas, 1,48, 0,255,0,255);
     38  _assertPixel(canvas, 98,48, 0,255,0,255);
     39 
     40 }, "Image patterns do not get flipped when painted");
     41 </script>