2d.text.draw.space.collapse.space.worker.js (912B)
1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. 2 // OffscreenCanvas test in a worker:2d.text.draw.space.collapse.space 3 // Description:Space characters are converted to U+0020, and are NOT collapsed 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", "url('/fonts/CanvasTest.ttf')"); 14 f.load(); 15 self.fonts.add(f); 16 await self.fonts.ready; 17 ctx.font = '50px CanvasTest'; 18 ctx.fillStyle = '#f00'; 19 ctx.fillRect(0, 0, 100, 50); 20 ctx.fillStyle = '#0f0'; 21 ctx.fillText('E EE', 0, 37.5); 22 _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); 23 _assertPixelApprox(canvas, 75,25, 255,0,0,255, 2); 24 }, "Space characters are converted to U+0020, and are NOT collapsed"); 25 done();