2d.state.saverestore.shadowBlur.worker.js (1815B)
1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. 2 // OffscreenCanvas test in a worker:2d.state.saverestore.shadowBlur 3 // Description: 4 // Note: 5 6 importScripts("/resources/testharness.js"); 7 importScripts("/html/canvas/resources/canvas-tests.js"); 8 9 test(t => { 10 const canvas = new OffscreenCanvas(300, 150); 11 const ctx = canvas.getContext('2d'); 12 13 const old = ctx.shadowBlur; 14 ctx.save(); 15 ctx.shadowBlur = 5; 16 ctx.restore(); 17 _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); 18 }, "save()/restore() restores shadowBlur, for a canvas of size (300, 150)."); 19 20 test(t => { 21 const canvas = new OffscreenCanvas(300, 150); 22 const ctx = canvas.getContext('2d'); 23 24 ctx.shadowBlur = 5; 25 const old = ctx.shadowBlur; 26 // We're not interested in failures caused by get(set(x)) != x (e.g. 27 // from rounding), so compare against `old` instead of 5. 28 ctx.save(); 29 _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); 30 ctx.restore(); 31 }, "save() does not modify shadowBlur, for a canvas of size (300, 150)."); 32 33 test(t => { 34 const canvas = new OffscreenCanvas(0, 0); 35 const ctx = canvas.getContext('2d'); 36 37 const old = ctx.shadowBlur; 38 ctx.save(); 39 ctx.shadowBlur = 5; 40 ctx.restore(); 41 _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); 42 }, "save()/restore() restores shadowBlur, for a canvas of size (0, 0)."); 43 44 test(t => { 45 const canvas = new OffscreenCanvas(0, 0); 46 const ctx = canvas.getContext('2d'); 47 48 ctx.shadowBlur = 5; 49 const old = ctx.shadowBlur; 50 // We're not interested in failures caused by get(set(x)) != x (e.g. 51 // from rounding), so compare against `old` instead of 5. 52 ctx.save(); 53 _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); 54 ctx.restore(); 55 }, "save() does not modify shadowBlur, for a canvas of size (0, 0)."); 56 57 done();