tor-browser

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

2d.pattern.paint.norepeat.coord2.html (1122B)


      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.norepeat.coord2</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.norepeat.coord2</h1>
     10 <p class="desc"></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  var response = await fetch('/images/green.png')
     20  var blob = await response.blob();
     21  var img = await createImageBitmap(blob);
     22  var pattern = ctx.createPattern(img, 'no-repeat');
     23  ctx.fillStyle = pattern;
     24  ctx.fillRect(0, 0, 50, 50);
     25 
     26  ctx.fillStyle = '#f00';
     27  ctx.fillRect(50, 0, 50, 50);
     28 
     29  ctx.fillStyle = pattern;
     30  ctx.translate(50, 0);
     31  ctx.fillRect(-50, 0, 100, 50);
     32 
     33  _assertPixel(canvas, 1,1, 0,255,0,255);
     34  _assertPixel(canvas, 98,1, 0,255,0,255);
     35  _assertPixel(canvas, 1,48, 0,255,0,255);
     36  _assertPixel(canvas, 98,48, 0,255,0,255);
     37 
     38 }, "");
     39 </script>