Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineJoin.worker.html - WPT Dashboard Interop Dashboard
// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
// OffscreenCanvas test in a worker:2d.state.saverestore.lineJoin
// 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.lineJoin;
ctx.save();
ctx.lineJoin = "round";
ctx.restore();
_assertSame(ctx.lineJoin, old, "ctx.lineJoin", "old");
}, "save()/restore() restores lineJoin, for a canvas of size (300, 150).");
test(t => {
const canvas = new OffscreenCanvas(300, 150);
const ctx = canvas.getContext('2d');
ctx.lineJoin = "round";
const old = ctx.lineJoin;
// We're not interested in failures caused by get(set(x)) != x (e.g.
// from rounding), so compare against `old` instead of "round".
ctx.save();
_assertSame(ctx.lineJoin, old, "ctx.lineJoin", "old");
ctx.restore();
}, "save() does not modify lineJoin, for a canvas of size (300, 150).");
test(t => {
const canvas = new OffscreenCanvas(0, 0);
const ctx = canvas.getContext('2d');
const old = ctx.lineJoin;
ctx.save();
ctx.lineJoin = "round";
ctx.restore();
_assertSame(ctx.lineJoin, old, "ctx.lineJoin", "old");
}, "save()/restore() restores lineJoin, for a canvas of size (0, 0).");
test(t => {
const canvas = new OffscreenCanvas(0, 0);
const ctx = canvas.getContext('2d');
ctx.lineJoin = "round";
const old = ctx.lineJoin;
// We're not interested in failures caused by get(set(x)) != x (e.g.
// from rounding), so compare against `old` instead of "round".
ctx.save();
_assertSame(ctx.lineJoin, old, "ctx.lineJoin", "old");
ctx.restore();
}, "save() does not modify lineJoin, for a canvas of size (0, 0).");
done();