Bug 1794662 [wpt PR 36401] - Batch-remove unused arguments in _assertPixel and _asser...
[gecko.git] / testing / web-platform / tests / html / canvas / offscreen / text / 2d.text.draw.baseline.ideographic.html
blob144d56f784d11d65460a35e25162fcd912afb69c
1 <!DOCTYPE html>
2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
3 <title>OffscreenCanvas test: 2d.text.draw.baseline.ideographic</title>
4 <script src="/resources/testharness.js"></script>
5 <script src="/resources/testharnessreport.js"></script>
6 <script src="/html/canvas/resources/canvas-tests.js"></script>
8 <h1>2d.text.draw.baseline.ideographic</h1>
9 <p class="desc"></p>
12 <script>
13 var t = async_test("");
14 var t_pass = t.done.bind(t);
15 var t_fail = t.step_func(function(reason) {
16 throw reason;
17 });
18 t.step(function() {
20 var canvas = new OffscreenCanvas(100, 50);
21 var ctx = canvas.getContext('2d');
23 var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')");
24 let fonts = (self.fonts ? self.fonts : document.fonts);
25 f.load();
26 fonts.add(f);
27 fonts.ready.then(function() {
28 ctx.font = '50px CanvasTest';
29 ctx.fillStyle = '#f00';
30 ctx.fillRect(0, 0, 100, 50);
31 ctx.fillStyle = '#0f0';
32 ctx.textBaseline = 'ideographic';
33 ctx.fillText('CC', 0, 31.25);
34 _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2);
35 _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2);
36 _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2);
37 _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2);
38 _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2);
39 _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2);
40 }).then(t_pass, t_fail);
42 });
43 </script>