tor-browser

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

2d.line.join.miter.worker.js (1629B)


      1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
      2 // OffscreenCanvas test in a worker:2d.line.join.miter
      3 // Description:lineJoin 'miter' is rendered correctly
      4 // Note:
      5 
      6 importScripts("/resources/testharness.js");
      7 importScripts("/html/canvas/resources/canvas-tests.js");
      8 
      9 var t = async_test("lineJoin 'miter' is rendered correctly");
     10 var t_pass = t.done.bind(t);
     11 var t_fail = t.step_func(function(reason) {
     12    throw reason;
     13 });
     14 t.step(function() {
     15 
     16  var canvas = new OffscreenCanvas(100, 50);
     17  var ctx = canvas.getContext('2d');
     18 
     19  ctx.fillStyle = '#0f0';
     20  ctx.fillRect(0, 0, 100, 50);
     21 
     22  ctx.lineJoin = 'miter';
     23  ctx.lineWidth = 20;
     24 
     25  ctx.fillStyle = '#f00';
     26  ctx.strokeStyle = '#0f0';
     27 
     28  ctx.fillStyle = '#f00';
     29  ctx.strokeStyle = '#0f0';
     30 
     31  ctx.fillRect(10, 10, 30, 20);
     32  ctx.fillRect(20, 10, 20, 30);
     33 
     34  ctx.beginPath();
     35  ctx.moveTo(10, 20);
     36  ctx.lineTo(30, 20);
     37  ctx.lineTo(30, 40);
     38  ctx.stroke();
     39 
     40 
     41  ctx.fillStyle = '#0f0';
     42  ctx.strokeStyle = '#f00';
     43 
     44  ctx.beginPath();
     45  ctx.moveTo(60, 20);
     46  ctx.lineTo(80, 20);
     47  ctx.lineTo(80, 40);
     48  ctx.stroke();
     49 
     50  ctx.fillRect(60, 10, 30, 20);
     51  ctx.fillRect(70, 10, 20, 30);
     52 
     53  _assertPixel(canvas, 38,12, 0,255,0,255);
     54  _assertPixel(canvas, 39,11, 0,255,0,255);
     55  _assertPixel(canvas, 40,10, 0,255,0,255);
     56  _assertPixel(canvas, 41,9, 0,255,0,255);
     57  _assertPixel(canvas, 42,8, 0,255,0,255);
     58 
     59  _assertPixel(canvas, 88,12, 0,255,0,255);
     60  _assertPixel(canvas, 89,11, 0,255,0,255);
     61  _assertPixel(canvas, 90,10, 0,255,0,255);
     62  _assertPixel(canvas, 91,9, 0,255,0,255);
     63  _assertPixel(canvas, 92,8, 0,255,0,255);
     64  t.done();
     65 });
     66 done();