tor-browser

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

2d.drawImage.negativedir.html (1516B)


      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.drawImage.negativedir</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.drawImage.negativedir</h1>
     10 <p class="desc">Negative dimensions do not affect the direction of the image</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  const response = await fetch('/images/ggrr-256x256.png');
     22  const blob = await response.blob();
     23  const bitmap = await createImageBitmap(blob);
     24  ctx.drawImage(bitmap, 0, 178, 50, -100, 0, 0, 50, 100);
     25  ctx.drawImage(bitmap, 0, 78, 50, 100, 50, 100, 50, -100);
     26  _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2);
     27  _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2);
     28  _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2);
     29  _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2);
     30  _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2);
     31  _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2);
     32  _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2);
     33  _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2);
     34  _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2);
     35  _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2);
     36 
     37 }, "Negative dimensions do not affect the direction of the image");
     38 </script>