tor-browser

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

2d.line.cap.square.worker.js (1545B)


      1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
      2 // OffscreenCanvas test in a worker:2d.line.cap.square
      3 // Description:lineCap 'square' 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("lineCap 'square' 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.lineCap = 'square';
     23  ctx.lineWidth = 20;
     24 
     25  ctx.fillStyle = '#f00';
     26  ctx.strokeStyle = '#0f0';
     27  ctx.fillRect(15, 5, 20, 40);
     28  ctx.beginPath();
     29  ctx.moveTo(25, 15);
     30  ctx.lineTo(25, 35);
     31  ctx.stroke();
     32 
     33  ctx.fillStyle = '#0f0';
     34  ctx.strokeStyle = '#f00';
     35  ctx.beginPath();
     36  ctx.moveTo(75, 15);
     37  ctx.lineTo(75, 35);
     38  ctx.stroke();
     39  ctx.fillRect(65, 5, 20, 40);
     40 
     41  _assertPixel(canvas, 25,4, 0,255,0,255);
     42  _assertPixel(canvas, 25,5, 0,255,0,255);
     43  _assertPixel(canvas, 25,6, 0,255,0,255);
     44  _assertPixel(canvas, 25,44, 0,255,0,255);
     45  _assertPixel(canvas, 25,45, 0,255,0,255);
     46  _assertPixel(canvas, 25,46, 0,255,0,255);
     47 
     48  _assertPixel(canvas, 75,4, 0,255,0,255);
     49  _assertPixel(canvas, 75,5, 0,255,0,255);
     50  _assertPixel(canvas, 75,6, 0,255,0,255);
     51  _assertPixel(canvas, 75,44, 0,255,0,255);
     52  _assertPixel(canvas, 75,45, 0,255,0,255);
     53  _assertPixel(canvas, 75,46, 0,255,0,255);
     54  t.done();
     55 });
     56 done();