// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.state.saverestore.shadowOffsetX // Description: // Note: importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); const old = ctx.shadowOffsetX; ctx.save(); ctx.shadowOffsetX = 5; ctx.restore(); _assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old"); }, "save()/restore() restores shadowOffsetX, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); ctx.shadowOffsetX = 5; const old = ctx.shadowOffsetX; // We're not interested in failures caused by get(set(x)) != x (e.g. // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old"); ctx.restore(); }, "save() does not modify shadowOffsetX, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); const old = ctx.shadowOffsetX; ctx.save(); ctx.shadowOffsetX = 5; ctx.restore(); _assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old"); }, "save()/restore() restores shadowOffsetX, for a canvas of size (0, 0)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); ctx.shadowOffsetX = 5; const old = ctx.shadowOffsetX; // We're not interested in failures caused by get(set(x)) != x (e.g. // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old"); ctx.restore(); }, "save() does not modify shadowOffsetX, for a canvas of size (0, 0)."); done();