tor-browser

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

2d.text.measure.fontBoundingBox-reduced-ascent.worker.js (1269B)


      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-reduced-ascent
      3 // Description:Testing fontBoundingBox for OffscreenCanvas with reduced ascent 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-ascent256", "url('/fonts/CanvasTest-ascent256.ttf')");
     14  f.load();
     15  self.fonts.add(f);
     16  await self.fonts.ready;
     17  ctx.font = '40px CanvasTest-ascent256';
     18  ctx.direction = 'ltr';
     19  ctx.align = 'left'
     20  _assertSame(ctx.measureText('A').fontBoundingBoxAscent, 10, "ctx.measureText('A').fontBoundingBoxAscent", "10");
     21  _assertSame(ctx.measureText('A').fontBoundingBoxDescent, 10, "ctx.measureText('A').fontBoundingBoxDescent", "10");
     22 
     23  _assertSame(ctx.measureText('ABCD').fontBoundingBoxAscent, 10, "ctx.measureText('ABCD').fontBoundingBoxAscent", "10");
     24  _assertSame(ctx.measureText('ABCD').fontBoundingBoxDescent, 10, "ctx.measureText('ABCD').fontBoundingBoxDescent", "10");
     25 }, "Testing fontBoundingBox for OffscreenCanvas with reduced ascent metric");
     26 done();