tor-browser

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

2d.text.measure.fontBoundingBox-zero-descent.worker.js (1256B)


      1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
      2 // OffscreenCanvas test in a worker:2d.text.measure.fontBoundingBox-zero-descent
      3 // Description:Testing fontBoundingBox for OffscreenCanvas with zero descent metric
      4 // Note:
      5 
      6 importScripts("/resources/testharness.js");
      7 importScripts("/html/canvas/resources/canvas-tests.js");
      8 
      9 promise_test(async t => {
     10  var canvas = new OffscreenCanvas(100, 50);
     11  var ctx = canvas.getContext('2d');
     12 
     13  var f = new FontFace("CanvasTest-descent0", "url('/fonts/CanvasTest-descent0.ttf')");
     14  f.load();
     15  self.fonts.add(f);
     16  await self.fonts.ready;
     17  ctx.font = '40px CanvasTest-descent0';
     18  ctx.direction = 'ltr';
     19  ctx.align = 'left'
     20  _assertSame(ctx.measureText('A').fontBoundingBoxAscent, 30, "ctx.measureText('A').fontBoundingBoxAscent", "30");
     21  _assertSame(ctx.measureText('A').fontBoundingBoxDescent, 0, "ctx.measureText('A').fontBoundingBoxDescent", "0");
     22 
     23  _assertSame(ctx.measureText('ABCD').fontBoundingBoxAscent, 30, "ctx.measureText('ABCD').fontBoundingBoxAscent", "30");
     24  _assertSame(ctx.measureText('ABCD').fontBoundingBoxDescent, 0, "ctx.measureText('ABCD').fontBoundingBoxDescent", "0");
     25 }, "Testing fontBoundingBox for OffscreenCanvas with zero descent metric");
     26 done();