tor-browser

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

2d.line.width.transformed.html (2283B)


      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>Canvas test: 2d.line.width.transformed</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 <link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
      9 <body class="show_output">
     10 
     11 <h1>2d.line.width.transformed</h1>
     12 <p class="desc">Line stroke widths are affected by scale transformations</p>
     13 
     14 
     15 <p class="output">Actual output:</p>
     16 <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
     17 <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
     18 <ul id="d"></ul>
     19 <script>
     20 var t = async_test("Line stroke widths are affected by scale transformations");
     21 _addTest(function(canvas, ctx) {
     22 
     23  ctx.fillStyle = '#0f0';
     24  ctx.fillRect(0, 0, 100, 50);
     25 
     26  ctx.lineWidth = 4;
     27  // Draw a green line over a red box, to check the line is not too small
     28  ctx.fillStyle = '#f00';
     29  ctx.strokeStyle = '#0f0';
     30  ctx.fillRect(15, 15, 20, 20);
     31  ctx.save();
     32   ctx.scale(5, 1);
     33   ctx.beginPath();
     34   ctx.moveTo(5, 15);
     35   ctx.lineTo(5, 35);
     36   ctx.stroke();
     37  ctx.restore();
     38 
     39  // Draw a green box over a red line, to check the line is not too large
     40  ctx.fillStyle = '#0f0';
     41  ctx.strokeStyle = '#f00';
     42  ctx.save();
     43   ctx.scale(-5, 1);
     44   ctx.beginPath();
     45   ctx.moveTo(-15, 15);
     46   ctx.lineTo(-15, 35);
     47   ctx.stroke();
     48  ctx.restore();
     49  ctx.fillRect(65, 15, 20, 20);
     50 
     51  _assertPixel(canvas, 14,25, 0,255,0,255);
     52  _assertPixel(canvas, 15,25, 0,255,0,255);
     53  _assertPixel(canvas, 16,25, 0,255,0,255);
     54  _assertPixel(canvas, 25,25, 0,255,0,255);
     55  _assertPixel(canvas, 34,25, 0,255,0,255);
     56  _assertPixel(canvas, 35,25, 0,255,0,255);
     57  _assertPixel(canvas, 36,25, 0,255,0,255);
     58 
     59  _assertPixel(canvas, 64,25, 0,255,0,255);
     60  _assertPixel(canvas, 65,25, 0,255,0,255);
     61  _assertPixel(canvas, 66,25, 0,255,0,255);
     62  _assertPixel(canvas, 75,25, 0,255,0,255);
     63  _assertPixel(canvas, 84,25, 0,255,0,255);
     64  _assertPixel(canvas, 85,25, 0,255,0,255);
     65  _assertPixel(canvas, 86,25, 0,255,0,255);
     66 
     67 });
     68 </script>