tor-browser

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

2d.line.cap.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.cap.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.cap.round</h1>
     12 <p class="desc">lineCap '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("lineCap '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.lineCap = 'round';
     29  ctx.lineWidth = 20;
     30 
     31 
     32  ctx.fillStyle = '#f00';
     33  ctx.strokeStyle = '#0f0';
     34 
     35  ctx.beginPath();
     36  ctx.moveTo(35-tol, 15);
     37  ctx.arc(25, 15, 10-tol, 0, Math.PI, true);
     38  ctx.arc(25, 35, 10-tol, Math.PI, 0, true);
     39  ctx.fill();
     40 
     41  ctx.beginPath();
     42  ctx.moveTo(25, 15);
     43  ctx.lineTo(25, 35);
     44  ctx.stroke();
     45 
     46 
     47  ctx.fillStyle = '#0f0';
     48  ctx.strokeStyle = '#f00';
     49 
     50  ctx.beginPath();
     51  ctx.moveTo(75, 15);
     52  ctx.lineTo(75, 35);
     53  ctx.stroke();
     54 
     55  ctx.beginPath();
     56  ctx.moveTo(85+tol, 15);
     57  ctx.arc(75, 15, 10+tol, 0, Math.PI, true);
     58  ctx.arc(75, 35, 10+tol, Math.PI, 0, true);
     59  ctx.fill();
     60 
     61  _assertPixel(canvas, 17,6, 0,255,0,255);
     62  _assertPixel(canvas, 25,6, 0,255,0,255);
     63  _assertPixel(canvas, 32,6, 0,255,0,255);
     64  _assertPixel(canvas, 17,43, 0,255,0,255);
     65  _assertPixel(canvas, 25,43, 0,255,0,255);
     66  _assertPixel(canvas, 32,43, 0,255,0,255);
     67 
     68  _assertPixel(canvas, 67,6, 0,255,0,255);
     69  _assertPixel(canvas, 75,6, 0,255,0,255);
     70  _assertPixel(canvas, 82,6, 0,255,0,255);
     71  _assertPixel(canvas, 67,43, 0,255,0,255);
     72  _assertPixel(canvas, 75,43, 0,255,0,255);
     73  _assertPixel(canvas, 82,43, 0,255,0,255);
     74 
     75 });
     76 </script>