summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/canvas/offscreen/the-canvas-state')
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.bitmap.html33
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.bitmap.worker.js28
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.clip.html35
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.clip.worker.js30
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.fillStyle.html41
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.fillStyle.worker.js36
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalAlpha.html41
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalAlpha.worker.js36
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalCompositeOperation.html41
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalCompositeOperation.worker.js36
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineCap.html41
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineCap.worker.js36
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineJoin.html41
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineJoin.worker.js36
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineWidth.html41
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineWidth.worker.js36
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.miterLimit.html41
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.miterLimit.worker.js36
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.path.html34
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.path.worker.js29
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowBlur.html41
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowBlur.worker.js36
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowColor.html41
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowColor.worker.js36
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetX.html41
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetX.worker.js36
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetY.html41
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetY.worker.js36
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stack.html36
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stack.worker.js31
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stackdepth.html37
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stackdepth.worker.js32
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.strokeStyle.html41
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.strokeStyle.worker.js36
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.transformation.html34
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.transformation.worker.js29
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.underflow.html31
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.underflow.worker.js26
38 files changed, 1369 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.bitmap.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.bitmap.html
new file mode 100644
index 0000000000..208043fbf6
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.bitmap.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.state.saverestore.bitmap</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.state.saverestore.bitmap</h1>
+<p class="desc">save()/restore() does not affect the current bitmap</p>
+
+
+<script>
+var t = async_test("save()/restore() does not affect the current bitmap");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.save();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.restore();
+ _assertPixel(canvas, 50,25, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.bitmap.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.bitmap.worker.js
new file mode 100644
index 0000000000..09c7dcca90
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.bitmap.worker.js
@@ -0,0 +1,28 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.state.saverestore.bitmap
+// Description:save()/restore() does not affect the current bitmap
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("save()/restore() does not affect the current bitmap");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.save();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.restore();
+ _assertPixel(canvas, 50,25, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.clip.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.clip.html
new file mode 100644
index 0000000000..f4d6b6f6e1
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.clip.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.state.saverestore.clip</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.state.saverestore.clip</h1>
+<p class="desc">save()/restore() affects the clipping path</p>
+
+
+<script>
+var t = async_test("save()/restore() affects the clipping path");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.save();
+ ctx.rect(0, 0, 1, 1);
+ ctx.clip();
+ ctx.restore();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ _assertPixel(canvas, 50,25, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.clip.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.clip.worker.js
new file mode 100644
index 0000000000..a7bc0615e5
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.clip.worker.js
@@ -0,0 +1,30 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.state.saverestore.clip
+// Description:save()/restore() affects the clipping path
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("save()/restore() affects the clipping path");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.save();
+ ctx.rect(0, 0, 1, 1);
+ ctx.clip();
+ ctx.restore();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ _assertPixel(canvas, 50,25, 0,255,0,255);
+ t.done();
+});
+done();
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
new file mode 100644
index 0000000000..789e1e8d2b
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.fillStyle.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.state.saverestore.fillStyle</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.state.saverestore.fillStyle</h1>
+<p class="desc">save()/restore() works for fillStyle</p>
+
+
+<script>
+var t = async_test("save()/restore() works for fillStyle");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.fillStyle;
+ ctx.save();
+ ctx.fillStyle = "#ff0000";
+ ctx.restore();
+ _assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.fillStyle = "#ff0000";
+ 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"
+ ctx.save();
+ _assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old");
+ ctx.restore();
+ t.done();
+
+});
+</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
new file mode 100644
index 0000000000..46cf6d1daa
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.fillStyle.worker.js
@@ -0,0 +1,36 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.state.saverestore.fillStyle
+// Description:save()/restore() works for fillStyle
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("save()/restore() works for fillStyle");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.fillStyle;
+ ctx.save();
+ ctx.fillStyle = "#ff0000";
+ ctx.restore();
+ _assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.fillStyle = "#ff0000";
+ 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"
+ ctx.save();
+ _assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old");
+ ctx.restore();
+ t.done();
+});
+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
new file mode 100644
index 0000000000..15b59725ab
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalAlpha.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.state.saverestore.globalAlpha</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.state.saverestore.globalAlpha</h1>
+<p class="desc">save()/restore() works for globalAlpha</p>
+
+
+<script>
+var t = async_test("save()/restore() works for globalAlpha");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.globalAlpha;
+ ctx.save();
+ ctx.globalAlpha = 0.5;
+ ctx.restore();
+ _assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.globalAlpha = 0.5;
+ 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
+ ctx.save();
+ _assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old");
+ ctx.restore();
+ t.done();
+
+});
+</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
new file mode 100644
index 0000000000..765f8b00a3
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalAlpha.worker.js
@@ -0,0 +1,36 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.state.saverestore.globalAlpha
+// Description:save()/restore() works for globalAlpha
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("save()/restore() works for globalAlpha");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.globalAlpha;
+ ctx.save();
+ ctx.globalAlpha = 0.5;
+ ctx.restore();
+ _assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.globalAlpha = 0.5;
+ 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
+ ctx.save();
+ _assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old");
+ ctx.restore();
+ t.done();
+});
+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
new file mode 100644
index 0000000000..1efb24aa9b
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalCompositeOperation.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.state.saverestore.globalCompositeOperation</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.state.saverestore.globalCompositeOperation</h1>
+<p class="desc">save()/restore() works for globalCompositeOperation</p>
+
+
+<script>
+var t = async_test("save()/restore() works for globalCompositeOperation");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.globalCompositeOperation;
+ ctx.save();
+ ctx.globalCompositeOperation = "copy";
+ ctx.restore();
+ _assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.globalCompositeOperation = "copy";
+ 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"
+ ctx.save();
+ _assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old");
+ ctx.restore();
+ t.done();
+
+});
+</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
new file mode 100644
index 0000000000..cd38d56c51
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalCompositeOperation.worker.js
@@ -0,0 +1,36 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.state.saverestore.globalCompositeOperation
+// Description:save()/restore() works for globalCompositeOperation
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("save()/restore() works for globalCompositeOperation");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.globalCompositeOperation;
+ ctx.save();
+ ctx.globalCompositeOperation = "copy";
+ ctx.restore();
+ _assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.globalCompositeOperation = "copy";
+ 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"
+ ctx.save();
+ _assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old");
+ ctx.restore();
+ t.done();
+});
+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
new file mode 100644
index 0000000000..5e651d0c7b
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineCap.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.state.saverestore.lineCap</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.state.saverestore.lineCap</h1>
+<p class="desc">save()/restore() works for lineCap</p>
+
+
+<script>
+var t = async_test("save()/restore() works for lineCap");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.lineCap;
+ ctx.save();
+ ctx.lineCap = "round";
+ ctx.restore();
+ _assertSame(ctx.lineCap, old, "ctx.lineCap", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.lineCap = "round";
+ 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"
+ ctx.save();
+ _assertSame(ctx.lineCap, old, "ctx.lineCap", "old");
+ ctx.restore();
+ t.done();
+
+});
+</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
new file mode 100644
index 0000000000..9895b44b00
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineCap.worker.js
@@ -0,0 +1,36 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.state.saverestore.lineCap
+// Description:save()/restore() works for lineCap
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("save()/restore() works for lineCap");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.lineCap;
+ ctx.save();
+ ctx.lineCap = "round";
+ ctx.restore();
+ _assertSame(ctx.lineCap, old, "ctx.lineCap", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.lineCap = "round";
+ 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"
+ ctx.save();
+ _assertSame(ctx.lineCap, old, "ctx.lineCap", "old");
+ ctx.restore();
+ t.done();
+});
+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
new file mode 100644
index 0000000000..20f53fec50
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineJoin.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.state.saverestore.lineJoin</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.state.saverestore.lineJoin</h1>
+<p class="desc">save()/restore() works for lineJoin</p>
+
+
+<script>
+var t = async_test("save()/restore() works for lineJoin");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.lineJoin;
+ ctx.save();
+ ctx.lineJoin = "round";
+ ctx.restore();
+ _assertSame(ctx.lineJoin, old, "ctx.lineJoin", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.lineJoin = "round";
+ 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"
+ ctx.save();
+ _assertSame(ctx.lineJoin, old, "ctx.lineJoin", "old");
+ ctx.restore();
+ t.done();
+
+});
+</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
new file mode 100644
index 0000000000..e8c85825f1
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineJoin.worker.js
@@ -0,0 +1,36 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.state.saverestore.lineJoin
+// Description:save()/restore() works for lineJoin
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("save()/restore() works for lineJoin");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.lineJoin;
+ ctx.save();
+ ctx.lineJoin = "round";
+ ctx.restore();
+ _assertSame(ctx.lineJoin, old, "ctx.lineJoin", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.lineJoin = "round";
+ 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"
+ ctx.save();
+ _assertSame(ctx.lineJoin, old, "ctx.lineJoin", "old");
+ ctx.restore();
+ t.done();
+});
+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
new file mode 100644
index 0000000000..e234e3efc2
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineWidth.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.state.saverestore.lineWidth</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.state.saverestore.lineWidth</h1>
+<p class="desc">save()/restore() works for lineWidth</p>
+
+
+<script>
+var t = async_test("save()/restore() works for lineWidth");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.lineWidth;
+ ctx.save();
+ ctx.lineWidth = 0.5;
+ ctx.restore();
+ _assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.lineWidth = 0.5;
+ 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
+ ctx.save();
+ _assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old");
+ ctx.restore();
+ t.done();
+
+});
+</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
new file mode 100644
index 0000000000..997748c377
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineWidth.worker.js
@@ -0,0 +1,36 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.state.saverestore.lineWidth
+// Description:save()/restore() works for lineWidth
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("save()/restore() works for lineWidth");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.lineWidth;
+ ctx.save();
+ ctx.lineWidth = 0.5;
+ ctx.restore();
+ _assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.lineWidth = 0.5;
+ 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
+ ctx.save();
+ _assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old");
+ ctx.restore();
+ t.done();
+});
+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
new file mode 100644
index 0000000000..1df2b2420f
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.miterLimit.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.state.saverestore.miterLimit</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.state.saverestore.miterLimit</h1>
+<p class="desc">save()/restore() works for miterLimit</p>
+
+
+<script>
+var t = async_test("save()/restore() works for miterLimit");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.miterLimit;
+ ctx.save();
+ ctx.miterLimit = 0.5;
+ ctx.restore();
+ _assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.miterLimit = 0.5;
+ 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
+ ctx.save();
+ _assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old");
+ ctx.restore();
+ t.done();
+
+});
+</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
new file mode 100644
index 0000000000..eb5adffe06
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.miterLimit.worker.js
@@ -0,0 +1,36 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.state.saverestore.miterLimit
+// Description:save()/restore() works for miterLimit
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("save()/restore() works for miterLimit");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.miterLimit;
+ ctx.save();
+ ctx.miterLimit = 0.5;
+ ctx.restore();
+ _assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.miterLimit = 0.5;
+ 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
+ ctx.save();
+ _assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old");
+ ctx.restore();
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.path.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.path.html
new file mode 100644
index 0000000000..a86851af68
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.path.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.state.saverestore.path</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.state.saverestore.path</h1>
+<p class="desc">save()/restore() does not affect the current path</p>
+
+
+<script>
+var t = async_test("save()/restore() does not affect the current path");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.save();
+ ctx.rect(0, 0, 100, 50);
+ ctx.restore();
+ ctx.fillStyle = '#0f0';
+ ctx.fill();
+ _assertPixel(canvas, 50,25, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.path.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.path.worker.js
new file mode 100644
index 0000000000..d174de5a50
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.path.worker.js
@@ -0,0 +1,29 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.state.saverestore.path
+// Description:save()/restore() does not affect the current path
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("save()/restore() does not affect the current path");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.save();
+ ctx.rect(0, 0, 100, 50);
+ ctx.restore();
+ ctx.fillStyle = '#0f0';
+ ctx.fill();
+ _assertPixel(canvas, 50,25, 0,255,0,255);
+ t.done();
+});
+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
new file mode 100644
index 0000000000..044ee1b4bb
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowBlur.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.state.saverestore.shadowBlur</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.state.saverestore.shadowBlur</h1>
+<p class="desc">save()/restore() works for shadowBlur</p>
+
+
+<script>
+var t = async_test("save()/restore() works for shadowBlur");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.shadowBlur;
+ ctx.save();
+ ctx.shadowBlur = 5;
+ ctx.restore();
+ _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.shadowBlur = 5;
+ 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
+ ctx.save();
+ _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old");
+ ctx.restore();
+ t.done();
+
+});
+</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
new file mode 100644
index 0000000000..00cd6f8317
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowBlur.worker.js
@@ -0,0 +1,36 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.state.saverestore.shadowBlur
+// Description:save()/restore() works for shadowBlur
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("save()/restore() works for shadowBlur");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.shadowBlur;
+ ctx.save();
+ ctx.shadowBlur = 5;
+ ctx.restore();
+ _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.shadowBlur = 5;
+ 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
+ ctx.save();
+ _assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old");
+ ctx.restore();
+ t.done();
+});
+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
new file mode 100644
index 0000000000..0e8b4293e0
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowColor.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.state.saverestore.shadowColor</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.state.saverestore.shadowColor</h1>
+<p class="desc">save()/restore() works for shadowColor</p>
+
+
+<script>
+var t = async_test("save()/restore() works for shadowColor");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.shadowColor;
+ ctx.save();
+ ctx.shadowColor = "#ff0000";
+ ctx.restore();
+ _assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.shadowColor = "#ff0000";
+ 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"
+ ctx.save();
+ _assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old");
+ ctx.restore();
+ t.done();
+
+});
+</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
new file mode 100644
index 0000000000..13c033f396
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowColor.worker.js
@@ -0,0 +1,36 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.state.saverestore.shadowColor
+// Description:save()/restore() works for shadowColor
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("save()/restore() works for shadowColor");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.shadowColor;
+ ctx.save();
+ ctx.shadowColor = "#ff0000";
+ ctx.restore();
+ _assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.shadowColor = "#ff0000";
+ 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"
+ ctx.save();
+ _assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old");
+ ctx.restore();
+ t.done();
+});
+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
new file mode 100644
index 0000000000..11aa658f3e
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetX.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.state.saverestore.shadowOffsetX</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.state.saverestore.shadowOffsetX</h1>
+<p class="desc">save()/restore() works for shadowOffsetX</p>
+
+
+<script>
+var t = async_test("save()/restore() works for shadowOffsetX");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.shadowOffsetX;
+ ctx.save();
+ ctx.shadowOffsetX = 5;
+ ctx.restore();
+ _assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.shadowOffsetX = 5;
+ 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
+ ctx.save();
+ _assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old");
+ ctx.restore();
+ t.done();
+
+});
+</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
new file mode 100644
index 0000000000..a6ad922647
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetX.worker.js
@@ -0,0 +1,36 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.state.saverestore.shadowOffsetX
+// Description:save()/restore() works for shadowOffsetX
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("save()/restore() works for shadowOffsetX");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.shadowOffsetX;
+ ctx.save();
+ ctx.shadowOffsetX = 5;
+ ctx.restore();
+ _assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.shadowOffsetX = 5;
+ 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
+ ctx.save();
+ _assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old");
+ ctx.restore();
+ t.done();
+});
+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
new file mode 100644
index 0000000000..c238f0ec94
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetY.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.state.saverestore.shadowOffsetY</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.state.saverestore.shadowOffsetY</h1>
+<p class="desc">save()/restore() works for shadowOffsetY</p>
+
+
+<script>
+var t = async_test("save()/restore() works for shadowOffsetY");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.shadowOffsetY;
+ ctx.save();
+ ctx.shadowOffsetY = 5;
+ ctx.restore();
+ _assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.shadowOffsetY = 5;
+ 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
+ ctx.save();
+ _assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old");
+ ctx.restore();
+ t.done();
+
+});
+</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
new file mode 100644
index 0000000000..323fcd1434
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetY.worker.js
@@ -0,0 +1,36 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.state.saverestore.shadowOffsetY
+// Description:save()/restore() works for shadowOffsetY
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("save()/restore() works for shadowOffsetY");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.shadowOffsetY;
+ ctx.save();
+ ctx.shadowOffsetY = 5;
+ ctx.restore();
+ _assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.shadowOffsetY = 5;
+ 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
+ ctx.save();
+ _assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old");
+ ctx.restore();
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stack.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stack.html
new file mode 100644
index 0000000000..4a8750867f
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stack.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.state.saverestore.stack</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.state.saverestore.stack</h1>
+<p class="desc">save()/restore() can be nested as a stack</p>
+
+
+<script>
+var t = async_test("save()/restore() can be nested as a stack");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ ctx.lineWidth = 1;
+ ctx.save();
+ ctx.lineWidth = 2;
+ ctx.save();
+ ctx.lineWidth = 3;
+ _assertSame(ctx.lineWidth, 3, "ctx.lineWidth", "3");
+ ctx.restore();
+ _assertSame(ctx.lineWidth, 2, "ctx.lineWidth", "2");
+ ctx.restore();
+ _assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1");
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stack.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stack.worker.js
new file mode 100644
index 0000000000..460df4ec83
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stack.worker.js
@@ -0,0 +1,31 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.state.saverestore.stack
+// Description:save()/restore() can be nested as a stack
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("save()/restore() can be nested as a stack");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ ctx.lineWidth = 1;
+ ctx.save();
+ ctx.lineWidth = 2;
+ ctx.save();
+ ctx.lineWidth = 3;
+ _assertSame(ctx.lineWidth, 3, "ctx.lineWidth", "3");
+ ctx.restore();
+ _assertSame(ctx.lineWidth, 2, "ctx.lineWidth", "2");
+ ctx.restore();
+ _assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1");
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stackdepth.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stackdepth.html
new file mode 100644
index 0000000000..d536155e64
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stackdepth.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.state.saverestore.stackdepth</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.state.saverestore.stackdepth</h1>
+<p class="desc">save()/restore() stack depth is not unreasonably limited</p>
+
+
+<script>
+var t = async_test("save()/restore() stack depth is not unreasonably limited");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ var limit = 512;
+ for (var i = 1; i < limit; ++i)
+ {
+ ctx.save();
+ ctx.lineWidth = i;
+ }
+ for (var i = limit-1; i > 0; --i)
+ {
+ _assertSame(ctx.lineWidth, i, "ctx.lineWidth", "i");
+ ctx.restore();
+ }
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stackdepth.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stackdepth.worker.js
new file mode 100644
index 0000000000..c494d9ddf8
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stackdepth.worker.js
@@ -0,0 +1,32 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.state.saverestore.stackdepth
+// Description:save()/restore() stack depth is not unreasonably limited
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("save()/restore() stack depth is not unreasonably limited");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ var limit = 512;
+ for (var i = 1; i < limit; ++i)
+ {
+ ctx.save();
+ ctx.lineWidth = i;
+ }
+ for (var i = limit-1; i > 0; --i)
+ {
+ _assertSame(ctx.lineWidth, i, "ctx.lineWidth", "i");
+ ctx.restore();
+ }
+ t.done();
+});
+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
new file mode 100644
index 0000000000..561205acd9
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.strokeStyle.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.state.saverestore.strokeStyle</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.state.saverestore.strokeStyle</h1>
+<p class="desc">save()/restore() works for strokeStyle</p>
+
+
+<script>
+var t = async_test("save()/restore() works for strokeStyle");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.strokeStyle;
+ ctx.save();
+ ctx.strokeStyle = "#ff0000";
+ ctx.restore();
+ _assertSame(ctx.strokeStyle, old, "ctx.strokeStyle", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.strokeStyle = "#ff0000";
+ 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"
+ ctx.save();
+ _assertSame(ctx.strokeStyle, old, "ctx.strokeStyle", "old");
+ ctx.restore();
+ t.done();
+
+});
+</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
new file mode 100644
index 0000000000..878a6d68cb
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.strokeStyle.worker.js
@@ -0,0 +1,36 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.state.saverestore.strokeStyle
+// Description:save()/restore() works for strokeStyle
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("save()/restore() works for strokeStyle");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Test that restore() undoes any modifications
+ var old = ctx.strokeStyle;
+ ctx.save();
+ ctx.strokeStyle = "#ff0000";
+ ctx.restore();
+ _assertSame(ctx.strokeStyle, old, "ctx.strokeStyle", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.strokeStyle = "#ff0000";
+ 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"
+ ctx.save();
+ _assertSame(ctx.strokeStyle, old, "ctx.strokeStyle", "old");
+ ctx.restore();
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.transformation.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.transformation.html
new file mode 100644
index 0000000000..79ecdece53
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.transformation.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.state.saverestore.transformation</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.state.saverestore.transformation</h1>
+<p class="desc">save()/restore() affects the current transformation matrix</p>
+
+
+<script>
+var t = async_test("save()/restore() affects the current transformation matrix");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.save();
+ ctx.translate(200, 0);
+ ctx.restore();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(-200, 0, 100, 50);
+ _assertPixel(canvas, 50,25, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.transformation.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.transformation.worker.js
new file mode 100644
index 0000000000..1647dfb790
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.transformation.worker.js
@@ -0,0 +1,29 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.state.saverestore.transformation
+// Description:save()/restore() affects the current transformation matrix
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("save()/restore() affects the current transformation matrix");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.save();
+ ctx.translate(200, 0);
+ ctx.restore();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(-200, 0, 100, 50);
+ _assertPixel(canvas, 50,25, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.underflow.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.underflow.html
new file mode 100644
index 0000000000..a6713adde2
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.underflow.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.state.saverestore.underflow</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.state.saverestore.underflow</h1>
+<p class="desc">restore() with an empty stack has no effect</p>
+
+
+<script>
+var t = async_test("restore() with an empty stack has no effect");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ for (var i = 0; i < 16; ++i)
+ ctx.restore();
+ ctx.lineWidth = 0.5;
+ ctx.restore();
+ _assertSame(ctx.lineWidth, 0.5, "ctx.lineWidth", "0.5");
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.underflow.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.underflow.worker.js
new file mode 100644
index 0000000000..8ed4bcbc10
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.underflow.worker.js
@@ -0,0 +1,26 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.state.saverestore.underflow
+// Description:restore() with an empty stack has no effect
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("restore() with an empty stack has no effect");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ for (var i = 0; i < 16; ++i)
+ ctx.restore();
+ ctx.lineWidth = 0.5;
+ ctx.restore();
+ _assertSame(ctx.lineWidth, 0.5, "ctx.lineWidth", "0.5");
+ t.done();
+});
+done();