tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 9d7e24c52dfd0c00a155f9ac27df8718745b0f37
parent 96b32e4a86720594aea405c67110b2f1d60ad863
Author: Jean-Philippe Gravel <jpgravel@chromium.org>
Date:   Wed,  3 Dec 2025 14:49:39 +0000

Bug 2003649 [wpt PR 56422] - Split 2d.state.saverestore into two atomic tests, a=testonly

Automatic update from web-platform-tests
Split 2d.state.saverestore into two atomic tests

This test was testing two different things. Using single_file variants,
we can split these in two independent test bodies, without increasing
the number of generated files.

Change-Id: I747ac734d9c52963cf730c9d6056e03a8d0fbb46
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7212940
Reviewed-by: Andres Ricardo Perez <andresrperez@chromium.org>
Commit-Queue: Jean-Philippe Gravel <jpgravel@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1552868}

--

wpt-commits: c45b04fded4947eb0440043c0b12a57d84266d93
wpt-pr: 56422

Diffstat:
Mtesting/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.fillStyle.html | 34++++++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.font.html | 34++++++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.globalAlpha.html | 34++++++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.globalCompositeOperation.html | 34++++++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.lineCap.html | 34++++++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.lineJoin.html | 34++++++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.lineWidth.html | 34++++++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.miterLimit.html | 34++++++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.shadowBlur.html | 34++++++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.shadowColor.html | 34++++++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.shadowOffsetX.html | 34++++++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.shadowOffsetY.html | 34++++++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.strokeStyle.html | 34++++++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.textAlign.html | 34++++++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.textBaseline.html | 34++++++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.fillStyle.html | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.fillStyle.worker.js | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalAlpha.html | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalAlpha.worker.js | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalCompositeOperation.html | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalCompositeOperation.worker.js | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineCap.html | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineCap.worker.js | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineJoin.html | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineJoin.worker.js | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineWidth.html | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineWidth.worker.js | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.miterLimit.html | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.miterLimit.worker.js | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowBlur.html | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowBlur.worker.js | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowColor.html | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowColor.worker.js | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetX.html | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetX.worker.js | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetY.html | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetY.worker.js | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.strokeStyle.html | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.strokeStyle.worker.js | 30++++++++++++++++++------------
Mtesting/web-platform/tests/html/canvas/tools/yaml/the-canvas-state.yaml | 40+++++++++++++++++++++-------------------
40 files changed, 783 insertions(+), 487 deletions(-)

diff --git a/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.fillStyle.html b/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.fillStyle.html @@ -17,22 +17,27 @@ test(t => { canvas.height = 150; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.fillStyle; + const old = ctx.fillStyle; ctx.save(); ctx.fillStyle = "#ff0000"; ctx.restore(); _assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old"); +}, "save()/restore() restores fillStyle, for a canvas of size (300, 150)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 300; + canvas.height = 150; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.fillStyle = "#ff0000"; - old = ctx.fillStyle; + const old = ctx.fillStyle; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "#ff0000". + // from rounding), so compare against `old` instead of "#ff0000". ctx.save(); _assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old"); ctx.restore(); -}, "save()/restore() works for fillStyle, with a canvas size of (300, 150)"); +}, "save() does not modify fillStyle, for a canvas of size (300, 150)."); test(t => { const canvas = document.createElement('canvas'); @@ -40,21 +45,26 @@ test(t => { canvas.height = 0; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.fillStyle; + const old = ctx.fillStyle; ctx.save(); ctx.fillStyle = "#ff0000"; ctx.restore(); _assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old"); +}, "save()/restore() restores fillStyle, for a canvas of size (0, 0)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 0; + canvas.height = 0; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.fillStyle = "#ff0000"; - old = ctx.fillStyle; + const old = ctx.fillStyle; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "#ff0000". + // from rounding), so compare against `old` instead of "#ff0000". ctx.save(); _assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old"); ctx.restore(); -}, "save()/restore() works for fillStyle, with a canvas size of (0, 0)"); +}, "save() does not modify fillStyle, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.font.html b/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.font.html @@ -17,22 +17,27 @@ test(t => { canvas.height = 150; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.font; + const old = ctx.font; ctx.save(); ctx.font = "25px serif"; ctx.restore(); _assertSame(ctx.font, old, "ctx.font", "old"); +}, "save()/restore() restores font, for a canvas of size (300, 150)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 300; + canvas.height = 150; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.font = "25px serif"; - old = ctx.font; + const old = ctx.font; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "25px serif". + // from rounding), so compare against `old` instead of "25px serif". ctx.save(); _assertSame(ctx.font, old, "ctx.font", "old"); ctx.restore(); -}, "save()/restore() works for font, with a canvas size of (300, 150)"); +}, "save() does not modify font, for a canvas of size (300, 150)."); test(t => { const canvas = document.createElement('canvas'); @@ -40,21 +45,26 @@ test(t => { canvas.height = 0; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.font; + const old = ctx.font; ctx.save(); ctx.font = "25px serif"; ctx.restore(); _assertSame(ctx.font, old, "ctx.font", "old"); +}, "save()/restore() restores font, for a canvas of size (0, 0)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 0; + canvas.height = 0; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.font = "25px serif"; - old = ctx.font; + const old = ctx.font; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "25px serif". + // from rounding), so compare against `old` instead of "25px serif". ctx.save(); _assertSame(ctx.font, old, "ctx.font", "old"); ctx.restore(); -}, "save()/restore() works for font, with a canvas size of (0, 0)"); +}, "save() does not modify font, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.globalAlpha.html b/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.globalAlpha.html @@ -17,22 +17,27 @@ test(t => { canvas.height = 150; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.globalAlpha; + const old = ctx.globalAlpha; ctx.save(); ctx.globalAlpha = 0.5; ctx.restore(); _assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old"); +}, "save()/restore() restores globalAlpha, for a canvas of size (300, 150)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 300; + canvas.height = 150; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.globalAlpha = 0.5; - old = ctx.globalAlpha; + const old = ctx.globalAlpha; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 0.5. + // from rounding), so compare against `old` instead of 0.5. ctx.save(); _assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old"); ctx.restore(); -}, "save()/restore() works for globalAlpha, with a canvas size of (300, 150)"); +}, "save() does not modify globalAlpha, for a canvas of size (300, 150)."); test(t => { const canvas = document.createElement('canvas'); @@ -40,21 +45,26 @@ test(t => { canvas.height = 0; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.globalAlpha; + const old = ctx.globalAlpha; ctx.save(); ctx.globalAlpha = 0.5; ctx.restore(); _assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old"); +}, "save()/restore() restores globalAlpha, for a canvas of size (0, 0)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 0; + canvas.height = 0; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.globalAlpha = 0.5; - old = ctx.globalAlpha; + const old = ctx.globalAlpha; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 0.5. + // from rounding), so compare against `old` instead of 0.5. ctx.save(); _assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old"); ctx.restore(); -}, "save()/restore() works for globalAlpha, with a canvas size of (0, 0)"); +}, "save() does not modify globalAlpha, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.globalCompositeOperation.html b/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.globalCompositeOperation.html @@ -17,22 +17,27 @@ test(t => { canvas.height = 150; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.globalCompositeOperation; + const old = ctx.globalCompositeOperation; ctx.save(); ctx.globalCompositeOperation = "copy"; ctx.restore(); _assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old"); +}, "save()/restore() restores globalCompositeOperation, for a canvas of size (300, 150)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 300; + canvas.height = 150; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.globalCompositeOperation = "copy"; - old = ctx.globalCompositeOperation; + const old = ctx.globalCompositeOperation; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "copy". + // from rounding), so compare against `old` instead of "copy". ctx.save(); _assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old"); ctx.restore(); -}, "save()/restore() works for globalCompositeOperation, with a canvas size of (300, 150)"); +}, "save() does not modify globalCompositeOperation, for a canvas of size (300, 150)."); test(t => { const canvas = document.createElement('canvas'); @@ -40,21 +45,26 @@ test(t => { canvas.height = 0; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.globalCompositeOperation; + const old = ctx.globalCompositeOperation; ctx.save(); ctx.globalCompositeOperation = "copy"; ctx.restore(); _assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old"); +}, "save()/restore() restores globalCompositeOperation, for a canvas of size (0, 0)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 0; + canvas.height = 0; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.globalCompositeOperation = "copy"; - old = ctx.globalCompositeOperation; + const old = ctx.globalCompositeOperation; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "copy". + // from rounding), so compare against `old` instead of "copy". ctx.save(); _assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old"); ctx.restore(); -}, "save()/restore() works for globalCompositeOperation, with a canvas size of (0, 0)"); +}, "save() does not modify globalCompositeOperation, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.lineCap.html b/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.lineCap.html @@ -17,22 +17,27 @@ test(t => { canvas.height = 150; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.lineCap; + const old = ctx.lineCap; ctx.save(); ctx.lineCap = "round"; ctx.restore(); _assertSame(ctx.lineCap, old, "ctx.lineCap", "old"); +}, "save()/restore() restores lineCap, for a canvas of size (300, 150)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 300; + canvas.height = 150; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.lineCap = "round"; - old = ctx.lineCap; + const old = ctx.lineCap; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "round". + // from rounding), so compare against `old` instead of "round". ctx.save(); _assertSame(ctx.lineCap, old, "ctx.lineCap", "old"); ctx.restore(); -}, "save()/restore() works for lineCap, with a canvas size of (300, 150)"); +}, "save() does not modify lineCap, for a canvas of size (300, 150)."); test(t => { const canvas = document.createElement('canvas'); @@ -40,21 +45,26 @@ test(t => { canvas.height = 0; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.lineCap; + const old = ctx.lineCap; ctx.save(); ctx.lineCap = "round"; ctx.restore(); _assertSame(ctx.lineCap, old, "ctx.lineCap", "old"); +}, "save()/restore() restores lineCap, for a canvas of size (0, 0)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 0; + canvas.height = 0; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.lineCap = "round"; - old = ctx.lineCap; + const old = ctx.lineCap; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "round". + // from rounding), so compare against `old` instead of "round". ctx.save(); _assertSame(ctx.lineCap, old, "ctx.lineCap", "old"); ctx.restore(); -}, "save()/restore() works for lineCap, with a canvas size of (0, 0)"); +}, "save() does not modify lineCap, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.lineJoin.html b/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.lineJoin.html @@ -17,22 +17,27 @@ test(t => { canvas.height = 150; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.lineJoin; + 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 = document.createElement('canvas'); + canvas.width = 300; + canvas.height = 150; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.lineJoin = "round"; - old = ctx.lineJoin; + 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 against "round". + // from rounding), so compare against `old` instead of "round". ctx.save(); _assertSame(ctx.lineJoin, old, "ctx.lineJoin", "old"); ctx.restore(); -}, "save()/restore() works for lineJoin, with a canvas size of (300, 150)"); +}, "save() does not modify lineJoin, for a canvas of size (300, 150)."); test(t => { const canvas = document.createElement('canvas'); @@ -40,21 +45,26 @@ test(t => { canvas.height = 0; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.lineJoin; + 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 = document.createElement('canvas'); + canvas.width = 0; + canvas.height = 0; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.lineJoin = "round"; - old = ctx.lineJoin; + 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 against "round". + // from rounding), so compare against `old` instead of "round". ctx.save(); _assertSame(ctx.lineJoin, old, "ctx.lineJoin", "old"); ctx.restore(); -}, "save()/restore() works for lineJoin, with a canvas size of (0, 0)"); +}, "save() does not modify lineJoin, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.lineWidth.html b/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.lineWidth.html @@ -17,22 +17,27 @@ test(t => { canvas.height = 150; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.lineWidth; + const old = ctx.lineWidth; ctx.save(); ctx.lineWidth = 0.5; ctx.restore(); _assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old"); +}, "save()/restore() restores lineWidth, for a canvas of size (300, 150)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 300; + canvas.height = 150; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.lineWidth = 0.5; - old = ctx.lineWidth; + const old = ctx.lineWidth; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 0.5. + // from rounding), so compare against `old` instead of 0.5. ctx.save(); _assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old"); ctx.restore(); -}, "save()/restore() works for lineWidth, with a canvas size of (300, 150)"); +}, "save() does not modify lineWidth, for a canvas of size (300, 150)."); test(t => { const canvas = document.createElement('canvas'); @@ -40,21 +45,26 @@ test(t => { canvas.height = 0; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.lineWidth; + const old = ctx.lineWidth; ctx.save(); ctx.lineWidth = 0.5; ctx.restore(); _assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old"); +}, "save()/restore() restores lineWidth, for a canvas of size (0, 0)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 0; + canvas.height = 0; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.lineWidth = 0.5; - old = ctx.lineWidth; + const old = ctx.lineWidth; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 0.5. + // from rounding), so compare against `old` instead of 0.5. ctx.save(); _assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old"); ctx.restore(); -}, "save()/restore() works for lineWidth, with a canvas size of (0, 0)"); +}, "save() does not modify lineWidth, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.miterLimit.html b/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.miterLimit.html @@ -17,22 +17,27 @@ test(t => { canvas.height = 150; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.miterLimit; + const old = ctx.miterLimit; ctx.save(); ctx.miterLimit = 0.5; ctx.restore(); _assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old"); +}, "save()/restore() restores miterLimit, for a canvas of size (300, 150)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 300; + canvas.height = 150; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.miterLimit = 0.5; - old = ctx.miterLimit; + const old = ctx.miterLimit; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 0.5. + // from rounding), so compare against `old` instead of 0.5. ctx.save(); _assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old"); ctx.restore(); -}, "save()/restore() works for miterLimit, with a canvas size of (300, 150)"); +}, "save() does not modify miterLimit, for a canvas of size (300, 150)."); test(t => { const canvas = document.createElement('canvas'); @@ -40,21 +45,26 @@ test(t => { canvas.height = 0; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.miterLimit; + const old = ctx.miterLimit; ctx.save(); ctx.miterLimit = 0.5; ctx.restore(); _assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old"); +}, "save()/restore() restores miterLimit, for a canvas of size (0, 0)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 0; + canvas.height = 0; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.miterLimit = 0.5; - old = ctx.miterLimit; + const old = ctx.miterLimit; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 0.5. + // from rounding), so compare against `old` instead of 0.5. ctx.save(); _assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old"); ctx.restore(); -}, "save()/restore() works for miterLimit, with a canvas size of (0, 0)"); +}, "save() does not modify miterLimit, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.shadowBlur.html b/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.shadowBlur.html @@ -17,22 +17,27 @@ test(t => { canvas.height = 150; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowBlur; + const old = ctx.shadowBlur; ctx.save(); ctx.shadowBlur = 5; ctx.restore(); _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); +}, "save()/restore() restores shadowBlur, for a canvas of size (300, 150)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 300; + canvas.height = 150; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowBlur = 5; - old = ctx.shadowBlur; + const old = ctx.shadowBlur; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 5. + // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); ctx.restore(); -}, "save()/restore() works for shadowBlur, with a canvas size of (300, 150)"); +}, "save() does not modify shadowBlur, for a canvas of size (300, 150)."); test(t => { const canvas = document.createElement('canvas'); @@ -40,21 +45,26 @@ test(t => { canvas.height = 0; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowBlur; + const old = ctx.shadowBlur; ctx.save(); ctx.shadowBlur = 5; ctx.restore(); _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); +}, "save()/restore() restores shadowBlur, for a canvas of size (0, 0)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 0; + canvas.height = 0; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowBlur = 5; - old = ctx.shadowBlur; + const old = ctx.shadowBlur; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 5. + // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); ctx.restore(); -}, "save()/restore() works for shadowBlur, with a canvas size of (0, 0)"); +}, "save() does not modify shadowBlur, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.shadowColor.html b/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.shadowColor.html @@ -17,22 +17,27 @@ test(t => { canvas.height = 150; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowColor; + const old = ctx.shadowColor; ctx.save(); ctx.shadowColor = "#ff0000"; ctx.restore(); _assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old"); +}, "save()/restore() restores shadowColor, for a canvas of size (300, 150)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 300; + canvas.height = 150; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowColor = "#ff0000"; - old = ctx.shadowColor; + const old = ctx.shadowColor; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "#ff0000". + // from rounding), so compare against `old` instead of "#ff0000". ctx.save(); _assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old"); ctx.restore(); -}, "save()/restore() works for shadowColor, with a canvas size of (300, 150)"); +}, "save() does not modify shadowColor, for a canvas of size (300, 150)."); test(t => { const canvas = document.createElement('canvas'); @@ -40,21 +45,26 @@ test(t => { canvas.height = 0; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowColor; + const old = ctx.shadowColor; ctx.save(); ctx.shadowColor = "#ff0000"; ctx.restore(); _assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old"); +}, "save()/restore() restores shadowColor, for a canvas of size (0, 0)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 0; + canvas.height = 0; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowColor = "#ff0000"; - old = ctx.shadowColor; + const old = ctx.shadowColor; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "#ff0000". + // from rounding), so compare against `old` instead of "#ff0000". ctx.save(); _assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old"); ctx.restore(); -}, "save()/restore() works for shadowColor, with a canvas size of (0, 0)"); +}, "save() does not modify shadowColor, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.shadowOffsetX.html b/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.shadowOffsetX.html @@ -17,22 +17,27 @@ test(t => { canvas.height = 150; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowOffsetX; + 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 = document.createElement('canvas'); + canvas.width = 300; + canvas.height = 150; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowOffsetX = 5; - old = ctx.shadowOffsetX; + 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 against 5. + // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old"); ctx.restore(); -}, "save()/restore() works for shadowOffsetX, with a canvas size of (300, 150)"); +}, "save() does not modify shadowOffsetX, for a canvas of size (300, 150)."); test(t => { const canvas = document.createElement('canvas'); @@ -40,21 +45,26 @@ test(t => { canvas.height = 0; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowOffsetX; + 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 = document.createElement('canvas'); + canvas.width = 0; + canvas.height = 0; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowOffsetX = 5; - old = ctx.shadowOffsetX; + 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 against 5. + // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old"); ctx.restore(); -}, "save()/restore() works for shadowOffsetX, with a canvas size of (0, 0)"); +}, "save() does not modify shadowOffsetX, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.shadowOffsetY.html b/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.shadowOffsetY.html @@ -17,22 +17,27 @@ test(t => { canvas.height = 150; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowOffsetY; + const old = ctx.shadowOffsetY; ctx.save(); ctx.shadowOffsetY = 5; ctx.restore(); _assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old"); +}, "save()/restore() restores shadowOffsetY, for a canvas of size (300, 150)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 300; + canvas.height = 150; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowOffsetY = 5; - old = ctx.shadowOffsetY; + const old = ctx.shadowOffsetY; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 5. + // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old"); ctx.restore(); -}, "save()/restore() works for shadowOffsetY, with a canvas size of (300, 150)"); +}, "save() does not modify shadowOffsetY, for a canvas of size (300, 150)."); test(t => { const canvas = document.createElement('canvas'); @@ -40,21 +45,26 @@ test(t => { canvas.height = 0; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowOffsetY; + const old = ctx.shadowOffsetY; ctx.save(); ctx.shadowOffsetY = 5; ctx.restore(); _assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old"); +}, "save()/restore() restores shadowOffsetY, for a canvas of size (0, 0)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 0; + canvas.height = 0; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowOffsetY = 5; - old = ctx.shadowOffsetY; + const old = ctx.shadowOffsetY; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 5. + // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old"); ctx.restore(); -}, "save()/restore() works for shadowOffsetY, with a canvas size of (0, 0)"); +}, "save() does not modify shadowOffsetY, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.strokeStyle.html b/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.strokeStyle.html @@ -17,22 +17,27 @@ test(t => { canvas.height = 150; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.strokeStyle; + 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 = document.createElement('canvas'); + canvas.width = 300; + canvas.height = 150; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.strokeStyle = "#ff0000"; - old = ctx.strokeStyle; + 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 against "#ff0000". + // from rounding), so compare against `old` instead of "#ff0000". ctx.save(); _assertSame(ctx.strokeStyle, old, "ctx.strokeStyle", "old"); ctx.restore(); -}, "save()/restore() works for strokeStyle, with a canvas size of (300, 150)"); +}, "save() does not modify strokeStyle, for a canvas of size (300, 150)."); test(t => { const canvas = document.createElement('canvas'); @@ -40,21 +45,26 @@ test(t => { canvas.height = 0; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.strokeStyle; + 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 = document.createElement('canvas'); + canvas.width = 0; + canvas.height = 0; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.strokeStyle = "#ff0000"; - old = ctx.strokeStyle; + 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 against "#ff0000". + // from rounding), so compare against `old` instead of "#ff0000". ctx.save(); _assertSame(ctx.strokeStyle, old, "ctx.strokeStyle", "old"); ctx.restore(); -}, "save()/restore() works for strokeStyle, with a canvas size of (0, 0)"); +}, "save() does not modify strokeStyle, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.textAlign.html b/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.textAlign.html @@ -17,22 +17,27 @@ test(t => { canvas.height = 150; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.textAlign; + const old = ctx.textAlign; ctx.save(); ctx.textAlign = "center"; ctx.restore(); _assertSame(ctx.textAlign, old, "ctx.textAlign", "old"); +}, "save()/restore() restores textAlign, for a canvas of size (300, 150)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 300; + canvas.height = 150; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.textAlign = "center"; - old = ctx.textAlign; + const old = ctx.textAlign; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "center". + // from rounding), so compare against `old` instead of "center". ctx.save(); _assertSame(ctx.textAlign, old, "ctx.textAlign", "old"); ctx.restore(); -}, "save()/restore() works for textAlign, with a canvas size of (300, 150)"); +}, "save() does not modify textAlign, for a canvas of size (300, 150)."); test(t => { const canvas = document.createElement('canvas'); @@ -40,21 +45,26 @@ test(t => { canvas.height = 0; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.textAlign; + const old = ctx.textAlign; ctx.save(); ctx.textAlign = "center"; ctx.restore(); _assertSame(ctx.textAlign, old, "ctx.textAlign", "old"); +}, "save()/restore() restores textAlign, for a canvas of size (0, 0)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 0; + canvas.height = 0; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.textAlign = "center"; - old = ctx.textAlign; + const old = ctx.textAlign; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "center". + // from rounding), so compare against `old` instead of "center". ctx.save(); _assertSame(ctx.textAlign, old, "ctx.textAlign", "old"); ctx.restore(); -}, "save()/restore() works for textAlign, with a canvas size of (0, 0)"); +}, "save() does not modify textAlign, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.textBaseline.html b/testing/web-platform/tests/html/canvas/element/the-canvas-state/2d.state.saverestore.textBaseline.html @@ -17,22 +17,27 @@ test(t => { canvas.height = 150; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.textBaseline; + const old = ctx.textBaseline; ctx.save(); ctx.textBaseline = "bottom"; ctx.restore(); _assertSame(ctx.textBaseline, old, "ctx.textBaseline", "old"); +}, "save()/restore() restores textBaseline, for a canvas of size (300, 150)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 300; + canvas.height = 150; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.textBaseline = "bottom"; - old = ctx.textBaseline; + const old = ctx.textBaseline; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "bottom". + // from rounding), so compare against `old` instead of "bottom". ctx.save(); _assertSame(ctx.textBaseline, old, "ctx.textBaseline", "old"); ctx.restore(); -}, "save()/restore() works for textBaseline, with a canvas size of (300, 150)"); +}, "save() does not modify textBaseline, for a canvas of size (300, 150)."); test(t => { const canvas = document.createElement('canvas'); @@ -40,21 +45,26 @@ test(t => { canvas.height = 0; const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.textBaseline; + const old = ctx.textBaseline; ctx.save(); ctx.textBaseline = "bottom"; ctx.restore(); _assertSame(ctx.textBaseline, old, "ctx.textBaseline", "old"); +}, "save()/restore() restores textBaseline, for a canvas of size (0, 0)."); + +test(t => { + const canvas = document.createElement('canvas'); + canvas.width = 0; + canvas.height = 0; + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.textBaseline = "bottom"; - old = ctx.textBaseline; + const old = ctx.textBaseline; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "bottom". + // from rounding), so compare against `old` instead of "bottom". ctx.save(); _assertSame(ctx.textBaseline, old, "ctx.textBaseline", "old"); ctx.restore(); -}, "save()/restore() works for textBaseline, with a canvas size of (0, 0)"); +}, "save() does not modify textBaseline, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.fillStyle.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.fillStyle.html @@ -14,42 +14,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.fillStyle; + const old = ctx.fillStyle; ctx.save(); ctx.fillStyle = "#ff0000"; ctx.restore(); _assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old"); +}, "save()/restore() restores fillStyle, for a canvas of size (300, 150)."); + +test(t => { + const canvas = new OffscreenCanvas(300, 150); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.fillStyle = "#ff0000"; - old = ctx.fillStyle; + const old = ctx.fillStyle; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "#ff0000". + // from rounding), so compare against `old` instead of "#ff0000". ctx.save(); _assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old"); ctx.restore(); -}, "save()/restore() works for fillStyle, with a canvas size of (300, 150)"); +}, "save() does not modify fillStyle, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.fillStyle; + const old = ctx.fillStyle; ctx.save(); ctx.fillStyle = "#ff0000"; ctx.restore(); _assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old"); +}, "save()/restore() restores fillStyle, for a canvas of size (0, 0)."); + +test(t => { + const canvas = new OffscreenCanvas(0, 0); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.fillStyle = "#ff0000"; - old = ctx.fillStyle; + const old = ctx.fillStyle; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "#ff0000". + // from rounding), so compare against `old` instead of "#ff0000". ctx.save(); _assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old"); ctx.restore(); -}, "save()/restore() works for fillStyle, with a canvas size of (0, 0)"); +}, "save() does not modify fillStyle, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.fillStyle.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.fillStyle.worker.js @@ -10,42 +10,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.fillStyle; + const old = ctx.fillStyle; ctx.save(); ctx.fillStyle = "#ff0000"; ctx.restore(); _assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old"); +}, "save()/restore() restores fillStyle, for a canvas of size (300, 150)."); + +test(t => { + const canvas = new OffscreenCanvas(300, 150); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.fillStyle = "#ff0000"; - old = ctx.fillStyle; + const old = ctx.fillStyle; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "#ff0000". + // from rounding), so compare against `old` instead of "#ff0000". ctx.save(); _assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old"); ctx.restore(); -}, "save()/restore() works for fillStyle, with a canvas size of (300, 150)"); +}, "save() does not modify fillStyle, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.fillStyle; + const old = ctx.fillStyle; ctx.save(); ctx.fillStyle = "#ff0000"; ctx.restore(); _assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old"); +}, "save()/restore() restores fillStyle, for a canvas of size (0, 0)."); + +test(t => { + const canvas = new OffscreenCanvas(0, 0); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.fillStyle = "#ff0000"; - old = ctx.fillStyle; + const old = ctx.fillStyle; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "#ff0000". + // from rounding), so compare against `old` instead of "#ff0000". ctx.save(); _assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old"); ctx.restore(); -}, "save()/restore() works for fillStyle, with a canvas size of (0, 0)"); +}, "save() does not modify fillStyle, for a canvas of size (0, 0)."); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalAlpha.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalAlpha.html @@ -14,42 +14,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.globalAlpha; + const old = ctx.globalAlpha; ctx.save(); ctx.globalAlpha = 0.5; ctx.restore(); _assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old"); +}, "save()/restore() restores globalAlpha, for a canvas of size (300, 150)."); + +test(t => { + const canvas = new OffscreenCanvas(300, 150); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.globalAlpha = 0.5; - old = ctx.globalAlpha; + const old = ctx.globalAlpha; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 0.5. + // from rounding), so compare against `old` instead of 0.5. ctx.save(); _assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old"); ctx.restore(); -}, "save()/restore() works for globalAlpha, with a canvas size of (300, 150)"); +}, "save() does not modify globalAlpha, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.globalAlpha; + const old = ctx.globalAlpha; ctx.save(); ctx.globalAlpha = 0.5; ctx.restore(); _assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old"); +}, "save()/restore() restores globalAlpha, for a canvas of size (0, 0)."); + +test(t => { + const canvas = new OffscreenCanvas(0, 0); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.globalAlpha = 0.5; - old = ctx.globalAlpha; + const old = ctx.globalAlpha; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 0.5. + // from rounding), so compare against `old` instead of 0.5. ctx.save(); _assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old"); ctx.restore(); -}, "save()/restore() works for globalAlpha, with a canvas size of (0, 0)"); +}, "save() does not modify globalAlpha, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalAlpha.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalAlpha.worker.js @@ -10,42 +10,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.globalAlpha; + const old = ctx.globalAlpha; ctx.save(); ctx.globalAlpha = 0.5; ctx.restore(); _assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old"); +}, "save()/restore() restores globalAlpha, for a canvas of size (300, 150)."); + +test(t => { + const canvas = new OffscreenCanvas(300, 150); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.globalAlpha = 0.5; - old = ctx.globalAlpha; + const old = ctx.globalAlpha; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 0.5. + // from rounding), so compare against `old` instead of 0.5. ctx.save(); _assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old"); ctx.restore(); -}, "save()/restore() works for globalAlpha, with a canvas size of (300, 150)"); +}, "save() does not modify globalAlpha, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.globalAlpha; + const old = ctx.globalAlpha; ctx.save(); ctx.globalAlpha = 0.5; ctx.restore(); _assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old"); +}, "save()/restore() restores globalAlpha, for a canvas of size (0, 0)."); + +test(t => { + const canvas = new OffscreenCanvas(0, 0); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.globalAlpha = 0.5; - old = ctx.globalAlpha; + const old = ctx.globalAlpha; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 0.5. + // from rounding), so compare against `old` instead of 0.5. ctx.save(); _assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old"); ctx.restore(); -}, "save()/restore() works for globalAlpha, with a canvas size of (0, 0)"); +}, "save() does not modify globalAlpha, for a canvas of size (0, 0)."); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalCompositeOperation.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalCompositeOperation.html @@ -14,42 +14,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.globalCompositeOperation; + const old = ctx.globalCompositeOperation; ctx.save(); ctx.globalCompositeOperation = "copy"; ctx.restore(); _assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old"); +}, "save()/restore() restores globalCompositeOperation, for a canvas of size (300, 150)."); + +test(t => { + const canvas = new OffscreenCanvas(300, 150); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.globalCompositeOperation = "copy"; - old = ctx.globalCompositeOperation; + const old = ctx.globalCompositeOperation; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "copy". + // from rounding), so compare against `old` instead of "copy". ctx.save(); _assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old"); ctx.restore(); -}, "save()/restore() works for globalCompositeOperation, with a canvas size of (300, 150)"); +}, "save() does not modify globalCompositeOperation, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.globalCompositeOperation; + const old = ctx.globalCompositeOperation; ctx.save(); ctx.globalCompositeOperation = "copy"; ctx.restore(); _assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old"); +}, "save()/restore() restores globalCompositeOperation, for a canvas of size (0, 0)."); + +test(t => { + const canvas = new OffscreenCanvas(0, 0); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.globalCompositeOperation = "copy"; - old = ctx.globalCompositeOperation; + const old = ctx.globalCompositeOperation; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "copy". + // from rounding), so compare against `old` instead of "copy". ctx.save(); _assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old"); ctx.restore(); -}, "save()/restore() works for globalCompositeOperation, with a canvas size of (0, 0)"); +}, "save() does not modify globalCompositeOperation, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalCompositeOperation.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalCompositeOperation.worker.js @@ -10,42 +10,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.globalCompositeOperation; + const old = ctx.globalCompositeOperation; ctx.save(); ctx.globalCompositeOperation = "copy"; ctx.restore(); _assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old"); +}, "save()/restore() restores globalCompositeOperation, for a canvas of size (300, 150)."); + +test(t => { + const canvas = new OffscreenCanvas(300, 150); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.globalCompositeOperation = "copy"; - old = ctx.globalCompositeOperation; + const old = ctx.globalCompositeOperation; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "copy". + // from rounding), so compare against `old` instead of "copy". ctx.save(); _assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old"); ctx.restore(); -}, "save()/restore() works for globalCompositeOperation, with a canvas size of (300, 150)"); +}, "save() does not modify globalCompositeOperation, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.globalCompositeOperation; + const old = ctx.globalCompositeOperation; ctx.save(); ctx.globalCompositeOperation = "copy"; ctx.restore(); _assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old"); +}, "save()/restore() restores globalCompositeOperation, for a canvas of size (0, 0)."); + +test(t => { + const canvas = new OffscreenCanvas(0, 0); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.globalCompositeOperation = "copy"; - old = ctx.globalCompositeOperation; + const old = ctx.globalCompositeOperation; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "copy". + // from rounding), so compare against `old` instead of "copy". ctx.save(); _assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old"); ctx.restore(); -}, "save()/restore() works for globalCompositeOperation, with a canvas size of (0, 0)"); +}, "save() does not modify globalCompositeOperation, for a canvas of size (0, 0)."); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineCap.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineCap.html @@ -14,42 +14,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.lineCap; + const old = ctx.lineCap; ctx.save(); ctx.lineCap = "round"; ctx.restore(); _assertSame(ctx.lineCap, old, "ctx.lineCap", "old"); +}, "save()/restore() restores lineCap, for a canvas of size (300, 150)."); + +test(t => { + const canvas = new OffscreenCanvas(300, 150); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.lineCap = "round"; - old = ctx.lineCap; + const old = ctx.lineCap; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "round". + // from rounding), so compare against `old` instead of "round". ctx.save(); _assertSame(ctx.lineCap, old, "ctx.lineCap", "old"); ctx.restore(); -}, "save()/restore() works for lineCap, with a canvas size of (300, 150)"); +}, "save() does not modify lineCap, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.lineCap; + const old = ctx.lineCap; ctx.save(); ctx.lineCap = "round"; ctx.restore(); _assertSame(ctx.lineCap, old, "ctx.lineCap", "old"); +}, "save()/restore() restores lineCap, for a canvas of size (0, 0)."); + +test(t => { + const canvas = new OffscreenCanvas(0, 0); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.lineCap = "round"; - old = ctx.lineCap; + const old = ctx.lineCap; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "round". + // from rounding), so compare against `old` instead of "round". ctx.save(); _assertSame(ctx.lineCap, old, "ctx.lineCap", "old"); ctx.restore(); -}, "save()/restore() works for lineCap, with a canvas size of (0, 0)"); +}, "save() does not modify lineCap, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineCap.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineCap.worker.js @@ -10,42 +10,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.lineCap; + const old = ctx.lineCap; ctx.save(); ctx.lineCap = "round"; ctx.restore(); _assertSame(ctx.lineCap, old, "ctx.lineCap", "old"); +}, "save()/restore() restores lineCap, for a canvas of size (300, 150)."); + +test(t => { + const canvas = new OffscreenCanvas(300, 150); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.lineCap = "round"; - old = ctx.lineCap; + const old = ctx.lineCap; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "round". + // from rounding), so compare against `old` instead of "round". ctx.save(); _assertSame(ctx.lineCap, old, "ctx.lineCap", "old"); ctx.restore(); -}, "save()/restore() works for lineCap, with a canvas size of (300, 150)"); +}, "save() does not modify lineCap, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.lineCap; + const old = ctx.lineCap; ctx.save(); ctx.lineCap = "round"; ctx.restore(); _assertSame(ctx.lineCap, old, "ctx.lineCap", "old"); +}, "save()/restore() restores lineCap, for a canvas of size (0, 0)."); + +test(t => { + const canvas = new OffscreenCanvas(0, 0); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.lineCap = "round"; - old = ctx.lineCap; + const old = ctx.lineCap; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "round". + // from rounding), so compare against `old` instead of "round". ctx.save(); _assertSame(ctx.lineCap, old, "ctx.lineCap", "old"); ctx.restore(); -}, "save()/restore() works for lineCap, with a canvas size of (0, 0)"); +}, "save() does not modify lineCap, for a canvas of size (0, 0)."); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineJoin.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineJoin.html @@ -14,42 +14,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.lineJoin; + 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'); - // Also test that save() doesn't modify the values. ctx.lineJoin = "round"; - old = ctx.lineJoin; + 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 against "round". + // from rounding), so compare against `old` instead of "round". ctx.save(); _assertSame(ctx.lineJoin, old, "ctx.lineJoin", "old"); ctx.restore(); -}, "save()/restore() works for lineJoin, with a canvas size of (300, 150)"); +}, "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'); - // Test that restore() undoes any modifications. - var old = ctx.lineJoin; + 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'); - // Also test that save() doesn't modify the values. ctx.lineJoin = "round"; - old = ctx.lineJoin; + 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 against "round". + // from rounding), so compare against `old` instead of "round". ctx.save(); _assertSame(ctx.lineJoin, old, "ctx.lineJoin", "old"); ctx.restore(); -}, "save()/restore() works for lineJoin, with a canvas size of (0, 0)"); +}, "save() does not modify lineJoin, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineJoin.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineJoin.worker.js @@ -10,42 +10,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.lineJoin; + 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'); - // Also test that save() doesn't modify the values. ctx.lineJoin = "round"; - old = ctx.lineJoin; + 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 against "round". + // from rounding), so compare against `old` instead of "round". ctx.save(); _assertSame(ctx.lineJoin, old, "ctx.lineJoin", "old"); ctx.restore(); -}, "save()/restore() works for lineJoin, with a canvas size of (300, 150)"); +}, "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'); - // Test that restore() undoes any modifications. - var old = ctx.lineJoin; + 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'); - // Also test that save() doesn't modify the values. ctx.lineJoin = "round"; - old = ctx.lineJoin; + 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 against "round". + // from rounding), so compare against `old` instead of "round". ctx.save(); _assertSame(ctx.lineJoin, old, "ctx.lineJoin", "old"); ctx.restore(); -}, "save()/restore() works for lineJoin, with a canvas size of (0, 0)"); +}, "save() does not modify lineJoin, for a canvas of size (0, 0)."); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineWidth.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineWidth.html @@ -14,42 +14,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.lineWidth; + const old = ctx.lineWidth; ctx.save(); ctx.lineWidth = 0.5; ctx.restore(); _assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old"); +}, "save()/restore() restores lineWidth, for a canvas of size (300, 150)."); + +test(t => { + const canvas = new OffscreenCanvas(300, 150); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.lineWidth = 0.5; - old = ctx.lineWidth; + const old = ctx.lineWidth; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 0.5. + // from rounding), so compare against `old` instead of 0.5. ctx.save(); _assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old"); ctx.restore(); -}, "save()/restore() works for lineWidth, with a canvas size of (300, 150)"); +}, "save() does not modify lineWidth, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.lineWidth; + const old = ctx.lineWidth; ctx.save(); ctx.lineWidth = 0.5; ctx.restore(); _assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old"); +}, "save()/restore() restores lineWidth, for a canvas of size (0, 0)."); + +test(t => { + const canvas = new OffscreenCanvas(0, 0); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.lineWidth = 0.5; - old = ctx.lineWidth; + const old = ctx.lineWidth; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 0.5. + // from rounding), so compare against `old` instead of 0.5. ctx.save(); _assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old"); ctx.restore(); -}, "save()/restore() works for lineWidth, with a canvas size of (0, 0)"); +}, "save() does not modify lineWidth, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineWidth.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineWidth.worker.js @@ -10,42 +10,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.lineWidth; + const old = ctx.lineWidth; ctx.save(); ctx.lineWidth = 0.5; ctx.restore(); _assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old"); +}, "save()/restore() restores lineWidth, for a canvas of size (300, 150)."); + +test(t => { + const canvas = new OffscreenCanvas(300, 150); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.lineWidth = 0.5; - old = ctx.lineWidth; + const old = ctx.lineWidth; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 0.5. + // from rounding), so compare against `old` instead of 0.5. ctx.save(); _assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old"); ctx.restore(); -}, "save()/restore() works for lineWidth, with a canvas size of (300, 150)"); +}, "save() does not modify lineWidth, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.lineWidth; + const old = ctx.lineWidth; ctx.save(); ctx.lineWidth = 0.5; ctx.restore(); _assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old"); +}, "save()/restore() restores lineWidth, for a canvas of size (0, 0)."); + +test(t => { + const canvas = new OffscreenCanvas(0, 0); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.lineWidth = 0.5; - old = ctx.lineWidth; + const old = ctx.lineWidth; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 0.5. + // from rounding), so compare against `old` instead of 0.5. ctx.save(); _assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old"); ctx.restore(); -}, "save()/restore() works for lineWidth, with a canvas size of (0, 0)"); +}, "save() does not modify lineWidth, for a canvas of size (0, 0)."); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.miterLimit.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.miterLimit.html @@ -14,42 +14,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.miterLimit; + const old = ctx.miterLimit; ctx.save(); ctx.miterLimit = 0.5; ctx.restore(); _assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old"); +}, "save()/restore() restores miterLimit, for a canvas of size (300, 150)."); + +test(t => { + const canvas = new OffscreenCanvas(300, 150); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.miterLimit = 0.5; - old = ctx.miterLimit; + const old = ctx.miterLimit; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 0.5. + // from rounding), so compare against `old` instead of 0.5. ctx.save(); _assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old"); ctx.restore(); -}, "save()/restore() works for miterLimit, with a canvas size of (300, 150)"); +}, "save() does not modify miterLimit, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.miterLimit; + const old = ctx.miterLimit; ctx.save(); ctx.miterLimit = 0.5; ctx.restore(); _assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old"); +}, "save()/restore() restores miterLimit, for a canvas of size (0, 0)."); + +test(t => { + const canvas = new OffscreenCanvas(0, 0); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.miterLimit = 0.5; - old = ctx.miterLimit; + const old = ctx.miterLimit; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 0.5. + // from rounding), so compare against `old` instead of 0.5. ctx.save(); _assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old"); ctx.restore(); -}, "save()/restore() works for miterLimit, with a canvas size of (0, 0)"); +}, "save() does not modify miterLimit, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.miterLimit.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.miterLimit.worker.js @@ -10,42 +10,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.miterLimit; + const old = ctx.miterLimit; ctx.save(); ctx.miterLimit = 0.5; ctx.restore(); _assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old"); +}, "save()/restore() restores miterLimit, for a canvas of size (300, 150)."); + +test(t => { + const canvas = new OffscreenCanvas(300, 150); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.miterLimit = 0.5; - old = ctx.miterLimit; + const old = ctx.miterLimit; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 0.5. + // from rounding), so compare against `old` instead of 0.5. ctx.save(); _assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old"); ctx.restore(); -}, "save()/restore() works for miterLimit, with a canvas size of (300, 150)"); +}, "save() does not modify miterLimit, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.miterLimit; + const old = ctx.miterLimit; ctx.save(); ctx.miterLimit = 0.5; ctx.restore(); _assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old"); +}, "save()/restore() restores miterLimit, for a canvas of size (0, 0)."); + +test(t => { + const canvas = new OffscreenCanvas(0, 0); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.miterLimit = 0.5; - old = ctx.miterLimit; + const old = ctx.miterLimit; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 0.5. + // from rounding), so compare against `old` instead of 0.5. ctx.save(); _assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old"); ctx.restore(); -}, "save()/restore() works for miterLimit, with a canvas size of (0, 0)"); +}, "save() does not modify miterLimit, for a canvas of size (0, 0)."); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowBlur.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowBlur.html @@ -14,42 +14,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowBlur; + const old = ctx.shadowBlur; ctx.save(); ctx.shadowBlur = 5; ctx.restore(); _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); +}, "save()/restore() restores shadowBlur, for a canvas of size (300, 150)."); + +test(t => { + const canvas = new OffscreenCanvas(300, 150); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowBlur = 5; - old = ctx.shadowBlur; + const old = ctx.shadowBlur; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 5. + // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); ctx.restore(); -}, "save()/restore() works for shadowBlur, with a canvas size of (300, 150)"); +}, "save() does not modify shadowBlur, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowBlur; + const old = ctx.shadowBlur; ctx.save(); ctx.shadowBlur = 5; ctx.restore(); _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); +}, "save()/restore() restores shadowBlur, for a canvas of size (0, 0)."); + +test(t => { + const canvas = new OffscreenCanvas(0, 0); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowBlur = 5; - old = ctx.shadowBlur; + const old = ctx.shadowBlur; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 5. + // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); ctx.restore(); -}, "save()/restore() works for shadowBlur, with a canvas size of (0, 0)"); +}, "save() does not modify shadowBlur, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowBlur.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowBlur.worker.js @@ -10,42 +10,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowBlur; + const old = ctx.shadowBlur; ctx.save(); ctx.shadowBlur = 5; ctx.restore(); _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); +}, "save()/restore() restores shadowBlur, for a canvas of size (300, 150)."); + +test(t => { + const canvas = new OffscreenCanvas(300, 150); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowBlur = 5; - old = ctx.shadowBlur; + const old = ctx.shadowBlur; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 5. + // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); ctx.restore(); -}, "save()/restore() works for shadowBlur, with a canvas size of (300, 150)"); +}, "save() does not modify shadowBlur, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowBlur; + const old = ctx.shadowBlur; ctx.save(); ctx.shadowBlur = 5; ctx.restore(); _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); +}, "save()/restore() restores shadowBlur, for a canvas of size (0, 0)."); + +test(t => { + const canvas = new OffscreenCanvas(0, 0); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowBlur = 5; - old = ctx.shadowBlur; + const old = ctx.shadowBlur; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 5. + // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); ctx.restore(); -}, "save()/restore() works for shadowBlur, with a canvas size of (0, 0)"); +}, "save() does not modify shadowBlur, for a canvas of size (0, 0)."); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowColor.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowColor.html @@ -14,42 +14,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowColor; + const old = ctx.shadowColor; ctx.save(); ctx.shadowColor = "#ff0000"; ctx.restore(); _assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old"); +}, "save()/restore() restores shadowColor, for a canvas of size (300, 150)."); + +test(t => { + const canvas = new OffscreenCanvas(300, 150); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowColor = "#ff0000"; - old = ctx.shadowColor; + const old = ctx.shadowColor; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "#ff0000". + // from rounding), so compare against `old` instead of "#ff0000". ctx.save(); _assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old"); ctx.restore(); -}, "save()/restore() works for shadowColor, with a canvas size of (300, 150)"); +}, "save() does not modify shadowColor, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowColor; + const old = ctx.shadowColor; ctx.save(); ctx.shadowColor = "#ff0000"; ctx.restore(); _assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old"); +}, "save()/restore() restores shadowColor, for a canvas of size (0, 0)."); + +test(t => { + const canvas = new OffscreenCanvas(0, 0); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowColor = "#ff0000"; - old = ctx.shadowColor; + const old = ctx.shadowColor; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "#ff0000". + // from rounding), so compare against `old` instead of "#ff0000". ctx.save(); _assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old"); ctx.restore(); -}, "save()/restore() works for shadowColor, with a canvas size of (0, 0)"); +}, "save() does not modify shadowColor, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowColor.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowColor.worker.js @@ -10,42 +10,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowColor; + const old = ctx.shadowColor; ctx.save(); ctx.shadowColor = "#ff0000"; ctx.restore(); _assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old"); +}, "save()/restore() restores shadowColor, for a canvas of size (300, 150)."); + +test(t => { + const canvas = new OffscreenCanvas(300, 150); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowColor = "#ff0000"; - old = ctx.shadowColor; + const old = ctx.shadowColor; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "#ff0000". + // from rounding), so compare against `old` instead of "#ff0000". ctx.save(); _assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old"); ctx.restore(); -}, "save()/restore() works for shadowColor, with a canvas size of (300, 150)"); +}, "save() does not modify shadowColor, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowColor; + const old = ctx.shadowColor; ctx.save(); ctx.shadowColor = "#ff0000"; ctx.restore(); _assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old"); +}, "save()/restore() restores shadowColor, for a canvas of size (0, 0)."); + +test(t => { + const canvas = new OffscreenCanvas(0, 0); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowColor = "#ff0000"; - old = ctx.shadowColor; + const old = ctx.shadowColor; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against "#ff0000". + // from rounding), so compare against `old` instead of "#ff0000". ctx.save(); _assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old"); ctx.restore(); -}, "save()/restore() works for shadowColor, with a canvas size of (0, 0)"); +}, "save() does not modify shadowColor, for a canvas of size (0, 0)."); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetX.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetX.html @@ -14,42 +14,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowOffsetX; + 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'); - // Also test that save() doesn't modify the values. ctx.shadowOffsetX = 5; - old = ctx.shadowOffsetX; + 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 against 5. + // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old"); ctx.restore(); -}, "save()/restore() works for shadowOffsetX, with a canvas size of (300, 150)"); +}, "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'); - // Test that restore() undoes any modifications. - var old = ctx.shadowOffsetX; + 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'); - // Also test that save() doesn't modify the values. ctx.shadowOffsetX = 5; - old = ctx.shadowOffsetX; + 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 against 5. + // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old"); ctx.restore(); -}, "save()/restore() works for shadowOffsetX, with a canvas size of (0, 0)"); +}, "save() does not modify shadowOffsetX, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetX.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetX.worker.js @@ -10,42 +10,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowOffsetX; + 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'); - // Also test that save() doesn't modify the values. ctx.shadowOffsetX = 5; - old = ctx.shadowOffsetX; + 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 against 5. + // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old"); ctx.restore(); -}, "save()/restore() works for shadowOffsetX, with a canvas size of (300, 150)"); +}, "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'); - // Test that restore() undoes any modifications. - var old = ctx.shadowOffsetX; + 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'); - // Also test that save() doesn't modify the values. ctx.shadowOffsetX = 5; - old = ctx.shadowOffsetX; + 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 against 5. + // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old"); ctx.restore(); -}, "save()/restore() works for shadowOffsetX, with a canvas size of (0, 0)"); +}, "save() does not modify shadowOffsetX, for a canvas of size (0, 0)."); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetY.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetY.html @@ -14,42 +14,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowOffsetY; + const old = ctx.shadowOffsetY; ctx.save(); ctx.shadowOffsetY = 5; ctx.restore(); _assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old"); +}, "save()/restore() restores shadowOffsetY, for a canvas of size (300, 150)."); + +test(t => { + const canvas = new OffscreenCanvas(300, 150); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowOffsetY = 5; - old = ctx.shadowOffsetY; + const old = ctx.shadowOffsetY; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 5. + // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old"); ctx.restore(); -}, "save()/restore() works for shadowOffsetY, with a canvas size of (300, 150)"); +}, "save() does not modify shadowOffsetY, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowOffsetY; + const old = ctx.shadowOffsetY; ctx.save(); ctx.shadowOffsetY = 5; ctx.restore(); _assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old"); +}, "save()/restore() restores shadowOffsetY, for a canvas of size (0, 0)."); + +test(t => { + const canvas = new OffscreenCanvas(0, 0); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowOffsetY = 5; - old = ctx.shadowOffsetY; + const old = ctx.shadowOffsetY; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 5. + // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old"); ctx.restore(); -}, "save()/restore() works for shadowOffsetY, with a canvas size of (0, 0)"); +}, "save() does not modify shadowOffsetY, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetY.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetY.worker.js @@ -10,42 +10,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowOffsetY; + const old = ctx.shadowOffsetY; ctx.save(); ctx.shadowOffsetY = 5; ctx.restore(); _assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old"); +}, "save()/restore() restores shadowOffsetY, for a canvas of size (300, 150)."); + +test(t => { + const canvas = new OffscreenCanvas(300, 150); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowOffsetY = 5; - old = ctx.shadowOffsetY; + const old = ctx.shadowOffsetY; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 5. + // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old"); ctx.restore(); -}, "save()/restore() works for shadowOffsetY, with a canvas size of (300, 150)"); +}, "save() does not modify shadowOffsetY, for a canvas of size (300, 150)."); test(t => { const canvas = new OffscreenCanvas(0, 0); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.shadowOffsetY; + const old = ctx.shadowOffsetY; ctx.save(); ctx.shadowOffsetY = 5; ctx.restore(); _assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old"); +}, "save()/restore() restores shadowOffsetY, for a canvas of size (0, 0)."); + +test(t => { + const canvas = new OffscreenCanvas(0, 0); + const ctx = canvas.getContext('2d'); - // Also test that save() doesn't modify the values. ctx.shadowOffsetY = 5; - old = ctx.shadowOffsetY; + const old = ctx.shadowOffsetY; // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against 5. + // from rounding), so compare against `old` instead of 5. ctx.save(); _assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old"); ctx.restore(); -}, "save()/restore() works for shadowOffsetY, with a canvas size of (0, 0)"); +}, "save() does not modify shadowOffsetY, for a canvas of size (0, 0)."); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.strokeStyle.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.strokeStyle.html @@ -14,42 +14,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.strokeStyle; + 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'); - // Also test that save() doesn't modify the values. ctx.strokeStyle = "#ff0000"; - old = ctx.strokeStyle; + 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 against "#ff0000". + // from rounding), so compare against `old` instead of "#ff0000". ctx.save(); _assertSame(ctx.strokeStyle, old, "ctx.strokeStyle", "old"); ctx.restore(); -}, "save()/restore() works for strokeStyle, with a canvas size of (300, 150)"); +}, "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'); - // Test that restore() undoes any modifications. - var old = ctx.strokeStyle; + 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'); - // Also test that save() doesn't modify the values. ctx.strokeStyle = "#ff0000"; - old = ctx.strokeStyle; + 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 against "#ff0000". + // from rounding), so compare against `old` instead of "#ff0000". ctx.save(); _assertSame(ctx.strokeStyle, old, "ctx.strokeStyle", "old"); ctx.restore(); -}, "save()/restore() works for strokeStyle, with a canvas size of (0, 0)"); +}, "save() does not modify strokeStyle, for a canvas of size (0, 0)."); </script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.strokeStyle.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.strokeStyle.worker.js @@ -10,42 +10,48 @@ test(t => { const canvas = new OffscreenCanvas(300, 150); const ctx = canvas.getContext('2d'); - // Test that restore() undoes any modifications. - var old = ctx.strokeStyle; + 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'); - // Also test that save() doesn't modify the values. ctx.strokeStyle = "#ff0000"; - old = ctx.strokeStyle; + 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 against "#ff0000". + // from rounding), so compare against `old` instead of "#ff0000". ctx.save(); _assertSame(ctx.strokeStyle, old, "ctx.strokeStyle", "old"); ctx.restore(); -}, "save()/restore() works for strokeStyle, with a canvas size of (300, 150)"); +}, "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'); - // Test that restore() undoes any modifications. - var old = ctx.strokeStyle; + 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'); - // Also test that save() doesn't modify the values. ctx.strokeStyle = "#ff0000"; - old = ctx.strokeStyle; + 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 against "#ff0000". + // from rounding), so compare against `old` instead of "#ff0000". ctx.save(); _assertSame(ctx.strokeStyle, old, "ctx.strokeStyle", "old"); ctx.restore(); -}, "save()/restore() works for strokeStyle, with a canvas size of (0, 0)"); +}, "save() does not modify strokeStyle, for a canvas of size (0, 0)."); done(); diff --git a/testing/web-platform/tests/html/canvas/tools/yaml/the-canvas-state.yaml b/testing/web-platform/tests/html/canvas/tools/yaml/the-canvas-state.yaml @@ -104,26 +104,28 @@ @assert ctx.lineWidth === 0.5; - name: 2d.state.saverestore - desc: save()/restore() works for {{ variant_names[1] }}, with a canvas size of - {{ size }} - code: | - // Test that restore() undoes any modifications. - var old = ctx.{{ variant_names[1] }}; - ctx.save(); - ctx.{{ variant_names[1] }} = {{ value }}; - ctx.restore(); - @assert ctx.{{ variant_names[1] }} === old; - - // Also test that save() doesn't modify the values. - ctx.{{ variant_names[1] }} = {{ value }}; - old = ctx.{{ variant_names[1] }}; - // We're not interested in failures caused by get(set(x)) != x (e.g. - // from rounding), so compare against `old` instead of against {{ value }}. - ctx.save(); - @assert ctx.{{ variant_names[1] }} === old; - ctx.restore(); - variants_layout: [single_file, multi_files] + variants_layout: [single_file, single_file, multi_files] variants: + - restore-undoes-changes: + desc: save()/restore() restores {{ variant_names[2] }}, for a canvas of + size {{ size }}. + code: | + const old = ctx.{{ variant_names[2] }}; + ctx.save(); + ctx.{{ variant_names[2] }} = {{ value }}; + ctx.restore(); + @assert ctx.{{ variant_names[2] }} === old; + save-does-not-modify-values: + desc: save() does not modify {{ variant_names[2] }}, for a canvas of size + {{ size }}. + code: | + ctx.{{ variant_names[2] }} = {{ value }}; + const old = ctx.{{ variant_names[2] }}; + // We're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against `old` instead of {{ value }}. + ctx.save(); + @assert ctx.{{ variant_names[2] }} === old; + ctx.restore(); - non-zero-size: size: [300, 150] zero-size: