tor-browser

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

2d.line.join.miter.html (1780B)


      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.line.join.miter</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.line.join.miter</h1>
     10 <p class="desc">lineJoin 'miter' is rendered correctly</p>
     11 
     12 
     13 <script>
     14 var t = async_test("lineJoin 'miter' is rendered correctly");
     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  ctx.fillStyle = '#0f0';
     25  ctx.fillRect(0, 0, 100, 50);
     26 
     27  ctx.lineJoin = 'miter';
     28  ctx.lineWidth = 20;
     29 
     30  ctx.fillStyle = '#f00';
     31  ctx.strokeStyle = '#0f0';
     32 
     33  ctx.fillStyle = '#f00';
     34  ctx.strokeStyle = '#0f0';
     35 
     36  ctx.fillRect(10, 10, 30, 20);
     37  ctx.fillRect(20, 10, 20, 30);
     38 
     39  ctx.beginPath();
     40  ctx.moveTo(10, 20);
     41  ctx.lineTo(30, 20);
     42  ctx.lineTo(30, 40);
     43  ctx.stroke();
     44 
     45 
     46  ctx.fillStyle = '#0f0';
     47  ctx.strokeStyle = '#f00';
     48 
     49  ctx.beginPath();
     50  ctx.moveTo(60, 20);
     51  ctx.lineTo(80, 20);
     52  ctx.lineTo(80, 40);
     53  ctx.stroke();
     54 
     55  ctx.fillRect(60, 10, 30, 20);
     56  ctx.fillRect(70, 10, 20, 30);
     57 
     58  _assertPixel(canvas, 38,12, 0,255,0,255);
     59  _assertPixel(canvas, 39,11, 0,255,0,255);
     60  _assertPixel(canvas, 40,10, 0,255,0,255);
     61  _assertPixel(canvas, 41,9, 0,255,0,255);
     62  _assertPixel(canvas, 42,8, 0,255,0,255);
     63 
     64  _assertPixel(canvas, 88,12, 0,255,0,255);
     65  _assertPixel(canvas, 89,11, 0,255,0,255);
     66  _assertPixel(canvas, 90,10, 0,255,0,255);
     67  _assertPixel(canvas, 91,9, 0,255,0,255);
     68  _assertPixel(canvas, 92,8, 0,255,0,255);
     69  t.done();
     70 
     71 });
     72 </script>