summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/canvas/offscreen/line-styles
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/canvas/offscreen/line-styles')
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.butt.html61
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.butt.worker.js56
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.closed.html46
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.closed.worker.js41
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.invalid.html52
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.invalid.worker.js47
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.open.html46
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.open.worker.js41
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.round.html77
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.round.worker.js72
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.square.html61
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.square.worker.js56
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.valid.html34
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.valid.worker.js29
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cross.html43
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cross.worker.js38
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.defaults.html30
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.defaults.worker.js25
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.fill.noop.html37
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.fill.noop.worker.js32
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.invalid.strokestyle.html37
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.invalid.strokestyle.worker.js32
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.bevel.html80
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.bevel.worker.js75
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.closed.html45
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.closed.worker.js40
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.invalid.html52
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.invalid.worker.js47
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.miter.html71
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.miter.worker.js66
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.open.html45
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.open.worker.js40
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.parallel.html42
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.parallel.worker.js37
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.round.html78
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.round.worker.js73
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.valid.html34
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.valid.worker.js29
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.acute.html52
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.acute.worker.js47
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.exceeded.html44
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.exceeded.worker.js39
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.invalid.html60
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.invalid.worker.js55
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.lineedge.html41
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.lineedge.worker.js36
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.obtuse.html52
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.obtuse.worker.js47
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.rightangle.html44
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.rightangle.worker.js39
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.valid.html37
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.valid.worker.js32
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.within.html44
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.within.worker.js39
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.union.html46
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.union.worker.js41
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.basic.html63
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.basic.worker.js58
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.invalid.html60
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.invalid.worker.js55
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.scaledefault.html40
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.scaledefault.worker.js35
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.transformed.html69
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.transformed.worker.js64
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.valid.html37
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.valid.worker.js32
66 files changed, 3155 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.butt.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.butt.html
new file mode 100644
index 0000000000..145e145cb4
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.butt.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.cap.butt</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.cap.butt</h1>
+<p class="desc">lineCap 'butt' is rendered correctly</p>
+
+
+<script>
+var t = async_test("lineCap 'butt' is rendered correctly");
+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.lineCap = 'butt';
+ ctx.lineWidth = 20;
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+ ctx.fillRect(15, 15, 20, 20);
+ ctx.beginPath();
+ ctx.moveTo(25, 15);
+ ctx.lineTo(25, 35);
+ ctx.stroke();
+
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(75, 15);
+ ctx.lineTo(75, 35);
+ ctx.stroke();
+ ctx.fillRect(65, 15, 20, 20);
+
+ _assertPixel(canvas, 25,14, 0,255,0,255);
+ _assertPixel(canvas, 25,15, 0,255,0,255);
+ _assertPixel(canvas, 25,16, 0,255,0,255);
+ _assertPixel(canvas, 25,34, 0,255,0,255);
+ _assertPixel(canvas, 25,35, 0,255,0,255);
+ _assertPixel(canvas, 25,36, 0,255,0,255);
+
+ _assertPixel(canvas, 75,14, 0,255,0,255);
+ _assertPixel(canvas, 75,15, 0,255,0,255);
+ _assertPixel(canvas, 75,16, 0,255,0,255);
+ _assertPixel(canvas, 75,34, 0,255,0,255);
+ _assertPixel(canvas, 75,35, 0,255,0,255);
+ _assertPixel(canvas, 75,36, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.butt.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.butt.worker.js
new file mode 100644
index 0000000000..127393790c
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.butt.worker.js
@@ -0,0 +1,56 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.cap.butt
+// Description:lineCap 'butt' is rendered correctly
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("lineCap 'butt' is rendered correctly");
+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.lineCap = 'butt';
+ ctx.lineWidth = 20;
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+ ctx.fillRect(15, 15, 20, 20);
+ ctx.beginPath();
+ ctx.moveTo(25, 15);
+ ctx.lineTo(25, 35);
+ ctx.stroke();
+
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(75, 15);
+ ctx.lineTo(75, 35);
+ ctx.stroke();
+ ctx.fillRect(65, 15, 20, 20);
+
+ _assertPixel(canvas, 25,14, 0,255,0,255);
+ _assertPixel(canvas, 25,15, 0,255,0,255);
+ _assertPixel(canvas, 25,16, 0,255,0,255);
+ _assertPixel(canvas, 25,34, 0,255,0,255);
+ _assertPixel(canvas, 25,35, 0,255,0,255);
+ _assertPixel(canvas, 25,36, 0,255,0,255);
+
+ _assertPixel(canvas, 75,14, 0,255,0,255);
+ _assertPixel(canvas, 75,15, 0,255,0,255);
+ _assertPixel(canvas, 75,16, 0,255,0,255);
+ _assertPixel(canvas, 75,34, 0,255,0,255);
+ _assertPixel(canvas, 75,35, 0,255,0,255);
+ _assertPixel(canvas, 75,36, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.closed.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.closed.html
new file mode 100644
index 0000000000..edddeb08e7
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.closed.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.cap.closed</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.cap.closed</h1>
+<p class="desc">Line caps are not drawn at the corners of an unclosed rectangle</p>
+
+
+<script>
+var t = async_test("Line caps are not drawn at the corners of an unclosed rectangle");
+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.strokeStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineCap = 'square';
+ ctx.lineWidth = 400;
+
+ ctx.beginPath();
+ ctx.moveTo(200, 200);
+ ctx.lineTo(200, 1000);
+ ctx.lineTo(1000, 1000);
+ ctx.lineTo(1000, 200);
+ ctx.closePath();
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.closed.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.closed.worker.js
new file mode 100644
index 0000000000..b8357316e4
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.closed.worker.js
@@ -0,0 +1,41 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.cap.closed
+// Description:Line caps are not drawn at the corners of an unclosed rectangle
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Line caps are not drawn at the corners of an unclosed rectangle");
+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.strokeStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineCap = 'square';
+ ctx.lineWidth = 400;
+
+ ctx.beginPath();
+ ctx.moveTo(200, 200);
+ ctx.lineTo(200, 1000);
+ ctx.lineTo(1000, 1000);
+ ctx.lineTo(1000, 200);
+ ctx.closePath();
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.invalid.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.invalid.html
new file mode 100644
index 0000000000..2054bbc515
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.invalid.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.cap.invalid</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.cap.invalid</h1>
+<p class="desc">Setting lineCap to invalid values is ignored</p>
+
+
+<script>
+var t = async_test("Setting lineCap to invalid values is ignored");
+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.lineCap = 'butt'
+ _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'");
+
+ ctx.lineCap = 'butt';
+ ctx.lineCap = 'invalid';
+ _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'");
+
+ ctx.lineCap = 'butt';
+ ctx.lineCap = 'ROUND';
+ _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'");
+
+ ctx.lineCap = 'butt';
+ ctx.lineCap = 'round\0';
+ _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'");
+
+ ctx.lineCap = 'butt';
+ ctx.lineCap = 'round ';
+ _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'");
+
+ ctx.lineCap = 'butt';
+ ctx.lineCap = "";
+ _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'");
+
+ ctx.lineCap = 'butt';
+ ctx.lineCap = 'bevel';
+ _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'");
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.invalid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.invalid.worker.js
new file mode 100644
index 0000000000..813ceb7f66
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.invalid.worker.js
@@ -0,0 +1,47 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.cap.invalid
+// Description:Setting lineCap to invalid values is ignored
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Setting lineCap to invalid values is ignored");
+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.lineCap = 'butt'
+ _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'");
+
+ ctx.lineCap = 'butt';
+ ctx.lineCap = 'invalid';
+ _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'");
+
+ ctx.lineCap = 'butt';
+ ctx.lineCap = 'ROUND';
+ _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'");
+
+ ctx.lineCap = 'butt';
+ ctx.lineCap = 'round\0';
+ _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'");
+
+ ctx.lineCap = 'butt';
+ ctx.lineCap = 'round ';
+ _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'");
+
+ ctx.lineCap = 'butt';
+ ctx.lineCap = "";
+ _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'");
+
+ ctx.lineCap = 'butt';
+ ctx.lineCap = 'bevel';
+ _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'");
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.open.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.open.html
new file mode 100644
index 0000000000..f26fbc686c
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.open.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.cap.open</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.cap.open</h1>
+<p class="desc">Line caps are drawn at the corners of an unclosed rectangle</p>
+
+
+<script>
+var t = async_test("Line caps are drawn at the corners of an unclosed rectangle");
+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.strokeStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineCap = 'square';
+ ctx.lineWidth = 400;
+
+ ctx.beginPath();
+ ctx.moveTo(200, 200);
+ ctx.lineTo(200, 1000);
+ ctx.lineTo(1000, 1000);
+ ctx.lineTo(1000, 200);
+ ctx.lineTo(200, 200);
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.open.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.open.worker.js
new file mode 100644
index 0000000000..169010ac2a
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.open.worker.js
@@ -0,0 +1,41 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.cap.open
+// Description:Line caps are drawn at the corners of an unclosed rectangle
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Line caps are drawn at the corners of an unclosed rectangle");
+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.strokeStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineCap = 'square';
+ ctx.lineWidth = 400;
+
+ ctx.beginPath();
+ ctx.moveTo(200, 200);
+ ctx.lineTo(200, 1000);
+ ctx.lineTo(1000, 1000);
+ ctx.lineTo(1000, 200);
+ ctx.lineTo(200, 200);
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.round.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.round.html
new file mode 100644
index 0000000000..31f5ba5423
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.round.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.cap.round</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.cap.round</h1>
+<p class="desc">lineCap 'round' is rendered correctly</p>
+
+
+<script>
+var t = async_test("lineCap 'round' is rendered correctly");
+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);
+
+ var tol = 1; // tolerance to avoid antialiasing artifacts
+
+ ctx.lineCap = 'round';
+ ctx.lineWidth = 20;
+
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+
+ ctx.beginPath();
+ ctx.moveTo(35-tol, 15);
+ ctx.arc(25, 15, 10-tol, 0, Math.PI, true);
+ ctx.arc(25, 35, 10-tol, Math.PI, 0, true);
+ ctx.fill();
+
+ ctx.beginPath();
+ ctx.moveTo(25, 15);
+ ctx.lineTo(25, 35);
+ ctx.stroke();
+
+
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+
+ ctx.beginPath();
+ ctx.moveTo(75, 15);
+ ctx.lineTo(75, 35);
+ ctx.stroke();
+
+ ctx.beginPath();
+ ctx.moveTo(85+tol, 15);
+ ctx.arc(75, 15, 10+tol, 0, Math.PI, true);
+ ctx.arc(75, 35, 10+tol, Math.PI, 0, true);
+ ctx.fill();
+
+ _assertPixel(canvas, 17,6, 0,255,0,255);
+ _assertPixel(canvas, 25,6, 0,255,0,255);
+ _assertPixel(canvas, 32,6, 0,255,0,255);
+ _assertPixel(canvas, 17,43, 0,255,0,255);
+ _assertPixel(canvas, 25,43, 0,255,0,255);
+ _assertPixel(canvas, 32,43, 0,255,0,255);
+
+ _assertPixel(canvas, 67,6, 0,255,0,255);
+ _assertPixel(canvas, 75,6, 0,255,0,255);
+ _assertPixel(canvas, 82,6, 0,255,0,255);
+ _assertPixel(canvas, 67,43, 0,255,0,255);
+ _assertPixel(canvas, 75,43, 0,255,0,255);
+ _assertPixel(canvas, 82,43, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.round.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.round.worker.js
new file mode 100644
index 0000000000..a8d9c1b92f
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.round.worker.js
@@ -0,0 +1,72 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.cap.round
+// Description:lineCap 'round' is rendered correctly
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("lineCap 'round' is rendered correctly");
+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);
+
+ var tol = 1; // tolerance to avoid antialiasing artifacts
+
+ ctx.lineCap = 'round';
+ ctx.lineWidth = 20;
+
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+
+ ctx.beginPath();
+ ctx.moveTo(35-tol, 15);
+ ctx.arc(25, 15, 10-tol, 0, Math.PI, true);
+ ctx.arc(25, 35, 10-tol, Math.PI, 0, true);
+ ctx.fill();
+
+ ctx.beginPath();
+ ctx.moveTo(25, 15);
+ ctx.lineTo(25, 35);
+ ctx.stroke();
+
+
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+
+ ctx.beginPath();
+ ctx.moveTo(75, 15);
+ ctx.lineTo(75, 35);
+ ctx.stroke();
+
+ ctx.beginPath();
+ ctx.moveTo(85+tol, 15);
+ ctx.arc(75, 15, 10+tol, 0, Math.PI, true);
+ ctx.arc(75, 35, 10+tol, Math.PI, 0, true);
+ ctx.fill();
+
+ _assertPixel(canvas, 17,6, 0,255,0,255);
+ _assertPixel(canvas, 25,6, 0,255,0,255);
+ _assertPixel(canvas, 32,6, 0,255,0,255);
+ _assertPixel(canvas, 17,43, 0,255,0,255);
+ _assertPixel(canvas, 25,43, 0,255,0,255);
+ _assertPixel(canvas, 32,43, 0,255,0,255);
+
+ _assertPixel(canvas, 67,6, 0,255,0,255);
+ _assertPixel(canvas, 75,6, 0,255,0,255);
+ _assertPixel(canvas, 82,6, 0,255,0,255);
+ _assertPixel(canvas, 67,43, 0,255,0,255);
+ _assertPixel(canvas, 75,43, 0,255,0,255);
+ _assertPixel(canvas, 82,43, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.square.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.square.html
new file mode 100644
index 0000000000..0d2988877d
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.square.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.cap.square</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.cap.square</h1>
+<p class="desc">lineCap 'square' is rendered correctly</p>
+
+
+<script>
+var t = async_test("lineCap 'square' is rendered correctly");
+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.lineCap = 'square';
+ ctx.lineWidth = 20;
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+ ctx.fillRect(15, 5, 20, 40);
+ ctx.beginPath();
+ ctx.moveTo(25, 15);
+ ctx.lineTo(25, 35);
+ ctx.stroke();
+
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(75, 15);
+ ctx.lineTo(75, 35);
+ ctx.stroke();
+ ctx.fillRect(65, 5, 20, 40);
+
+ _assertPixel(canvas, 25,4, 0,255,0,255);
+ _assertPixel(canvas, 25,5, 0,255,0,255);
+ _assertPixel(canvas, 25,6, 0,255,0,255);
+ _assertPixel(canvas, 25,44, 0,255,0,255);
+ _assertPixel(canvas, 25,45, 0,255,0,255);
+ _assertPixel(canvas, 25,46, 0,255,0,255);
+
+ _assertPixel(canvas, 75,4, 0,255,0,255);
+ _assertPixel(canvas, 75,5, 0,255,0,255);
+ _assertPixel(canvas, 75,6, 0,255,0,255);
+ _assertPixel(canvas, 75,44, 0,255,0,255);
+ _assertPixel(canvas, 75,45, 0,255,0,255);
+ _assertPixel(canvas, 75,46, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.square.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.square.worker.js
new file mode 100644
index 0000000000..6776e9891b
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.square.worker.js
@@ -0,0 +1,56 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.cap.square
+// Description:lineCap 'square' is rendered correctly
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("lineCap 'square' is rendered correctly");
+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.lineCap = 'square';
+ ctx.lineWidth = 20;
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+ ctx.fillRect(15, 5, 20, 40);
+ ctx.beginPath();
+ ctx.moveTo(25, 15);
+ ctx.lineTo(25, 35);
+ ctx.stroke();
+
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(75, 15);
+ ctx.lineTo(75, 35);
+ ctx.stroke();
+ ctx.fillRect(65, 5, 20, 40);
+
+ _assertPixel(canvas, 25,4, 0,255,0,255);
+ _assertPixel(canvas, 25,5, 0,255,0,255);
+ _assertPixel(canvas, 25,6, 0,255,0,255);
+ _assertPixel(canvas, 25,44, 0,255,0,255);
+ _assertPixel(canvas, 25,45, 0,255,0,255);
+ _assertPixel(canvas, 25,46, 0,255,0,255);
+
+ _assertPixel(canvas, 75,4, 0,255,0,255);
+ _assertPixel(canvas, 75,5, 0,255,0,255);
+ _assertPixel(canvas, 75,6, 0,255,0,255);
+ _assertPixel(canvas, 75,44, 0,255,0,255);
+ _assertPixel(canvas, 75,45, 0,255,0,255);
+ _assertPixel(canvas, 75,46, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.valid.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.valid.html
new file mode 100644
index 0000000000..6334891f56
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.valid.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.line.cap.valid</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.cap.valid</h1>
+<p class="desc">Setting lineCap to valid values works</p>
+
+
+<script>
+var t = async_test("Setting lineCap to valid values works");
+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.lineCap = 'butt'
+ _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'");
+
+ ctx.lineCap = 'round';
+ _assertSame(ctx.lineCap, 'round', "ctx.lineCap", "'round'");
+
+ ctx.lineCap = 'square';
+ _assertSame(ctx.lineCap, 'square', "ctx.lineCap", "'square'");
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.valid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.valid.worker.js
new file mode 100644
index 0000000000..0010fd61dd
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.valid.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.line.cap.valid
+// Description:Setting lineCap to valid values works
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Setting lineCap to valid values works");
+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.lineCap = 'butt'
+ _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'");
+
+ ctx.lineCap = 'round';
+ _assertSame(ctx.lineCap, 'round', "ctx.lineCap", "'round'");
+
+ ctx.lineCap = 'square';
+ _assertSame(ctx.lineCap, 'square', "ctx.lineCap", "'square'");
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cross.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cross.html
new file mode 100644
index 0000000000..83e2a758fd
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cross.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.cross</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.cross</h1>
+<p class="desc"></p>
+
+
+<script>
+var t = async_test("");
+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.lineWidth = 200;
+ ctx.lineJoin = 'bevel';
+
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(110, 50);
+ ctx.lineTo(110, 60);
+ ctx.lineTo(100, 60);
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cross.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cross.worker.js
new file mode 100644
index 0000000000..5dc95c25f1
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cross.worker.js
@@ -0,0 +1,38 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.cross
+// Description:
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("");
+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.lineWidth = 200;
+ ctx.lineJoin = 'bevel';
+
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(110, 50);
+ ctx.lineTo(110, 60);
+ ctx.lineTo(100, 60);
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.defaults.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.defaults.html
new file mode 100644
index 0000000000..7f50257288
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.defaults.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.defaults</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.defaults</h1>
+<p class="desc"></p>
+
+
+<script>
+var t = async_test("");
+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');
+
+ _assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1");
+ _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'");
+ _assertSame(ctx.lineJoin, 'miter', "ctx.lineJoin", "'miter'");
+ _assertSame(ctx.miterLimit, 10, "ctx.miterLimit", "10");
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.defaults.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.defaults.worker.js
new file mode 100644
index 0000000000..1a59b81027
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.defaults.worker.js
@@ -0,0 +1,25 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.defaults
+// Description:
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("");
+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');
+
+ _assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1");
+ _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'");
+ _assertSame(ctx.lineJoin, 'miter', "ctx.lineJoin", "'miter'");
+ _assertSame(ctx.miterLimit, 10, "ctx.miterLimit", "10");
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.fill.noop.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.fill.noop.html
new file mode 100644
index 0000000000..0d1aa4be30
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.fill.noop.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.line.fill.noop</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.fill.noop</h1>
+<p class="desc">Filling a line draws nothing</p>
+
+
+<script>
+var t = async_test("Filling a line draws nothing");
+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.fillStyle = '#f00';
+ ctx.lineWidth = 20;
+ ctx.beginPath();
+ ctx.moveTo(10, 20);
+ ctx.lineTo(90, 30);
+ ctx.fill();
+ _assertPixel(canvas, 50,24, 0,255,0,255);
+ _assertPixel(canvas, 50,25, 0,255,0,255);
+ _assertPixel(canvas, 50,26, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.fill.noop.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.fill.noop.worker.js
new file mode 100644
index 0000000000..e3e8c14b3f
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.fill.noop.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.line.fill.noop
+// Description:Filling a line draws nothing
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Filling a line draws nothing");
+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.fillStyle = '#f00';
+ ctx.lineWidth = 20;
+ ctx.beginPath();
+ ctx.moveTo(10, 20);
+ ctx.lineTo(90, 30);
+ ctx.fill();
+ _assertPixel(canvas, 50,24, 0,255,0,255);
+ _assertPixel(canvas, 50,25, 0,255,0,255);
+ _assertPixel(canvas, 50,26, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.invalid.strokestyle.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.invalid.strokestyle.html
new file mode 100644
index 0000000000..fa67e3b3f8
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.invalid.strokestyle.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.line.invalid.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.line.invalid.strokestyle</h1>
+<p class="desc">Verify correct behavior of canvas on an invalid strokeStyle()</p>
+
+
+<script>
+var t = async_test("Verify correct behavior of canvas on an invalid 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');
+
+ ctx.strokeStyle = 'rgb(0, 255, 0)';
+ ctx.strokeStyle = 'nonsense';
+ ctx.lineWidth = 200;
+ ctx.moveTo(0,100);
+ ctx.lineTo(200,100);
+ ctx.stroke();
+ var imageData = ctx.getImageData(0, 0, 200, 200);
+ var imgdata = imageData.data;
+ _assert(imgdata[4] == 0, "imgdata[\""+(4)+"\"] == 0");
+ _assert(imgdata[5] == 255, "imgdata[\""+(5)+"\"] == 255");
+ _assert(imgdata[6] == 0, "imgdata[\""+(6)+"\"] == 0");
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.invalid.strokestyle.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.invalid.strokestyle.worker.js
new file mode 100644
index 0000000000..5726b1835a
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.invalid.strokestyle.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.line.invalid.strokestyle
+// Description:Verify correct behavior of canvas on an invalid strokeStyle()
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Verify correct behavior of canvas on an invalid 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');
+
+ ctx.strokeStyle = 'rgb(0, 255, 0)';
+ ctx.strokeStyle = 'nonsense';
+ ctx.lineWidth = 200;
+ ctx.moveTo(0,100);
+ ctx.lineTo(200,100);
+ ctx.stroke();
+ var imageData = ctx.getImageData(0, 0, 200, 200);
+ var imgdata = imageData.data;
+ _assert(imgdata[4] == 0, "imgdata[\""+(4)+"\"] == 0");
+ _assert(imgdata[5] == 255, "imgdata[\""+(5)+"\"] == 255");
+ _assert(imgdata[6] == 0, "imgdata[\""+(6)+"\"] == 0");
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.bevel.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.bevel.html
new file mode 100644
index 0000000000..70e3896281
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.bevel.html
@@ -0,0 +1,80 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.join.bevel</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.join.bevel</h1>
+<p class="desc">lineJoin 'bevel' is rendered correctly</p>
+
+
+<script>
+var t = async_test("lineJoin 'bevel' is rendered correctly");
+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);
+
+ var tol = 1; // tolerance to avoid antialiasing artifacts
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineWidth = 20;
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+
+ ctx.fillRect(10, 10, 20, 20);
+ ctx.fillRect(20, 20, 20, 20);
+ ctx.beginPath();
+ ctx.moveTo(30, 20);
+ ctx.lineTo(40-tol, 20);
+ ctx.lineTo(30, 10+tol);
+ ctx.fill();
+
+ ctx.beginPath();
+ ctx.moveTo(10, 20);
+ ctx.lineTo(30, 20);
+ ctx.lineTo(30, 40);
+ ctx.stroke();
+
+
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+
+ ctx.beginPath();
+ ctx.moveTo(60, 20);
+ ctx.lineTo(80, 20);
+ ctx.lineTo(80, 40);
+ ctx.stroke();
+
+ ctx.fillRect(60, 10, 20, 20);
+ ctx.fillRect(70, 20, 20, 20);
+ ctx.beginPath();
+ ctx.moveTo(80, 20);
+ ctx.lineTo(90+tol, 20);
+ ctx.lineTo(80, 10-tol);
+ ctx.fill();
+
+ _assertPixel(canvas, 34,16, 0,255,0,255);
+ _assertPixel(canvas, 34,15, 0,255,0,255);
+ _assertPixel(canvas, 35,15, 0,255,0,255);
+ _assertPixel(canvas, 36,15, 0,255,0,255);
+ _assertPixel(canvas, 36,14, 0,255,0,255);
+
+ _assertPixel(canvas, 84,16, 0,255,0,255);
+ _assertPixel(canvas, 84,15, 0,255,0,255);
+ _assertPixel(canvas, 85,15, 0,255,0,255);
+ _assertPixel(canvas, 86,15, 0,255,0,255);
+ _assertPixel(canvas, 86,14, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.bevel.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.bevel.worker.js
new file mode 100644
index 0000000000..efd884debe
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.bevel.worker.js
@@ -0,0 +1,75 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.join.bevel
+// Description:lineJoin 'bevel' is rendered correctly
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("lineJoin 'bevel' is rendered correctly");
+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);
+
+ var tol = 1; // tolerance to avoid antialiasing artifacts
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineWidth = 20;
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+
+ ctx.fillRect(10, 10, 20, 20);
+ ctx.fillRect(20, 20, 20, 20);
+ ctx.beginPath();
+ ctx.moveTo(30, 20);
+ ctx.lineTo(40-tol, 20);
+ ctx.lineTo(30, 10+tol);
+ ctx.fill();
+
+ ctx.beginPath();
+ ctx.moveTo(10, 20);
+ ctx.lineTo(30, 20);
+ ctx.lineTo(30, 40);
+ ctx.stroke();
+
+
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+
+ ctx.beginPath();
+ ctx.moveTo(60, 20);
+ ctx.lineTo(80, 20);
+ ctx.lineTo(80, 40);
+ ctx.stroke();
+
+ ctx.fillRect(60, 10, 20, 20);
+ ctx.fillRect(70, 20, 20, 20);
+ ctx.beginPath();
+ ctx.moveTo(80, 20);
+ ctx.lineTo(90+tol, 20);
+ ctx.lineTo(80, 10-tol);
+ ctx.fill();
+
+ _assertPixel(canvas, 34,16, 0,255,0,255);
+ _assertPixel(canvas, 34,15, 0,255,0,255);
+ _assertPixel(canvas, 35,15, 0,255,0,255);
+ _assertPixel(canvas, 36,15, 0,255,0,255);
+ _assertPixel(canvas, 36,14, 0,255,0,255);
+
+ _assertPixel(canvas, 84,16, 0,255,0,255);
+ _assertPixel(canvas, 84,15, 0,255,0,255);
+ _assertPixel(canvas, 85,15, 0,255,0,255);
+ _assertPixel(canvas, 86,15, 0,255,0,255);
+ _assertPixel(canvas, 86,14, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.closed.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.closed.html
new file mode 100644
index 0000000000..60650adeb3
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.closed.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.join.closed</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.join.closed</h1>
+<p class="desc">Line joins are drawn at the corner of a closed rectangle</p>
+
+
+<script>
+var t = async_test("Line joins are drawn at the corner of a closed rectangle");
+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.strokeStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineJoin = 'miter';
+ ctx.lineWidth = 200;
+
+ ctx.beginPath();
+ ctx.moveTo(100, 50);
+ ctx.lineTo(100, 1000);
+ ctx.lineTo(1000, 1000);
+ ctx.lineTo(1000, 50);
+ ctx.closePath();
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.closed.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.closed.worker.js
new file mode 100644
index 0000000000..4882311961
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.closed.worker.js
@@ -0,0 +1,40 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.join.closed
+// Description:Line joins are drawn at the corner of a closed rectangle
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Line joins are drawn at the corner of a closed rectangle");
+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.strokeStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineJoin = 'miter';
+ ctx.lineWidth = 200;
+
+ ctx.beginPath();
+ ctx.moveTo(100, 50);
+ ctx.lineTo(100, 1000);
+ ctx.lineTo(1000, 1000);
+ ctx.lineTo(1000, 50);
+ ctx.closePath();
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.invalid.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.invalid.html
new file mode 100644
index 0000000000..be1f7e393e
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.invalid.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.join.invalid</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.join.invalid</h1>
+<p class="desc">Setting lineJoin to invalid values is ignored</p>
+
+
+<script>
+var t = async_test("Setting lineJoin to invalid values is ignored");
+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.lineJoin = 'bevel'
+ _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'");
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineJoin = 'invalid';
+ _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'");
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineJoin = 'ROUND';
+ _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'");
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineJoin = 'round\0';
+ _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'");
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineJoin = 'round ';
+ _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'");
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineJoin = "";
+ _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'");
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineJoin = 'butt';
+ _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'");
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.invalid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.invalid.worker.js
new file mode 100644
index 0000000000..aa5a35c0c5
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.invalid.worker.js
@@ -0,0 +1,47 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.join.invalid
+// Description:Setting lineJoin to invalid values is ignored
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Setting lineJoin to invalid values is ignored");
+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.lineJoin = 'bevel'
+ _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'");
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineJoin = 'invalid';
+ _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'");
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineJoin = 'ROUND';
+ _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'");
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineJoin = 'round\0';
+ _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'");
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineJoin = 'round ';
+ _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'");
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineJoin = "";
+ _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'");
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineJoin = 'butt';
+ _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'");
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.miter.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.miter.html
new file mode 100644
index 0000000000..c26e883c40
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.miter.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.join.miter</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.join.miter</h1>
+<p class="desc">lineJoin 'miter' is rendered correctly</p>
+
+
+<script>
+var t = async_test("lineJoin 'miter' is rendered correctly");
+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.lineJoin = 'miter';
+ ctx.lineWidth = 20;
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+
+ ctx.fillRect(10, 10, 30, 20);
+ ctx.fillRect(20, 10, 20, 30);
+
+ ctx.beginPath();
+ ctx.moveTo(10, 20);
+ ctx.lineTo(30, 20);
+ ctx.lineTo(30, 40);
+ ctx.stroke();
+
+
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+
+ ctx.beginPath();
+ ctx.moveTo(60, 20);
+ ctx.lineTo(80, 20);
+ ctx.lineTo(80, 40);
+ ctx.stroke();
+
+ ctx.fillRect(60, 10, 30, 20);
+ ctx.fillRect(70, 10, 20, 30);
+
+ _assertPixel(canvas, 38,12, 0,255,0,255);
+ _assertPixel(canvas, 39,11, 0,255,0,255);
+ _assertPixel(canvas, 40,10, 0,255,0,255);
+ _assertPixel(canvas, 41,9, 0,255,0,255);
+ _assertPixel(canvas, 42,8, 0,255,0,255);
+
+ _assertPixel(canvas, 88,12, 0,255,0,255);
+ _assertPixel(canvas, 89,11, 0,255,0,255);
+ _assertPixel(canvas, 90,10, 0,255,0,255);
+ _assertPixel(canvas, 91,9, 0,255,0,255);
+ _assertPixel(canvas, 92,8, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.miter.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.miter.worker.js
new file mode 100644
index 0000000000..7b70000100
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.miter.worker.js
@@ -0,0 +1,66 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.join.miter
+// Description:lineJoin 'miter' is rendered correctly
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("lineJoin 'miter' is rendered correctly");
+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.lineJoin = 'miter';
+ ctx.lineWidth = 20;
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+
+ ctx.fillRect(10, 10, 30, 20);
+ ctx.fillRect(20, 10, 20, 30);
+
+ ctx.beginPath();
+ ctx.moveTo(10, 20);
+ ctx.lineTo(30, 20);
+ ctx.lineTo(30, 40);
+ ctx.stroke();
+
+
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+
+ ctx.beginPath();
+ ctx.moveTo(60, 20);
+ ctx.lineTo(80, 20);
+ ctx.lineTo(80, 40);
+ ctx.stroke();
+
+ ctx.fillRect(60, 10, 30, 20);
+ ctx.fillRect(70, 10, 20, 30);
+
+ _assertPixel(canvas, 38,12, 0,255,0,255);
+ _assertPixel(canvas, 39,11, 0,255,0,255);
+ _assertPixel(canvas, 40,10, 0,255,0,255);
+ _assertPixel(canvas, 41,9, 0,255,0,255);
+ _assertPixel(canvas, 42,8, 0,255,0,255);
+
+ _assertPixel(canvas, 88,12, 0,255,0,255);
+ _assertPixel(canvas, 89,11, 0,255,0,255);
+ _assertPixel(canvas, 90,10, 0,255,0,255);
+ _assertPixel(canvas, 91,9, 0,255,0,255);
+ _assertPixel(canvas, 92,8, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.open.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.open.html
new file mode 100644
index 0000000000..d801e5c367
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.open.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.join.open</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.join.open</h1>
+<p class="desc">Line joins are not drawn at the corner of an unclosed rectangle</p>
+
+
+<script>
+var t = async_test("Line joins are not drawn at the corner of an unclosed rectangle");
+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.strokeStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineJoin = 'miter';
+ ctx.lineWidth = 200;
+
+ ctx.beginPath();
+ ctx.moveTo(100, 50);
+ ctx.lineTo(100, 1000);
+ ctx.lineTo(1000, 1000);
+ ctx.lineTo(1000, 50);
+ ctx.lineTo(100, 50);
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.open.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.open.worker.js
new file mode 100644
index 0000000000..2a1242436d
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.open.worker.js
@@ -0,0 +1,40 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.join.open
+// Description:Line joins are not drawn at the corner of an unclosed rectangle
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Line joins are not drawn at the corner of an unclosed rectangle");
+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.strokeStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineJoin = 'miter';
+ ctx.lineWidth = 200;
+
+ ctx.beginPath();
+ ctx.moveTo(100, 50);
+ ctx.lineTo(100, 1000);
+ ctx.lineTo(1000, 1000);
+ ctx.lineTo(1000, 50);
+ ctx.lineTo(100, 50);
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.parallel.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.parallel.html
new file mode 100644
index 0000000000..0826406b9d
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.parallel.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.join.parallel</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.join.parallel</h1>
+<p class="desc">Line joins are drawn at 180-degree joins</p>
+
+
+<script>
+var t = async_test("Line joins are drawn at 180-degree joins");
+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.strokeStyle = '#0f0';
+ ctx.lineWidth = 300;
+ ctx.lineJoin = 'round';
+ ctx.beginPath();
+ ctx.moveTo(-100, 25);
+ ctx.lineTo(0, 25);
+ ctx.lineTo(-100, 25);
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.parallel.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.parallel.worker.js
new file mode 100644
index 0000000000..f5b67dc5a2
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.parallel.worker.js
@@ -0,0 +1,37 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.join.parallel
+// Description:Line joins are drawn at 180-degree joins
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Line joins are drawn at 180-degree joins");
+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.strokeStyle = '#0f0';
+ ctx.lineWidth = 300;
+ ctx.lineJoin = 'round';
+ ctx.beginPath();
+ ctx.moveTo(-100, 25);
+ ctx.lineTo(0, 25);
+ ctx.lineTo(-100, 25);
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.round.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.round.html
new file mode 100644
index 0000000000..70f6a8e517
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.round.html
@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.join.round</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.join.round</h1>
+<p class="desc">lineJoin 'round' is rendered correctly</p>
+
+
+<script>
+var t = async_test("lineJoin 'round' is rendered correctly");
+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);
+
+ var tol = 1; // tolerance to avoid antialiasing artifacts
+
+ ctx.lineJoin = 'round';
+ ctx.lineWidth = 20;
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+
+ ctx.fillRect(10, 10, 20, 20);
+ ctx.fillRect(20, 20, 20, 20);
+ ctx.beginPath();
+ ctx.moveTo(30, 20);
+ ctx.arc(30, 20, 10-tol, 0, 2*Math.PI, true);
+ ctx.fill();
+
+ ctx.beginPath();
+ ctx.moveTo(10, 20);
+ ctx.lineTo(30, 20);
+ ctx.lineTo(30, 40);
+ ctx.stroke();
+
+
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+
+ ctx.beginPath();
+ ctx.moveTo(60, 20);
+ ctx.lineTo(80, 20);
+ ctx.lineTo(80, 40);
+ ctx.stroke();
+
+ ctx.fillRect(60, 10, 20, 20);
+ ctx.fillRect(70, 20, 20, 20);
+ ctx.beginPath();
+ ctx.moveTo(80, 20);
+ ctx.arc(80, 20, 10+tol, 0, 2*Math.PI, true);
+ ctx.fill();
+
+ _assertPixel(canvas, 36,14, 0,255,0,255);
+ _assertPixel(canvas, 36,13, 0,255,0,255);
+ _assertPixel(canvas, 37,13, 0,255,0,255);
+ _assertPixel(canvas, 38,13, 0,255,0,255);
+ _assertPixel(canvas, 38,12, 0,255,0,255);
+
+ _assertPixel(canvas, 86,14, 0,255,0,255);
+ _assertPixel(canvas, 86,13, 0,255,0,255);
+ _assertPixel(canvas, 87,13, 0,255,0,255);
+ _assertPixel(canvas, 88,13, 0,255,0,255);
+ _assertPixel(canvas, 88,12, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.round.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.round.worker.js
new file mode 100644
index 0000000000..33b135d604
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.round.worker.js
@@ -0,0 +1,73 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.join.round
+// Description:lineJoin 'round' is rendered correctly
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("lineJoin 'round' is rendered correctly");
+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);
+
+ var tol = 1; // tolerance to avoid antialiasing artifacts
+
+ ctx.lineJoin = 'round';
+ ctx.lineWidth = 20;
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+
+ ctx.fillRect(10, 10, 20, 20);
+ ctx.fillRect(20, 20, 20, 20);
+ ctx.beginPath();
+ ctx.moveTo(30, 20);
+ ctx.arc(30, 20, 10-tol, 0, 2*Math.PI, true);
+ ctx.fill();
+
+ ctx.beginPath();
+ ctx.moveTo(10, 20);
+ ctx.lineTo(30, 20);
+ ctx.lineTo(30, 40);
+ ctx.stroke();
+
+
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+
+ ctx.beginPath();
+ ctx.moveTo(60, 20);
+ ctx.lineTo(80, 20);
+ ctx.lineTo(80, 40);
+ ctx.stroke();
+
+ ctx.fillRect(60, 10, 20, 20);
+ ctx.fillRect(70, 20, 20, 20);
+ ctx.beginPath();
+ ctx.moveTo(80, 20);
+ ctx.arc(80, 20, 10+tol, 0, 2*Math.PI, true);
+ ctx.fill();
+
+ _assertPixel(canvas, 36,14, 0,255,0,255);
+ _assertPixel(canvas, 36,13, 0,255,0,255);
+ _assertPixel(canvas, 37,13, 0,255,0,255);
+ _assertPixel(canvas, 38,13, 0,255,0,255);
+ _assertPixel(canvas, 38,12, 0,255,0,255);
+
+ _assertPixel(canvas, 86,14, 0,255,0,255);
+ _assertPixel(canvas, 86,13, 0,255,0,255);
+ _assertPixel(canvas, 87,13, 0,255,0,255);
+ _assertPixel(canvas, 88,13, 0,255,0,255);
+ _assertPixel(canvas, 88,12, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.valid.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.valid.html
new file mode 100644
index 0000000000..3b3935d1f7
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.valid.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.line.join.valid</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.join.valid</h1>
+<p class="desc">Setting lineJoin to valid values works</p>
+
+
+<script>
+var t = async_test("Setting lineJoin to valid values works");
+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.lineJoin = 'bevel'
+ _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'");
+
+ ctx.lineJoin = 'round';
+ _assertSame(ctx.lineJoin, 'round', "ctx.lineJoin", "'round'");
+
+ ctx.lineJoin = 'miter';
+ _assertSame(ctx.lineJoin, 'miter', "ctx.lineJoin", "'miter'");
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.valid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.valid.worker.js
new file mode 100644
index 0000000000..d1bdfd8845
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.valid.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.line.join.valid
+// Description:Setting lineJoin to valid values works
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Setting lineJoin to valid values works");
+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.lineJoin = 'bevel'
+ _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'");
+
+ ctx.lineJoin = 'round';
+ _assertSame(ctx.lineJoin, 'round', "ctx.lineJoin", "'round'");
+
+ ctx.lineJoin = 'miter';
+ _assertSame(ctx.lineJoin, 'miter', "ctx.lineJoin", "'miter'");
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.acute.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.acute.html
new file mode 100644
index 0000000000..587062ed12
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.acute.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.miter.acute</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.miter.acute</h1>
+<p class="desc">Miter joins are drawn correctly with acute angles</p>
+
+
+<script>
+var t = async_test("Miter joins are drawn correctly with acute angles");
+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.lineWidth = 200;
+ ctx.lineJoin = 'miter';
+
+ ctx.strokeStyle = '#0f0';
+ ctx.miterLimit = 2.614;
+ ctx.beginPath();
+ ctx.moveTo(100, 1000);
+ ctx.lineTo(100, 100);
+ ctx.lineTo(1000, 1000);
+ ctx.stroke();
+
+ ctx.strokeStyle = '#f00';
+ ctx.miterLimit = 2.613;
+ ctx.beginPath();
+ ctx.moveTo(100, 1000);
+ ctx.lineTo(100, 100);
+ ctx.lineTo(1000, 1000);
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.acute.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.acute.worker.js
new file mode 100644
index 0000000000..0ab5c9050c
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.acute.worker.js
@@ -0,0 +1,47 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.miter.acute
+// Description:Miter joins are drawn correctly with acute angles
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Miter joins are drawn correctly with acute angles");
+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.lineWidth = 200;
+ ctx.lineJoin = 'miter';
+
+ ctx.strokeStyle = '#0f0';
+ ctx.miterLimit = 2.614;
+ ctx.beginPath();
+ ctx.moveTo(100, 1000);
+ ctx.lineTo(100, 100);
+ ctx.lineTo(1000, 1000);
+ ctx.stroke();
+
+ ctx.strokeStyle = '#f00';
+ ctx.miterLimit = 2.613;
+ ctx.beginPath();
+ ctx.moveTo(100, 1000);
+ ctx.lineTo(100, 100);
+ ctx.lineTo(1000, 1000);
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.exceeded.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.exceeded.html
new file mode 100644
index 0000000000..1ae5c55aef
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.exceeded.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.miter.exceeded</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.miter.exceeded</h1>
+<p class="desc">Miter joins are not drawn when the miter limit is exceeded</p>
+
+
+<script>
+var t = async_test("Miter joins are not drawn when the miter limit is exceeded");
+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.lineWidth = 400;
+ ctx.lineJoin = 'miter';
+
+ ctx.strokeStyle = '#f00';
+ ctx.miterLimit = 1.414;
+ ctx.beginPath();
+ ctx.moveTo(200, 1000);
+ ctx.lineTo(200, 200);
+ ctx.lineTo(1000, 201); // slightly non-right-angle to avoid being a special case
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.exceeded.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.exceeded.worker.js
new file mode 100644
index 0000000000..41c4716c88
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.exceeded.worker.js
@@ -0,0 +1,39 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.miter.exceeded
+// Description:Miter joins are not drawn when the miter limit is exceeded
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Miter joins are not drawn when the miter limit is exceeded");
+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.lineWidth = 400;
+ ctx.lineJoin = 'miter';
+
+ ctx.strokeStyle = '#f00';
+ ctx.miterLimit = 1.414;
+ ctx.beginPath();
+ ctx.moveTo(200, 1000);
+ ctx.lineTo(200, 200);
+ ctx.lineTo(1000, 201); // slightly non-right-angle to avoid being a special case
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.invalid.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.invalid.html
new file mode 100644
index 0000000000..eacd95b811
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.invalid.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.miter.invalid</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.miter.invalid</h1>
+<p class="desc">Setting miterLimit to invalid values is ignored</p>
+
+
+<script>
+var t = async_test("Setting miterLimit to invalid values is ignored");
+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.miterLimit = 1.5;
+ _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5");
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = 0;
+ _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5");
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = -1;
+ _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5");
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = Infinity;
+ _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5");
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = -Infinity;
+ _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5");
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = NaN;
+ _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5");
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = 'string';
+ _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5");
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = true;
+ _assertSame(ctx.miterLimit, 1, "ctx.miterLimit", "1");
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = false;
+ _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5");
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.invalid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.invalid.worker.js
new file mode 100644
index 0000000000..62f250670c
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.invalid.worker.js
@@ -0,0 +1,55 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.miter.invalid
+// Description:Setting miterLimit to invalid values is ignored
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Setting miterLimit to invalid values is ignored");
+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.miterLimit = 1.5;
+ _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5");
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = 0;
+ _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5");
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = -1;
+ _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5");
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = Infinity;
+ _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5");
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = -Infinity;
+ _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5");
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = NaN;
+ _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5");
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = 'string';
+ _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5");
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = true;
+ _assertSame(ctx.miterLimit, 1, "ctx.miterLimit", "1");
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = false;
+ _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5");
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.lineedge.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.lineedge.html
new file mode 100644
index 0000000000..bad3cedc0e
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.lineedge.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.line.miter.lineedge</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.miter.lineedge</h1>
+<p class="desc">Miter joins are not drawn when the miter limit is exceeded at the corners of a zero-height rectangle</p>
+
+
+<script>
+var t = async_test("Miter joins are not drawn when the miter limit is exceeded at the corners of a zero-height rectangle");
+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.lineWidth = 200;
+ ctx.lineJoin = 'miter';
+
+ ctx.strokeStyle = '#f00';
+ ctx.miterLimit = 1.414;
+ ctx.beginPath();
+ ctx.strokeRect(100, 25, 200, 0);
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.lineedge.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.lineedge.worker.js
new file mode 100644
index 0000000000..2b61bc8975
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.lineedge.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.line.miter.lineedge
+// Description:Miter joins are not drawn when the miter limit is exceeded at the corners of a zero-height rectangle
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Miter joins are not drawn when the miter limit is exceeded at the corners of a zero-height rectangle");
+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.lineWidth = 200;
+ ctx.lineJoin = 'miter';
+
+ ctx.strokeStyle = '#f00';
+ ctx.miterLimit = 1.414;
+ ctx.beginPath();
+ ctx.strokeRect(100, 25, 200, 0);
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.obtuse.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.obtuse.html
new file mode 100644
index 0000000000..efab533fba
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.obtuse.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.miter.obtuse</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.miter.obtuse</h1>
+<p class="desc">Miter joins are drawn correctly with obtuse angles</p>
+
+
+<script>
+var t = async_test("Miter joins are drawn correctly with obtuse angles");
+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.lineWidth = 1600;
+ ctx.lineJoin = 'miter';
+
+ ctx.strokeStyle = '#0f0';
+ ctx.miterLimit = 1.083;
+ ctx.beginPath();
+ ctx.moveTo(800, 10000);
+ ctx.lineTo(800, 300);
+ ctx.lineTo(10000, -8900);
+ ctx.stroke();
+
+ ctx.strokeStyle = '#f00';
+ ctx.miterLimit = 1.082;
+ ctx.beginPath();
+ ctx.moveTo(800, 10000);
+ ctx.lineTo(800, 300);
+ ctx.lineTo(10000, -8900);
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.obtuse.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.obtuse.worker.js
new file mode 100644
index 0000000000..42b1cd37b1
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.obtuse.worker.js
@@ -0,0 +1,47 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.miter.obtuse
+// Description:Miter joins are drawn correctly with obtuse angles
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Miter joins are drawn correctly with obtuse angles");
+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.lineWidth = 1600;
+ ctx.lineJoin = 'miter';
+
+ ctx.strokeStyle = '#0f0';
+ ctx.miterLimit = 1.083;
+ ctx.beginPath();
+ ctx.moveTo(800, 10000);
+ ctx.lineTo(800, 300);
+ ctx.lineTo(10000, -8900);
+ ctx.stroke();
+
+ ctx.strokeStyle = '#f00';
+ ctx.miterLimit = 1.082;
+ ctx.beginPath();
+ ctx.moveTo(800, 10000);
+ ctx.lineTo(800, 300);
+ ctx.lineTo(10000, -8900);
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.rightangle.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.rightangle.html
new file mode 100644
index 0000000000..5bb4e63230
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.rightangle.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.miter.rightangle</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.miter.rightangle</h1>
+<p class="desc">Miter joins are not drawn when the miter limit is exceeded, on exact right angles</p>
+
+
+<script>
+var t = async_test("Miter joins are not drawn when the miter limit is exceeded, on exact right angles");
+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.lineWidth = 400;
+ ctx.lineJoin = 'miter';
+
+ ctx.strokeStyle = '#f00';
+ ctx.miterLimit = 1.414;
+ ctx.beginPath();
+ ctx.moveTo(200, 1000);
+ ctx.lineTo(200, 200);
+ ctx.lineTo(1000, 200);
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.rightangle.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.rightangle.worker.js
new file mode 100644
index 0000000000..42e995deed
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.rightangle.worker.js
@@ -0,0 +1,39 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.miter.rightangle
+// Description:Miter joins are not drawn when the miter limit is exceeded, on exact right angles
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Miter joins are not drawn when the miter limit is exceeded, on exact right angles");
+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.lineWidth = 400;
+ ctx.lineJoin = 'miter';
+
+ ctx.strokeStyle = '#f00';
+ ctx.miterLimit = 1.414;
+ ctx.beginPath();
+ ctx.moveTo(200, 1000);
+ ctx.lineTo(200, 200);
+ ctx.lineTo(1000, 200);
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.valid.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.valid.html
new file mode 100644
index 0000000000..3c569ea655
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.valid.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.line.miter.valid</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.miter.valid</h1>
+<p class="desc">Setting miterLimit to valid values works</p>
+
+
+<script>
+var t = async_test("Setting miterLimit to valid values works");
+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.miterLimit = 1.5;
+ _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5");
+
+ ctx.miterLimit = "1e1";
+ _assertSame(ctx.miterLimit, 10, "ctx.miterLimit", "10");
+
+ ctx.miterLimit = 1/1024;
+ _assertSame(ctx.miterLimit, 1/1024, "ctx.miterLimit", "1/1024");
+
+ ctx.miterLimit = 1000;
+ _assertSame(ctx.miterLimit, 1000, "ctx.miterLimit", "1000");
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.valid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.valid.worker.js
new file mode 100644
index 0000000000..cb0548abd0
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.valid.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.line.miter.valid
+// Description:Setting miterLimit to valid values works
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Setting miterLimit to valid values works");
+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.miterLimit = 1.5;
+ _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5");
+
+ ctx.miterLimit = "1e1";
+ _assertSame(ctx.miterLimit, 10, "ctx.miterLimit", "10");
+
+ ctx.miterLimit = 1/1024;
+ _assertSame(ctx.miterLimit, 1/1024, "ctx.miterLimit", "1/1024");
+
+ ctx.miterLimit = 1000;
+ _assertSame(ctx.miterLimit, 1000, "ctx.miterLimit", "1000");
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.within.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.within.html
new file mode 100644
index 0000000000..da87cf4a29
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.within.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.miter.within</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.miter.within</h1>
+<p class="desc">Miter joins are drawn when the miter limit is not quite exceeded</p>
+
+
+<script>
+var t = async_test("Miter joins are drawn when the miter limit is not quite exceeded");
+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.lineWidth = 400;
+ ctx.lineJoin = 'miter';
+
+ ctx.strokeStyle = '#0f0';
+ ctx.miterLimit = 1.416;
+ ctx.beginPath();
+ ctx.moveTo(200, 1000);
+ ctx.lineTo(200, 200);
+ ctx.lineTo(1000, 201);
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.within.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.within.worker.js
new file mode 100644
index 0000000000..1d9aacb817
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.within.worker.js
@@ -0,0 +1,39 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.miter.within
+// Description:Miter joins are drawn when the miter limit is not quite exceeded
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Miter joins are drawn when the miter limit is not quite exceeded");
+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.lineWidth = 400;
+ ctx.lineJoin = 'miter';
+
+ ctx.strokeStyle = '#0f0';
+ ctx.miterLimit = 1.416;
+ ctx.beginPath();
+ ctx.moveTo(200, 1000);
+ ctx.lineTo(200, 200);
+ ctx.lineTo(1000, 201);
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.union.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.union.html
new file mode 100644
index 0000000000..d3d13ece09
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.union.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.union</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.union</h1>
+<p class="desc"></p>
+
+
+<script>
+var t = async_test("");
+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.lineWidth = 100;
+ ctx.lineCap = 'round';
+
+ ctx.strokeStyle = '#0f0';
+ ctx.beginPath();
+ ctx.moveTo(0, 24);
+ ctx.lineTo(100, 25);
+ ctx.lineTo(0, 26);
+ ctx.closePath();
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 25,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ _assertPixel(canvas, 25,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.union.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.union.worker.js
new file mode 100644
index 0000000000..f2c7b2c4ce
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.union.worker.js
@@ -0,0 +1,41 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.union
+// Description:
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("");
+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.lineWidth = 100;
+ ctx.lineCap = 'round';
+
+ ctx.strokeStyle = '#0f0';
+ ctx.beginPath();
+ ctx.moveTo(0, 24);
+ ctx.lineTo(100, 25);
+ ctx.lineTo(0, 26);
+ ctx.closePath();
+ ctx.stroke();
+
+ _assertPixel(canvas, 1,1, 0,255,0,255);
+ _assertPixel(canvas, 25,1, 0,255,0,255);
+ _assertPixel(canvas, 48,1, 0,255,0,255);
+ _assertPixel(canvas, 1,48, 0,255,0,255);
+ _assertPixel(canvas, 25,1, 0,255,0,255);
+ _assertPixel(canvas, 48,48, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.basic.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.basic.html
new file mode 100644
index 0000000000..88e38294bf
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.basic.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.width.basic</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.width.basic</h1>
+<p class="desc">lineWidth determines the width of line strokes</p>
+
+
+<script>
+var t = async_test("lineWidth determines the width of line strokes");
+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.lineWidth = 20;
+ // Draw a green line over a red box, to check the line is not too small
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+ ctx.fillRect(15, 15, 20, 20);
+ ctx.beginPath();
+ ctx.moveTo(25, 15);
+ ctx.lineTo(25, 35);
+ ctx.stroke();
+
+ // Draw a green box over a red line, to check the line is not too large
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(75, 15);
+ ctx.lineTo(75, 35);
+ ctx.stroke();
+ ctx.fillRect(65, 15, 20, 20);
+
+ _assertPixel(canvas, 14,25, 0,255,0,255);
+ _assertPixel(canvas, 15,25, 0,255,0,255);
+ _assertPixel(canvas, 16,25, 0,255,0,255);
+ _assertPixel(canvas, 25,25, 0,255,0,255);
+ _assertPixel(canvas, 34,25, 0,255,0,255);
+ _assertPixel(canvas, 35,25, 0,255,0,255);
+ _assertPixel(canvas, 36,25, 0,255,0,255);
+
+ _assertPixel(canvas, 64,25, 0,255,0,255);
+ _assertPixel(canvas, 65,25, 0,255,0,255);
+ _assertPixel(canvas, 66,25, 0,255,0,255);
+ _assertPixel(canvas, 75,25, 0,255,0,255);
+ _assertPixel(canvas, 84,25, 0,255,0,255);
+ _assertPixel(canvas, 85,25, 0,255,0,255);
+ _assertPixel(canvas, 86,25, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.basic.worker.js
new file mode 100644
index 0000000000..012d9b11bd
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.basic.worker.js
@@ -0,0 +1,58 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.width.basic
+// Description:lineWidth determines the width of line strokes
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("lineWidth determines the width of line strokes");
+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.lineWidth = 20;
+ // Draw a green line over a red box, to check the line is not too small
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+ ctx.fillRect(15, 15, 20, 20);
+ ctx.beginPath();
+ ctx.moveTo(25, 15);
+ ctx.lineTo(25, 35);
+ ctx.stroke();
+
+ // Draw a green box over a red line, to check the line is not too large
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(75, 15);
+ ctx.lineTo(75, 35);
+ ctx.stroke();
+ ctx.fillRect(65, 15, 20, 20);
+
+ _assertPixel(canvas, 14,25, 0,255,0,255);
+ _assertPixel(canvas, 15,25, 0,255,0,255);
+ _assertPixel(canvas, 16,25, 0,255,0,255);
+ _assertPixel(canvas, 25,25, 0,255,0,255);
+ _assertPixel(canvas, 34,25, 0,255,0,255);
+ _assertPixel(canvas, 35,25, 0,255,0,255);
+ _assertPixel(canvas, 36,25, 0,255,0,255);
+
+ _assertPixel(canvas, 64,25, 0,255,0,255);
+ _assertPixel(canvas, 65,25, 0,255,0,255);
+ _assertPixel(canvas, 66,25, 0,255,0,255);
+ _assertPixel(canvas, 75,25, 0,255,0,255);
+ _assertPixel(canvas, 84,25, 0,255,0,255);
+ _assertPixel(canvas, 85,25, 0,255,0,255);
+ _assertPixel(canvas, 86,25, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.invalid.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.invalid.html
new file mode 100644
index 0000000000..481a316822
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.invalid.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.width.invalid</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.width.invalid</h1>
+<p class="desc">Setting lineWidth to invalid values is ignored</p>
+
+
+<script>
+var t = async_test("Setting lineWidth to invalid values is ignored");
+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.5;
+ _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5");
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = 0;
+ _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5");
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = -1;
+ _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5");
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = Infinity;
+ _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5");
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = -Infinity;
+ _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5");
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = NaN;
+ _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5");
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = 'string';
+ _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5");
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = true;
+ _assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1");
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = false;
+ _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5");
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.invalid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.invalid.worker.js
new file mode 100644
index 0000000000..3a10cb48e8
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.invalid.worker.js
@@ -0,0 +1,55 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.width.invalid
+// Description:Setting lineWidth to invalid values is ignored
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Setting lineWidth to invalid values is ignored");
+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.5;
+ _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5");
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = 0;
+ _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5");
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = -1;
+ _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5");
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = Infinity;
+ _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5");
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = -Infinity;
+ _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5");
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = NaN;
+ _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5");
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = 'string';
+ _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5");
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = true;
+ _assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1");
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = false;
+ _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5");
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.scaledefault.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.scaledefault.html
new file mode 100644
index 0000000000..9ac77a9c49
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.scaledefault.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.width.scaledefault</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.width.scaledefault</h1>
+<p class="desc">Default lineWidth strokes are affected by scale transformations</p>
+
+
+<script>
+var t = async_test("Default lineWidth strokes are affected by scale transformations");
+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.scale(50, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.moveTo(0, 0.5);
+ ctx.lineTo(2, 0.5);
+ ctx.stroke();
+
+ _assertPixel(canvas, 25,25, 0,255,0,255);
+ _assertPixel(canvas, 50,25, 0,255,0,255);
+ _assertPixel(canvas, 75,25, 0,255,0,255);
+ _assertPixel(canvas, 50,5, 0,255,0,255);
+ _assertPixel(canvas, 50,45, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.scaledefault.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.scaledefault.worker.js
new file mode 100644
index 0000000000..8d8089476b
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.scaledefault.worker.js
@@ -0,0 +1,35 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.width.scaledefault
+// Description:Default lineWidth strokes are affected by scale transformations
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Default lineWidth strokes are affected by scale transformations");
+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.scale(50, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.moveTo(0, 0.5);
+ ctx.lineTo(2, 0.5);
+ ctx.stroke();
+
+ _assertPixel(canvas, 25,25, 0,255,0,255);
+ _assertPixel(canvas, 50,25, 0,255,0,255);
+ _assertPixel(canvas, 75,25, 0,255,0,255);
+ _assertPixel(canvas, 50,5, 0,255,0,255);
+ _assertPixel(canvas, 50,45, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.transformed.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.transformed.html
new file mode 100644
index 0000000000..ea8f285dc4
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.transformed.html
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.line.width.transformed</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.width.transformed</h1>
+<p class="desc">Line stroke widths are affected by scale transformations</p>
+
+
+<script>
+var t = async_test("Line stroke widths are affected by scale transformations");
+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.lineWidth = 4;
+ // Draw a green line over a red box, to check the line is not too small
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+ ctx.fillRect(15, 15, 20, 20);
+ ctx.save();
+ ctx.scale(5, 1);
+ ctx.beginPath();
+ ctx.moveTo(5, 15);
+ ctx.lineTo(5, 35);
+ ctx.stroke();
+ ctx.restore();
+
+ // Draw a green box over a red line, to check the line is not too large
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+ ctx.save();
+ ctx.scale(-5, 1);
+ ctx.beginPath();
+ ctx.moveTo(-15, 15);
+ ctx.lineTo(-15, 35);
+ ctx.stroke();
+ ctx.restore();
+ ctx.fillRect(65, 15, 20, 20);
+
+ _assertPixel(canvas, 14,25, 0,255,0,255);
+ _assertPixel(canvas, 15,25, 0,255,0,255);
+ _assertPixel(canvas, 16,25, 0,255,0,255);
+ _assertPixel(canvas, 25,25, 0,255,0,255);
+ _assertPixel(canvas, 34,25, 0,255,0,255);
+ _assertPixel(canvas, 35,25, 0,255,0,255);
+ _assertPixel(canvas, 36,25, 0,255,0,255);
+
+ _assertPixel(canvas, 64,25, 0,255,0,255);
+ _assertPixel(canvas, 65,25, 0,255,0,255);
+ _assertPixel(canvas, 66,25, 0,255,0,255);
+ _assertPixel(canvas, 75,25, 0,255,0,255);
+ _assertPixel(canvas, 84,25, 0,255,0,255);
+ _assertPixel(canvas, 85,25, 0,255,0,255);
+ _assertPixel(canvas, 86,25, 0,255,0,255);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.transformed.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.transformed.worker.js
new file mode 100644
index 0000000000..67fc0a29bd
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.transformed.worker.js
@@ -0,0 +1,64 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.line.width.transformed
+// Description:Line stroke widths are affected by scale transformations
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Line stroke widths are affected by scale transformations");
+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.lineWidth = 4;
+ // Draw a green line over a red box, to check the line is not too small
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+ ctx.fillRect(15, 15, 20, 20);
+ ctx.save();
+ ctx.scale(5, 1);
+ ctx.beginPath();
+ ctx.moveTo(5, 15);
+ ctx.lineTo(5, 35);
+ ctx.stroke();
+ ctx.restore();
+
+ // Draw a green box over a red line, to check the line is not too large
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+ ctx.save();
+ ctx.scale(-5, 1);
+ ctx.beginPath();
+ ctx.moveTo(-15, 15);
+ ctx.lineTo(-15, 35);
+ ctx.stroke();
+ ctx.restore();
+ ctx.fillRect(65, 15, 20, 20);
+
+ _assertPixel(canvas, 14,25, 0,255,0,255);
+ _assertPixel(canvas, 15,25, 0,255,0,255);
+ _assertPixel(canvas, 16,25, 0,255,0,255);
+ _assertPixel(canvas, 25,25, 0,255,0,255);
+ _assertPixel(canvas, 34,25, 0,255,0,255);
+ _assertPixel(canvas, 35,25, 0,255,0,255);
+ _assertPixel(canvas, 36,25, 0,255,0,255);
+
+ _assertPixel(canvas, 64,25, 0,255,0,255);
+ _assertPixel(canvas, 65,25, 0,255,0,255);
+ _assertPixel(canvas, 66,25, 0,255,0,255);
+ _assertPixel(canvas, 75,25, 0,255,0,255);
+ _assertPixel(canvas, 84,25, 0,255,0,255);
+ _assertPixel(canvas, 85,25, 0,255,0,255);
+ _assertPixel(canvas, 86,25, 0,255,0,255);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.valid.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.valid.html
new file mode 100644
index 0000000000..813433da3f
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.valid.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.line.width.valid</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.line.width.valid</h1>
+<p class="desc">Setting lineWidth to valid values works</p>
+
+
+<script>
+var t = async_test("Setting lineWidth to valid values works");
+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.5;
+ _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5");
+
+ ctx.lineWidth = "1e1";
+ _assertSame(ctx.lineWidth, 10, "ctx.lineWidth", "10");
+
+ ctx.lineWidth = 1/1024;
+ _assertSame(ctx.lineWidth, 1/1024, "ctx.lineWidth", "1/1024");
+
+ ctx.lineWidth = 1000;
+ _assertSame(ctx.lineWidth, 1000, "ctx.lineWidth", "1000");
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.valid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.valid.worker.js
new file mode 100644
index 0000000000..195575f7de
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.valid.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.line.width.valid
+// Description:Setting lineWidth to valid values works
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Setting lineWidth to valid values works");
+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.5;
+ _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5");
+
+ ctx.lineWidth = "1e1";
+ _assertSame(ctx.lineWidth, 10, "ctx.lineWidth", "10");
+
+ ctx.lineWidth = 1/1024;
+ _assertSame(ctx.lineWidth, 1/1024, "ctx.lineWidth", "1/1024");
+
+ ctx.lineWidth = 1000;
+ _assertSame(ctx.lineWidth, 1000, "ctx.lineWidth", "1000");
+ t.done();
+});
+done();