tor-browser

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

2d.state.saverestore.lineCap.worker.js (1788B)


      1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
      2 // OffscreenCanvas test in a worker:2d.state.saverestore.lineCap
      3 // Description:
      4 // Note:
      5 
      6 importScripts("/resources/testharness.js");
      7 importScripts("/html/canvas/resources/canvas-tests.js");
      8 
      9 test(t => {
     10  const canvas = new OffscreenCanvas(300, 150);
     11  const ctx = canvas.getContext('2d');
     12 
     13  const old = ctx.lineCap;
     14  ctx.save();
     15  ctx.lineCap = "round";
     16  ctx.restore();
     17  _assertSame(ctx.lineCap, old, "ctx.lineCap", "old");
     18 }, "save()/restore() restores lineCap, for a canvas of size (300, 150).");
     19 
     20 test(t => {
     21  const canvas = new OffscreenCanvas(300, 150);
     22  const ctx = canvas.getContext('2d');
     23 
     24  ctx.lineCap = "round";
     25  const old = ctx.lineCap;
     26  // We're not interested in failures caused by get(set(x)) != x (e.g.
     27  // from rounding), so compare against `old` instead of "round".
     28  ctx.save();
     29  _assertSame(ctx.lineCap, old, "ctx.lineCap", "old");
     30  ctx.restore();
     31 }, "save() does not modify lineCap, for a canvas of size (300, 150).");
     32 
     33 test(t => {
     34  const canvas = new OffscreenCanvas(0, 0);
     35  const ctx = canvas.getContext('2d');
     36 
     37  const old = ctx.lineCap;
     38  ctx.save();
     39  ctx.lineCap = "round";
     40  ctx.restore();
     41  _assertSame(ctx.lineCap, old, "ctx.lineCap", "old");
     42 }, "save()/restore() restores lineCap, for a canvas of size (0, 0).");
     43 
     44 test(t => {
     45  const canvas = new OffscreenCanvas(0, 0);
     46  const ctx = canvas.getContext('2d');
     47 
     48  ctx.lineCap = "round";
     49  const old = ctx.lineCap;
     50  // We're not interested in failures caused by get(set(x)) != x (e.g.
     51  // from rounding), so compare against `old` instead of "round".
     52  ctx.save();
     53  _assertSame(ctx.lineCap, old, "ctx.lineCap", "old");
     54  ctx.restore();
     55 }, "save() does not modify lineCap, for a canvas of size (0, 0).");
     56 
     57 done();