diff options
Diffstat (limited to 'testing/web-platform/tests/html/canvas/element/text/2d.text.measure.fontBoundingBox.ahem.html')
-rw-r--r-- | testing/web-platform/tests/html/canvas/element/text/2d.text.measure.fontBoundingBox.ahem.html | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/canvas/element/text/2d.text.measure.fontBoundingBox.ahem.html b/testing/web-platform/tests/html/canvas/element/text/2d.text.measure.fontBoundingBox.ahem.html new file mode 100644 index 0000000000..0044f4d1e7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/element/text/2d.text.measure.fontBoundingBox.ahem.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.text.measure.fontBoundingBox.ahem</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css"> +<style> +@font-face { + font-family: Ahem; + src: url("/fonts/Ahem.ttf"); +} +</style> +<body class="show_output"> + +<h1>2d.text.measure.fontBoundingBox.ahem</h1> +<p class="desc">Testing fontBoundingBox for font ahem</p> + + +<span style="font-family: Ahem; position: absolute; visibility: hidden">A</span> +<p class="output">Actual output:</p> +<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas> + +<ul id="d"></ul> +<script> +promise_test(async t => { + + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + + await document.fonts.ready; + ctx.font = '50px Ahem'; + ctx.direction = 'ltr'; + ctx.align = 'left' + _assertSame(ctx.measureText('A').fontBoundingBoxAscent, 40, "ctx.measureText('A').fontBoundingBoxAscent", "40"); + _assertSame(ctx.measureText('A').fontBoundingBoxDescent, 10, "ctx.measureText('A').fontBoundingBoxDescent", "10"); + _assertSame(ctx.measureText('ABCD').fontBoundingBoxAscent, 40, "ctx.measureText('ABCD').fontBoundingBoxAscent", "40"); + _assertSame(ctx.measureText('ABCD').fontBoundingBoxDescent, 10, "ctx.measureText('ABCD').fontBoundingBoxDescent", "10"); + +}, "Testing fontBoundingBox for font ahem"); +</script> + |