tor-browser

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

2d.pattern.paint.norepeat.outside_arc.html (1221B)


      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.outside_arc</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.outside_arc</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  ctx.fillStyle = '#f00';
     20  ctx.fillRect(0, 0, 100, 50);
     21  var response = await fetch('/images/red-16x16.png')
     22  var blob = await response.blob();
     23  var img = await createImageBitmap(blob);
     24  var pattern = ctx.createPattern(img, 'no-repeat');
     25  ctx.fillStyle = '#0f0';
     26  ctx.fillRect(0, 0, 100, 50);
     27  ctx.fillStyle = pattern;
     28  ctx.beginPath();
     29  ctx.arc(0, 0, 50, 0, Math.PI * 2);
     30  ctx.closePath();
     31  ctx.fill();
     32  ctx.fillStyle = '#0f0';
     33  ctx.fillRect(0, 0, 16, 16);
     34  _assertPixel(canvas, 1,1, 0,255,0,255);
     35  _assertPixel(canvas, 20,1, 0,255,0,255);
     36  _assertPixel(canvas, 1,20, 0,255,0,255);
     37  _assertPixel(canvas, 48,48, 0,255,0,255);
     38 
     39 }, "");
     40 </script>