tor-browser

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

2d.path.arcTo.shape.curve1.html (1843B)


      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.path.arcTo.shape.curve1</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.path.arcTo.shape.curve1</h1>
     10 <p class="desc">arcTo() curves in the right kind of shape</p>
     11 
     12 
     13 <script>
     14 var t = async_test("arcTo() curves in the right kind of shape");
     15 var t_pass = t.done.bind(t);
     16 var t_fail = t.step_func(function(reason) {
     17    throw reason;
     18 });
     19 t.step(function() {
     20 
     21  var canvas = new OffscreenCanvas(100, 50);
     22  var ctx = canvas.getContext('2d');
     23 
     24  var tol = 1.5; // tolerance to avoid antialiasing artifacts
     25 
     26  ctx.fillStyle = '#0f0';
     27  ctx.fillRect(0, 0, 100, 50);
     28 
     29  ctx.strokeStyle = '#f00';
     30  ctx.lineWidth = 10;
     31  ctx.beginPath();
     32  ctx.moveTo(10, 25);
     33  ctx.arcTo(75, 25, 75, 60, 20);
     34  ctx.stroke();
     35 
     36  ctx.fillStyle = '#0f0';
     37  ctx.beginPath();
     38  ctx.rect(10, 20, 45, 10);
     39  ctx.moveTo(80, 45);
     40  ctx.arc(55, 45, 25+tol, 0, -Math.PI/2, true);
     41  ctx.arc(55, 45, 15-tol, -Math.PI/2, 0, false);
     42  ctx.fill();
     43 
     44  _assertPixel(canvas, 50,25, 0,255,0,255);
     45  _assertPixel(canvas, 55,19, 0,255,0,255);
     46  _assertPixel(canvas, 55,20, 0,255,0,255);
     47  _assertPixel(canvas, 55,21, 0,255,0,255);
     48  _assertPixel(canvas, 64,22, 0,255,0,255);
     49  _assertPixel(canvas, 65,21, 0,255,0,255);
     50  _assertPixel(canvas, 72,28, 0,255,0,255);
     51  _assertPixel(canvas, 73,27, 0,255,0,255);
     52  _assertPixel(canvas, 78,36, 0,255,0,255);
     53  _assertPixel(canvas, 79,35, 0,255,0,255);
     54  _assertPixel(canvas, 80,44, 0,255,0,255);
     55  _assertPixel(canvas, 80,45, 0,255,0,255);
     56  _assertPixel(canvas, 80,46, 0,255,0,255);
     57  _assertPixel(canvas, 65,45, 0,255,0,255);
     58  t.done();
     59 
     60 });
     61 </script>