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