2d.text.measure.lang.worker.js (864B)
1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. 2 // OffscreenCanvas test in a worker:2d.text.measure.lang 3 // Description:Testing the lang attribute 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("Lato-Medium", "url('/fonts/Lato-Medium.ttf')"); 14 f.load(); 15 self.fonts.add(f); 16 await self.fonts.ready; 17 18 ctx.font = '50px Lato-Medium'; 19 ctx.lang = 'tr'; 20 const text = 'fi'; 21 const tm_tr = ctx.measureText(text); 22 const tr_width = tm_tr.width; 23 24 ctx.lang = 'en'; 25 const tm_en = ctx.measureText(text); 26 const en_width = tm_en.width; 27 28 _assert(tr_width > en_width, "tr_width > en_width"); 29 }, "Testing the lang attribute"); 30 done();