tor-browser

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

2d.line.join.bevel.html (2214B)


      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.join.bevel</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.join.bevel</h1>
     12 <p class="desc">lineJoin 'bevel' is rendered correctly</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("lineJoin 'bevel' is rendered correctly");
     21 _addTest(function(canvas, ctx) {
     22 
     23  ctx.fillStyle = '#0f0';
     24  ctx.fillRect(0, 0, 100, 50);
     25 
     26  var tol = 1; // tolerance to avoid antialiasing artifacts
     27 
     28  ctx.lineJoin = 'bevel';
     29  ctx.lineWidth = 20;
     30 
     31  ctx.fillStyle = '#f00';
     32  ctx.strokeStyle = '#0f0';
     33 
     34  ctx.fillRect(10, 10, 20, 20);
     35  ctx.fillRect(20, 20, 20, 20);
     36  ctx.beginPath();
     37  ctx.moveTo(30, 20);
     38  ctx.lineTo(40-tol, 20);
     39  ctx.lineTo(30, 10+tol);
     40  ctx.fill();
     41 
     42  ctx.beginPath();
     43  ctx.moveTo(10, 20);
     44  ctx.lineTo(30, 20);
     45  ctx.lineTo(30, 40);
     46  ctx.stroke();
     47 
     48 
     49  ctx.fillStyle = '#0f0';
     50  ctx.strokeStyle = '#f00';
     51 
     52  ctx.beginPath();
     53  ctx.moveTo(60, 20);
     54  ctx.lineTo(80, 20);
     55  ctx.lineTo(80, 40);
     56  ctx.stroke();
     57 
     58  ctx.fillRect(60, 10, 20, 20);
     59  ctx.fillRect(70, 20, 20, 20);
     60  ctx.beginPath();
     61  ctx.moveTo(80, 20);
     62  ctx.lineTo(90+tol, 20);
     63  ctx.lineTo(80, 10-tol);
     64  ctx.fill();
     65 
     66  _assertPixel(canvas, 34,16, 0,255,0,255);
     67  _assertPixel(canvas, 34,15, 0,255,0,255);
     68  _assertPixel(canvas, 35,15, 0,255,0,255);
     69  _assertPixel(canvas, 36,15, 0,255,0,255);
     70  _assertPixel(canvas, 36,14, 0,255,0,255);
     71 
     72  _assertPixel(canvas, 84,16, 0,255,0,255);
     73  _assertPixel(canvas, 84,15, 0,255,0,255);
     74  _assertPixel(canvas, 85,15, 0,255,0,255);
     75  _assertPixel(canvas, 86,15, 0,255,0,255);
     76  _assertPixel(canvas, 86,14, 0,255,0,255);
     77 
     78 });
     79 </script>