tor-browser

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

2d.line.join.round.html (2204B)


      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.round</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.round</h1>
     12 <p class="desc">lineJoin 'round' 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 'round' 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 = 'round';
     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.arc(30, 20, 10-tol, 0, 2*Math.PI, true);
     39  ctx.fill();
     40 
     41  ctx.beginPath();
     42  ctx.moveTo(10, 20);
     43  ctx.lineTo(30, 20);
     44  ctx.lineTo(30, 40);
     45  ctx.stroke();
     46 
     47 
     48  ctx.fillStyle = '#0f0';
     49  ctx.strokeStyle = '#f00';
     50 
     51  ctx.beginPath();
     52  ctx.moveTo(60, 20);
     53  ctx.lineTo(80, 20);
     54  ctx.lineTo(80, 40);
     55  ctx.stroke();
     56 
     57  ctx.fillRect(60, 10, 20, 20);
     58  ctx.fillRect(70, 20, 20, 20);
     59  ctx.beginPath();
     60  ctx.moveTo(80, 20);
     61  ctx.arc(80, 20, 10+tol, 0, 2*Math.PI, true);
     62  ctx.fill();
     63 
     64  _assertPixel(canvas, 36,14, 0,255,0,255);
     65  _assertPixel(canvas, 36,13, 0,255,0,255);
     66  _assertPixel(canvas, 37,13, 0,255,0,255);
     67  _assertPixel(canvas, 38,13, 0,255,0,255);
     68  _assertPixel(canvas, 38,12, 0,255,0,255);
     69 
     70  _assertPixel(canvas, 86,14, 0,255,0,255);
     71  _assertPixel(canvas, 86,13, 0,255,0,255);
     72  _assertPixel(canvas, 87,13, 0,255,0,255);
     73  _assertPixel(canvas, 88,13, 0,255,0,255);
     74  _assertPixel(canvas, 88,12, 0,255,0,255);
     75 
     76 });
     77 </script>