diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/html/canvas/offscreen | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/canvas/offscreen')
1764 files changed, 66018 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/canvas/offscreen/2d.conformance.requirements.basics.html b/testing/web-platform/tests/html/canvas/offscreen/2d.conformance.requirements.basics.html new file mode 100644 index 0000000000..a89ec10f9b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/2d.conformance.requirements.basics.html @@ -0,0 +1,62 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.conformance.requirements.basics</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.conformance.requirements.basics</h1> +<p class="desc">void methods return undefined</p> + +<p class="notes">Defined in "Web IDL" (draft) +<script> +var t = async_test("void methods return undefined"); +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.save(), undefined, "ctx.save()", "undefined"); +_assertSame(ctx.restore(), undefined, "ctx.restore()", "undefined"); +_assertSame(ctx.scale(1, 1), undefined, "ctx.scale(1, 1)", "undefined"); +_assertSame(ctx.rotate(0), undefined, "ctx.rotate(0)", "undefined"); +_assertSame(ctx.translate(0, 0), undefined, "ctx.translate(0, 0)", "undefined"); +if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) + _assertSame(ctx.transform(1, 0, 0, 1, 0, 0), undefined, "ctx.transform(1, 0, 0, 1, 0, 0)", "undefined"); +} +if (ctx.setTransform) { + _assertSame(ctx.setTransform(1, 0, 0, 1, 0, 0), undefined, "ctx.setTransform(1, 0, 0, 1, 0, 0)", "undefined"); + _assertSame(ctx.setTransform(), undefined, "ctx.setTransform()", "undefined"); +} +_assertSame(ctx.clearRect(0, 0, 0, 0), undefined, "ctx.clearRect(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.fillRect(0, 0, 0, 0), undefined, "ctx.fillRect(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.strokeRect(0, 0, 0, 0), undefined, "ctx.strokeRect(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.beginPath(), undefined, "ctx.beginPath()", "undefined"); +_assertSame(ctx.closePath(), undefined, "ctx.closePath()", "undefined"); +_assertSame(ctx.moveTo(0, 0), undefined, "ctx.moveTo(0, 0)", "undefined"); +_assertSame(ctx.lineTo(0, 0), undefined, "ctx.lineTo(0, 0)", "undefined"); +_assertSame(ctx.quadraticCurveTo(0, 0, 0, 0), undefined, "ctx.quadraticCurveTo(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.bezierCurveTo(0, 0, 0, 0, 0, 0), undefined, "ctx.bezierCurveTo(0, 0, 0, 0, 0, 0)", "undefined"); +_assertSame(ctx.arcTo(0, 0, 0, 0, 1), undefined, "ctx.arcTo(0, 0, 0, 0, 1)", "undefined"); +_assertSame(ctx.rect(0, 0, 0, 0), undefined, "ctx.rect(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.arc(0, 0, 1, 0, 0, true), undefined, "ctx.arc(0, 0, 1, 0, 0, true)", "undefined"); +_assertSame(ctx.fill(), undefined, "ctx.fill()", "undefined"); +_assertSame(ctx.stroke(), undefined, "ctx.stroke()", "undefined"); +_assertSame(ctx.clip(), undefined, "ctx.clip()", "undefined"); +if (ctx.fillText) { + _assertSame(ctx.fillText('test', 0, 0), undefined, "ctx.fillText('test', 0, 0)", "undefined"); + _assertSame(ctx.strokeText('test', 0, 0), undefined, "ctx.strokeText('test', 0, 0)", "undefined"); +} +if (ctx.putImageData) { + _assertSame(ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0), undefined, "ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0)", "undefined"); +} +_assertSame(ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0), undefined, "ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0)", "undefined"); +_assertSame(ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white'), undefined, "ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white')", "undefined"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/2d.conformance.requirements.basics.worker.js b/testing/web-platform/tests/html/canvas/offscreen/2d.conformance.requirements.basics.worker.js new file mode 100644 index 0000000000..8d6ddc894f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/2d.conformance.requirements.basics.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.conformance.requirements.basics +// Description:void methods return undefined +// Note:<p class="notes">Defined in "Web IDL" (draft) + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("void methods return undefined"); +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.save(), undefined, "ctx.save()", "undefined"); +_assertSame(ctx.restore(), undefined, "ctx.restore()", "undefined"); +_assertSame(ctx.scale(1, 1), undefined, "ctx.scale(1, 1)", "undefined"); +_assertSame(ctx.rotate(0), undefined, "ctx.rotate(0)", "undefined"); +_assertSame(ctx.translate(0, 0), undefined, "ctx.translate(0, 0)", "undefined"); +if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) + _assertSame(ctx.transform(1, 0, 0, 1, 0, 0), undefined, "ctx.transform(1, 0, 0, 1, 0, 0)", "undefined"); +} +if (ctx.setTransform) { + _assertSame(ctx.setTransform(1, 0, 0, 1, 0, 0), undefined, "ctx.setTransform(1, 0, 0, 1, 0, 0)", "undefined"); + _assertSame(ctx.setTransform(), undefined, "ctx.setTransform()", "undefined"); +} +_assertSame(ctx.clearRect(0, 0, 0, 0), undefined, "ctx.clearRect(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.fillRect(0, 0, 0, 0), undefined, "ctx.fillRect(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.strokeRect(0, 0, 0, 0), undefined, "ctx.strokeRect(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.beginPath(), undefined, "ctx.beginPath()", "undefined"); +_assertSame(ctx.closePath(), undefined, "ctx.closePath()", "undefined"); +_assertSame(ctx.moveTo(0, 0), undefined, "ctx.moveTo(0, 0)", "undefined"); +_assertSame(ctx.lineTo(0, 0), undefined, "ctx.lineTo(0, 0)", "undefined"); +_assertSame(ctx.quadraticCurveTo(0, 0, 0, 0), undefined, "ctx.quadraticCurveTo(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.bezierCurveTo(0, 0, 0, 0, 0, 0), undefined, "ctx.bezierCurveTo(0, 0, 0, 0, 0, 0)", "undefined"); +_assertSame(ctx.arcTo(0, 0, 0, 0, 1), undefined, "ctx.arcTo(0, 0, 0, 0, 1)", "undefined"); +_assertSame(ctx.rect(0, 0, 0, 0), undefined, "ctx.rect(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.arc(0, 0, 1, 0, 0, true), undefined, "ctx.arc(0, 0, 1, 0, 0, true)", "undefined"); +_assertSame(ctx.fill(), undefined, "ctx.fill()", "undefined"); +_assertSame(ctx.stroke(), undefined, "ctx.stroke()", "undefined"); +_assertSame(ctx.clip(), undefined, "ctx.clip()", "undefined"); +if (ctx.fillText) { + _assertSame(ctx.fillText('test', 0, 0), undefined, "ctx.fillText('test', 0, 0)", "undefined"); + _assertSame(ctx.strokeText('test', 0, 0), undefined, "ctx.strokeText('test', 0, 0)", "undefined"); +} +if (ctx.putImageData) { + _assertSame(ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0), undefined, "ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0)", "undefined"); +} +_assertSame(ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0), undefined, "ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0)", "undefined"); +_assertSame(ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white'), undefined, "ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white')", "undefined"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/2d.conformance.requirements.missingargs.html b/testing/web-platform/tests/html/canvas/offscreen/2d.conformance.requirements.missingargs.html new file mode 100644 index 0000000000..cfbbca9e5e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/2d.conformance.requirements.missingargs.html @@ -0,0 +1,141 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.conformance.requirements.missingargs</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.conformance.requirements.missingargs</h1> +<p class="desc">Missing arguments cause TypeError</p> + + +<script> +var t = async_test("Missing arguments cause TypeError"); +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'); + +assert_throws_js(TypeError, function() { ctx.scale(); }); +assert_throws_js(TypeError, function() { ctx.scale(1); }); +assert_throws_js(TypeError, function() { ctx.rotate(); }); +assert_throws_js(TypeError, function() { ctx.translate(); }); +assert_throws_js(TypeError, function() { ctx.translate(0); }); +if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) + assert_throws_js(TypeError, function() { ctx.transform(); }); + assert_throws_js(TypeError, function() { ctx.transform(1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1, 0); }); +} +if (ctx.setTransform) { + assert_throws_js(TypeError, function() { ctx.setTransform(1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1, 0); }); +} +assert_throws_js(TypeError, function() { ctx.createLinearGradient(); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.createPattern(canvas); }); +assert_throws_js(TypeError, function() { ctx.clearRect(); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.moveTo(); }); +assert_throws_js(TypeError, function() { ctx.moveTo(0); }); +assert_throws_js(TypeError, function() { ctx.lineTo(); }); +assert_throws_js(TypeError, function() { ctx.lineTo(0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.rect(); }); +assert_throws_js(TypeError, function() { ctx.rect(0); }); +assert_throws_js(TypeError, function() { ctx.rect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.rect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arc(); }); +assert_throws_js(TypeError, function() { ctx.arc(0); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1, 0); }); +// (6th argument to arc is optional) +if (ctx.isPointInPath) { + assert_throws_js(TypeError, function() { ctx.isPointInPath(); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(0); }); +} +if (ctx.drawFocusRing) { + assert_throws_js(TypeError, function() { ctx.drawFocusRing(); }); + assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas); }); + assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas, 0); }); +} +if (ctx.fillText) { + assert_throws_js(TypeError, function() { ctx.fillText(); }); + assert_throws_js(TypeError, function() { ctx.fillText('test'); }); + assert_throws_js(TypeError, function() { ctx.fillText('test', 0); }); + assert_throws_js(TypeError, function() { ctx.strokeText(); }); + assert_throws_js(TypeError, function() { ctx.strokeText('test'); }); + assert_throws_js(TypeError, function() { ctx.strokeText('test', 0); }); + assert_throws_js(TypeError, function() { ctx.measureText(); }); +} +assert_throws_js(TypeError, function() { ctx.drawImage(); }); +assert_throws_js(TypeError, function() { ctx.drawImage(canvas); }); +assert_throws_js(TypeError, function() { ctx.drawImage(canvas, 0); }); +// TODO: n >= 3 args on drawImage could be either a valid overload, +// or too few for another overload, or too many for another +// overload - what should happen? +if (ctx.createImageData) { + assert_throws_js(TypeError, function() { ctx.createImageData(); }); + assert_throws_js(TypeError, function() { ctx.createImageData(1); }); +} +if (ctx.getImageData) { + assert_throws_js(TypeError, function() { ctx.getImageData(); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0, 1); }); +} +if (ctx.putImageData) { + var imgdata = ctx.getImageData(0, 0, 1, 1); + assert_throws_js(TypeError, function() { ctx.putImageData(); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0); }); +} +var g = ctx.createLinearGradient(0, 0, 0, 0); +assert_throws_js(TypeError, function() { g.addColorStop(); }); +assert_throws_js(TypeError, function() { g.addColorStop(0); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/2d.conformance.requirements.missingargs.worker.js b/testing/web-platform/tests/html/canvas/offscreen/2d.conformance.requirements.missingargs.worker.js new file mode 100644 index 0000000000..fe1b111f05 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/2d.conformance.requirements.missingargs.worker.js @@ -0,0 +1,137 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.conformance.requirements.missingargs +// Description:Missing arguments cause TypeError +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Missing arguments cause TypeError"); +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'); + +assert_throws_js(TypeError, function() { ctx.scale(); }); +assert_throws_js(TypeError, function() { ctx.scale(1); }); +assert_throws_js(TypeError, function() { ctx.rotate(); }); +assert_throws_js(TypeError, function() { ctx.translate(); }); +assert_throws_js(TypeError, function() { ctx.translate(0); }); +if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) + assert_throws_js(TypeError, function() { ctx.transform(); }); + assert_throws_js(TypeError, function() { ctx.transform(1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1, 0); }); +} +if (ctx.setTransform) { + assert_throws_js(TypeError, function() { ctx.setTransform(1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1, 0); }); +} +assert_throws_js(TypeError, function() { ctx.createLinearGradient(); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.createPattern(canvas); }); +assert_throws_js(TypeError, function() { ctx.clearRect(); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.moveTo(); }); +assert_throws_js(TypeError, function() { ctx.moveTo(0); }); +assert_throws_js(TypeError, function() { ctx.lineTo(); }); +assert_throws_js(TypeError, function() { ctx.lineTo(0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.rect(); }); +assert_throws_js(TypeError, function() { ctx.rect(0); }); +assert_throws_js(TypeError, function() { ctx.rect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.rect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arc(); }); +assert_throws_js(TypeError, function() { ctx.arc(0); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1, 0); }); +// (6th argument to arc is optional) +if (ctx.isPointInPath) { + assert_throws_js(TypeError, function() { ctx.isPointInPath(); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(0); }); +} +if (ctx.drawFocusRing) { + assert_throws_js(TypeError, function() { ctx.drawFocusRing(); }); + assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas); }); + assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas, 0); }); +} +if (ctx.fillText) { + assert_throws_js(TypeError, function() { ctx.fillText(); }); + assert_throws_js(TypeError, function() { ctx.fillText('test'); }); + assert_throws_js(TypeError, function() { ctx.fillText('test', 0); }); + assert_throws_js(TypeError, function() { ctx.strokeText(); }); + assert_throws_js(TypeError, function() { ctx.strokeText('test'); }); + assert_throws_js(TypeError, function() { ctx.strokeText('test', 0); }); + assert_throws_js(TypeError, function() { ctx.measureText(); }); +} +assert_throws_js(TypeError, function() { ctx.drawImage(); }); +assert_throws_js(TypeError, function() { ctx.drawImage(canvas); }); +assert_throws_js(TypeError, function() { ctx.drawImage(canvas, 0); }); +// TODO: n >= 3 args on drawImage could be either a valid overload, +// or too few for another overload, or too many for another +// overload - what should happen? +if (ctx.createImageData) { + assert_throws_js(TypeError, function() { ctx.createImageData(); }); + assert_throws_js(TypeError, function() { ctx.createImageData(1); }); +} +if (ctx.getImageData) { + assert_throws_js(TypeError, function() { ctx.getImageData(); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0, 1); }); +} +if (ctx.putImageData) { + var imgdata = ctx.getImageData(0, 0, 1, 1); + assert_throws_js(TypeError, function() { ctx.putImageData(); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0); }); +} +var g = ctx.createLinearGradient(0, 0, 0, 0); +assert_throws_js(TypeError, function() { g.addColorStop(); }); +assert_throws_js(TypeError, function() { g.addColorStop(0); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/META.yml b/testing/web-platform/tests/html/canvas/offscreen/META.yml new file mode 100644 index 0000000000..d0524194c9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/META.yml @@ -0,0 +1,7 @@ +spec: https://html.spec.whatwg.org/multipage/canvas.html#the-offscreencanvas-interface +suggested_reviewers: + - AmeliaBR + - annevk + - kenrussell + - fserb + - Cwiiis diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.copy.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.copy.html new file mode 100644 index 0000000000..a89736b579 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.copy.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.canvas.copy</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.canvas.copy</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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'copy'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 255,255,0,191, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.copy.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.copy.worker.js new file mode 100644 index 0000000000..a8fbc74c1c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.copy.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.canvas.copy +// 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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'copy'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 255,255,0,191, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-atop.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-atop.html new file mode 100644 index 0000000000..dc53e8b5f0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-atop.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.canvas.destination-atop</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.canvas.destination-atop</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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'destination-atop'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 128,255,128,191, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-atop.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-atop.worker.js new file mode 100644 index 0000000000..fcb944543c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-atop.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.canvas.destination-atop +// 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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'destination-atop'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 128,255,128,191, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-in.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-in.html new file mode 100644 index 0000000000..73140e11df --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-in.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.canvas.destination-in</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.canvas.destination-in</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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'destination-in'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,255,96, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-in.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-in.worker.js new file mode 100644 index 0000000000..e5d7f0b039 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-in.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.canvas.destination-in +// 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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'destination-in'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,255,96, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-out.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-out.html new file mode 100644 index 0000000000..5f89aa29f7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-out.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.canvas.destination-out</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.canvas.destination-out</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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'destination-out'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,255,32, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-out.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-out.worker.js new file mode 100644 index 0000000000..a4436be0d2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-out.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.canvas.destination-out +// 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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'destination-out'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,255,32, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-over.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-over.html new file mode 100644 index 0000000000..d18f9dc864 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-over.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.canvas.destination-over</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.canvas.destination-over</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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'destination-over'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 109,255,146,223, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-over.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-over.worker.js new file mode 100644 index 0000000000..967e47b34d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.destination-over.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.canvas.destination-over +// 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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'destination-over'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 109,255,146,223, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.lighter.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.lighter.html new file mode 100644 index 0000000000..9de44add68 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.lighter.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.canvas.lighter</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.canvas.lighter</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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'lighter'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 191,255,128,255, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.lighter.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.lighter.worker.js new file mode 100644 index 0000000000..849d4a6a6f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.lighter.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.canvas.lighter +// 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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'lighter'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 191,255,128,255, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-atop.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-atop.html new file mode 100644 index 0000000000..cf9d5cfcbe --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-atop.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.canvas.source-atop</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.canvas.source-atop</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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'source-atop'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 191,255,64,128, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-atop.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-atop.worker.js new file mode 100644 index 0000000000..7601db1f5a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-atop.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.canvas.source-atop +// 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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'source-atop'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 191,255,64,128, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-in.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-in.html new file mode 100644 index 0000000000..30864d65a3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-in.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.canvas.source-in</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.canvas.source-in</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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'source-in'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 255,255,0,96, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-in.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-in.worker.js new file mode 100644 index 0000000000..5b21b35564 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-in.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.canvas.source-in +// 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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'source-in'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 255,255,0,96, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-out.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-out.html new file mode 100644 index 0000000000..d698540260 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-out.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.canvas.source-out</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.canvas.source-out</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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'source-out'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 255,255,0,96, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-out.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-out.worker.js new file mode 100644 index 0000000000..cf5b0a9ac4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-out.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.canvas.source-out +// 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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'source-out'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 255,255,0,96, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-over.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-over.html new file mode 100644 index 0000000000..e1e86c7979 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-over.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.canvas.source-over</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.canvas.source-over</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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'source-over'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 219,255,36,223, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-over.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-over.worker.js new file mode 100644 index 0000000000..d61ebd1e56 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.source-over.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.canvas.source-over +// 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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'source-over'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 219,255,36,223, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.xor.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.xor.html new file mode 100644 index 0000000000..c2d1f52645 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.xor.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.canvas.xor</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.canvas.xor</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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'xor'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 191,255,64,128, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.xor.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.xor.worker.js new file mode 100644 index 0000000000..1b2286a87a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.canvas.xor.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.canvas.xor +// 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'); + + +var offscreenCanvas2 = new OffscreenCanvas(canvas.width, canvas.height); +var ctx2 = offscreenCanvas2.getContext('2d'); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx2.drawImage(bitmap, 0, 0); + ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'xor'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 191,255,64,128, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.copy.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.copy.html new file mode 100644 index 0000000000..5d6afc11cf --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.copy.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.clip.copy</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.clip.copy</h1> +<p class="desc">fill() does not affect pixels outside the clip region.</p> + + +<script> +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'copy'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.copy.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.copy.worker.js new file mode 100644 index 0000000000..3158893fc5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.copy.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.composite.clip.copy +// Description:fill() does not affect pixels outside the clip region. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'copy'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-atop.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-atop.html new file mode 100644 index 0000000000..93d4d70adb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-atop.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.clip.destination-atop</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.clip.destination-atop</h1> +<p class="desc">fill() does not affect pixels outside the clip region.</p> + + +<script> +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'destination-atop'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-atop.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-atop.worker.js new file mode 100644 index 0000000000..78b5368194 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-atop.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.composite.clip.destination-atop +// Description:fill() does not affect pixels outside the clip region. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'destination-atop'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-in.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-in.html new file mode 100644 index 0000000000..d2520378e4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-in.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.clip.destination-in</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.clip.destination-in</h1> +<p class="desc">fill() does not affect pixels outside the clip region.</p> + + +<script> +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'destination-in'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-in.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-in.worker.js new file mode 100644 index 0000000000..bc12026103 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-in.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.composite.clip.destination-in +// Description:fill() does not affect pixels outside the clip region. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'destination-in'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-out.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-out.html new file mode 100644 index 0000000000..fdb1792b53 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-out.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.clip.destination-out</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.clip.destination-out</h1> +<p class="desc">fill() does not affect pixels outside the clip region.</p> + + +<script> +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'destination-out'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-out.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-out.worker.js new file mode 100644 index 0000000000..ebe3a70d03 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-out.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.composite.clip.destination-out +// Description:fill() does not affect pixels outside the clip region. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'destination-out'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-over.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-over.html new file mode 100644 index 0000000000..ae4cb499bc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-over.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.clip.destination-over</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.clip.destination-over</h1> +<p class="desc">fill() does not affect pixels outside the clip region.</p> + + +<script> +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'destination-over'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-over.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-over.worker.js new file mode 100644 index 0000000000..fb8778f0e1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.destination-over.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.composite.clip.destination-over +// Description:fill() does not affect pixels outside the clip region. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'destination-over'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.lighter.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.lighter.html new file mode 100644 index 0000000000..1f705f2645 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.lighter.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.clip.lighter</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.clip.lighter</h1> +<p class="desc">fill() does not affect pixels outside the clip region.</p> + + +<script> +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'lighter'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.lighter.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.lighter.worker.js new file mode 100644 index 0000000000..f6bf4c4aff --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.lighter.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.composite.clip.lighter +// Description:fill() does not affect pixels outside the clip region. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'lighter'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-atop.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-atop.html new file mode 100644 index 0000000000..eb5474702c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-atop.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.clip.source-atop</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.clip.source-atop</h1> +<p class="desc">fill() does not affect pixels outside the clip region.</p> + + +<script> +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'source-atop'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-atop.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-atop.worker.js new file mode 100644 index 0000000000..fec34e1bc6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-atop.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.composite.clip.source-atop +// Description:fill() does not affect pixels outside the clip region. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'source-atop'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-in.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-in.html new file mode 100644 index 0000000000..cdc814fa75 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-in.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.clip.source-in</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.clip.source-in</h1> +<p class="desc">fill() does not affect pixels outside the clip region.</p> + + +<script> +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'source-in'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-in.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-in.worker.js new file mode 100644 index 0000000000..b9a67cef2e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-in.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.composite.clip.source-in +// Description:fill() does not affect pixels outside the clip region. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'source-in'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-out.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-out.html new file mode 100644 index 0000000000..9df047f77f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-out.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.clip.source-out</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.clip.source-out</h1> +<p class="desc">fill() does not affect pixels outside the clip region.</p> + + +<script> +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'source-out'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-out.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-out.worker.js new file mode 100644 index 0000000000..9d2524064a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-out.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.composite.clip.source-out +// Description:fill() does not affect pixels outside the clip region. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'source-out'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-over.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-over.html new file mode 100644 index 0000000000..522f4f996b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-over.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.clip.source-over</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.clip.source-over</h1> +<p class="desc">fill() does not affect pixels outside the clip region.</p> + + +<script> +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'source-over'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-over.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-over.worker.js new file mode 100644 index 0000000000..6d401c46b0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.source-over.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.composite.clip.source-over +// Description:fill() does not affect pixels outside the clip region. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'source-over'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.xor.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.xor.html new file mode 100644 index 0000000000..dc1170db37 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.xor.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.clip.xor</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.clip.xor</h1> +<p class="desc">fill() does not affect pixels outside the clip region.</p> + + +<script> +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'xor'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.xor.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.xor.worker.js new file mode 100644 index 0000000000..1d89becc27 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.clip.xor.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.composite.clip.xor +// Description:fill() does not affect pixels outside the clip region. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fill() does not affect pixels outside the clip region."); +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.globalCompositeOperation = 'xor'; +ctx.rect(-20, -20, 10, 10); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvas.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvas.html new file mode 100644 index 0000000000..cd05d7b57b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvas.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.globalAlpha.canvas</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.globalAlpha.canvas</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'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#f00'; +ctx2.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations +ctx.drawImage(offscreenCanvas2, 0, 0); +_assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvas.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvas.worker.js new file mode 100644 index 0000000000..fe644f2ca3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvas.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.globalAlpha.canvas +// 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'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#f00'; +ctx2.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations +ctx.drawImage(offscreenCanvas2, 0, 0); +_assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvascopy.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvascopy.html new file mode 100644 index 0000000000..52a431cfaa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvascopy.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.globalAlpha.canvascopy</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.globalAlpha.canvascopy</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'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#0f0'; +ctx2.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'copy' +ctx.globalAlpha = 0.51; +ctx.drawImage(offscreenCanvas2, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,255,0,130, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvascopy.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvascopy.worker.js new file mode 100644 index 0000000000..e0ef84a78b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvascopy.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.composite.globalAlpha.canvascopy +// 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'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#0f0'; +ctx2.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'copy' +ctx.globalAlpha = 0.51; +ctx.drawImage(offscreenCanvas2, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,255,0,130, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvaspattern.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvaspattern.html new file mode 100644 index 0000000000..24d7a0fc3c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvaspattern.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.globalAlpha.canvaspattern</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.globalAlpha.canvaspattern</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'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#f00'; +ctx2.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = ctx.createPattern(offscreenCanvas2, 'no-repeat'); +ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvaspattern.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvaspattern.worker.js new file mode 100644 index 0000000000..2fb494d054 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvaspattern.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.composite.globalAlpha.canvaspattern +// 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'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#f00'; +ctx2.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = ctx.createPattern(offscreenCanvas2, 'no-repeat'); +ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.default.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.default.html new file mode 100644 index 0000000000..6604d5647d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.default.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.globalAlpha.default</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.globalAlpha.default</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.globalAlpha, 1.0, "ctx.globalAlpha", "1.0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.default.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.default.worker.js new file mode 100644 index 0000000000..921c401551 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.default.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.globalAlpha.default +// 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.globalAlpha, 1.0, "ctx.globalAlpha", "1.0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.fill.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.fill.html new file mode 100644 index 0000000000..e349b92376 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.fill.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.globalAlpha.fill</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.globalAlpha.fill</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.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.fill.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.fill.worker.js new file mode 100644 index 0000000000..f354773bf4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.fill.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.globalAlpha.fill +// 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.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.image.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.image.html new file mode 100644 index 0000000000..29a963a7c6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.image.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.composite.globalAlpha.image</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.globalAlpha.image</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.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.image.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.image.worker.js new file mode 100644 index 0000000000..010fbd8bfa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.image.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.composite.globalAlpha.image +// 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.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.imagepattern.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.imagepattern.html new file mode 100644 index 0000000000..7eacf16c4f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.imagepattern.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.composite.globalAlpha.imagepattern</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.globalAlpha.imagepattern</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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); + ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.imagepattern.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.imagepattern.worker.js new file mode 100644 index 0000000000..5607972635 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.imagepattern.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.composite.globalAlpha.imagepattern +// 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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); + ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.invalid.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.invalid.html new file mode 100644 index 0000000000..d00951e46e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.invalid.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.composite.globalAlpha.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.composite.globalAlpha.invalid</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.globalAlpha = 0.5; +var a = ctx.globalAlpha; // might not be exactly 0.5, if it is rounded/quantised, so remember for future comparisons +ctx.globalAlpha = Infinity; +_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); +ctx.globalAlpha = -Infinity; +_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); +ctx.globalAlpha = NaN; +_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.invalid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.invalid.worker.js new file mode 100644 index 0000000000..88f017dec7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.invalid.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.globalAlpha.invalid +// 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.globalAlpha = 0.5; +var a = ctx.globalAlpha; // might not be exactly 0.5, if it is rounded/quantised, so remember for future comparisons +ctx.globalAlpha = Infinity; +_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); +ctx.globalAlpha = -Infinity; +_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); +ctx.globalAlpha = NaN; +_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.range.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.range.html new file mode 100644 index 0000000000..29efb63aad --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.range.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.globalAlpha.range</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.globalAlpha.range</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.globalAlpha = 0.5; +var a = ctx.globalAlpha; // might not be exactly 0.5, if it is rounded/quantised, so remember for future comparisons +ctx.globalAlpha = 1.1; +_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); +ctx.globalAlpha = -0.1; +_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); +ctx.globalAlpha = 0; +_assertSame(ctx.globalAlpha, 0, "ctx.globalAlpha", "0"); +ctx.globalAlpha = 1; +_assertSame(ctx.globalAlpha, 1, "ctx.globalAlpha", "1"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.range.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.range.worker.js new file mode 100644 index 0000000000..cfd0836665 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.range.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.composite.globalAlpha.range +// 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.globalAlpha = 0.5; +var a = ctx.globalAlpha; // might not be exactly 0.5, if it is rounded/quantised, so remember for future comparisons +ctx.globalAlpha = 1.1; +_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); +ctx.globalAlpha = -0.1; +_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); +ctx.globalAlpha = 0; +_assertSame(ctx.globalAlpha, 0, "ctx.globalAlpha", "0"); +ctx.globalAlpha = 1; +_assertSame(ctx.globalAlpha, 1, "ctx.globalAlpha", "1"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.copy.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.copy.html new file mode 100644 index 0000000000..1aa9c98e9d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.copy.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.composite.image.copy</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.image.copy</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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'copy'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 255,255,0,191, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.copy.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.copy.worker.js new file mode 100644 index 0000000000..ba3399a2b1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.copy.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.composite.image.copy +// 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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'copy'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 255,255,0,191, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-atop.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-atop.html new file mode 100644 index 0000000000..76547a1f86 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-atop.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.composite.image.destination-atop</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.image.destination-atop</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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-atop'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 128,255,128,191, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-atop.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-atop.worker.js new file mode 100644 index 0000000000..677b882b01 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-atop.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.composite.image.destination-atop +// 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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-atop'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 128,255,128,191, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-in.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-in.html new file mode 100644 index 0000000000..8fa5786961 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-in.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.composite.image.destination-in</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.image.destination-in</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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-in'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,255,96, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-in.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-in.worker.js new file mode 100644 index 0000000000..aa8c1ac06d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-in.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.composite.image.destination-in +// 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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-in'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,255,96, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-out.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-out.html new file mode 100644 index 0000000000..3a4da68c2c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-out.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.composite.image.destination-out</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.image.destination-out</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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-out'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,255,32, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-out.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-out.worker.js new file mode 100644 index 0000000000..94ac27a00d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-out.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.composite.image.destination-out +// 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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-out'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,255,32, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-over.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-over.html new file mode 100644 index 0000000000..c6da28db6a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-over.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.composite.image.destination-over</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.image.destination-over</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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-over'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 109,255,146,223, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-over.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-over.worker.js new file mode 100644 index 0000000000..3bc357dce8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.destination-over.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.composite.image.destination-over +// 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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-over'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 109,255,146,223, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.lighter.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.lighter.html new file mode 100644 index 0000000000..db89e5a3e8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.lighter.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.composite.image.lighter</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.image.lighter</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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'lighter'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 191,255,128,255, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.lighter.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.lighter.worker.js new file mode 100644 index 0000000000..922b5f4635 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.lighter.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.composite.image.lighter +// 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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'lighter'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 191,255,128,255, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-atop.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-atop.html new file mode 100644 index 0000000000..44dd6f4274 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-atop.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.composite.image.source-atop</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.image.source-atop</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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-atop'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 191,255,64,128, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-atop.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-atop.worker.js new file mode 100644 index 0000000000..1b32993858 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-atop.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.composite.image.source-atop +// 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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-atop'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 191,255,64,128, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-in.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-in.html new file mode 100644 index 0000000000..64c28c0c21 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-in.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.composite.image.source-in</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.image.source-in</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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-in'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 255,255,0,96, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-in.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-in.worker.js new file mode 100644 index 0000000000..3048f849a9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-in.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.composite.image.source-in +// 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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-in'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 255,255,0,96, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-out.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-out.html new file mode 100644 index 0000000000..46d3e483ee --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-out.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.composite.image.source-out</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.image.source-out</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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-out'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 255,255,0,96, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-out.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-out.worker.js new file mode 100644 index 0000000000..090bbe7d22 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-out.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.composite.image.source-out +// 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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-out'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 255,255,0,96, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-over.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-over.html new file mode 100644 index 0000000000..1d13b77248 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-over.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.composite.image.source-over</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.image.source-over</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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-over'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 219,255,36,223, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-over.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-over.worker.js new file mode 100644 index 0000000000..7937e5be69 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.source-over.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.composite.image.source-over +// 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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-over'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 219,255,36,223, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.xor.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.xor.html new file mode 100644 index 0000000000..73253fabca --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.xor.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.composite.image.xor</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.image.xor</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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'xor'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 191,255,64,128, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.xor.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.xor.worker.js new file mode 100644 index 0000000000..7a22f7d39f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.image.xor.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.composite.image.xor +// 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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'xor'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow75.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 191,255,64,128, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.casesensitive.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.casesensitive.html new file mode 100644 index 0000000000..a317e7cf60 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.casesensitive.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.operation.casesensitive</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.operation.casesensitive</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.globalCompositeOperation = 'xor'; +ctx.globalCompositeOperation = 'Source-over'; +_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.casesensitive.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.casesensitive.worker.js new file mode 100644 index 0000000000..b6f7adacb9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.casesensitive.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.composite.operation.casesensitive +// 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.globalCompositeOperation = 'xor'; +ctx.globalCompositeOperation = 'Source-over'; +_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.clear.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.clear.html new file mode 100644 index 0000000000..c838cf3f83 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.clear.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.operation.clear</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.operation.clear</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.globalCompositeOperation = 'xor'; +ctx.globalCompositeOperation = 'clear'; +_assertSame(ctx.globalCompositeOperation, 'clear', "ctx.globalCompositeOperation", "'clear'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.clear.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.clear.worker.js new file mode 100644 index 0000000000..e911da2023 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.clear.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.composite.operation.clear +// 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.globalCompositeOperation = 'xor'; +ctx.globalCompositeOperation = 'clear'; +_assertSame(ctx.globalCompositeOperation, 'clear', "ctx.globalCompositeOperation", "'clear'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.darker.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.darker.html new file mode 100644 index 0000000000..1439cbbf41 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.darker.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.operation.darker</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.operation.darker</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.globalCompositeOperation = 'xor'; +ctx.globalCompositeOperation = 'darker'; +_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.darker.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.darker.worker.js new file mode 100644 index 0000000000..c90d4828e4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.darker.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.composite.operation.darker +// 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.globalCompositeOperation = 'xor'; +ctx.globalCompositeOperation = 'darker'; +_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.default.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.default.html new file mode 100644 index 0000000000..f6a9d162ca --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.default.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.operation.default</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.operation.default</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.globalCompositeOperation, 'source-over', "ctx.globalCompositeOperation", "'source-over'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.default.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.default.worker.js new file mode 100644 index 0000000000..691c153ea7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.default.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.operation.default +// 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.globalCompositeOperation, 'source-over', "ctx.globalCompositeOperation", "'source-over'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.get.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.get.html new file mode 100644 index 0000000000..0b3226c279 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.get.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.composite.operation.get</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.operation.get</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'); + +var modes = ['source-atop', 'source-in', 'source-out', 'source-over', + 'destination-atop', 'destination-in', 'destination-out', 'destination-over', + 'lighter', 'copy', 'xor']; +for (var i = 0; i < modes.length; ++i) +{ + ctx.globalCompositeOperation = modes[i]; + _assertSame(ctx.globalCompositeOperation, modes[i], "ctx.globalCompositeOperation", "modes[\""+(i)+"\"]"); +} +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.get.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.get.worker.js new file mode 100644 index 0000000000..9009536ef7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.get.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.operation.get +// 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'); + +var modes = ['source-atop', 'source-in', 'source-out', 'source-over', + 'destination-atop', 'destination-in', 'destination-out', 'destination-over', + 'lighter', 'copy', 'xor']; +for (var i = 0; i < modes.length; ++i) +{ + ctx.globalCompositeOperation = modes[i]; + _assertSame(ctx.globalCompositeOperation, modes[i], "ctx.globalCompositeOperation", "modes[\""+(i)+"\"]"); +} +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.highlight.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.highlight.html new file mode 100644 index 0000000000..bffe7b4edb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.highlight.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.operation.highlight</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.operation.highlight</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.globalCompositeOperation = 'xor'; +ctx.globalCompositeOperation = 'highlight'; +_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.highlight.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.highlight.worker.js new file mode 100644 index 0000000000..234893aac7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.highlight.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.composite.operation.highlight +// 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.globalCompositeOperation = 'xor'; +ctx.globalCompositeOperation = 'highlight'; +_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.nullsuffix.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.nullsuffix.html new file mode 100644 index 0000000000..72e83fcf80 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.nullsuffix.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.operation.nullsuffix</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.operation.nullsuffix</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.globalCompositeOperation = 'xor'; +ctx.globalCompositeOperation = 'source-over\0'; +_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.nullsuffix.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.nullsuffix.worker.js new file mode 100644 index 0000000000..ee3266e18a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.nullsuffix.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.composite.operation.nullsuffix +// 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.globalCompositeOperation = 'xor'; +ctx.globalCompositeOperation = 'source-over\0'; +_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.over.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.over.html new file mode 100644 index 0000000000..0400d974c4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.over.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.operation.over</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.operation.over</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.globalCompositeOperation = 'xor'; +ctx.globalCompositeOperation = 'over'; +_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.over.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.over.worker.js new file mode 100644 index 0000000000..97a4209c83 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.over.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.composite.operation.over +// 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.globalCompositeOperation = 'xor'; +ctx.globalCompositeOperation = 'over'; +_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.unrecognised.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.unrecognised.html new file mode 100644 index 0000000000..1bcc764721 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.unrecognised.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.operation.unrecognised</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.operation.unrecognised</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.globalCompositeOperation = 'xor'; +ctx.globalCompositeOperation = 'nonexistent'; +_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.unrecognised.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.unrecognised.worker.js new file mode 100644 index 0000000000..d02e9f1aa7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.operation.unrecognised.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.composite.operation.unrecognised +// 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.globalCompositeOperation = 'xor'; +ctx.globalCompositeOperation = 'nonexistent'; +_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.copy.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.copy.html new file mode 100644 index 0000000000..aaad0b418f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.copy.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.solid.copy</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.solid.copy</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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'copy'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 255,255,0,255, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.copy.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.copy.worker.js new file mode 100644 index 0000000000..63cc6c1e90 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.copy.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.composite.solid.copy +// 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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'copy'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 255,255,0,255, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-atop.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-atop.html new file mode 100644 index 0000000000..be4cf393a1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-atop.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.solid.destination-atop</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.solid.destination-atop</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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-atop'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,255,255,255, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-atop.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-atop.worker.js new file mode 100644 index 0000000000..a09827ca88 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-atop.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.composite.solid.destination-atop +// 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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-atop'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,255,255,255, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-in.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-in.html new file mode 100644 index 0000000000..e5ea33b5b0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-in.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.solid.destination-in</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.solid.destination-in</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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-in'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,255,255,255, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-in.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-in.worker.js new file mode 100644 index 0000000000..b06ad63266 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-in.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.composite.solid.destination-in +// 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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-in'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,255,255,255, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-out.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-out.html new file mode 100644 index 0000000000..49efe240d0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-out.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.solid.destination-out</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.solid.destination-out</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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-out'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-out.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-out.worker.js new file mode 100644 index 0000000000..3b0232e255 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-out.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.composite.solid.destination-out +// 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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-out'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-over.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-over.html new file mode 100644 index 0000000000..c1d7965cad --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-over.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.solid.destination-over</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.solid.destination-over</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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-over'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,255,255,255, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-over.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-over.worker.js new file mode 100644 index 0000000000..99d64be578 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.destination-over.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.composite.solid.destination-over +// 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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-over'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,255,255,255, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.lighter.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.lighter.html new file mode 100644 index 0000000000..2877e14ad9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.lighter.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.solid.lighter</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.solid.lighter</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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'lighter'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 255,255,255,255, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.lighter.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.lighter.worker.js new file mode 100644 index 0000000000..011a19934e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.lighter.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.composite.solid.lighter +// 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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'lighter'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 255,255,255,255, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-atop.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-atop.html new file mode 100644 index 0000000000..9f972edabc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-atop.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.solid.source-atop</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.solid.source-atop</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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-atop'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 255,255,0,255, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-atop.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-atop.worker.js new file mode 100644 index 0000000000..2dc6ec9b2e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-atop.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.composite.solid.source-atop +// 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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-atop'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 255,255,0,255, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-in.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-in.html new file mode 100644 index 0000000000..c674bbde91 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-in.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.solid.source-in</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.solid.source-in</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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-in'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 255,255,0,255, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-in.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-in.worker.js new file mode 100644 index 0000000000..5b833ec156 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-in.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.composite.solid.source-in +// 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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-in'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 255,255,0,255, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-out.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-out.html new file mode 100644 index 0000000000..0fa403bb75 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-out.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.solid.source-out</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.solid.source-out</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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-out'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-out.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-out.worker.js new file mode 100644 index 0000000000..0486939935 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-out.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.composite.solid.source-out +// 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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-out'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-over.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-over.html new file mode 100644 index 0000000000..4392e60c9e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-over.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.solid.source-over</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.solid.source-over</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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-over'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 255,255,0,255, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-over.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-over.worker.js new file mode 100644 index 0000000000..ce8190ec0f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.source-over.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.composite.solid.source-over +// 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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-over'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 255,255,0,255, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.xor.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.xor.html new file mode 100644 index 0000000000..a9eb83e6a9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.xor.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.solid.xor</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.solid.xor</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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'xor'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.xor.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.xor.worker.js new file mode 100644 index 0000000000..8b7edec945 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.solid.xor.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.composite.solid.xor +// 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 = 'rgba(0, 255, 255, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'xor'; +ctx.fillStyle = 'rgba(255, 255, 0, 1.0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.copy.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.copy.html new file mode 100644 index 0000000000..20c107bd77 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.copy.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.transparent.copy</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.transparent.copy</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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'copy'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,255,191, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.copy.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.copy.worker.js new file mode 100644 index 0000000000..7fb646acd5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.copy.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.composite.transparent.copy +// 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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'copy'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,255,191, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-atop.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-atop.html new file mode 100644 index 0000000000..2bc5466d27 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-atop.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.transparent.destination-atop</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.transparent.destination-atop</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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-atop'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,128,128,191, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-atop.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-atop.worker.js new file mode 100644 index 0000000000..f433bedf7c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-atop.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.composite.transparent.destination-atop +// 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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-atop'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,128,128,191, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-in.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-in.html new file mode 100644 index 0000000000..1d1121812d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-in.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.transparent.destination-in</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.transparent.destination-in</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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-in'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,255,0,96, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-in.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-in.worker.js new file mode 100644 index 0000000000..a4c159aeef --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-in.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.composite.transparent.destination-in +// 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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-in'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,255,0,96, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-out.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-out.html new file mode 100644 index 0000000000..17b3fecd02 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-out.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.transparent.destination-out</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.transparent.destination-out</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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-out'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,255,0,32, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-out.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-out.worker.js new file mode 100644 index 0000000000..cf6827fc51 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-out.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.composite.transparent.destination-out +// 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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-out'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,255,0,32, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-over.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-over.html new file mode 100644 index 0000000000..04c267a817 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-over.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.transparent.destination-over</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.transparent.destination-over</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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-over'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,146,109,223, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-over.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-over.worker.js new file mode 100644 index 0000000000..98a4b5b59e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.destination-over.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.composite.transparent.destination-over +// 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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-over'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,146,109,223, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.lighter.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.lighter.html new file mode 100644 index 0000000000..86d06f2485 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.lighter.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.transparent.lighter</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.transparent.lighter</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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'lighter'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,128,191,255, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.lighter.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.lighter.worker.js new file mode 100644 index 0000000000..f9b419ace7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.lighter.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.composite.transparent.lighter +// 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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'lighter'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,128,191,255, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-atop.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-atop.html new file mode 100644 index 0000000000..f4e79c0c24 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-atop.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.transparent.source-atop</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.transparent.source-atop</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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-atop'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,64,191,128, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-atop.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-atop.worker.js new file mode 100644 index 0000000000..db65db8366 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-atop.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.composite.transparent.source-atop +// 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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-atop'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,64,191,128, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-in.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-in.html new file mode 100644 index 0000000000..56b4e7704d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-in.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.transparent.source-in</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.transparent.source-in</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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-in'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,255,96, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-in.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-in.worker.js new file mode 100644 index 0000000000..32765c4c03 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-in.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.composite.transparent.source-in +// 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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-in'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,255,96, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-out.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-out.html new file mode 100644 index 0000000000..cca28c5ebc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-out.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.transparent.source-out</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.transparent.source-out</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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-out'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,255,96, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-out.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-out.worker.js new file mode 100644 index 0000000000..3cf507bf84 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-out.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.composite.transparent.source-out +// 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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-out'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,255,96, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-over.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-over.html new file mode 100644 index 0000000000..a8ae30131d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-over.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.transparent.source-over</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.transparent.source-over</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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-over'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,36,219,223, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-over.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-over.worker.js new file mode 100644 index 0000000000..35545c04d4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.source-over.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.composite.transparent.source-over +// 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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-over'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,36,219,223, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.xor.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.xor.html new file mode 100644 index 0000000000..638bae02ec --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.xor.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.transparent.xor</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.transparent.xor</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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'xor'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,64,191,128, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.xor.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.xor.worker.js new file mode 100644 index 0000000000..b21d30d900 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.transparent.xor.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.composite.transparent.xor +// 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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'xor'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,64,191,128, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.copy.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.copy.html new file mode 100644 index 0000000000..f10275f407 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.copy.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.composite.uncovered.fill.copy</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.fill.copy</h1> +<p class="desc">fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'copy'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.translate(0, 25); +ctx.fillRect(0, 50, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.copy.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.copy.worker.js new file mode 100644 index 0000000000..3b86c720f5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.copy.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.uncovered.fill.copy +// Description:fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'copy'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.translate(0, 25); +ctx.fillRect(0, 50, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.destination-atop.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.destination-atop.html new file mode 100644 index 0000000000..8672e9e19f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.destination-atop.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.composite.uncovered.fill.destination-atop</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.fill.destination-atop</h1> +<p class="desc">fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-atop'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.translate(0, 25); +ctx.fillRect(0, 50, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.destination-atop.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.destination-atop.worker.js new file mode 100644 index 0000000000..69610fc107 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.destination-atop.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.uncovered.fill.destination-atop +// Description:fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-atop'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.translate(0, 25); +ctx.fillRect(0, 50, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.destination-in.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.destination-in.html new file mode 100644 index 0000000000..0f069372ad --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.destination-in.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.uncovered.fill.destination-in</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.fill.destination-in</h1> +<p class="desc">fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-in'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.translate(0, 25); +ctx.fillRect(0, 50, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.destination-in.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.destination-in.worker.js new file mode 100644 index 0000000000..26b287134b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.destination-in.worker.js @@ -0,0 +1,31 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.uncovered.fill.destination-in +// Description:fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-in'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.translate(0, 25); +ctx.fillRect(0, 50, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.source-in.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.source-in.html new file mode 100644 index 0000000000..6e1ecdd719 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.source-in.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.composite.uncovered.fill.source-in</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.fill.source-in</h1> +<p class="desc">fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-in'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.translate(0, 25); +ctx.fillRect(0, 50, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.source-in.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.source-in.worker.js new file mode 100644 index 0000000000..6da98654cf --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.source-in.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.uncovered.fill.source-in +// Description:fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-in'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.translate(0, 25); +ctx.fillRect(0, 50, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.source-out.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.source-out.html new file mode 100644 index 0000000000..de16897f8c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.source-out.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.composite.uncovered.fill.source-out</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.fill.source-out</h1> +<p class="desc">fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-out'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.translate(0, 25); +ctx.fillRect(0, 50, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.source-out.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.source-out.worker.js new file mode 100644 index 0000000000..515b587b58 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.fill.source-out.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.composite.uncovered.fill.source-out +// Description:fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-out'; +ctx.fillStyle = 'rgba(0, 0, 255, 0.75)'; +ctx.translate(0, 25); +ctx.fillRect(0, 50, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.copy.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.copy.html new file mode 100644 index 0000000000..5f3c9a1914 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.copy.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.composite.uncovered.image.copy</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.image.copy</h1> +<p class="desc">drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'copy'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 40, 40, 10, 10, 40, 50, 10, 10); + _assertPixelApprox(canvas, 15,15, 0,0,0,0, 5); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.copy.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.copy.worker.js new file mode 100644 index 0000000000..2faecdf0dd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.copy.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.composite.uncovered.image.copy +// Description:drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'copy'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 40, 40, 10, 10, 40, 50, 10, 10); + _assertPixelApprox(canvas, 15,15, 0,0,0,0, 5); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.destination-atop.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.destination-atop.html new file mode 100644 index 0000000000..3605e44698 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.destination-atop.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.composite.uncovered.image.destination-atop</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.image.destination-atop</h1> +<p class="desc">drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-atop'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 40, 40, 10, 10, 40, 50, 10, 10); + _assertPixelApprox(canvas, 15,15, 0,0,0,0, 5); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.destination-atop.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.destination-atop.worker.js new file mode 100644 index 0000000000..8b361e066d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.destination-atop.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.composite.uncovered.image.destination-atop +// Description:drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-atop'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 40, 40, 10, 10, 40, 50, 10, 10); + _assertPixelApprox(canvas, 15,15, 0,0,0,0, 5); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.destination-in.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.destination-in.html new file mode 100644 index 0000000000..c48ee8e16e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.destination-in.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.composite.uncovered.image.destination-in</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.image.destination-in</h1> +<p class="desc">drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-in'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 40, 40, 10, 10, 40, 50, 10, 10); + _assertPixelApprox(canvas, 15,15, 0,0,0,0, 5); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.destination-in.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.destination-in.worker.js new file mode 100644 index 0000000000..b270efc7aa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.destination-in.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.composite.uncovered.image.destination-in +// Description:drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-in'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 40, 40, 10, 10, 40, 50, 10, 10); + _assertPixelApprox(canvas, 15,15, 0,0,0,0, 5); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.source-in.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.source-in.html new file mode 100644 index 0000000000..af4c3b7daa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.source-in.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.composite.uncovered.image.source-in</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.image.source-in</h1> +<p class="desc">drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-in'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 40, 40, 10, 10, 40, 50, 10, 10); + _assertPixelApprox(canvas, 15,15, 0,0,0,0, 5); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.source-in.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.source-in.worker.js new file mode 100644 index 0000000000..5fe00cf14b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.source-in.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.composite.uncovered.image.source-in +// Description:drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-in'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 40, 40, 10, 10, 40, 50, 10, 10); + _assertPixelApprox(canvas, 15,15, 0,0,0,0, 5); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.source-out.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.source-out.html new file mode 100644 index 0000000000..4f1c3869b0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.source-out.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.composite.uncovered.image.source-out</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.image.source-out</h1> +<p class="desc">drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-out'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 40, 40, 10, 10, 40, 50, 10, 10); + _assertPixelApprox(canvas, 15,15, 0,0,0,0, 5); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.source-out.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.source-out.worker.js new file mode 100644 index 0000000000..f93185bc66 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.image.source-out.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.composite.uncovered.image.source-out +// Description:drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-out'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 40, 40, 10, 10, 40, 50, 10, 10); + _assertPixelApprox(canvas, 15,15, 0,0,0,0, 5); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.copy.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.copy.html new file mode 100644 index 0000000000..57c499d81c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.copy.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.uncovered.nocontext.copy</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.nocontext.copy</h1> +<p class="desc">drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'copy'; +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +ctx.drawImage(offscreenCanvas2, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.copy.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.copy.worker.js new file mode 100644 index 0000000000..bf6bdfe943 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.copy.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.composite.uncovered.nocontext.copy +// Description:drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'copy'; +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +ctx.drawImage(offscreenCanvas2, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.destination-atop.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.destination-atop.html new file mode 100644 index 0000000000..73684800ca --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.destination-atop.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.uncovered.nocontext.destination-atop</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.nocontext.destination-atop</h1> +<p class="desc">drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-atop'; +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +ctx.drawImage(offscreenCanvas2, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.destination-atop.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.destination-atop.worker.js new file mode 100644 index 0000000000..3574add7d8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.destination-atop.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.composite.uncovered.nocontext.destination-atop +// Description:drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-atop'; +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +ctx.drawImage(offscreenCanvas2, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.destination-in.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.destination-in.html new file mode 100644 index 0000000000..b41c4b749c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.destination-in.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.uncovered.nocontext.destination-in</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.nocontext.destination-in</h1> +<p class="desc">drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-in'; +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +ctx.drawImage(offscreenCanvas2, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.destination-in.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.destination-in.worker.js new file mode 100644 index 0000000000..979a0849e8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.destination-in.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.composite.uncovered.nocontext.destination-in +// Description:drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-in'; +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +ctx.drawImage(offscreenCanvas2, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.source-in.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.source-in.html new file mode 100644 index 0000000000..99aeefbb6a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.source-in.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.uncovered.nocontext.source-in</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.nocontext.source-in</h1> +<p class="desc">drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-in'; +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +ctx.drawImage(offscreenCanvas2, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.source-in.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.source-in.worker.js new file mode 100644 index 0000000000..55596f859d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.source-in.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.composite.uncovered.nocontext.source-in +// Description:drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-in'; +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +ctx.drawImage(offscreenCanvas2, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.source-out.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.source-out.html new file mode 100644 index 0000000000..0dfd4ae0d0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.source-out.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.composite.uncovered.nocontext.source-out</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.nocontext.source-out</h1> +<p class="desc">drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-out'; +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +ctx.drawImage(offscreenCanvas2, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.source-out.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.source-out.worker.js new file mode 100644 index 0000000000..f0820e03fe --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.nocontext.source-out.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.composite.uncovered.nocontext.source-out +// Description:drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-out'; +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +ctx.drawImage(offscreenCanvas2, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.copy.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.copy.html new file mode 100644 index 0000000000..244cc82f55 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.copy.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.composite.uncovered.pattern.copy</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.pattern.copy</h1> +<p class="desc">Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'copy'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillRect(0, 50, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.copy.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.copy.worker.js new file mode 100644 index 0000000000..3aeddac219 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.copy.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.composite.uncovered.pattern.copy +// Description:Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'copy'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillRect(0, 50, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.destination-atop.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.destination-atop.html new file mode 100644 index 0000000000..3624f1baa9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.destination-atop.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.composite.uncovered.pattern.destination-atop</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.pattern.destination-atop</h1> +<p class="desc">Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-atop'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillRect(0, 50, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.destination-atop.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.destination-atop.worker.js new file mode 100644 index 0000000000..86aaf9fb52 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.destination-atop.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.composite.uncovered.pattern.destination-atop +// Description:Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-atop'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillRect(0, 50, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.destination-in.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.destination-in.html new file mode 100644 index 0000000000..21990f1ae0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.destination-in.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.composite.uncovered.pattern.destination-in</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.pattern.destination-in</h1> +<p class="desc">Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-in'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillRect(0, 50, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.destination-in.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.destination-in.worker.js new file mode 100644 index 0000000000..184efcd71e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.destination-in.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.composite.uncovered.pattern.destination-in +// Description:Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-in'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillRect(0, 50, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.source-in.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.source-in.html new file mode 100644 index 0000000000..f95da543c9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.source-in.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.composite.uncovered.pattern.source-in</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.pattern.source-in</h1> +<p class="desc">Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-in'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillRect(0, 50, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.source-in.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.source-in.worker.js new file mode 100644 index 0000000000..61c798b7aa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.source-in.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.composite.uncovered.pattern.source-in +// Description:Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-in'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillRect(0, 50, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.source-out.html b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.source-out.html new file mode 100644 index 0000000000..4eb6ba519f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.source-out.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.composite.uncovered.pattern.source-out</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.composite.uncovered.pattern.source-out</h1> +<p class="desc">Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.</p> + + +<script> +var t = async_test("Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-out'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillRect(0, 50, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.source-out.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.source-out.worker.js new file mode 100644 index 0000000000..5827c7a1d7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.uncovered.pattern.source-out.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.composite.uncovered.pattern.source-out +// Description:Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Pattern fill() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged."); +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 = 'rgba(0, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'source-out'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/yellow.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillRect(0, 50, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,0,0,0, 5); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.html b/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.html new file mode 100644 index 0000000000..a89ec10f9b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.html @@ -0,0 +1,62 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.conformance.requirements.basics</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.conformance.requirements.basics</h1> +<p class="desc">void methods return undefined</p> + +<p class="notes">Defined in "Web IDL" (draft) +<script> +var t = async_test("void methods return undefined"); +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.save(), undefined, "ctx.save()", "undefined"); +_assertSame(ctx.restore(), undefined, "ctx.restore()", "undefined"); +_assertSame(ctx.scale(1, 1), undefined, "ctx.scale(1, 1)", "undefined"); +_assertSame(ctx.rotate(0), undefined, "ctx.rotate(0)", "undefined"); +_assertSame(ctx.translate(0, 0), undefined, "ctx.translate(0, 0)", "undefined"); +if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) + _assertSame(ctx.transform(1, 0, 0, 1, 0, 0), undefined, "ctx.transform(1, 0, 0, 1, 0, 0)", "undefined"); +} +if (ctx.setTransform) { + _assertSame(ctx.setTransform(1, 0, 0, 1, 0, 0), undefined, "ctx.setTransform(1, 0, 0, 1, 0, 0)", "undefined"); + _assertSame(ctx.setTransform(), undefined, "ctx.setTransform()", "undefined"); +} +_assertSame(ctx.clearRect(0, 0, 0, 0), undefined, "ctx.clearRect(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.fillRect(0, 0, 0, 0), undefined, "ctx.fillRect(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.strokeRect(0, 0, 0, 0), undefined, "ctx.strokeRect(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.beginPath(), undefined, "ctx.beginPath()", "undefined"); +_assertSame(ctx.closePath(), undefined, "ctx.closePath()", "undefined"); +_assertSame(ctx.moveTo(0, 0), undefined, "ctx.moveTo(0, 0)", "undefined"); +_assertSame(ctx.lineTo(0, 0), undefined, "ctx.lineTo(0, 0)", "undefined"); +_assertSame(ctx.quadraticCurveTo(0, 0, 0, 0), undefined, "ctx.quadraticCurveTo(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.bezierCurveTo(0, 0, 0, 0, 0, 0), undefined, "ctx.bezierCurveTo(0, 0, 0, 0, 0, 0)", "undefined"); +_assertSame(ctx.arcTo(0, 0, 0, 0, 1), undefined, "ctx.arcTo(0, 0, 0, 0, 1)", "undefined"); +_assertSame(ctx.rect(0, 0, 0, 0), undefined, "ctx.rect(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.arc(0, 0, 1, 0, 0, true), undefined, "ctx.arc(0, 0, 1, 0, 0, true)", "undefined"); +_assertSame(ctx.fill(), undefined, "ctx.fill()", "undefined"); +_assertSame(ctx.stroke(), undefined, "ctx.stroke()", "undefined"); +_assertSame(ctx.clip(), undefined, "ctx.clip()", "undefined"); +if (ctx.fillText) { + _assertSame(ctx.fillText('test', 0, 0), undefined, "ctx.fillText('test', 0, 0)", "undefined"); + _assertSame(ctx.strokeText('test', 0, 0), undefined, "ctx.strokeText('test', 0, 0)", "undefined"); +} +if (ctx.putImageData) { + _assertSame(ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0), undefined, "ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0)", "undefined"); +} +_assertSame(ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0), undefined, "ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0)", "undefined"); +_assertSame(ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white'), undefined, "ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white')", "undefined"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.worker.js b/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.worker.js new file mode 100644 index 0000000000..8d6ddc894f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.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.conformance.requirements.basics +// Description:void methods return undefined +// Note:<p class="notes">Defined in "Web IDL" (draft) + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("void methods return undefined"); +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.save(), undefined, "ctx.save()", "undefined"); +_assertSame(ctx.restore(), undefined, "ctx.restore()", "undefined"); +_assertSame(ctx.scale(1, 1), undefined, "ctx.scale(1, 1)", "undefined"); +_assertSame(ctx.rotate(0), undefined, "ctx.rotate(0)", "undefined"); +_assertSame(ctx.translate(0, 0), undefined, "ctx.translate(0, 0)", "undefined"); +if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) + _assertSame(ctx.transform(1, 0, 0, 1, 0, 0), undefined, "ctx.transform(1, 0, 0, 1, 0, 0)", "undefined"); +} +if (ctx.setTransform) { + _assertSame(ctx.setTransform(1, 0, 0, 1, 0, 0), undefined, "ctx.setTransform(1, 0, 0, 1, 0, 0)", "undefined"); + _assertSame(ctx.setTransform(), undefined, "ctx.setTransform()", "undefined"); +} +_assertSame(ctx.clearRect(0, 0, 0, 0), undefined, "ctx.clearRect(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.fillRect(0, 0, 0, 0), undefined, "ctx.fillRect(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.strokeRect(0, 0, 0, 0), undefined, "ctx.strokeRect(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.beginPath(), undefined, "ctx.beginPath()", "undefined"); +_assertSame(ctx.closePath(), undefined, "ctx.closePath()", "undefined"); +_assertSame(ctx.moveTo(0, 0), undefined, "ctx.moveTo(0, 0)", "undefined"); +_assertSame(ctx.lineTo(0, 0), undefined, "ctx.lineTo(0, 0)", "undefined"); +_assertSame(ctx.quadraticCurveTo(0, 0, 0, 0), undefined, "ctx.quadraticCurveTo(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.bezierCurveTo(0, 0, 0, 0, 0, 0), undefined, "ctx.bezierCurveTo(0, 0, 0, 0, 0, 0)", "undefined"); +_assertSame(ctx.arcTo(0, 0, 0, 0, 1), undefined, "ctx.arcTo(0, 0, 0, 0, 1)", "undefined"); +_assertSame(ctx.rect(0, 0, 0, 0), undefined, "ctx.rect(0, 0, 0, 0)", "undefined"); +_assertSame(ctx.arc(0, 0, 1, 0, 0, true), undefined, "ctx.arc(0, 0, 1, 0, 0, true)", "undefined"); +_assertSame(ctx.fill(), undefined, "ctx.fill()", "undefined"); +_assertSame(ctx.stroke(), undefined, "ctx.stroke()", "undefined"); +_assertSame(ctx.clip(), undefined, "ctx.clip()", "undefined"); +if (ctx.fillText) { + _assertSame(ctx.fillText('test', 0, 0), undefined, "ctx.fillText('test', 0, 0)", "undefined"); + _assertSame(ctx.strokeText('test', 0, 0), undefined, "ctx.strokeText('test', 0, 0)", "undefined"); +} +if (ctx.putImageData) { + _assertSame(ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0), undefined, "ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0)", "undefined"); +} +_assertSame(ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0), undefined, "ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0)", "undefined"); +_assertSame(ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white'), undefined, "ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white')", "undefined"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.html b/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.html new file mode 100644 index 0000000000..cfbbca9e5e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.html @@ -0,0 +1,141 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.conformance.requirements.missingargs</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.conformance.requirements.missingargs</h1> +<p class="desc">Missing arguments cause TypeError</p> + + +<script> +var t = async_test("Missing arguments cause TypeError"); +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'); + +assert_throws_js(TypeError, function() { ctx.scale(); }); +assert_throws_js(TypeError, function() { ctx.scale(1); }); +assert_throws_js(TypeError, function() { ctx.rotate(); }); +assert_throws_js(TypeError, function() { ctx.translate(); }); +assert_throws_js(TypeError, function() { ctx.translate(0); }); +if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) + assert_throws_js(TypeError, function() { ctx.transform(); }); + assert_throws_js(TypeError, function() { ctx.transform(1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1, 0); }); +} +if (ctx.setTransform) { + assert_throws_js(TypeError, function() { ctx.setTransform(1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1, 0); }); +} +assert_throws_js(TypeError, function() { ctx.createLinearGradient(); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.createPattern(canvas); }); +assert_throws_js(TypeError, function() { ctx.clearRect(); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.moveTo(); }); +assert_throws_js(TypeError, function() { ctx.moveTo(0); }); +assert_throws_js(TypeError, function() { ctx.lineTo(); }); +assert_throws_js(TypeError, function() { ctx.lineTo(0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.rect(); }); +assert_throws_js(TypeError, function() { ctx.rect(0); }); +assert_throws_js(TypeError, function() { ctx.rect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.rect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arc(); }); +assert_throws_js(TypeError, function() { ctx.arc(0); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1, 0); }); +// (6th argument to arc is optional) +if (ctx.isPointInPath) { + assert_throws_js(TypeError, function() { ctx.isPointInPath(); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(0); }); +} +if (ctx.drawFocusRing) { + assert_throws_js(TypeError, function() { ctx.drawFocusRing(); }); + assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas); }); + assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas, 0); }); +} +if (ctx.fillText) { + assert_throws_js(TypeError, function() { ctx.fillText(); }); + assert_throws_js(TypeError, function() { ctx.fillText('test'); }); + assert_throws_js(TypeError, function() { ctx.fillText('test', 0); }); + assert_throws_js(TypeError, function() { ctx.strokeText(); }); + assert_throws_js(TypeError, function() { ctx.strokeText('test'); }); + assert_throws_js(TypeError, function() { ctx.strokeText('test', 0); }); + assert_throws_js(TypeError, function() { ctx.measureText(); }); +} +assert_throws_js(TypeError, function() { ctx.drawImage(); }); +assert_throws_js(TypeError, function() { ctx.drawImage(canvas); }); +assert_throws_js(TypeError, function() { ctx.drawImage(canvas, 0); }); +// TODO: n >= 3 args on drawImage could be either a valid overload, +// or too few for another overload, or too many for another +// overload - what should happen? +if (ctx.createImageData) { + assert_throws_js(TypeError, function() { ctx.createImageData(); }); + assert_throws_js(TypeError, function() { ctx.createImageData(1); }); +} +if (ctx.getImageData) { + assert_throws_js(TypeError, function() { ctx.getImageData(); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0, 1); }); +} +if (ctx.putImageData) { + var imgdata = ctx.getImageData(0, 0, 1, 1); + assert_throws_js(TypeError, function() { ctx.putImageData(); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0); }); +} +var g = ctx.createLinearGradient(0, 0, 0, 0); +assert_throws_js(TypeError, function() { g.addColorStop(); }); +assert_throws_js(TypeError, function() { g.addColorStop(0); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.worker.js b/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.worker.js new file mode 100644 index 0000000000..fe1b111f05 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.worker.js @@ -0,0 +1,137 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.conformance.requirements.missingargs +// Description:Missing arguments cause TypeError +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Missing arguments cause TypeError"); +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'); + +assert_throws_js(TypeError, function() { ctx.scale(); }); +assert_throws_js(TypeError, function() { ctx.scale(1); }); +assert_throws_js(TypeError, function() { ctx.rotate(); }); +assert_throws_js(TypeError, function() { ctx.translate(); }); +assert_throws_js(TypeError, function() { ctx.translate(0); }); +if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) + assert_throws_js(TypeError, function() { ctx.transform(); }); + assert_throws_js(TypeError, function() { ctx.transform(1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1, 0); }); +} +if (ctx.setTransform) { + assert_throws_js(TypeError, function() { ctx.setTransform(1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1, 0); }); +} +assert_throws_js(TypeError, function() { ctx.createLinearGradient(); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.createPattern(canvas); }); +assert_throws_js(TypeError, function() { ctx.clearRect(); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.moveTo(); }); +assert_throws_js(TypeError, function() { ctx.moveTo(0); }); +assert_throws_js(TypeError, function() { ctx.lineTo(); }); +assert_throws_js(TypeError, function() { ctx.lineTo(0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.rect(); }); +assert_throws_js(TypeError, function() { ctx.rect(0); }); +assert_throws_js(TypeError, function() { ctx.rect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.rect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arc(); }); +assert_throws_js(TypeError, function() { ctx.arc(0); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1, 0); }); +// (6th argument to arc is optional) +if (ctx.isPointInPath) { + assert_throws_js(TypeError, function() { ctx.isPointInPath(); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(0); }); +} +if (ctx.drawFocusRing) { + assert_throws_js(TypeError, function() { ctx.drawFocusRing(); }); + assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas); }); + assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas, 0); }); +} +if (ctx.fillText) { + assert_throws_js(TypeError, function() { ctx.fillText(); }); + assert_throws_js(TypeError, function() { ctx.fillText('test'); }); + assert_throws_js(TypeError, function() { ctx.fillText('test', 0); }); + assert_throws_js(TypeError, function() { ctx.strokeText(); }); + assert_throws_js(TypeError, function() { ctx.strokeText('test'); }); + assert_throws_js(TypeError, function() { ctx.strokeText('test', 0); }); + assert_throws_js(TypeError, function() { ctx.measureText(); }); +} +assert_throws_js(TypeError, function() { ctx.drawImage(); }); +assert_throws_js(TypeError, function() { ctx.drawImage(canvas); }); +assert_throws_js(TypeError, function() { ctx.drawImage(canvas, 0); }); +// TODO: n >= 3 args on drawImage could be either a valid overload, +// or too few for another overload, or too many for another +// overload - what should happen? +if (ctx.createImageData) { + assert_throws_js(TypeError, function() { ctx.createImageData(); }); + assert_throws_js(TypeError, function() { ctx.createImageData(1); }); +} +if (ctx.getImageData) { + assert_throws_js(TypeError, function() { ctx.getImageData(); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0, 1); }); +} +if (ctx.putImageData) { + var imgdata = ctx.getImageData(0, 0, 1, 1); + assert_throws_js(TypeError, function() { ctx.putImageData(); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0); }); +} +var g = ctx.createLinearGradient(0, 0, 0, 0); +assert_throws_js(TypeError, function() { g.addColorStop(); }); +assert_throws_js(TypeError, function() { g.addColorStop(0); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.html new file mode 100644 index 0000000000..8e144b1ba6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.html @@ -0,0 +1,59 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.drawImage.3arg</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.3arg</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'); + +var promise1 = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +var promise2 = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +Promise.all([promise1, promise2]).then(function(response1, response2) { + var promise3 = createImageBitmap(response1); + var promise4 = createImageBitmap(response2); + Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { + ctx.drawImage(bitmap2, 0, 0); + ctx.drawImage(bitmap1, -100, 0); + ctx.drawImage(bitmap1, 100, 0); + ctx.drawImage(bitmap1, 0, -50); + ctx.drawImage(bitmap1, 0, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.worker.js new file mode 100644 index 0000000000..22cb3653e4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.worker.js @@ -0,0 +1,55 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.3arg +// 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'); + +var promise1 = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +var promise2 = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +Promise.all([promise1, promise2]).then(function(response1, response2) { + var promise3 = createImageBitmap(response1); + var promise4 = createImageBitmap(response2); + Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { + ctx.drawImage(bitmap2, 0, 0); + ctx.drawImage(bitmap1, -100, 0); + ctx.drawImage(bitmap1, 100, 0); + ctx.drawImage(bitmap1, 0, -50); + ctx.drawImage(bitmap1, 0, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.html new file mode 100644 index 0000000000..c383d1a417 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.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.drawImage.5arg</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.5arg</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); +var promise1 = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +var promise2 = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +Promise.all([promise1, promise2]).then(function(response1, response2) { + var promise3 = createImageBitmap(response1); + var promise4 = createImageBitmap(response2); + Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { + ctx.drawImage(bitmap2, 50, 0, 50, 50); + ctx.drawImage(bitmap1, 0, 0, 50, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.worker.js new file mode 100644 index 0000000000..3906a5a00b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.worker.js @@ -0,0 +1,56 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.5arg +// 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); +var promise1 = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +var promise2 = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +Promise.all([promise1, promise2]).then(function(response1, response2) { + var promise3 = createImageBitmap(response1); + var promise4 = createImageBitmap(response2); + Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { + ctx.drawImage(bitmap2, 50, 0, 50, 50); + ctx.drawImage(bitmap1, 0, 0, 50, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.html new file mode 100644 index 0000000000..72ffb4ee3b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.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.drawImage.9arg.basic</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.9arg.basic</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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.worker.js new file mode 100644 index 0000000000..244bc90fe7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.worker.js @@ -0,0 +1,42 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.9arg.basic +// 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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.html new file mode 100644 index 0000000000..ddfa0cbf7c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.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.drawImage.9arg.destpos</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.9arg.destpos</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); +var promise1 = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +var promise2 = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +Promise.all([promise1, promise2]).then(function(response1, response2) { + var promise3 = createImageBitmap(response1); + var promise4 = createImageBitmap(response2); + Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { + ctx.drawImage(bitmap2, 0, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap1, 0, 0, 100, 50, -100, 0, 100, 50); + ctx.drawImage(bitmap1, 0, 0, 100, 50, 100, 0, 100, 50); + ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, -50, 100, 50); + ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, 50, 100, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.worker.js new file mode 100644 index 0000000000..81fdae81df --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.worker.js @@ -0,0 +1,57 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.9arg.destpos +// 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); +var promise1 = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +var promise2 = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +Promise.all([promise1, promise2]).then(function(response1, response2) { + var promise3 = createImageBitmap(response1); + var promise4 = createImageBitmap(response2); + Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { + ctx.drawImage(bitmap2, 0, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap1, 0, 0, 100, 50, -100, 0, 100, 50); + ctx.drawImage(bitmap1, 0, 0, 100, 50, 100, 0, 100, 50); + ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, -50, 100, 50); + ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, 50, 100, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.html new file mode 100644 index 0000000000..d94daa861e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.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.drawImage.9arg.destsize</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.9arg.destsize</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); +var promise1 = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +var promise2 = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +Promise.all([promise1, promise2]).then(function(response1, response2) { + var promise3 = createImageBitmap(response1); + var promise4 = createImageBitmap(response2); + Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { + ctx.drawImage(bitmap2, 1, 1, 1, 1, 0, 0, 100, 50); + ctx.drawImage(bitmap1, 0, 0, 100, 50, -50, 0, 50, 50); + ctx.drawImage(bitmap1, 0, 0, 100, 50, 100, 0, 50, 50); + ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, -25, 100, 25); + ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, 50, 100, 25); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.worker.js new file mode 100644 index 0000000000..60fea26afe --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.worker.js @@ -0,0 +1,57 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.9arg.destsize +// 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); +var promise1 = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +var promise2 = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +Promise.all([promise1, promise2]).then(function(response1, response2) { + var promise3 = createImageBitmap(response1); + var promise4 = createImageBitmap(response2); + Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { + ctx.drawImage(bitmap2, 1, 1, 1, 1, 0, 0, 100, 50); + ctx.drawImage(bitmap1, 0, 0, 100, 50, -50, 0, 50, 50); + ctx.drawImage(bitmap1, 0, 0, 100, 50, 100, 0, 50, 50); + ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, -25, 100, 25); + ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, 50, 100, 25); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.html new file mode 100644 index 0000000000..ffd60f5da9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.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.drawImage.9arg.sourcepos</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.9arg.sourcepos</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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/rgrg-256x256.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 140, 20, 100, 50, 0, 0, 100, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.worker.js new file mode 100644 index 0000000000..1522353ad6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.worker.js @@ -0,0 +1,42 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.9arg.sourcepos +// 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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/rgrg-256x256.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 140, 20, 100, 50, 0, 0, 100, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.html new file mode 100644 index 0000000000..91962b671b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.html @@ -0,0 +1,53 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.drawImage.9arg.sourcesize</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.9arg.sourcesize</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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/rgrg-256x256.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0, 256, 256, 0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 51, 26); + ctx.fillRect(49, 24, 51, 26); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 20,20, 0,255,0,255, 2); + _assertPixelApprox(canvas, 80,20, 0,255,0,255, 2); + _assertPixelApprox(canvas, 20,30, 0,255,0,255, 2); + _assertPixelApprox(canvas, 80,30, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.worker.js new file mode 100644 index 0000000000..6658e21750 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.worker.js @@ -0,0 +1,49 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.9arg.sourcesize +// 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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/rgrg-256x256.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0, 256, 256, 0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 51, 26); + ctx.fillRect(49, 24, 51, 26); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 20,20, 0,255,0,255, 2); + _assertPixelApprox(canvas, 80,20, 0,255,0,255, 2); + _assertPixelApprox(canvas, 20,30, 0,255,0,255, 2); + _assertPixelApprox(canvas, 80,30, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.html new file mode 100644 index 0000000000..505c3fde5d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.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.drawImage.alpha</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.alpha</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.globalAlpha = 0; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.worker.js new file mode 100644 index 0000000000..92cb23fe14 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.worker.js @@ -0,0 +1,40 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.alpha +// 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.globalAlpha = 0; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.animated.poster.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.animated.poster.html new file mode 100644 index 0000000000..59d79fd717 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.animated.poster.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.drawImage.animated.poster</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.animated.poster</h1> +<p class="desc">drawImage() of an APNG draws the poster frame</p> + + +<script> +var t = async_test("drawImage() of an APNG draws the poster frame"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/anim-poster-gr.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.animated.poster.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.animated.poster.worker.js new file mode 100644 index 0000000000..94ca08a075 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.animated.poster.worker.js @@ -0,0 +1,37 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.animated.poster +// Description:drawImage() of an APNG draws the poster frame +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("drawImage() of an APNG draws the poster frame"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/anim-poster-gr.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.html new file mode 100644 index 0000000000..3324bebcbf --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.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.drawImage.broken</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.broken</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'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/broken.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.worker.js new file mode 100644 index 0000000000..d3f1b7e4a1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.worker.js @@ -0,0 +1,39 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.broken +// 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'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/broken.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.canvas.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.canvas.html new file mode 100644 index 0000000000..9b12871086 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.canvas.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.drawImage.canvas</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.canvas</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'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#0f0'; +ctx2.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.drawImage(offscreenCanvas2, 0, 0); +_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); +_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); +_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); +_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.canvas.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.canvas.worker.js new file mode 100644 index 0000000000..da01a86ba0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.canvas.worker.js @@ -0,0 +1,33 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.canvas +// 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'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#0f0'; +ctx2.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.drawImage(offscreenCanvas2, 0, 0); +_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); +_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); +_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); +_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.html new file mode 100644 index 0000000000..fa31852158 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.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.drawImage.clip</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.clip</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.rect(-10, -10, 1, 1); +ctx.clip(); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.worker.js new file mode 100644 index 0000000000..d30a05fa9d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.worker.js @@ -0,0 +1,41 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.clip +// 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.rect(-10, -10, 1, 1); +ctx.clip(); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.html new file mode 100644 index 0000000000..de4ea40d7d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.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.drawImage.composite</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.composite</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.globalCompositeOperation = 'destination-over'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.worker.js new file mode 100644 index 0000000000..0c4a7fe10a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.worker.js @@ -0,0 +1,40 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.composite +// 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.globalCompositeOperation = 'destination-over'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.html new file mode 100644 index 0000000000..5f72973782 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.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.drawImage.floatsource</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.floatsource</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'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 10.1, 10.1, 0.1, 0.1, 0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.worker.js new file mode 100644 index 0000000000..7b16cbb4f5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.worker.js @@ -0,0 +1,37 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.floatsource +// 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'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 10.1, 10.1, 0.1, 0.1, 0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.html new file mode 100644 index 0000000000..5851fcfb03 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.html @@ -0,0 +1,53 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.drawImage.negativedest</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.negativedest</h1> +<p class="desc">Negative destination width/height represents the correct rectangle</p> + + +<script> +var t = async_test("Negative destination width/height represents the correct 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.fillRect(0, 0, 100, 50); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/ggrr-256x256.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 100, 78, 50, 50, 0, 50, 50, -50); + ctx.drawImage(bitmap, 100, 128, 50, -50, 100, 50, -50, -50); + _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.worker.js new file mode 100644 index 0000000000..5ca4d14ef6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.worker.js @@ -0,0 +1,49 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.negativedest +// Description:Negative destination width/height represents the correct rectangle +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Negative destination width/height represents the correct 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.fillRect(0, 0, 100, 50); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/ggrr-256x256.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 100, 78, 50, 50, 0, 50, 50, -50); + ctx.drawImage(bitmap, 100, 128, 50, -50, 100, 50, -50, -50); + _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.html new file mode 100644 index 0000000000..f9d820733d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.html @@ -0,0 +1,53 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.drawImage.negativedir</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.negativedir</h1> +<p class="desc">Negative dimensions do not affect the direction of the image</p> + + +<script> +var t = async_test("Negative dimensions do not affect the direction of the image"); +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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/ggrr-256x256.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 178, 50, -100, 0, 0, 50, 100); + ctx.drawImage(bitmap, 0, 78, 50, 100, 50, 100, 50, -100); + _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.worker.js new file mode 100644 index 0000000000..2a6cc81058 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.worker.js @@ -0,0 +1,49 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.negativedir +// Description:Negative dimensions do not affect the direction of the image +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Negative dimensions do not affect the direction of the image"); +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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/ggrr-256x256.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 178, 50, -100, 0, 0, 50, 100); + ctx.drawImage(bitmap, 0, 78, 50, 100, 50, 100, 50, -100); + _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.html new file mode 100644 index 0000000000..9c2a2a1b10 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.html @@ -0,0 +1,53 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.drawImage.negativesource</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.negativesource</h1> +<p class="desc">Negative source width/height represents the correct rectangle</p> + + +<script> +var t = async_test("Negative source width/height represents the correct 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.fillRect(0, 0, 100, 50); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/ggrr-256x256.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 100, 78, -100, 50, 0, 0, 50, 50); + ctx.drawImage(bitmap, 100, 128, -100, -50, 50, 0, 50, 50); + _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.worker.js new file mode 100644 index 0000000000..ada79f9137 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.worker.js @@ -0,0 +1,49 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.negativesource +// Description:Negative source width/height represents the correct rectangle +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Negative source width/height represents the correct 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.fillRect(0, 0, 100, 50); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/ggrr-256x256.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 100, 78, -100, 50, 0, 0, 50, 50); + ctx.drawImage(bitmap, 100, 128, -100, -50, 50, 0, 50, 50); + _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.html new file mode 100644 index 0000000000..54f8d95269 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.html @@ -0,0 +1,343 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.drawImage.nonfinite</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.nonfinite</h1> +<p class="desc">drawImage() with Infinity/NaN is ignored</p> + + +<script> +var t = async_test("drawImage() with Infinity/NaN 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.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/redtransparent.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, Infinity, 0); +ctx.drawImage(bitmap, -Infinity, 0); +ctx.drawImage(bitmap, NaN, 0); +ctx.drawImage(bitmap, 0, Infinity); +ctx.drawImage(bitmap, 0, -Infinity); +ctx.drawImage(bitmap, 0, NaN); +ctx.drawImage(bitmap, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, -Infinity, 0, 100, 50); +ctx.drawImage(bitmap, NaN, 0, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, -Infinity, 100, 50); +ctx.drawImage(bitmap, 0, NaN, 100, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, -Infinity, 50); +ctx.drawImage(bitmap, 0, 0, NaN, 50); +ctx.drawImage(bitmap, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, -Infinity); +ctx.drawImage(bitmap, 0, 0, 100, NaN); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, -Infinity, 0, 100, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, NaN, 0, 100, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, -Infinity, 100, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, NaN, 100, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, -Infinity, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, NaN, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, -Infinity, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, NaN, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, -Infinity, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, NaN, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, -Infinity, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, NaN, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, -Infinity, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, NaN, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, -Infinity); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, NaN); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, Infinity, Infinity); + _assertPixel(canvas, 50,25, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.worker.js new file mode 100644 index 0000000000..a2e77832a2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.worker.js @@ -0,0 +1,339 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.nonfinite +// Description:drawImage() with Infinity/NaN is ignored +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("drawImage() with Infinity/NaN 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.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/redtransparent.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, Infinity, 0); +ctx.drawImage(bitmap, -Infinity, 0); +ctx.drawImage(bitmap, NaN, 0); +ctx.drawImage(bitmap, 0, Infinity); +ctx.drawImage(bitmap, 0, -Infinity); +ctx.drawImage(bitmap, 0, NaN); +ctx.drawImage(bitmap, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, -Infinity, 0, 100, 50); +ctx.drawImage(bitmap, NaN, 0, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, -Infinity, 100, 50); +ctx.drawImage(bitmap, 0, NaN, 100, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, -Infinity, 50); +ctx.drawImage(bitmap, 0, 0, NaN, 50); +ctx.drawImage(bitmap, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, -Infinity); +ctx.drawImage(bitmap, 0, 0, 100, NaN); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, -Infinity, 0, 100, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, NaN, 0, 100, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, -Infinity, 100, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, NaN, 100, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, -Infinity, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, NaN, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, -Infinity, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, NaN, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, -Infinity, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, NaN, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, -Infinity, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, NaN, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, -Infinity, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, NaN, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, -Infinity); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, NaN); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, 100, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, Infinity, 50); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, Infinity, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, 100, Infinity); +ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, Infinity, Infinity); + _assertPixel(canvas, 50,25, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.html new file mode 100644 index 0000000000..6ec22c45d6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.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.drawImage.nowrap</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.nowrap</h1> +<p class="desc">Stretched images do not get pixels wrapping around the edges</p> + + +<script> +var t = async_test("Stretched images do not get pixels wrapping around the edges"); +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 promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/redtransparent.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, -1950, 0, 2000, 50); + _assertPixelApprox(canvas, 45,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 55,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.worker.js new file mode 100644 index 0000000000..ab3a9367dd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.worker.js @@ -0,0 +1,41 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.nowrap +// Description:Stretched images do not get pixels wrapping around the edges +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Stretched images do not get pixels wrapping around the edges"); +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 promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/redtransparent.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, -1950, 0, 2000, 50); + _assertPixelApprox(canvas, 45,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 55,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.null.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.null.html new file mode 100644 index 0000000000..c32d836ce4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.null.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.drawImage.null</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.null</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'); + +assert_throws_js(TypeError, function() { ctx.drawImage(null, 0, 0); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.null.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.null.worker.js new file mode 100644 index 0000000000..792dc6ef41 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.null.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.null +// 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'); + +assert_throws_js(TypeError, function() { ctx.drawImage(null, 0, 0); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.html new file mode 100644 index 0000000000..b6bad65df5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.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.drawImage.path</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.path</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.rect(0, 0, 100, 50); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + ctx.fill(); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.worker.js new file mode 100644 index 0000000000..5521290977 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.worker.js @@ -0,0 +1,40 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.path +// 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.rect(0, 0, 100, 50); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + ctx.fill(); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.1.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.1.html new file mode 100644 index 0000000000..38857453a4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.1.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.drawImage.self.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.self.1</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, 50, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(50, 0, 50, 50); +ctx.drawImage(canvas, 50, 0); + +_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); +_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); +_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); +_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.1.worker.js new file mode 100644 index 0000000000..01d47cb334 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.1.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.drawImage.self.1 +// 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, 50, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(50, 0, 50, 50); +ctx.drawImage(canvas, 50, 0); + +_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); +_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); +_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); +_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.2.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.2.html new file mode 100644 index 0000000000..74d383f7e3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.2.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.drawImage.self.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.self.2</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, 1, 100, 49); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 1); +ctx.drawImage(canvas, 0, 1); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 2); + +_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); +_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); +_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); +_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.2.worker.js new file mode 100644 index 0000000000..61a02c87a6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.2.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.self.2 +// 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, 1, 100, 49); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 1); +ctx.drawImage(canvas, 0, 1); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 2); + +_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); +_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); +_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); +_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.svg.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.svg.html new file mode 100644 index 0000000000..d275bf9567 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.svg.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.drawImage.svg</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.svg</h1> +<p class="desc">drawImage() of an SVG image</p> + + +<script> +var t = async_test("drawImage() of an SVG image"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.svg'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.svg.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.svg.worker.js new file mode 100644 index 0000000000..2d832be363 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.svg.worker.js @@ -0,0 +1,37 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.svg +// Description:drawImage() of an SVG image +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("drawImage() of an SVG image"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.svg'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.html new file mode 100644 index 0000000000..741c5efb9f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.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.drawImage.transform</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.transform</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.translate(100, 0); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.worker.js new file mode 100644 index 0000000000..2fc0caf1c3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.worker.js @@ -0,0 +1,40 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.transform +// 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.translate(100, 0); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.wrongtype.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.wrongtype.html new file mode 100644 index 0000000000..84cfaef1a7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.wrongtype.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.drawImage.wrongtype</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.wrongtype</h1> +<p class="desc">Incorrect image types in drawImage do not match any defined overloads, so WebIDL throws a TypeError</p> + + +<script> +var t = async_test("Incorrect image types in drawImage do not match any defined overloads, so WebIDL throws a TypeError"); +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'); + +assert_throws_js(TypeError, function() { ctx.drawImage(undefined, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage("", 0, 0); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.wrongtype.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.wrongtype.worker.js new file mode 100644 index 0000000000..9a52628c61 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.wrongtype.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.drawImage.wrongtype +// Description:Incorrect image types in drawImage do not match any defined overloads, so WebIDL throws a TypeError +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Incorrect image types in drawImage do not match any defined overloads, so WebIDL throws a TypeError"); +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'); + +assert_throws_js(TypeError, function() { ctx.drawImage(undefined, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage("", 0, 0); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.html new file mode 100644 index 0000000000..9d59ba70bc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.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.drawImage.zerocanvas</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.zerocanvas</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'); + +var offscreenCanvas2 = new OffscreenCanvas(0, 10); +assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(offscreenCanvas2, 0, 0); }); + +offscreenCanvas2.width = 10; +offscreenCanvas2.height = 0; +assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(offscreenCanvas2, 0, 0); }); + +offscreenCanvas2.width = 0; +offscreenCanvas2.height = 0; +assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(offscreenCanvas2, 0, 0); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.worker.js new file mode 100644 index 0000000000..5f3764b157 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.worker.js @@ -0,0 +1,33 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.zerocanvas +// 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'); + +var offscreenCanvas2 = new OffscreenCanvas(0, 10); +assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(offscreenCanvas2, 0, 0); }); + +offscreenCanvas2.width = 10; +offscreenCanvas2.height = 0; +assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(offscreenCanvas2, 0, 0); }); + +offscreenCanvas2.width = 0; +offscreenCanvas2.height = 0; +assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(offscreenCanvas2, 0, 0); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.html new file mode 100644 index 0000000000..cc610399db --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.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.drawImage.zerosource</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.zerosource</h1> +<p class="desc">drawImage with zero-sized source rectangle draws nothing without exception</p> + + +<script> +var t = async_test("drawImage with zero-sized source rectangle draws nothing without exception"); +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 promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 10, 10, 0, 1, 0, 0, 100, 50); + ctx.drawImage(bitmap, 10, 10, 1, 0, 0, 0, 100, 50); + ctx.drawImage(bitmap, 10, 10, 0, 0, 0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.html new file mode 100644 index 0000000000..d79f821d44 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.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.drawImage.zerosource.image</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.drawImage.zerosource.image</h1> +<p class="desc">drawImage with zero-sized source rectangle from image draws nothing without exception</p> + + +<script> +var t = async_test("drawImage with zero-sized source rectangle from image draws nothing without exception"); +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 promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red-zerowidth.svg'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.worker.js new file mode 100644 index 0000000000..1465d6c1bc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.worker.js @@ -0,0 +1,41 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.zerosource.image +// Description:drawImage with zero-sized source rectangle from image draws nothing without exception +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("drawImage with zero-sized source rectangle from image draws nothing without exception"); +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 promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red-zerowidth.svg'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.worker.js new file mode 100644 index 0000000000..654e9bdd74 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.worker.js @@ -0,0 +1,41 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.zerosource +// Description:drawImage with zero-sized source rectangle draws nothing without exception +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("drawImage with zero-sized source rectangle draws nothing without exception"); +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 promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 10, 10, 0, 1, 0, 0, 100, 50); + ctx.drawImage(bitmap, 10, 10, 1, 0, 0, 0, 100, 50); + ctx.drawImage(bitmap, 10, 10, 0, 0, 0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.basic.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.basic.html new file mode 100644 index 0000000000..846b264ee8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.basic.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.clearRect.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.clearRect.basic</h1> +<p class="desc">clearRect clears to transparent black</p> + + +<script> +var t = async_test("clearRect clears to transparent black"); +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.clearRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.basic.worker.js new file mode 100644 index 0000000000..5908ecca85 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.basic.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.clearRect.basic +// Description:clearRect clears to transparent black +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("clearRect clears to transparent black"); +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.clearRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.clip.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.clip.html new file mode 100644 index 0000000000..eb3de8b591 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.clip.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.clearRect.clip</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.clearRect.clip</h1> +<p class="desc">clearRect is affected by clipping regions</p> + + +<script> +var t = async_test("clearRect is affected by clipping regions"); +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.beginPath(); +ctx.rect(0, 0, 16, 16); +ctx.clip(); +ctx.clearRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 16, 16); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.clip.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.clip.worker.js new file mode 100644 index 0000000000..7fb5791cc9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.clip.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.clearRect.clip +// Description:clearRect is affected by clipping regions +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("clearRect is affected by clipping regions"); +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.beginPath(); +ctx.rect(0, 0, 16, 16); +ctx.clip(); +ctx.clearRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 16, 16); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalalpha.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalalpha.html new file mode 100644 index 0000000000..c1a3463d31 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalalpha.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.clearRect.globalalpha</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.clearRect.globalalpha</h1> +<p class="desc">clearRect is not affected by globalAlpha</p> + + +<script> +var t = async_test("clearRect is not affected by globalAlpha"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalAlpha = 0.1; +ctx.clearRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalalpha.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalalpha.worker.js new file mode 100644 index 0000000000..885e389ba5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalalpha.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.clearRect.globalalpha +// Description:clearRect is not affected by globalAlpha +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("clearRect is not affected by globalAlpha"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalAlpha = 0.1; +ctx.clearRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalcomposite.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalcomposite.html new file mode 100644 index 0000000000..a77f67a4ba --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalcomposite.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.clearRect.globalcomposite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.clearRect.globalcomposite</h1> +<p class="desc">clearRect is not affected by globalCompositeOperation</p> + + +<script> +var t = async_test("clearRect is not affected by globalCompositeOperation"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-atop'; +ctx.clearRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalcomposite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalcomposite.worker.js new file mode 100644 index 0000000000..a31962f73e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalcomposite.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.clearRect.globalcomposite +// Description:clearRect is not affected by globalCompositeOperation +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("clearRect is not affected by globalCompositeOperation"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-atop'; +ctx.clearRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.negative.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.negative.html new file mode 100644 index 0000000000..158294ab3e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.negative.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.clearRect.negative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.clearRect.negative</h1> +<p class="desc">clearRect of negative sizes works</p> + + +<script> +var t = async_test("clearRect of negative sizes 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.clearRect(0, 0, 50, 25); +ctx.clearRect(100, 0, -50, 25); +ctx.clearRect(0, 50, 50, -25); +ctx.clearRect(100, 50, -50, -25); +_assertPixel(canvas, 25,12, 0,0,0,0); +_assertPixel(canvas, 75,12, 0,0,0,0); +_assertPixel(canvas, 25,37, 0,0,0,0); +_assertPixel(canvas, 75,37, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.negative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.negative.worker.js new file mode 100644 index 0000000000..c7390550b8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.negative.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.clearRect.negative +// Description:clearRect of negative sizes works +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("clearRect of negative sizes 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.clearRect(0, 0, 50, 25); +ctx.clearRect(100, 0, -50, 25); +ctx.clearRect(0, 50, 50, -25); +ctx.clearRect(100, 50, -50, -25); +_assertPixel(canvas, 25,12, 0,0,0,0); +_assertPixel(canvas, 75,12, 0,0,0,0); +_assertPixel(canvas, 25,37, 0,0,0,0); +_assertPixel(canvas, 75,37, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.nonfinite.html new file mode 100644 index 0000000000..4d3037b26b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.nonfinite.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.clearRect.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.clearRect.nonfinite</h1> +<p class="desc">clearRect() with Infinity/NaN is ignored</p> + + +<script> +var t = async_test("clearRect() with Infinity/NaN 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.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.clearRect(Infinity, 0, 100, 50); +ctx.clearRect(-Infinity, 0, 100, 50); +ctx.clearRect(NaN, 0, 100, 50); +ctx.clearRect(0, Infinity, 100, 50); +ctx.clearRect(0, -Infinity, 100, 50); +ctx.clearRect(0, NaN, 100, 50); +ctx.clearRect(0, 0, Infinity, 50); +ctx.clearRect(0, 0, -Infinity, 50); +ctx.clearRect(0, 0, NaN, 50); +ctx.clearRect(0, 0, 100, Infinity); +ctx.clearRect(0, 0, 100, -Infinity); +ctx.clearRect(0, 0, 100, NaN); +ctx.clearRect(Infinity, Infinity, 100, 50); +ctx.clearRect(Infinity, Infinity, Infinity, 50); +ctx.clearRect(Infinity, Infinity, Infinity, Infinity); +ctx.clearRect(Infinity, Infinity, 100, Infinity); +ctx.clearRect(Infinity, 0, Infinity, 50); +ctx.clearRect(Infinity, 0, Infinity, Infinity); +ctx.clearRect(Infinity, 0, 100, Infinity); +ctx.clearRect(0, Infinity, Infinity, 50); +ctx.clearRect(0, Infinity, Infinity, Infinity); +ctx.clearRect(0, Infinity, 100, Infinity); +ctx.clearRect(0, 0, Infinity, Infinity); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.nonfinite.worker.js new file mode 100644 index 0000000000..e4dc952200 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.nonfinite.worker.js @@ -0,0 +1,48 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.clearRect.nonfinite +// Description:clearRect() with Infinity/NaN is ignored +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("clearRect() with Infinity/NaN 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.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.clearRect(Infinity, 0, 100, 50); +ctx.clearRect(-Infinity, 0, 100, 50); +ctx.clearRect(NaN, 0, 100, 50); +ctx.clearRect(0, Infinity, 100, 50); +ctx.clearRect(0, -Infinity, 100, 50); +ctx.clearRect(0, NaN, 100, 50); +ctx.clearRect(0, 0, Infinity, 50); +ctx.clearRect(0, 0, -Infinity, 50); +ctx.clearRect(0, 0, NaN, 50); +ctx.clearRect(0, 0, 100, Infinity); +ctx.clearRect(0, 0, 100, -Infinity); +ctx.clearRect(0, 0, 100, NaN); +ctx.clearRect(Infinity, Infinity, 100, 50); +ctx.clearRect(Infinity, Infinity, Infinity, 50); +ctx.clearRect(Infinity, Infinity, Infinity, Infinity); +ctx.clearRect(Infinity, Infinity, 100, Infinity); +ctx.clearRect(Infinity, 0, Infinity, 50); +ctx.clearRect(Infinity, 0, Infinity, Infinity); +ctx.clearRect(Infinity, 0, 100, Infinity); +ctx.clearRect(0, Infinity, Infinity, 50); +ctx.clearRect(0, Infinity, Infinity, Infinity); +ctx.clearRect(0, Infinity, 100, Infinity); +ctx.clearRect(0, 0, Infinity, Infinity); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.path.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.path.html new file mode 100644 index 0000000000..ab813b1e9b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.path.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.clearRect.path</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.clearRect.path</h1> +<p class="desc">clearRect does not affect the current path</p> + + +<script> +var t = async_test("clearRect does not affect the current path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.rect(0, 0, 100, 50); +ctx.clearRect(0, 0, 16, 16); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.path.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.path.worker.js new file mode 100644 index 0000000000..eee973df5a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.path.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.clearRect.path +// Description:clearRect does not affect the current path +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("clearRect does not affect the current path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.rect(0, 0, 100, 50); +ctx.clearRect(0, 0, 16, 16); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.shadow.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.shadow.html new file mode 100644 index 0000000000..050591d620 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.shadow.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.clearRect.shadow</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.clearRect.shadow</h1> +<p class="desc">clearRect does not draw shadows</p> + + +<script> +var t = async_test("clearRect does not draw shadows"); +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.shadowColor = '#f00'; +ctx.shadowBlur = 0; +ctx.shadowOffsetX = 0; +ctx.shadowOffsetY = 50; +ctx.clearRect(0, -50, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.shadow.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.shadow.worker.js new file mode 100644 index 0000000000..74ac17c1d2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.shadow.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.clearRect.shadow +// Description:clearRect does not draw shadows +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("clearRect does not draw shadows"); +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.shadowColor = '#f00'; +ctx.shadowBlur = 0; +ctx.shadowOffsetX = 0; +ctx.shadowOffsetY = 50; +ctx.clearRect(0, -50, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.transform.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.transform.html new file mode 100644 index 0000000000..cca3c4d32b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.transform.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.clearRect.transform</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.clearRect.transform</h1> +<p class="desc">clearRect is affected by transforms</p> + + +<script> +var t = async_test("clearRect is affected by transforms"); +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(10, 10); +ctx.translate(0, 5); +ctx.clearRect(0, -5, 10, 5); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.transform.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.transform.worker.js new file mode 100644 index 0000000000..8b76d4e0ae --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.transform.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.clearRect.transform +// Description:clearRect is affected by transforms +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("clearRect is affected by transforms"); +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(10, 10); +ctx.translate(0, 5); +ctx.clearRect(0, -5, 10, 5); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.zero.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.zero.html new file mode 100644 index 0000000000..69bbb5ecc7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.zero.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.clearRect.zero</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.clearRect.zero</h1> +<p class="desc">clearRect of zero pixels has no effect</p> + + +<script> +var t = async_test("clearRect of zero pixels has no effect"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.clearRect(0, 0, 100, 0); +ctx.clearRect(0, 0, 0, 50); +ctx.clearRect(0, 0, 0, 0); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.zero.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.zero.worker.js new file mode 100644 index 0000000000..24c1c4253f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.zero.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.clearRect.zero +// Description:clearRect of zero pixels has no effect +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("clearRect of zero pixels has no effect"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.clearRect(0, 0, 100, 0); +ctx.clearRect(0, 0, 0, 50); +ctx.clearRect(0, 0, 0, 0); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.basic.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.basic.html new file mode 100644 index 0000000000..bad032bb7c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.basic.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillRect.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.fillRect.basic</h1> +<p class="desc">fillRect works</p> + + +<script> +var t = async_test("fillRect 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.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.basic.worker.js new file mode 100644 index 0000000000..3a42a2a13b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.basic.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.fillRect.basic +// Description:fillRect works +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fillRect 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.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.clip.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.clip.html new file mode 100644 index 0000000000..7043c2355b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.clip.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillRect.clip</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillRect.clip</h1> +<p class="desc">fillRect is affected by clipping regions</p> + + +<script> +var t = async_test("fillRect is affected by clipping regions"); +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.beginPath(); +ctx.rect(0, 0, 16, 16); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 16, 16); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.clip.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.clip.worker.js new file mode 100644 index 0000000000..926821ac96 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.clip.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.fillRect.clip +// Description:fillRect is affected by clipping regions +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fillRect is affected by clipping regions"); +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.beginPath(); +ctx.rect(0, 0, 16, 16); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 16, 16); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.negative.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.negative.html new file mode 100644 index 0000000000..880e5700bd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.negative.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.fillRect.negative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillRect.negative</h1> +<p class="desc">fillRect of negative sizes works</p> + + +<script> +var t = async_test("fillRect of negative sizes 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 50, 25); +ctx.fillRect(100, 0, -50, 25); +ctx.fillRect(0, 50, 50, -25); +ctx.fillRect(100, 50, -50, -25); +_assertPixel(canvas, 25,12, 0,255,0,255); +_assertPixel(canvas, 75,12, 0,255,0,255); +_assertPixel(canvas, 25,37, 0,255,0,255); +_assertPixel(canvas, 75,37, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.negative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.negative.worker.js new file mode 100644 index 0000000000..b868dec9ff --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.negative.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillRect.negative +// Description:fillRect of negative sizes works +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fillRect of negative sizes 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 50, 25); +ctx.fillRect(100, 0, -50, 25); +ctx.fillRect(0, 50, 50, -25); +ctx.fillRect(100, 50, -50, -25); +_assertPixel(canvas, 25,12, 0,255,0,255); +_assertPixel(canvas, 75,12, 0,255,0,255); +_assertPixel(canvas, 25,37, 0,255,0,255); +_assertPixel(canvas, 75,37, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.nonfinite.html new file mode 100644 index 0000000000..0d545e9f3f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.nonfinite.html @@ -0,0 +1,53 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillRect.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillRect.nonfinite</h1> +<p class="desc">fillRect() with Infinity/NaN is ignored</p> + + +<script> +var t = async_test("fillRect() with Infinity/NaN 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.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(Infinity, 0, 100, 50); +ctx.fillRect(-Infinity, 0, 100, 50); +ctx.fillRect(NaN, 0, 100, 50); +ctx.fillRect(0, Infinity, 100, 50); +ctx.fillRect(0, -Infinity, 100, 50); +ctx.fillRect(0, NaN, 100, 50); +ctx.fillRect(0, 0, Infinity, 50); +ctx.fillRect(0, 0, -Infinity, 50); +ctx.fillRect(0, 0, NaN, 50); +ctx.fillRect(0, 0, 100, Infinity); +ctx.fillRect(0, 0, 100, -Infinity); +ctx.fillRect(0, 0, 100, NaN); +ctx.fillRect(Infinity, Infinity, 100, 50); +ctx.fillRect(Infinity, Infinity, Infinity, 50); +ctx.fillRect(Infinity, Infinity, Infinity, Infinity); +ctx.fillRect(Infinity, Infinity, 100, Infinity); +ctx.fillRect(Infinity, 0, Infinity, 50); +ctx.fillRect(Infinity, 0, Infinity, Infinity); +ctx.fillRect(Infinity, 0, 100, Infinity); +ctx.fillRect(0, Infinity, Infinity, 50); +ctx.fillRect(0, Infinity, Infinity, Infinity); +ctx.fillRect(0, Infinity, 100, Infinity); +ctx.fillRect(0, 0, Infinity, Infinity); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.nonfinite.worker.js new file mode 100644 index 0000000000..418250e4bf --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.nonfinite.worker.js @@ -0,0 +1,49 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillRect.nonfinite +// Description:fillRect() with Infinity/NaN is ignored +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fillRect() with Infinity/NaN 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.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(Infinity, 0, 100, 50); +ctx.fillRect(-Infinity, 0, 100, 50); +ctx.fillRect(NaN, 0, 100, 50); +ctx.fillRect(0, Infinity, 100, 50); +ctx.fillRect(0, -Infinity, 100, 50); +ctx.fillRect(0, NaN, 100, 50); +ctx.fillRect(0, 0, Infinity, 50); +ctx.fillRect(0, 0, -Infinity, 50); +ctx.fillRect(0, 0, NaN, 50); +ctx.fillRect(0, 0, 100, Infinity); +ctx.fillRect(0, 0, 100, -Infinity); +ctx.fillRect(0, 0, 100, NaN); +ctx.fillRect(Infinity, Infinity, 100, 50); +ctx.fillRect(Infinity, Infinity, Infinity, 50); +ctx.fillRect(Infinity, Infinity, Infinity, Infinity); +ctx.fillRect(Infinity, Infinity, 100, Infinity); +ctx.fillRect(Infinity, 0, Infinity, 50); +ctx.fillRect(Infinity, 0, Infinity, Infinity); +ctx.fillRect(Infinity, 0, 100, Infinity); +ctx.fillRect(0, Infinity, Infinity, 50); +ctx.fillRect(0, Infinity, Infinity, Infinity); +ctx.fillRect(0, Infinity, 100, Infinity); +ctx.fillRect(0, 0, Infinity, Infinity); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.path.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.path.html new file mode 100644 index 0000000000..13974b7e2a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.path.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillRect.path</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillRect.path</h1> +<p class="desc">fillRect does not affect the current path</p> + + +<script> +var t = async_test("fillRect does not affect the current path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.beginPath(); +ctx.rect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 16, 16); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.path.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.path.worker.js new file mode 100644 index 0000000000..0200fc568e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.path.worker.js @@ -0,0 +1,29 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillRect.path +// Description:fillRect does not affect the current path +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fillRect does not affect the current path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.beginPath(); +ctx.rect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 16, 16); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.shadow.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.shadow.html new file mode 100644 index 0000000000..f3b015f25a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.shadow.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.fillRect.shadow</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillRect.shadow</h1> +<p class="desc">fillRect draws shadows</p> + + +<script> +var t = async_test("fillRect draws shadows"); +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.shadowColor = '#0f0'; +ctx.shadowBlur = 0; +ctx.shadowOffsetX = 0; +ctx.shadowOffsetY = 50; +ctx.fillRect(0, -50, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.shadow.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.shadow.worker.js new file mode 100644 index 0000000000..dea83df9aa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.shadow.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillRect.shadow +// Description:fillRect draws shadows +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fillRect draws shadows"); +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.shadowColor = '#0f0'; +ctx.shadowBlur = 0; +ctx.shadowOffsetX = 0; +ctx.shadowOffsetY = 50; +ctx.fillRect(0, -50, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.transform.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.transform.html new file mode 100644 index 0000000000..081ac763bd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.transform.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillRect.transform</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillRect.transform</h1> +<p class="desc">fillRect is affected by transforms</p> + + +<script> +var t = async_test("fillRect is affected by transforms"); +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.scale(10, 10); +ctx.translate(0, 5); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, -5, 10, 5); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.transform.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.transform.worker.js new file mode 100644 index 0000000000..8d0cb83c1b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.transform.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillRect.transform +// Description:fillRect is affected by transforms +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fillRect is affected by transforms"); +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.scale(10, 10); +ctx.translate(0, 5); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, -5, 10, 5); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.zero.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.zero.html new file mode 100644 index 0000000000..3f015475d5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.zero.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillRect.zero</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillRect.zero</h1> +<p class="desc">fillRect of zero pixels has no effect</p> + + +<script> +var t = async_test("fillRect of zero pixels has no effect"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 0); +ctx.fillRect(0, 0, 0, 50); +ctx.fillRect(0, 0, 0, 0); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.zero.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.zero.worker.js new file mode 100644 index 0000000000..48ee67ae74 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.zero.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.fillRect.zero +// Description:fillRect of zero pixels has no effect +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fillRect of zero pixels has no effect"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 0); +ctx.fillRect(0, 0, 0, 50); +ctx.fillRect(0, 0, 0, 0); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.basic.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.basic.html new file mode 100644 index 0000000000..caee5d6735 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.basic.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.strokeRect.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.strokeRect.basic</h1> +<p class="desc">strokeRect works</p> + + +<script> +var t = async_test("strokeRect 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.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.strokeRect(25, 24, 50, 2); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.basic.worker.js new file mode 100644 index 0000000000..304fc5ba84 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.basic.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.strokeRect.basic +// Description:strokeRect works +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("strokeRect 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.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.strokeRect(25, 24, 50, 2); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.clip.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.clip.html new file mode 100644 index 0000000000..3aa5d0392e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.clip.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.strokeRect.clip</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.strokeRect.clip</h1> +<p class="desc">strokeRect is affected by clipping regions</p> + + +<script> +var t = async_test("strokeRect is affected by clipping regions"); +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.beginPath(); +ctx.rect(0, 0, 16, 16); +ctx.clip(); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.strokeRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 16, 16); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.clip.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.clip.worker.js new file mode 100644 index 0000000000..d5a50443d3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.clip.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.strokeRect.clip +// Description:strokeRect is affected by clipping regions +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("strokeRect is affected by clipping regions"); +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.beginPath(); +ctx.rect(0, 0, 16, 16); +ctx.clip(); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.strokeRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 16, 16); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalalpha.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalalpha.html new file mode 100644 index 0000000000..a470939455 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalalpha.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.strokeRect.globalalpha</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.strokeRect.globalalpha</h1> +<p class="desc">strokeRect is affected by globalAlpha</p> + + +<script> +var t = async_test("strokeRect is affected by globalAlpha"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.globalAlpha = 0; +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.strokeRect(25, 24, 50, 2); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalalpha.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalalpha.worker.js new file mode 100644 index 0000000000..2556f65668 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalalpha.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.strokeRect.globalalpha +// Description:strokeRect is affected by globalAlpha +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("strokeRect is affected by globalAlpha"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.globalAlpha = 0; +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.strokeRect(25, 24, 50, 2); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalcomposite.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalcomposite.html new file mode 100644 index 0000000000..bfca74c48a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalcomposite.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.strokeRect.globalcomposite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.strokeRect.globalcomposite</h1> +<p class="desc">strokeRect is not affected by globalCompositeOperation</p> + + +<script> +var t = async_test("strokeRect is not affected by globalCompositeOperation"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.globalCompositeOperation = 'source-in'; +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.strokeRect(25, 24, 50, 2); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalcomposite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalcomposite.worker.js new file mode 100644 index 0000000000..7c9859c7fb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalcomposite.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.strokeRect.globalcomposite +// Description:strokeRect is not affected by globalCompositeOperation +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("strokeRect is not affected by globalCompositeOperation"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.globalCompositeOperation = 'source-in'; +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.strokeRect(25, 24, 50, 2); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.negative.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.negative.html new file mode 100644 index 0000000000..04f33b184c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.negative.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.strokeRect.negative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.strokeRect.negative</h1> +<p class="desc">strokeRect of negative sizes works</p> + + +<script> +var t = async_test("strokeRect of negative sizes 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 25; +ctx.strokeRect(12, 12, 26, 1); +ctx.strokeRect(88, 12, -26, 1); +ctx.strokeRect(12, 38, 26, -1); +ctx.strokeRect(88, 38, -26, -1); +_assertPixel(canvas, 25,12, 0,255,0,255); +_assertPixel(canvas, 75,12, 0,255,0,255); +_assertPixel(canvas, 25,37, 0,255,0,255); +_assertPixel(canvas, 75,37, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.negative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.negative.worker.js new file mode 100644 index 0000000000..c80a44680c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.negative.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.strokeRect.negative +// Description:strokeRect of negative sizes works +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("strokeRect of negative sizes 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 25; +ctx.strokeRect(12, 12, 26, 1); +ctx.strokeRect(88, 12, -26, 1); +ctx.strokeRect(12, 38, 26, -1); +ctx.strokeRect(88, 38, -26, -1); +_assertPixel(canvas, 25,12, 0,255,0,255); +_assertPixel(canvas, 75,12, 0,255,0,255); +_assertPixel(canvas, 25,37, 0,255,0,255); +_assertPixel(canvas, 75,37, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.nonfinite.html new file mode 100644 index 0000000000..1688912ab8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.nonfinite.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.strokeRect.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.strokeRect.nonfinite</h1> +<p class="desc">strokeRect() with Infinity/NaN is ignored</p> + + +<script> +var t = async_test("strokeRect() with Infinity/NaN 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.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 150; +ctx.strokeRect(Infinity, 0, 100, 50); +ctx.strokeRect(-Infinity, 0, 100, 50); +ctx.strokeRect(NaN, 0, 100, 50); +ctx.strokeRect(0, Infinity, 100, 50); +ctx.strokeRect(0, -Infinity, 100, 50); +ctx.strokeRect(0, NaN, 100, 50); +ctx.strokeRect(0, 0, Infinity, 50); +ctx.strokeRect(0, 0, -Infinity, 50); +ctx.strokeRect(0, 0, NaN, 50); +ctx.strokeRect(0, 0, 100, Infinity); +ctx.strokeRect(0, 0, 100, -Infinity); +ctx.strokeRect(0, 0, 100, NaN); +ctx.strokeRect(Infinity, Infinity, 100, 50); +ctx.strokeRect(Infinity, Infinity, Infinity, 50); +ctx.strokeRect(Infinity, Infinity, Infinity, Infinity); +ctx.strokeRect(Infinity, Infinity, 100, Infinity); +ctx.strokeRect(Infinity, 0, Infinity, 50); +ctx.strokeRect(Infinity, 0, Infinity, Infinity); +ctx.strokeRect(Infinity, 0, 100, Infinity); +ctx.strokeRect(0, Infinity, Infinity, 50); +ctx.strokeRect(0, Infinity, Infinity, Infinity); +ctx.strokeRect(0, Infinity, 100, Infinity); +ctx.strokeRect(0, 0, Infinity, Infinity); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.nonfinite.worker.js new file mode 100644 index 0000000000..4c1bc4c609 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.nonfinite.worker.js @@ -0,0 +1,50 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.strokeRect.nonfinite +// Description:strokeRect() with Infinity/NaN is ignored +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("strokeRect() with Infinity/NaN 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.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 150; +ctx.strokeRect(Infinity, 0, 100, 50); +ctx.strokeRect(-Infinity, 0, 100, 50); +ctx.strokeRect(NaN, 0, 100, 50); +ctx.strokeRect(0, Infinity, 100, 50); +ctx.strokeRect(0, -Infinity, 100, 50); +ctx.strokeRect(0, NaN, 100, 50); +ctx.strokeRect(0, 0, Infinity, 50); +ctx.strokeRect(0, 0, -Infinity, 50); +ctx.strokeRect(0, 0, NaN, 50); +ctx.strokeRect(0, 0, 100, Infinity); +ctx.strokeRect(0, 0, 100, -Infinity); +ctx.strokeRect(0, 0, 100, NaN); +ctx.strokeRect(Infinity, Infinity, 100, 50); +ctx.strokeRect(Infinity, Infinity, Infinity, 50); +ctx.strokeRect(Infinity, Infinity, Infinity, Infinity); +ctx.strokeRect(Infinity, Infinity, 100, Infinity); +ctx.strokeRect(Infinity, 0, Infinity, 50); +ctx.strokeRect(Infinity, 0, Infinity, Infinity); +ctx.strokeRect(Infinity, 0, 100, Infinity); +ctx.strokeRect(0, Infinity, Infinity, 50); +ctx.strokeRect(0, Infinity, Infinity, Infinity); +ctx.strokeRect(0, Infinity, 100, Infinity); +ctx.strokeRect(0, 0, Infinity, Infinity); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.path.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.path.html new file mode 100644 index 0000000000..c3d80bf299 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.path.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.strokeRect.path</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.strokeRect.path</h1> +<p class="desc">strokeRect does not affect the current path</p> + + +<script> +var t = async_test("strokeRect does not affect the current path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.beginPath(); +ctx.rect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 5; +ctx.strokeRect(0, 0, 16, 16); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.path.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.path.worker.js new file mode 100644 index 0000000000..436bd03107 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.path.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.strokeRect.path +// Description:strokeRect does not affect the current path +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("strokeRect does not affect the current path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.beginPath(); +ctx.rect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 5; +ctx.strokeRect(0, 0, 16, 16); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.shadow.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.shadow.html new file mode 100644 index 0000000000..e80d7511d4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.shadow.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.strokeRect.shadow</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.strokeRect.shadow</h1> +<p class="desc">strokeRect draws shadows</p> + + +<script> +var t = async_test("strokeRect draws shadows"); +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.fillStyle = '#f00'; +ctx.shadowColor = '#0f0'; +ctx.shadowBlur = 0; +ctx.shadowOffsetX = 0; +ctx.shadowOffsetY = 50; +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.strokeRect(0, -75, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.shadow.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.shadow.worker.js new file mode 100644 index 0000000000..13beb42ff0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.shadow.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.strokeRect.shadow +// Description:strokeRect draws shadows +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("strokeRect draws shadows"); +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.fillStyle = '#f00'; +ctx.shadowColor = '#0f0'; +ctx.shadowBlur = 0; +ctx.shadowOffsetX = 0; +ctx.shadowOffsetY = 50; +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.strokeRect(0, -75, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.transform.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.transform.html new file mode 100644 index 0000000000..2b44d0c627 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.transform.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.strokeRect.transform</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.strokeRect.transform</h1> +<p class="desc">fillRect is affected by transforms</p> + + +<script> +var t = async_test("fillRect is affected by transforms"); +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.scale(10, 10); +ctx.translate(0, 5); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 5; +ctx.strokeRect(2.5, -2.6, 5, 0.2); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.transform.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.transform.worker.js new file mode 100644 index 0000000000..5958cf1406 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.transform.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.strokeRect.transform +// Description:fillRect is affected by transforms +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fillRect is affected by transforms"); +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.scale(10, 10); +ctx.translate(0, 5); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 5; +ctx.strokeRect(2.5, -2.6, 5, 0.2); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.1.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.1.html new file mode 100644 index 0000000000..fe4d77baaa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.1.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.strokeRect.zero.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.strokeRect.zero.1</h1> +<p class="desc">strokeRect of 0x0 pixels draws nothing</p> + + +<script> +var t = async_test("strokeRect of 0x0 pixels 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.strokeStyle = '#f00'; +ctx.lineWidth = 250; +ctx.strokeRect(50, 25, 0, 0); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.1.worker.js new file mode 100644 index 0000000000..be3da7c88a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.1.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.strokeRect.zero.1 +// Description:strokeRect of 0x0 pixels draws nothing +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("strokeRect of 0x0 pixels 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.strokeStyle = '#f00'; +ctx.lineWidth = 250; +ctx.strokeRect(50, 25, 0, 0); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.2.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.2.html new file mode 100644 index 0000000000..0e234f85e5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.2.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.strokeRect.zero.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.strokeRect.zero.2</h1> +<p class="desc">strokeRect of 0x0 pixels draws nothing, including caps and joins</p> + + +<script> +var t = async_test("strokeRect of 0x0 pixels draws nothing, including caps and 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.strokeStyle = '#f00'; +ctx.lineWidth = 250; +ctx.lineCap = 'round'; +ctx.lineJoin = 'round'; +ctx.strokeRect(50, 25, 0, 0); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.2.worker.js new file mode 100644 index 0000000000..ab24ad3412 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.2.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.strokeRect.zero.2 +// Description:strokeRect of 0x0 pixels draws nothing, including caps and joins +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("strokeRect of 0x0 pixels draws nothing, including caps and 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.strokeStyle = '#f00'; +ctx.lineWidth = 250; +ctx.lineCap = 'round'; +ctx.lineJoin = 'round'; +ctx.strokeRect(50, 25, 0, 0); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.3.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.3.html new file mode 100644 index 0000000000..0145b2e412 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.3.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.strokeRect.zero.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.strokeRect.zero.3</h1> +<p class="desc">strokeRect of Nx0 pixels draws a straight line</p> + + +<script> +var t = async_test("strokeRect of Nx0 pixels draws a straight line"); +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 = '#0f0'; +ctx.lineWidth = 50; +ctx.strokeRect(0, 25, 100, 0); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.3.worker.js new file mode 100644 index 0000000000..d9b365f7e8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.3.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.strokeRect.zero.3 +// Description:strokeRect of Nx0 pixels draws a straight line +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("strokeRect of Nx0 pixels draws a straight line"); +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 = '#0f0'; +ctx.lineWidth = 50; +ctx.strokeRect(0, 25, 100, 0); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.4.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.4.html new file mode 100644 index 0000000000..d0c284f8e0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.4.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.strokeRect.zero.4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.strokeRect.zero.4</h1> +<p class="desc">strokeRect of Nx0 pixels draws a closed line with no caps</p> + + +<script> +var t = async_test("strokeRect of Nx0 pixels draws a closed line with no caps"); +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 = '#f00'; +ctx.lineWidth = 250; +ctx.lineCap = 'round'; +ctx.strokeRect(100, 25, 100, 0); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.4.worker.js new file mode 100644 index 0000000000..23513a4750 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.4.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.strokeRect.zero.4 +// Description:strokeRect of Nx0 pixels draws a closed line with no caps +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("strokeRect of Nx0 pixels draws a closed line with no caps"); +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 = '#f00'; +ctx.lineWidth = 250; +ctx.lineCap = 'round'; +ctx.strokeRect(100, 25, 100, 0); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.5.html b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.5.html new file mode 100644 index 0000000000..2441354c90 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.5.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.strokeRect.zero.5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.strokeRect.zero.5</h1> +<p class="desc">strokeRect of Nx0 pixels draws a closed line with joins</p> + + +<script> +var t = async_test("strokeRect of Nx0 pixels draws a closed line with 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.strokeStyle = '#0f0'; +ctx.lineWidth = 250; +ctx.lineJoin = 'round'; +ctx.strokeRect(100, 25, 100, 0); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.5.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.5.worker.js new file mode 100644 index 0000000000..0ef9e67725 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.5.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.strokeRect.zero.5 +// Description:strokeRect of Nx0 pixels draws a closed line with joins +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("strokeRect of Nx0 pixels draws a closed line with 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.strokeStyle = '#0f0'; +ctx.lineWidth = 250; +ctx.lineJoin = 'round'; +ctx.strokeRect(100, 25, 100, 0); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.CSSHSL.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.CSSHSL.html new file mode 100644 index 0000000000..af5b04170d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.CSSHSL.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.fillStyle.CSSHSL</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.CSSHSL</h1> +<p class="desc">CSSHSL works as color input</p> + + +<script> +var t = async_test("CSSHSL works as color input"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var offscreenCanvas = new OffscreenCanvas(100, 50); +var ctx = offscreenCanvas.getContext('2d'); + +ctx.fillStyle = new CSSHSL(CSS.deg(180), 0.5, 0.5); +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(offscreenCanvas, 50,25, 64,191,191,255, 3); + +const color = new CSSHSL(CSS.deg(180), 1, 1); +ctx.fillStyle = color; +_assertSame(ctx.fillStyle, '#ffffff', "ctx.fillStyle", "'#ffffff'"); +ctx.fillRect(0, 0, 100, 50); +_assertPixel(offscreenCanvas, 50,25, 255,255,255,255); +color.l = 0.5; +ctx.fillStyle = color; +_assertSame(ctx.fillStyle, '#00ffff', "ctx.fillStyle", "'#00ffff'"); +ctx.fillRect(0, 0, 100, 50); +_assertPixel(offscreenCanvas, 50,25, 0,255,255,255); + +ctx.fillStyle = new CSSRGB(1, 0, 1).toHSL(); +_assertSame(ctx.fillStyle, '#ff00ff', "ctx.fillStyle", "'#ff00ff'"); +ctx.fillRect(0, 0, 100, 50); +_assertPixel(offscreenCanvas, 50,25, 255,0,255,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.default.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.default.html new file mode 100644 index 0000000000..3a3b6a9798 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.default.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.default</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.default</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.fillStyle, '#000000', "ctx.fillStyle", "'#000000'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.default.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.default.worker.js new file mode 100644 index 0000000000..95ae259ca4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.default.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.default +// 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.fillStyle, '#000000', "ctx.fillStyle", "'#000000'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.halftransparent.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.halftransparent.html new file mode 100644 index 0000000000..68b09d06f5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.halftransparent.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.get.halftransparent</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.get.halftransparent</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 = 'rgba(255,255,255,0.5)'; +_assertSame(ctx.fillStyle, 'rgba(255, 255, 255, 0.5)', "ctx.fillStyle", "'rgba(255, 255, 255, 0.5)'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.halftransparent.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.halftransparent.worker.js new file mode 100644 index 0000000000..de8f491ca3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.halftransparent.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.get.halftransparent +// 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 = 'rgba(255,255,255,0.5)'; +_assertSame(ctx.fillStyle, 'rgba(255, 255, 255, 0.5)', "ctx.fillStyle", "'rgba(255, 255, 255, 0.5)'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.semitransparent.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.semitransparent.html new file mode 100644 index 0000000000..9f8566809d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.semitransparent.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.get.semitransparent</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.get.semitransparent</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 = 'rgba(255,255,255,0.45)'; +assert_regexp_match(ctx.fillStyle, /^rgba\(255, 255, 255, 0\.4\d+\)$/); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.semitransparent.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.semitransparent.worker.js new file mode 100644 index 0000000000..3715183d55 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.semitransparent.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.get.semitransparent +// 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 = 'rgba(255,255,255,0.45)'; +assert_regexp_match(ctx.fillStyle, /^rgba\(255, 255, 255, 0\.4\d+\)$/); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.solid.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.solid.html new file mode 100644 index 0000000000..3eca93e237 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.solid.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.get.solid</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.get.solid</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 = '#fa0'; +_assertSame(ctx.fillStyle, '#ffaa00', "ctx.fillStyle", "'#ffaa00'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.solid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.solid.worker.js new file mode 100644 index 0000000000..2ada733651 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.solid.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.get.solid +// 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 = '#fa0'; +_assertSame(ctx.fillStyle, '#ffaa00', "ctx.fillStyle", "'#ffaa00'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.transparent.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.transparent.html new file mode 100644 index 0000000000..caab8e0236 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.transparent.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.get.transparent</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.get.transparent</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 = 'rgba(0,0,0,0)'; +_assertSame(ctx.fillStyle, 'rgba(0, 0, 0, 0)', "ctx.fillStyle", "'rgba(0, 0, 0, 0)'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.transparent.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.transparent.worker.js new file mode 100644 index 0000000000..57f5facf2e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.get.transparent.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.get.transparent +// 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 = 'rgba(0,0,0,0)'; +_assertSame(ctx.fillStyle, 'rgba(0, 0, 0, 0)', "ctx.fillStyle", "'rgba(0, 0, 0, 0)'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.invalidstring.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.invalidstring.html new file mode 100644 index 0000000000..260554c4bc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.invalidstring.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.invalidstring</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.invalidstring</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.fillStyle = '#0f0'; +ctx.fillStyle = 'invalid'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.invalidstring.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.invalidstring.worker.js new file mode 100644 index 0000000000..4e4df4f810 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.invalidstring.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.invalidstring +// 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.fillStyle = '#0f0'; +ctx.fillStyle = 'invalid'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.invalidtype.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.invalidtype.html new file mode 100644 index 0000000000..53c0f77c8c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.invalidtype.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.invalidtype</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.invalidtype</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.fillStyle = '#0f0'; +ctx.fillStyle = null; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.invalidtype.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.invalidtype.worker.js new file mode 100644 index 0000000000..19b3120638 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.invalidtype.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.invalidtype +// 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.fillStyle = '#0f0'; +ctx.fillStyle = null; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-1.html new file mode 100644 index 0000000000..d4a2466b7d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-hsl-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-hsl-1</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(120 100.0% 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-1.worker.js new file mode 100644 index 0000000000..074d796caf --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-hsl-1 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(120 100.0% 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-2.html new file mode 100644 index 0000000000..6853ae51ea --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-hsl-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-hsl-2</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(120 100.0% 50.0% / 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-2.worker.js new file mode 100644 index 0000000000..a4226cf8ca --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-hsl-2 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(120 100.0% 50.0% / 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-3.html new file mode 100644 index 0000000000..62f4e48ef3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-hsl-3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-hsl-3</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(120.0, 100.0%, 50.0%, 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-3.worker.js new file mode 100644 index 0000000000..de3e3791fa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-hsl-3 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(120.0, 100.0%, 50.0%, 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-4.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-4.html new file mode 100644 index 0000000000..082ddcd75e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-4.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-hsl-4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-hsl-4</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(120.0, 100.0%, 50.0%, 20%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-4.worker.js new file mode 100644 index 0000000000..2714bdf835 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-4.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-hsl-4 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(120.0, 100.0%, 50.0%, 20%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-5.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-5.html new file mode 100644 index 0000000000..55f92e17ef --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-5.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-hsl-5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-hsl-5</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(120deg, 100.0%, 50.0%, 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-5.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-5.worker.js new file mode 100644 index 0000000000..ef3fe13355 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-5.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-hsl-5 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(120deg, 100.0%, 50.0%, 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-6.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-6.html new file mode 100644 index 0000000000..74657fca63 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-6.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-hsl-6</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-hsl-6</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(120deg, 100.0%, 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-6.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-6.worker.js new file mode 100644 index 0000000000..a36af9a563 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-6.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-hsl-6 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(120deg, 100.0%, 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-7.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-7.html new file mode 100644 index 0000000000..419b15f72e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-7.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-hsl-7</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-hsl-7</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(133.33333333grad, 100.0%, 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-7.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-7.worker.js new file mode 100644 index 0000000000..10da1141aa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-7.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-hsl-7 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(133.33333333grad, 100.0%, 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-8.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-8.html new file mode 100644 index 0000000000..a5acc80ef8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-8.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-hsl-8</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-hsl-8</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(2.0943951024rad, 100.0%, 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-8.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-8.worker.js new file mode 100644 index 0000000000..e12f96350b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-8.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-hsl-8 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(2.0943951024rad, 100.0%, 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-9.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-9.html new file mode 100644 index 0000000000..dc18415399 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-9.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-hsl-9</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-hsl-9</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(0.3333333333turn, 100.0%, 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-9.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-9.worker.js new file mode 100644 index 0000000000..51de0e0b15 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsl-9.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-hsl-9 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(0.3333333333turn, 100.0%, 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-1.html new file mode 100644 index 0000000000..84b80615be --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-hsla-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-hsla-1</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(120 100.0% 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-1.worker.js new file mode 100644 index 0000000000..2d7abab3be --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-hsla-1 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(120 100.0% 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-2.html new file mode 100644 index 0000000000..a3f2c67ab4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-hsla-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-hsla-2</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(120 100.0% 50.0% / 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-2.worker.js new file mode 100644 index 0000000000..dd66b1d079 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-hsla-2 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(120 100.0% 50.0% / 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-3.html new file mode 100644 index 0000000000..5b809ba567 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-hsla-3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-hsla-3</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(120.0, 100.0%, 50.0%, 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-3.worker.js new file mode 100644 index 0000000000..7ef6d8f475 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-hsla-3 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(120.0, 100.0%, 50.0%, 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-4.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-4.html new file mode 100644 index 0000000000..3e063664fb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-4.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-hsla-4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-hsla-4</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(120.0, 100.0%, 50.0%, 20%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-4.worker.js new file mode 100644 index 0000000000..ed1dec0162 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-4.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-hsla-4 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(120.0, 100.0%, 50.0%, 20%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-5.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-5.html new file mode 100644 index 0000000000..34f626a0a5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-5.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-hsla-5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-hsla-5</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(120deg, 100.0%, 50.0%, 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-5.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-5.worker.js new file mode 100644 index 0000000000..89042269ab --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-5.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-hsla-5 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(120deg, 100.0%, 50.0%, 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-6.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-6.html new file mode 100644 index 0000000000..3c1a23bf37 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-6.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-hsla-6</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-hsla-6</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(120deg, 100.0%, 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-6.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-6.worker.js new file mode 100644 index 0000000000..645081df5e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-6.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-hsla-6 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(120deg, 100.0%, 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-7.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-7.html new file mode 100644 index 0000000000..cc874e8fbe --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-7.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-hsla-7</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-hsla-7</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(133.33333333grad, 100.0%, 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-7.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-7.worker.js new file mode 100644 index 0000000000..f42602ebc3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-7.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-hsla-7 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(133.33333333grad, 100.0%, 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-8.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-8.html new file mode 100644 index 0000000000..7501436481 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-8.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-hsla-8</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-hsla-8</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(2.0943951024rad, 100.0%, 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-8.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-8.worker.js new file mode 100644 index 0000000000..376cb94c90 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-8.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-hsla-8 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(2.0943951024rad, 100.0%, 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-9.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-9.html new file mode 100644 index 0000000000..f759e6910b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-9.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-hsla-9</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-hsla-9</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(0.3333333333turn, 100.0%, 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-9.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-9.worker.js new file mode 100644 index 0000000000..58f404175d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-hsla-9.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-hsla-9 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(0.3333333333turn, 100.0%, 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-1.html new file mode 100644 index 0000000000..44648751a3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-rgb-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-rgb-1</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgb(0, 255.0, 0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-1.worker.js new file mode 100644 index 0000000000..34ecf3d318 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-rgb-1 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgb(0, 255.0, 0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-2.html new file mode 100644 index 0000000000..328d731e49 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-rgb-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-rgb-2</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgb(0, 255, 0, 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-2.worker.js new file mode 100644 index 0000000000..958d5df352 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-rgb-2 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgb(0, 255, 0, 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-3.html new file mode 100644 index 0000000000..1dc99c24c7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-rgb-3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-rgb-3</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgb(0, 255, 0, 20%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-3.worker.js new file mode 100644 index 0000000000..f82df16e9a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-rgb-3 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgb(0, 255, 0, 20%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-4.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-4.html new file mode 100644 index 0000000000..1b72c4f235 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-4.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-rgb-4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-rgb-4</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgb(0 255 0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-4.worker.js new file mode 100644 index 0000000000..08dba89ec8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-4.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-rgb-4 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgb(0 255 0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-5.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-5.html new file mode 100644 index 0000000000..9044fe81a4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-5.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-rgb-5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-rgb-5</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgb(0 255 0 / 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-5.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-5.worker.js new file mode 100644 index 0000000000..27ccca6c64 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-5.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-rgb-5 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgb(0 255 0 / 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-6.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-6.html new file mode 100644 index 0000000000..66cb90876f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-6.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-rgb-6</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-rgb-6</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgb(0 255 0 / 20%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-6.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-6.worker.js new file mode 100644 index 0000000000..3ff4312fcb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgb-6.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-rgb-6 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgb(0 255 0 / 20%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-1.html new file mode 100644 index 0000000000..a0d2239244 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-rgba-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-rgba-1</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgba(0, 255.0, 0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-1.worker.js new file mode 100644 index 0000000000..ef45434cab --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-rgba-1 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgba(0, 255.0, 0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-2.html new file mode 100644 index 0000000000..96dcbf61d8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-rgba-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-rgba-2</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgba(0, 255, 0, 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-2.worker.js new file mode 100644 index 0000000000..e03f5252e9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-rgba-2 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgba(0, 255, 0, 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-3.html new file mode 100644 index 0000000000..f972e83696 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-rgba-3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-rgba-3</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgba(0, 255, 0, 20%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-3.worker.js new file mode 100644 index 0000000000..3bc693f212 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-rgba-3 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgba(0, 255, 0, 20%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-4.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-4.html new file mode 100644 index 0000000000..6825e8658a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-4.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-rgba-4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-rgba-4</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgba(0 255 0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-4.worker.js new file mode 100644 index 0000000000..a50cc026bb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-4.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-rgba-4 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgba(0 255 0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-5.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-5.html new file mode 100644 index 0000000000..7c8b19c80d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-5.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-rgba-5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-rgba-5</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgba(0 255 0 / 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-5.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-5.worker.js new file mode 100644 index 0000000000..e134e34b29 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-5.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-rgba-5 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgba(0 255 0 / 0.2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-6.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-6.html new file mode 100644 index 0000000000..b63b46f9d2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-6.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.css-color-4-rgba-6</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.css-color-4-rgba-6</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgba(0 255 0 / 20%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-6.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-6.worker.js new file mode 100644 index 0000000000..3e401de74d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.css-color-4-rgba-6.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.css-color-4-rgba-6 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgba(0 255 0 / 20%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,51); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex3.html new file mode 100644 index 0000000000..90d3e6037e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hex3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hex3</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex3.worker.js new file mode 100644 index 0000000000..9f0d0a4322 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hex3 +// Description: +// Note:<p class="notes"> + +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.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex4.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex4.html new file mode 100644 index 0000000000..d10e3a8910 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex4.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hex4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hex4</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = '#0f0f'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex4.worker.js new file mode 100644 index 0000000000..fa84ca1352 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex4.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hex4 +// Description: +// Note:<p class="notes"> + +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.fillStyle = '#0f0f'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex6.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex6.html new file mode 100644 index 0000000000..69394c9a83 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex6.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hex6</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hex6</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = '#00fF00'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex6.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex6.worker.js new file mode 100644 index 0000000000..cb432b4f99 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex6.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hex6 +// Description: +// Note:<p class="notes"> + +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.fillStyle = '#00fF00'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex8.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex8.html new file mode 100644 index 0000000000..80abfe3265 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex8.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hex8</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hex8</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = '#00ff00ff'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex8.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex8.worker.js new file mode 100644 index 0000000000..e114569893 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hex8.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hex8 +// Description: +// Note:<p class="notes"> + +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.fillStyle = '#00ff00ff'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-1.html new file mode 100644 index 0000000000..65e5c18747 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hsl-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hsl-1</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(120, 100%, 50%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-1.worker.js new file mode 100644 index 0000000000..83d507c826 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hsl-1 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(120, 100%, 50%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-2.html new file mode 100644 index 0000000000..fdd78ad7be --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hsl-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hsl-2</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl( -240 , 100% , 50% )'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-2.worker.js new file mode 100644 index 0000000000..0dfc848716 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hsl-2 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl( -240 , 100% , 50% )'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-3.html new file mode 100644 index 0000000000..5169244407 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hsl-3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hsl-3</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(360120, 100%, 50%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-3.worker.js new file mode 100644 index 0000000000..54dec44d38 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hsl-3 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(360120, 100%, 50%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-4.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-4.html new file mode 100644 index 0000000000..90f30ab92c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-4.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hsl-4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hsl-4</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(-360240, 100%, 50%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-4.worker.js new file mode 100644 index 0000000000..43c20668af --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-4.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hsl-4 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(-360240, 100%, 50%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-5.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-5.html new file mode 100644 index 0000000000..7760e236fd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-5.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hsl-5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hsl-5</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(120.0, 100.0%, 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-5.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-5.worker.js new file mode 100644 index 0000000000..d4c95c10b2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-5.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hsl-5 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(120.0, 100.0%, 50.0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-6.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-6.html new file mode 100644 index 0000000000..795092931b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-6.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hsl-6</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hsl-6</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(+120, +100%, +50%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-6.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-6.worker.js new file mode 100644 index 0000000000..f5acc2df25 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-6.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hsl-6 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(+120, +100%, +50%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-1.html new file mode 100644 index 0000000000..1b375468ba --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hsl-clamp-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hsl-clamp-1</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(120, 200%, 50%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-1.worker.js new file mode 100644 index 0000000000..cc3308d7ed --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hsl-clamp-1 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(120, 200%, 50%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-2.html new file mode 100644 index 0000000000..0133f7f50a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hsl-clamp-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hsl-clamp-2</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(120, -200%, 49.9%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 127,127,127,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-2.worker.js new file mode 100644 index 0000000000..48c23aa10a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hsl-clamp-2 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(120, -200%, 49.9%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 127,127,127,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-3.html new file mode 100644 index 0000000000..e35355c21c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hsl-clamp-3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hsl-clamp-3</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(120, 100%, 200%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 255,255,255,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-3.worker.js new file mode 100644 index 0000000000..ef1ac418c9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hsl-clamp-3 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(120, 100%, 200%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 255,255,255,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-4.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-4.html new file mode 100644 index 0000000000..c42b6f1f5d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-4.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hsl-clamp-4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hsl-clamp-4</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsl(120, 100%, -200%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,0,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-4.worker.js new file mode 100644 index 0000000000..061685dbde --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsl-clamp-4.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hsl-clamp-4 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsl(120, 100%, -200%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,0,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-1.html new file mode 100644 index 0000000000..0defd457ab --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hsla-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hsla-1</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsla(120, 100%, 50%, 0.499)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,127); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-1.worker.js new file mode 100644 index 0000000000..64a26e6ca3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hsla-1 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsla(120, 100%, 50%, 0.499)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,127); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-2.html new file mode 100644 index 0000000000..0498edd6da --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hsla-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hsla-2</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsla( 120.0 , 100.0% , 50.0% , 1 )'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-2.worker.js new file mode 100644 index 0000000000..6101f0e3ab --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hsla-2 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsla( 120.0 , 100.0% , 50.0% , 1 )'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-1.html new file mode 100644 index 0000000000..313ecf277c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hsla-clamp-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hsla-clamp-1</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsla(120, 200%, 50%, 1)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-1.worker.js new file mode 100644 index 0000000000..8724efd28a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hsla-clamp-1 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsla(120, 200%, 50%, 1)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-2.html new file mode 100644 index 0000000000..761471f43a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hsla-clamp-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hsla-clamp-2</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsla(120, -200%, 49.9%, 1)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 127,127,127,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-2.worker.js new file mode 100644 index 0000000000..af4271c66c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hsla-clamp-2 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsla(120, -200%, 49.9%, 1)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 127,127,127,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-3.html new file mode 100644 index 0000000000..287a23a58a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hsla-clamp-3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hsla-clamp-3</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsla(120, 100%, 200%, 1)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 255,255,255,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-3.worker.js new file mode 100644 index 0000000000..1e10a76dc2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hsla-clamp-3 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsla(120, 100%, 200%, 1)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 255,255,255,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-4.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-4.html new file mode 100644 index 0000000000..a0e420cab2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-4.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hsla-clamp-4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hsla-clamp-4</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsla(120, 100%, -200%, 1)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,0,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-4.worker.js new file mode 100644 index 0000000000..e746bc3472 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-4.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hsla-clamp-4 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsla(120, 100%, -200%, 1)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,0,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-5.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-5.html new file mode 100644 index 0000000000..0683719749 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-5.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hsla-clamp-5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hsla-clamp-5</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsla(120, 100%, 50%, 2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-5.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-5.worker.js new file mode 100644 index 0000000000..61d86a8a95 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-5.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hsla-clamp-5 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsla(120, 100%, 50%, 2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-6.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-6.html new file mode 100644 index 0000000000..a810639519 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-6.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.hsla-clamp-6</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.hsla-clamp-6</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'hsla(120, 100%, 0%, -2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-6.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-6.worker.js new file mode 100644 index 0000000000..57c0d587ee --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.hsla-clamp-6.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.hsla-clamp-6 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'hsla(120, 100%, 0%, -2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.html4.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.html4.html new file mode 100644 index 0000000000..767768ab2f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.html4.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.html4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.html4</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'limE'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.html4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.html4.worker.js new file mode 100644 index 0000000000..a8b8552afb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.html4.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.html4 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'limE'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-1.html new file mode 100644 index 0000000000..1a227a436a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.css-color-4-hsl-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.css-color-4-hsl-1</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'; +try { ctx.fillStyle = 'hsl(0, 100%, 50% / 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-1.worker.js new file mode 100644 index 0000000000..20fc879bc6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.css-color-4-hsl-1 +// 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'; +try { ctx.fillStyle = 'hsl(0, 100%, 50% / 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-2.html new file mode 100644 index 0000000000..36b95ed247 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.css-color-4-hsl-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.css-color-4-hsl-2</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'; +try { ctx.fillStyle = 'hsl(0 100% 50%, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-2.worker.js new file mode 100644 index 0000000000..c2c6fc0ace --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.css-color-4-hsl-2 +// 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'; +try { ctx.fillStyle = 'hsl(0 100% 50%, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-3.html new file mode 100644 index 0000000000..d208c6296b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.css-color-4-hsl-3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.css-color-4-hsl-3</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'; +try { ctx.fillStyle = 'hsl(0, 100% 50%)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-3.worker.js new file mode 100644 index 0000000000..c2f90ef320 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.css-color-4-hsl-3 +// 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'; +try { ctx.fillStyle = 'hsl(0, 100% 50%)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-4.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-4.html new file mode 100644 index 0000000000..2fba5aaf9c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-4.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.css-color-4-hsl-4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.css-color-4-hsl-4</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'; +try { ctx.fillStyle = 'hsl(0 100% 50% /)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-4.worker.js new file mode 100644 index 0000000000..6903ae94c2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-4.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.css-color-4-hsl-4 +// 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'; +try { ctx.fillStyle = 'hsl(0 100% 50% /)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-5.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-5.html new file mode 100644 index 0000000000..f340a52aa8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-5.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.css-color-4-hsl-5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.css-color-4-hsl-5</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'; +try { ctx.fillStyle = 'hsl(0, 100%, 50% /)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-5.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-5.worker.js new file mode 100644 index 0000000000..8f0cfc0cba --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsl-5.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.css-color-4-hsl-5 +// 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'; +try { ctx.fillStyle = 'hsl(0, 100%, 50% /)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsla-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsla-1.html new file mode 100644 index 0000000000..834a1b7b18 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsla-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.css-color-4-hsla-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.css-color-4-hsla-1</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'; +try { ctx.fillStyle = 'hsla(0, 100%, 50% / 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsla-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsla-1.worker.js new file mode 100644 index 0000000000..45e074321e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsla-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.css-color-4-hsla-1 +// 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'; +try { ctx.fillStyle = 'hsla(0, 100%, 50% / 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsla-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsla-2.html new file mode 100644 index 0000000000..cd33bbf800 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsla-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.css-color-4-hsla-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.css-color-4-hsla-2</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'; +try { ctx.fillStyle = 'hsla(0 100% 50%, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsla-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsla-2.worker.js new file mode 100644 index 0000000000..e0d75717db --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsla-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.css-color-4-hsla-2 +// 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'; +try { ctx.fillStyle = 'hsla(0 100% 50%, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsla-3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsla-3.html new file mode 100644 index 0000000000..fd01b7623a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsla-3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.css-color-4-hsla-3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.css-color-4-hsla-3</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'; +try { ctx.fillStyle = 'hsla(0, 100% 50%)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsla-3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsla-3.worker.js new file mode 100644 index 0000000000..4adb92bb64 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-hsla-3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.css-color-4-hsla-3 +// 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'; +try { ctx.fillStyle = 'hsla(0, 100% 50%)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-1.html new file mode 100644 index 0000000000..f1e1b2ab37 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.css-color-4-rgb-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.css-color-4-rgb-1</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'; +try { ctx.fillStyle = 'rgb(255, 0, 0 / 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-1.worker.js new file mode 100644 index 0000000000..450556b31b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.css-color-4-rgb-1 +// 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'; +try { ctx.fillStyle = 'rgb(255, 0, 0 / 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-2.html new file mode 100644 index 0000000000..dc22f99e3d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.css-color-4-rgb-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.css-color-4-rgb-2</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'; +try { ctx.fillStyle = 'rgb(255 0 0, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-2.worker.js new file mode 100644 index 0000000000..35217d1b80 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.css-color-4-rgb-2 +// 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'; +try { ctx.fillStyle = 'rgb(255 0 0, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-3.html new file mode 100644 index 0000000000..434c15eccb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.css-color-4-rgb-3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.css-color-4-rgb-3</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'; +try { ctx.fillStyle = 'rgb(255, 0 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-3.worker.js new file mode 100644 index 0000000000..28200cfdd5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.css-color-4-rgb-3 +// 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'; +try { ctx.fillStyle = 'rgb(255, 0 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-4.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-4.html new file mode 100644 index 0000000000..58ed0e7318 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-4.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.css-color-4-rgb-4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.css-color-4-rgb-4</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'; +try { ctx.fillStyle = 'rgb(0 0 0 /)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-4.worker.js new file mode 100644 index 0000000000..1830996c26 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-4.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.css-color-4-rgb-4 +// 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'; +try { ctx.fillStyle = 'rgb(0 0 0 /)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-5.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-5.html new file mode 100644 index 0000000000..95643739c4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-5.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.css-color-4-rgb-5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.css-color-4-rgb-5</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'; +try { ctx.fillStyle = 'rgb(0, 0, 0 /)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-5.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-5.worker.js new file mode 100644 index 0000000000..4591bbde34 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgb-5.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.css-color-4-rgb-5 +// 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'; +try { ctx.fillStyle = 'rgb(0, 0, 0 /)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgba-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgba-1.html new file mode 100644 index 0000000000..5ae093eae1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgba-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.css-color-4-rgba-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.css-color-4-rgba-1</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'; +try { ctx.fillStyle = 'rgba(255, 0, 0 / 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgba-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgba-1.worker.js new file mode 100644 index 0000000000..d9a315c98d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgba-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.css-color-4-rgba-1 +// 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'; +try { ctx.fillStyle = 'rgba(255, 0, 0 / 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgba-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgba-2.html new file mode 100644 index 0000000000..036f389153 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgba-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.css-color-4-rgba-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.css-color-4-rgba-2</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'; +try { ctx.fillStyle = 'rgba(255 0 0, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgba-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgba-2.worker.js new file mode 100644 index 0000000000..1fc2f5d863 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgba-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.css-color-4-rgba-2 +// 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'; +try { ctx.fillStyle = 'rgba(255 0 0, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgba-3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgba-3.html new file mode 100644 index 0000000000..663557987a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgba-3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.css-color-4-rgba-3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.css-color-4-rgba-3</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'; +try { ctx.fillStyle = 'rgba(255, 0 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgba-3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgba-3.worker.js new file mode 100644 index 0000000000..1eadf9125b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.css-color-4-rgba-3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.css-color-4-rgba-3 +// 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'; +try { ctx.fillStyle = 'rgba(255, 0 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex1.html new file mode 100644 index 0000000000..83e1c410f5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.hex1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.hex1</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'; +try { ctx.fillStyle = '#f'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex1.worker.js new file mode 100644 index 0000000000..3807fd3311 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.hex1 +// 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'; +try { ctx.fillStyle = '#f'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex2.html new file mode 100644 index 0000000000..453ec4bd5c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.hex2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.hex2</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'; +try { ctx.fillStyle = '#f0'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex2.worker.js new file mode 100644 index 0000000000..9bb7e2c33c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.hex2 +// 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'; +try { ctx.fillStyle = '#f0'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex3.html new file mode 100644 index 0000000000..c1d4e8c1e8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.hex3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.hex3</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'; +try { ctx.fillStyle = '#g00'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex3.worker.js new file mode 100644 index 0000000000..4eaa0b0d0f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.hex3 +// 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'; +try { ctx.fillStyle = '#g00'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex4.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex4.html new file mode 100644 index 0000000000..89c23a0074 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex4.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.hex4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.hex4</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'; +try { ctx.fillStyle = '#fg00'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex4.worker.js new file mode 100644 index 0000000000..ceffb191b2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex4.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.hex4 +// 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'; +try { ctx.fillStyle = '#fg00'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex5.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex5.html new file mode 100644 index 0000000000..4d62d09be0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex5.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.hex5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.hex5</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'; +try { ctx.fillStyle = '#ff000'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex5.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex5.worker.js new file mode 100644 index 0000000000..7225544f8b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex5.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.hex5 +// 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'; +try { ctx.fillStyle = '#ff000'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex6.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex6.html new file mode 100644 index 0000000000..69dfdc723f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex6.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.hex6</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.hex6</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'; +try { ctx.fillStyle = '#fg0000'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex6.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex6.worker.js new file mode 100644 index 0000000000..2e5a93b49a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex6.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.hex6 +// 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'; +try { ctx.fillStyle = '#fg0000'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex7.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex7.html new file mode 100644 index 0000000000..2be93ca69a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex7.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.hex7</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.hex7</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'; +try { ctx.fillStyle = '#ff0000f'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex7.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex7.worker.js new file mode 100644 index 0000000000..fbd4a887c5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex7.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.hex7 +// 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'; +try { ctx.fillStyle = '#ff0000f'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex8.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex8.html new file mode 100644 index 0000000000..f67758d42e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex8.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.hex8</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.hex8</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'; +try { ctx.fillStyle = '#fg0000ff'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex8.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex8.worker.js new file mode 100644 index 0000000000..fcc230ce9d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hex8.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.hex8 +// 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'; +try { ctx.fillStyle = '#fg0000ff'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-1.html new file mode 100644 index 0000000000..54e6711137 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.hsl-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.hsl-1</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'; +try { ctx.fillStyle = 'hsl(0%, 100%, 50%)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-1.worker.js new file mode 100644 index 0000000000..3b0bb9165b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.hsl-1 +// 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'; +try { ctx.fillStyle = 'hsl(0%, 100%, 50%)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-2.html new file mode 100644 index 0000000000..7614b8c34d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.hsl-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.hsl-2</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'; +try { ctx.fillStyle = 'hsl(z, 100%, 50%)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-2.worker.js new file mode 100644 index 0000000000..ec906f7fa1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.hsl-2 +// 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'; +try { ctx.fillStyle = 'hsl(z, 100%, 50%)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-3.html new file mode 100644 index 0000000000..13d19ac924 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.hsl-3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.hsl-3</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'; +try { ctx.fillStyle = 'hsl(0, 0, 50%)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-3.worker.js new file mode 100644 index 0000000000..370eba2097 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.hsl-3 +// 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'; +try { ctx.fillStyle = 'hsl(0, 0, 50%)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-4.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-4.html new file mode 100644 index 0000000000..9f01aa2180 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-4.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.hsl-4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.hsl-4</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'; +try { ctx.fillStyle = 'hsl(0, 100%, 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-4.worker.js new file mode 100644 index 0000000000..9d53d26c96 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-4.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.hsl-4 +// 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'; +try { ctx.fillStyle = 'hsl(0, 100%, 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-5.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-5.html new file mode 100644 index 0000000000..23f38067a9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-5.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.hsl-5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.hsl-5</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'; +try { ctx.fillStyle = 'hsl(0, 100.%, 50%)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-5.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-5.worker.js new file mode 100644 index 0000000000..98f4b1c721 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-5.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.hsl-5 +// 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'; +try { ctx.fillStyle = 'hsl(0, 100.%, 50%)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-6.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-6.html new file mode 100644 index 0000000000..405a0e52b2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-6.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.hsl-6</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.hsl-6</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'; +try { ctx.fillStyle = 'hsl(0, 100%, 50%,)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-6.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-6.worker.js new file mode 100644 index 0000000000..8718547002 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsl-6.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.hsl-6 +// 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'; +try { ctx.fillStyle = 'hsl(0, 100%, 50%,)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsla-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsla-1.html new file mode 100644 index 0000000000..ae9d7986b7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsla-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.hsla-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.hsla-1</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'; +try { ctx.fillStyle = 'hsla(0%, 100%, 50%, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsla-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsla-1.worker.js new file mode 100644 index 0000000000..b6a70f2a42 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsla-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.hsla-1 +// 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'; +try { ctx.fillStyle = 'hsla(0%, 100%, 50%, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsla-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsla-2.html new file mode 100644 index 0000000000..de123411ec --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsla-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.hsla-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.hsla-2</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'; +try { ctx.fillStyle = 'hsla(0, 0, 50%, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsla-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsla-2.worker.js new file mode 100644 index 0000000000..809c805352 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsla-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.hsla-2 +// 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'; +try { ctx.fillStyle = 'hsla(0, 0, 50%, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsla-3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsla-3.html new file mode 100644 index 0000000000..beab07b862 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsla-3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.hsla-3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.hsla-3</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'; +try { ctx.fillStyle = 'hsla(0, 0, 50%, 1,)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsla-3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsla-3.worker.js new file mode 100644 index 0000000000..4d2b53bbeb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.hsla-3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.hsla-3 +// 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'; +try { ctx.fillStyle = 'hsla(0, 0, 50%, 1,)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-1.html new file mode 100644 index 0000000000..4ac286e616 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.name-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.name-1</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'; +try { ctx.fillStyle = 'darkbrown'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-1.worker.js new file mode 100644 index 0000000000..ef588934c1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.name-1 +// 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'; +try { ctx.fillStyle = 'darkbrown'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-2.html new file mode 100644 index 0000000000..6b54c1816b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.name-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.name-2</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'; +try { ctx.fillStyle = 'firebrick1'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-2.worker.js new file mode 100644 index 0000000000..b66a07419c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.name-2 +// 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'; +try { ctx.fillStyle = 'firebrick1'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-3.html new file mode 100644 index 0000000000..05cfaa906d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.name-3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.name-3</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'; +try { ctx.fillStyle = 'red blue'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-3.worker.js new file mode 100644 index 0000000000..da51a4ab2a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.name-3 +// 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'; +try { ctx.fillStyle = 'red blue'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-4.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-4.html new file mode 100644 index 0000000000..47aab58ada --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-4.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.name-4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.name-4</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'; +try { ctx.fillStyle = '"red"'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-4.worker.js new file mode 100644 index 0000000000..c167c2b955 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-4.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.name-4 +// 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'; +try { ctx.fillStyle = '"red"'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-5.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-5.html new file mode 100644 index 0000000000..af19e193e0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-5.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.name-5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.name-5</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'; +try { ctx.fillStyle = '"red'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-5.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-5.worker.js new file mode 100644 index 0000000000..8fe3a9b13e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.name-5.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.name-5 +// 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'; +try { ctx.fillStyle = '"red'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgb-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgb-1.html new file mode 100644 index 0000000000..300bb85ee2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgb-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.rgb-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.rgb-1</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'; +try { ctx.fillStyle = 'rgb(255.0, 0, 0,)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgb-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgb-1.worker.js new file mode 100644 index 0000000000..3c97d856c7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgb-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.rgb-1 +// 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'; +try { ctx.fillStyle = 'rgb(255.0, 0, 0,)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgb-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgb-2.html new file mode 100644 index 0000000000..8bc9c079dd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgb-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.rgb-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.rgb-2</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'; +try { ctx.fillStyle = 'rgb(100%, 0, 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgb-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgb-2.worker.js new file mode 100644 index 0000000000..7e4e27c914 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgb-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.rgb-2 +// 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'; +try { ctx.fillStyle = 'rgb(100%, 0, 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgb-3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgb-3.html new file mode 100644 index 0000000000..11e93a1c72 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgb-3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.rgb-3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.rgb-3</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'; +try { ctx.fillStyle = 'rgb(255, - 1, 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgb-3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgb-3.worker.js new file mode 100644 index 0000000000..59d89f7b51 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgb-3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.rgb-3 +// 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'; +try { ctx.fillStyle = 'rgb(255, - 1, 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-1.html new file mode 100644 index 0000000000..3a0b399117 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.rgba-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.rgba-1</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'; +try { ctx.fillStyle = 'rgba(100%, 0, 0, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-1.worker.js new file mode 100644 index 0000000000..efd7640594 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.rgba-1 +// 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'; +try { ctx.fillStyle = 'rgba(100%, 0, 0, 1)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-2.html new file mode 100644 index 0000000000..28a2180520 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.rgba-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.rgba-2</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'; +try { ctx.fillStyle = 'rgba(255, 0, 0, 1. 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-2.worker.js new file mode 100644 index 0000000000..dfdafb1a7e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.rgba-2 +// 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'; +try { ctx.fillStyle = 'rgba(255, 0, 0, 1. 0)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-3.html new file mode 100644 index 0000000000..d9ad0be5e5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.rgba-3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.rgba-3</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'; +try { ctx.fillStyle = 'rgba(255, 0, 0, 1.)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-3.worker.js new file mode 100644 index 0000000000..1dca0eb9b1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.rgba-3 +// 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'; +try { ctx.fillStyle = 'rgba(255, 0, 0, 1.)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-4.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-4.html new file mode 100644 index 0000000000..db71a88e70 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-4.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.rgba-4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.rgba-4</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'; +try { ctx.fillStyle = 'rgba(255, 0, 0, '; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-4.worker.js new file mode 100644 index 0000000000..dff64ba907 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-4.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.rgba-4 +// 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'; +try { ctx.fillStyle = 'rgba(255, 0, 0, '; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-5.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-5.html new file mode 100644 index 0000000000..00e7791bcb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-5.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.invalid.rgba-5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.invalid.rgba-5</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'; +try { ctx.fillStyle = 'rgba(255, 0, 0, 1,)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-5.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-5.worker.js new file mode 100644 index 0000000000..80a65dcbc2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.invalid.rgba-5.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.invalid.rgba-5 +// 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'; +try { ctx.fillStyle = 'rgba(255, 0, 0, 1,)'; } catch (e) { } // this shouldn't throw, but it shouldn't matter here if it does +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-1.html new file mode 100644 index 0000000000..ce03f7b840 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.rgb-clamp-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.rgb-clamp-1</h1> +<p class="desc"></p> + +<p class="notes">Assumes colors are clamped to [0,255]. +<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.fillStyle = 'rgb(-1000, 1000, -1000)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-1.worker.js new file mode 100644 index 0000000000..48cf6a72f5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.rgb-clamp-1 +// Description: +// Note:<p class="notes">Assumes colors are clamped to [0,255]. + +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.fillStyle = 'rgb(-1000, 1000, -1000)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-2.html new file mode 100644 index 0000000000..e4f9260ec6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.rgb-clamp-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.rgb-clamp-2</h1> +<p class="desc"></p> + +<p class="notes">Assumes colors are clamped to [0,255]. +<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.fillStyle = 'rgb(-200%, 200%, -200%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-2.worker.js new file mode 100644 index 0000000000..70adec462a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.rgb-clamp-2 +// Description: +// Note:<p class="notes">Assumes colors are clamped to [0,255]. + +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.fillStyle = 'rgb(-200%, 200%, -200%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-3.html new file mode 100644 index 0000000000..73bbc00d1e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.rgb-clamp-3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.rgb-clamp-3</h1> +<p class="desc"></p> + +<p class="notes">Assumes colors are clamped to [0,255]. +<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.fillStyle = 'rgb(-2147483649, 4294967298, -18446744073709551619)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-3.worker.js new file mode 100644 index 0000000000..883328b42d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.rgb-clamp-3 +// Description: +// Note:<p class="notes">Assumes colors are clamped to [0,255]. + +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.fillStyle = 'rgb(-2147483649, 4294967298, -18446744073709551619)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-4.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-4.html new file mode 100644 index 0000000000..1bdb70d68c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-4.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.rgb-clamp-4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.rgb-clamp-4</h1> +<p class="desc"></p> + +<p class="notes">Assumes colors are clamped to [0,255]. +<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.fillStyle = 'rgb(-1000000000000000000000000000000000000000, 1000000000000000000000000000000000000000, -1000000000000000000000000000000000000000)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-4.worker.js new file mode 100644 index 0000000000..ca5543ac9b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-4.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.rgb-clamp-4 +// Description: +// Note:<p class="notes">Assumes colors are clamped to [0,255]. + +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.fillStyle = 'rgb(-1000000000000000000000000000000000000000, 1000000000000000000000000000000000000000, -1000000000000000000000000000000000000000)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-5.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-5.html new file mode 100644 index 0000000000..880ad046e1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-5.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.rgb-clamp-5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.rgb-clamp-5</h1> +<p class="desc"></p> + +<p class="notes">Assumes colors are clamped to [0,255]. +<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.fillStyle = 'rgb(-10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, -10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-5.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-5.worker.js new file mode 100644 index 0000000000..41f8799f40 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-clamp-5.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.rgb-clamp-5 +// Description: +// Note:<p class="notes">Assumes colors are clamped to [0,255]. + +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.fillStyle = 'rgb(-10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, -10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-eof.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-eof.html new file mode 100644 index 0000000000..9a84105dbc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-eof.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.rgb-eof</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.rgb-eof</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgb(0, 255, 0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-eof.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-eof.worker.js new file mode 100644 index 0000000000..39589937d5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-eof.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.rgb-eof +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgb(0, 255, 0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-num.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-num.html new file mode 100644 index 0000000000..6cda83e0a8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-num.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.rgb-num</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.rgb-num</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgb(0,255,0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-num.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-num.worker.js new file mode 100644 index 0000000000..229d6aec61 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-num.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.rgb-num +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgb(0,255,0)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-percent.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-percent.html new file mode 100644 index 0000000000..6f7125de0f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-percent.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.rgb-percent</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.rgb-percent</h1> +<p class="desc"></p> + +<p class="notes">CSS3 Color says "The integer value 255 corresponds to 100%". (In particular, it is not 254...) +<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.fillStyle = 'rgb(0% ,100% ,0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-percent.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-percent.worker.js new file mode 100644 index 0000000000..4ba5c987e5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgb-percent.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.rgb-percent +// Description: +// Note:<p class="notes">CSS3 Color says "The integer value 255 corresponds to 100%". (In particular, it is not 254...) + +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.fillStyle = 'rgb(0% ,100% ,0%)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-clamp-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-clamp-1.html new file mode 100644 index 0000000000..1cf20f7898 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-clamp-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.rgba-clamp-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.rgba-clamp-1</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgba(0, 255, 0, -2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-clamp-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-clamp-1.worker.js new file mode 100644 index 0000000000..9ba73e22eb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-clamp-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.rgba-clamp-1 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgba(0, 255, 0, -2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-clamp-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-clamp-2.html new file mode 100644 index 0000000000..c8b4844ae6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-clamp-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.rgba-clamp-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.rgba-clamp-2</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgba(0, 255, 0, 2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-clamp-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-clamp-2.worker.js new file mode 100644 index 0000000000..fd1c53a733 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-clamp-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.rgba-clamp-2 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgba(0, 255, 0, 2)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-eof.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-eof.html new file mode 100644 index 0000000000..d3fd3df2e4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-eof.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.rgba-eof</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.rgba-eof</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgba(0, 255, 0, 1'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-eof.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-eof.worker.js new file mode 100644 index 0000000000..6e51f09b5f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-eof.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.rgba-eof +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgba(0, 255, 0, 1'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-1.html new file mode 100644 index 0000000000..1ce69821ae --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.rgba-num-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.rgba-num-1</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgba( 0 , 255 , 0 , .499 )'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,127); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-1.worker.js new file mode 100644 index 0000000000..2805af6e05 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.rgba-num-1 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgba( 0 , 255 , 0 , .499 )'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,127); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-2.html new file mode 100644 index 0000000000..979eff66b2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.rgba-num-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.rgba-num-2</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgba( 0 , 255 , 0 , 0.499 )'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,127); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-2.worker.js new file mode 100644 index 0000000000..2ed1549240 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-num-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.rgba-num-2 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgba( 0 , 255 , 0 , 0.499 )'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,127); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-percent.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-percent.html new file mode 100644 index 0000000000..2c737e21c1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-percent.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.rgba-percent</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.rgba-percent</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgba(0%,100%,0%,0.499)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,127); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-percent.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-percent.worker.js new file mode 100644 index 0000000000..5852ea3eb1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-percent.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.rgba-percent +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgba(0%,100%,0%,0.499)'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,127); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-1.html new file mode 100644 index 0000000000..701b5efc79 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.rgba-solid-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.rgba-solid-1</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgba( 0 , 255 , 0 , 1 )'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-1.worker.js new file mode 100644 index 0000000000..51e6d77421 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.rgba-solid-1 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgba( 0 , 255 , 0 , 1 )'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-2.html new file mode 100644 index 0000000000..7280c10dd6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.rgba-solid-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.rgba-solid-2</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgba( 0 , 255 , 0 , 1.0 )'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-2.worker.js new file mode 100644 index 0000000000..4dcbd72aef --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.rgba-solid-2 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgba( 0 , 255 , 0 , 1.0 )'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-3.html new file mode 100644 index 0000000000..dfbb443973 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-3.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.rgba-solid-3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.rgba-solid-3</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgba( 0 , 255 , 0 , +1 )'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-3.worker.js new file mode 100644 index 0000000000..060fad9bb8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-3.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.rgba-solid-3 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgba( 0 , 255 , 0 , +1 )'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-4.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-4.html new file mode 100644 index 0000000000..131396c8d0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-4.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.rgba-solid-4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.rgba-solid-4</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'rgba( -0 , 255 , +0 , 1 )'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-4.worker.js new file mode 100644 index 0000000000..43a8cf8251 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.rgba-solid-4.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.rgba-solid-4 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'rgba( -0 , 255 , +0 , 1 )'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.svg-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.svg-1.html new file mode 100644 index 0000000000..ffcc525b48 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.svg-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.svg-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.svg-1</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'gray'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 128,128,128,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.svg-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.svg-1.worker.js new file mode 100644 index 0000000000..86b4f8175d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.svg-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.svg-1 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'gray'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 128,128,128,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.svg-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.svg-2.html new file mode 100644 index 0000000000..eafecd0e6d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.svg-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.svg-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.svg-2</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'grey'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 128,128,128,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.svg-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.svg-2.worker.js new file mode 100644 index 0000000000..3aa530508e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.svg-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.svg-2 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'grey'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 128,128,128,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.system.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.system.html new file mode 100644 index 0000000000..65a84a78ec --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.system.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.fillStyle.parse.system</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.system</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.fillStyle = 'ThreeDDarkShadow'; +assert_regexp_match(ctx.fillStyle, /^#(?!(FF0000|ff0000|f00)$)/); // test that it's not red +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.system.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.system.worker.js new file mode 100644 index 0000000000..8e21145823 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.system.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.system +// 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.fillStyle = 'ThreeDDarkShadow'; +assert_regexp_match(ctx.fillStyle, /^#(?!(FF0000|ff0000|f00)$)/); // test that it's not red +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.transparent-1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.transparent-1.html new file mode 100644 index 0000000000..98da0c29cd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.transparent-1.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.transparent-1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.transparent-1</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'transparent'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.transparent-1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.transparent-1.worker.js new file mode 100644 index 0000000000..a934b66c8c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.transparent-1.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.transparent-1 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'transparent'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.transparent-2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.transparent-2.html new file mode 100644 index 0000000000..cfebe8fc1d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.transparent-2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.fillStyle.parse.transparent-2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.parse.transparent-2</h1> +<p class="desc"></p> + +<p class="notes"> +<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.fillStyle = 'TrAnSpArEnT'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.transparent-2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.transparent-2.worker.js new file mode 100644 index 0000000000..e577bf55dd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.parse.transparent-2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.fillStyle.parse.transparent-2 +// Description: +// Note:<p class="notes"> + +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.fillStyle = 'TrAnSpArEnT'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.toStringFunctionCallback.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.toStringFunctionCallback.html new file mode 100644 index 0000000000..70eb6b1a26 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.toStringFunctionCallback.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.fillStyle.toStringFunctionCallback</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.fillStyle.toStringFunctionCallback</h1> +<p class="desc">Passing a function in to ctx.fillStyle or ctx.strokeStyle with a toString callback works as specified</p> + + +<script> +var t = async_test("Passing a function in to ctx.fillStyle or ctx.strokeStyle with a toString callback works as specified"); +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 = { toString: function() { return "#008000"; } }; +_assertSame(ctx.fillStyle, "#008000", "ctx.fillStyle", "\"#008000\""); +ctx.fillStyle = {}; +_assertSame(ctx.fillStyle, "#008000", "ctx.fillStyle", "\"#008000\""); +ctx.fillStyle = 800000; +_assertSame(ctx.fillStyle, "#008000", "ctx.fillStyle", "\"#008000\""); +assert_throws_js(TypeError, function() { ctx.fillStyle = { toString: function() { throw new TypeError; } }; }); +ctx.strokeStyle = { toString: function() { return "#008000"; } }; +_assertSame(ctx.strokeStyle, "#008000", "ctx.strokeStyle", "\"#008000\""); +ctx.strokeStyle = {}; +_assertSame(ctx.strokeStyle, "#008000", "ctx.strokeStyle", "\"#008000\""); +ctx.strokeStyle = 800000; +_assertSame(ctx.strokeStyle, "#008000", "ctx.strokeStyle", "\"#008000\""); +assert_throws_js(TypeError, function() { ctx.strokeStyle = { toString: function() { throw new TypeError; } }; }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.toStringFunctionCallback.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.toStringFunctionCallback.worker.js new file mode 100644 index 0000000000..68ae0a5da2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.fillStyle.toStringFunctionCallback.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.fillStyle.toStringFunctionCallback +// Description:Passing a function in to ctx.fillStyle or ctx.strokeStyle with a toString callback works as specified +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Passing a function in to ctx.fillStyle or ctx.strokeStyle with a toString callback works as specified"); +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 = { toString: function() { return "#008000"; } }; +_assertSame(ctx.fillStyle, "#008000", "ctx.fillStyle", "\"#008000\""); +ctx.fillStyle = {}; +_assertSame(ctx.fillStyle, "#008000", "ctx.fillStyle", "\"#008000\""); +ctx.fillStyle = 800000; +_assertSame(ctx.fillStyle, "#008000", "ctx.fillStyle", "\"#008000\""); +assert_throws_js(TypeError, function() { ctx.fillStyle = { toString: function() { throw new TypeError; } }; }); +ctx.strokeStyle = { toString: function() { return "#008000"; } }; +_assertSame(ctx.strokeStyle, "#008000", "ctx.strokeStyle", "\"#008000\""); +ctx.strokeStyle = {}; +_assertSame(ctx.strokeStyle, "#008000", "ctx.strokeStyle", "\"#008000\""); +ctx.strokeStyle = 800000; +_assertSame(ctx.strokeStyle, "#008000", "ctx.strokeStyle", "\"#008000\""); +assert_throws_js(TypeError, function() { ctx.strokeStyle = { toString: function() { throw new TypeError; } }; }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.invalid.inputs.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.invalid.inputs.html new file mode 100644 index 0000000000..3d1f21ec05 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.invalid.inputs.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.gradient.conic.invalid.inputs</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.conic.invalid.inputs</h1> +<p class="desc">Conic gradient function with invalid inputs</p> + + +<script> +var t = async_test("Conic gradient function with invalid inputs"); +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'); + +assert_throws_js(TypeError, function() { ctx.createConicGradient(Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(-Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(NaN, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(0, -Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(0, NaN, 1); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(0, 0, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(0, 0, NaN); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(0, Infinity, Infinity); }); + +const g = ctx.createConicGradient(0, 0, 25); +assert_throws_js(TypeError, function() { g.addColorStop(-Infinity, '#f00'); }); +assert_throws_js(TypeError, function() { g.addColorStop(NaN, '#f00'); }); +assert_throws_dom("SYNTAX_ERR", function() { g.addColorStop(0, -Infinity); }); +assert_throws_dom("SYNTAX_ERR", function() { g.addColorStop(0, NaN); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.invalid.inputs.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.invalid.inputs.worker.js new file mode 100644 index 0000000000..b6bd62cbb7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.invalid.inputs.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.gradient.conic.invalid.inputs +// Description:Conic gradient function with invalid inputs +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Conic gradient function with invalid inputs"); +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'); + +assert_throws_js(TypeError, function() { ctx.createConicGradient(Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(-Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(NaN, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(0, -Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(0, NaN, 1); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(0, 0, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(0, 0, NaN); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createConicGradient(0, Infinity, Infinity); }); + +const g = ctx.createConicGradient(0, 0, 25); +assert_throws_js(TypeError, function() { g.addColorStop(-Infinity, '#f00'); }); +assert_throws_js(TypeError, function() { g.addColorStop(NaN, '#f00'); }); +assert_throws_dom("SYNTAX_ERR", function() { g.addColorStop(0, -Infinity); }); +assert_throws_dom("SYNTAX_ERR", function() { g.addColorStop(0, NaN); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.negative.rotation.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.negative.rotation.html new file mode 100644 index 0000000000..dde54400e2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.negative.rotation.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.conic.negative.rotation</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.conic.negative.rotation</h1> +<p class="desc">Conic gradient with negative rotation</p> + + +<script> +var t = async_test("Conic gradient with negative rotation"); +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'); + +const g = ctx.createConicGradient(-Math.PI/2, 50, 25); +// It's red in the upper right region and green on the lower left region +g.addColorStop(0, "#f00"); +g.addColorStop(0.25, "#0f0"); +g.addColorStop(0.50, "#0f0"); +g.addColorStop(0.75, "#f00"); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 25,15, 255,0,0,255, 3); +_assertPixelApprox(canvas, 75,40, 0,255,0,255, 3); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.negative.rotation.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.negative.rotation.worker.js new file mode 100644 index 0000000000..68589cfab5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.negative.rotation.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.gradient.conic.negative.rotation +// Description:Conic gradient with negative rotation +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Conic gradient with negative rotation"); +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'); + +const g = ctx.createConicGradient(-Math.PI/2, 50, 25); +// It's red in the upper right region and green on the lower left region +g.addColorStop(0, "#f00"); +g.addColorStop(0.25, "#0f0"); +g.addColorStop(0.50, "#0f0"); +g.addColorStop(0.75, "#f00"); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 25,15, 255,0,0,255, 3); +_assertPixelApprox(canvas, 75,40, 0,255,0,255, 3); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.positive.rotation.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.positive.rotation.html new file mode 100644 index 0000000000..42d5a87af4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.positive.rotation.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.conic.positive.rotation</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.conic.positive.rotation</h1> +<p class="desc">Conic gradient with positive rotation</p> + + +<script> +var t = async_test("Conic gradient with positive rotation"); +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'); + +const g = ctx.createConicGradient(3*Math.PI/2, 50, 25); +// It's red in the upper right region and green on the lower left region +g.addColorStop(0, "#f00"); +g.addColorStop(0.25, "#0f0"); +g.addColorStop(0.50, "#0f0"); +g.addColorStop(0.75, "#f00"); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 25,15, 255,0,0,255, 3); +_assertPixelApprox(canvas, 75,40, 0,255,0,255, 3); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.positive.rotation.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.positive.rotation.worker.js new file mode 100644 index 0000000000..cece603ddb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.positive.rotation.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.gradient.conic.positive.rotation +// Description:Conic gradient with positive rotation +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Conic gradient with positive rotation"); +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'); + +const g = ctx.createConicGradient(3*Math.PI/2, 50, 25); +// It's red in the upper right region and green on the lower left region +g.addColorStop(0, "#f00"); +g.addColorStop(0.25, "#0f0"); +g.addColorStop(0.50, "#0f0"); +g.addColorStop(0.75, "#f00"); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 25,15, 255,0,0,255, 3); +_assertPixelApprox(canvas, 75,40, 0,255,0,255, 3); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.empty.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.empty.html new file mode 100644 index 0000000000..93229d93f5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.empty.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.empty</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.empty</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); +var g = ctx.createLinearGradient(0, 0, 0, 50); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.empty.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.empty.worker.js new file mode 100644 index 0000000000..207a1b0cab --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.empty.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.empty +// 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); +var g = ctx.createLinearGradient(0, 0, 0, 50); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.alpha.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.alpha.html new file mode 100644 index 0000000000..52c11fcbfd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.alpha.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.interpolate.alpha</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.interpolate.alpha</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 = '#ff0'; +ctx.fillRect(0, 0, 100, 50); +var g = ctx.createLinearGradient(0, 0, 100, 0); +g.addColorStop(0, 'rgba(0,0,255, 0)'); +g.addColorStop(1, 'rgba(0,0,255, 1)'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 25,25, 191,191,63,255, 3); +_assertPixelApprox(canvas, 50,25, 127,127,127,255, 3); +_assertPixelApprox(canvas, 75,25, 63,63,191,255, 3); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.alpha.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.alpha.worker.js new file mode 100644 index 0000000000..d9f08a9bed --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.alpha.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.gradient.interpolate.alpha +// 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 = '#ff0'; +ctx.fillRect(0, 0, 100, 50); +var g = ctx.createLinearGradient(0, 0, 100, 0); +g.addColorStop(0, 'rgba(0,0,255, 0)'); +g.addColorStop(1, 'rgba(0,0,255, 1)'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 25,25, 191,191,63,255, 3); +_assertPixelApprox(canvas, 50,25, 127,127,127,255, 3); +_assertPixelApprox(canvas, 75,25, 63,63,191,255, 3); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.color.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.color.html new file mode 100644 index 0000000000..8f32781760 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.color.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.gradient.interpolate.color</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.interpolate.color</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'); + +var g = ctx.createLinearGradient(0, 0, 100, 0); +g.addColorStop(0, '#ff0'); +g.addColorStop(1, '#00f'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 25,25, 191,191,63,255, 3); +_assertPixelApprox(canvas, 50,25, 127,127,127,255, 3); +_assertPixelApprox(canvas, 75,25, 63,63,191,255, 3); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.color.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.color.worker.js new file mode 100644 index 0000000000..fcf1f84f37 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.color.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.interpolate.color +// 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'); + +var g = ctx.createLinearGradient(0, 0, 100, 0); +g.addColorStop(0, '#ff0'); +g.addColorStop(1, '#00f'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 25,25, 191,191,63,255, 3); +_assertPixelApprox(canvas, 50,25, 127,127,127,255, 3); +_assertPixelApprox(canvas, 75,25, 63,63,191,255, 3); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.coloralpha.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.coloralpha.html new file mode 100644 index 0000000000..0e7d3b5577 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.coloralpha.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.gradient.interpolate.coloralpha</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.interpolate.coloralpha</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'); + +var g = ctx.createLinearGradient(0, 0, 100, 0); +g.addColorStop(0, 'rgba(255,255,0, 0)'); +g.addColorStop(1, 'rgba(0,0,255, 1)'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 25,25, 190,190,65,65, 3); +_assertPixelApprox(canvas, 50,25, 126,126,128,128, 3); +_assertPixelApprox(canvas, 75,25, 62,62,192,192, 3); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.coloralpha.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.coloralpha.worker.js new file mode 100644 index 0000000000..cc1cc9f219 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.coloralpha.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.interpolate.coloralpha +// 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'); + +var g = ctx.createLinearGradient(0, 0, 100, 0); +g.addColorStop(0, 'rgba(255,255,0, 0)'); +g.addColorStop(1, 'rgba(0,0,255, 1)'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 25,25, 190,190,65,65, 3); +_assertPixelApprox(canvas, 50,25, 126,126,128,128, 3); +_assertPixelApprox(canvas, 75,25, 62,62,192,192, 3); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.multiple.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.multiple.html new file mode 100644 index 0000000000..724ae5c093 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.multiple.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.interpolate.multiple</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.interpolate.multiple</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'); + +canvas.width = 200; +var g = ctx.createLinearGradient(0, 0, 200, 0); +g.addColorStop(0, '#ff0'); +g.addColorStop(0.5, '#0ff'); +g.addColorStop(1, '#f0f'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 200, 50); +_assertPixelApprox(canvas, 50,25, 127,255,127,255, 3); +_assertPixelApprox(canvas, 100,25, 0,255,255,255, 3); +_assertPixelApprox(canvas, 150,25, 127,127,255,255, 3); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.multiple.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.multiple.worker.js new file mode 100644 index 0000000000..ff3687c1a9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.multiple.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.gradient.interpolate.multiple +// 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'); + +canvas.width = 200; +var g = ctx.createLinearGradient(0, 0, 200, 0); +g.addColorStop(0, '#ff0'); +g.addColorStop(0.5, '#0ff'); +g.addColorStop(1, '#f0f'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 200, 50); +_assertPixelApprox(canvas, 50,25, 127,255,127,255, 3); +_assertPixelApprox(canvas, 100,25, 0,255,255,255, 3); +_assertPixelApprox(canvas, 150,25, 127,127,255,255, 3); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.outside.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.outside.html new file mode 100644 index 0000000000..0ef97af879 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.outside.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.interpolate.outside</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.interpolate.outside</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); +var g = ctx.createLinearGradient(25, 0, 75, 0); +g.addColorStop(0.4, '#0f0'); +g.addColorStop(0.6, '#0f0'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 20,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 80,25, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.outside.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.outside.worker.js new file mode 100644 index 0000000000..60d10a59d8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.outside.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.gradient.interpolate.outside +// 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); +var g = ctx.createLinearGradient(25, 0, 75, 0); +g.addColorStop(0.4, '#0f0'); +g.addColorStop(0.6, '#0f0'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 20,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 80,25, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.overlap.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.overlap.html new file mode 100644 index 0000000000..77eb328ecf --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.overlap.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.gradient.interpolate.overlap</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.interpolate.overlap</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'); + +canvas.width = 200; +var g = ctx.createLinearGradient(0, 0, 200, 0); +g.addColorStop(0, '#f00'); +g.addColorStop(0, '#ff0'); +g.addColorStop(0.25, '#00f'); +g.addColorStop(0.25, '#0f0'); +g.addColorStop(0.25, '#0f0'); +g.addColorStop(0.25, '#0f0'); +g.addColorStop(0.25, '#ff0'); +g.addColorStop(0.5, '#00f'); +g.addColorStop(0.5, '#0f0'); +g.addColorStop(0.75, '#00f'); +g.addColorStop(0.75, '#f00'); +g.addColorStop(0.75, '#ff0'); +g.addColorStop(0.5, '#0f0'); +g.addColorStop(0.5, '#0f0'); +g.addColorStop(0.5, '#ff0'); +g.addColorStop(1, '#00f'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 200, 50); +_assertPixelApprox(canvas, 49,25, 0,0,255,255, 16); +_assertPixelApprox(canvas, 51,25, 255,255,0,255, 16); +_assertPixelApprox(canvas, 99,25, 0,0,255,255, 16); +_assertPixelApprox(canvas, 101,25, 255,255,0,255, 16); +_assertPixelApprox(canvas, 149,25, 0,0,255,255, 16); +_assertPixelApprox(canvas, 151,25, 255,255,0,255, 16); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.overlap.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.overlap.worker.js new file mode 100644 index 0000000000..e11c85f8d8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.overlap.worker.js @@ -0,0 +1,48 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.interpolate.overlap +// 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'); + +canvas.width = 200; +var g = ctx.createLinearGradient(0, 0, 200, 0); +g.addColorStop(0, '#f00'); +g.addColorStop(0, '#ff0'); +g.addColorStop(0.25, '#00f'); +g.addColorStop(0.25, '#0f0'); +g.addColorStop(0.25, '#0f0'); +g.addColorStop(0.25, '#0f0'); +g.addColorStop(0.25, '#ff0'); +g.addColorStop(0.5, '#00f'); +g.addColorStop(0.5, '#0f0'); +g.addColorStop(0.75, '#00f'); +g.addColorStop(0.75, '#f00'); +g.addColorStop(0.75, '#ff0'); +g.addColorStop(0.5, '#0f0'); +g.addColorStop(0.5, '#0f0'); +g.addColorStop(0.5, '#ff0'); +g.addColorStop(1, '#00f'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 200, 50); +_assertPixelApprox(canvas, 49,25, 0,0,255,255, 16); +_assertPixelApprox(canvas, 51,25, 255,255,0,255, 16); +_assertPixelApprox(canvas, 99,25, 0,0,255,255, 16); +_assertPixelApprox(canvas, 101,25, 255,255,0,255, 16); +_assertPixelApprox(canvas, 149,25, 0,0,255,255, 16); +_assertPixelApprox(canvas, 151,25, 255,255,0,255, 16); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.overlap2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.overlap2.html new file mode 100644 index 0000000000..662913b13f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.overlap2.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.gradient.interpolate.overlap2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.interpolate.overlap2</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'); + +var g = ctx.createLinearGradient(0, 0, 100, 0); +var ps = [ 0, 1/10, 1/4, 1/3, 1/2, 3/4, 1 ]; +for (var p = 0; p < ps.length; ++p) +{ + g.addColorStop(ps[p], '#0f0'); + for (var i = 0; i < 15; ++i) + g.addColorStop(ps[p], '#f00'); + g.addColorStop(ps[p], '#0f0'); +} +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 30,25, 0,255,0,255); +_assertPixel(canvas, 40,25, 0,255,0,255); +_assertPixel(canvas, 60,25, 0,255,0,255); +_assertPixel(canvas, 80,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.overlap2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.overlap2.worker.js new file mode 100644 index 0000000000..a6329af99a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.overlap2.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.gradient.interpolate.overlap2 +// 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'); + +var g = ctx.createLinearGradient(0, 0, 100, 0); +var ps = [ 0, 1/10, 1/4, 1/3, 1/2, 3/4, 1 ]; +for (var p = 0; p < ps.length; ++p) +{ + g.addColorStop(ps[p], '#0f0'); + for (var i = 0; i < 15; ++i) + g.addColorStop(ps[p], '#f00'); + g.addColorStop(ps[p], '#0f0'); +} +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 30,25, 0,255,0,255); +_assertPixel(canvas, 40,25, 0,255,0,255); +_assertPixel(canvas, 60,25, 0,255,0,255); +_assertPixel(canvas, 80,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.solid.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.solid.html new file mode 100644 index 0000000000..aa488d9412 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.solid.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.interpolate.solid</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.interpolate.solid</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'); + +var g = ctx.createLinearGradient(0, 0, 100, 0); +g.addColorStop(0, '#0f0'); +g.addColorStop(1, '#0f0'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.solid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.solid.worker.js new file mode 100644 index 0000000000..8cc4a88d98 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.solid.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.interpolate.solid +// 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'); + +var g = ctx.createLinearGradient(0, 0, 100, 0); +g.addColorStop(0, '#0f0'); +g.addColorStop(1, '#0f0'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.vertical.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.vertical.html new file mode 100644 index 0000000000..15c4c7c39e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.vertical.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.gradient.interpolate.vertical</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.interpolate.vertical</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'); + +var g = ctx.createLinearGradient(0, 0, 0, 50); +g.addColorStop(0, '#ff0'); +g.addColorStop(1, '#00f'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,12, 191,191,63,255, 10); +_assertPixelApprox(canvas, 50,25, 127,127,127,255, 5); +_assertPixelApprox(canvas, 50,37, 63,63,191,255, 10); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.vertical.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.vertical.worker.js new file mode 100644 index 0000000000..a25692cf42 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.vertical.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.interpolate.vertical +// 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'); + +var g = ctx.createLinearGradient(0, 0, 0, 50); +g.addColorStop(0, '#ff0'); +g.addColorStop(1, '#00f'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,12, 191,191,63,255, 10); +_assertPixelApprox(canvas, 50,25, 127,127,127,255, 5); +_assertPixelApprox(canvas, 50,37, 63,63,191,255, 10); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.fill.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.fill.html new file mode 100644 index 0000000000..b679d5b83d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.fill.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.interpolate.zerosize.fill</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.interpolate.zerosize.fill</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); +var g = ctx.createLinearGradient(50, 25, 50, 25); // zero-length line (undefined direction) +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.rect(0, 0, 100, 50); +ctx.fill(); +_assertPixel(canvas, 40,20, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.fill.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.fill.worker.js new file mode 100644 index 0000000000..71df9674ce --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.fill.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.interpolate.zerosize.fill +// 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); +var g = ctx.createLinearGradient(50, 25, 50, 25); // zero-length line (undefined direction) +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.rect(0, 0, 100, 50); +ctx.fill(); +_assertPixel(canvas, 40,20, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.fillRect.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.fillRect.html new file mode 100644 index 0000000000..9576f2a99e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.fillRect.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.gradient.interpolate.zerosize.fillRect</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.interpolate.zerosize.fillRect</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); +var g = ctx.createLinearGradient(50, 25, 50, 25); // zero-length line (undefined direction) +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 40,20, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.fillRect.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.fillRect.worker.js new file mode 100644 index 0000000000..b6dfbf081c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.fillRect.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.interpolate.zerosize.fillRect +// 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); +var g = ctx.createLinearGradient(50, 25, 50, 25); // zero-length line (undefined direction) +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 40,20, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.stroke.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.stroke.html new file mode 100644 index 0000000000..81a5e4e35d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.stroke.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.gradient.interpolate.zerosize.stroke</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.interpolate.zerosize.stroke</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); +var g = ctx.createLinearGradient(50, 25, 50, 25); // zero-length line (undefined direction) +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.strokeStyle = g; +ctx.rect(20, 20, 60, 10); +ctx.stroke(); +_assertPixel(canvas, 19,19, 0,255,0,255); +_assertPixel(canvas, 20,19, 0,255,0,255); +_assertPixel(canvas, 21,19, 0,255,0,255); +_assertPixel(canvas, 19,20, 0,255,0,255); +_assertPixel(canvas, 20,20, 0,255,0,255); +_assertPixel(canvas, 21,20, 0,255,0,255); +_assertPixel(canvas, 19,21, 0,255,0,255); +_assertPixel(canvas, 20,21, 0,255,0,255); +_assertPixel(canvas, 21,21, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.stroke.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.stroke.worker.js new file mode 100644 index 0000000000..c8744645a0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.stroke.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.gradient.interpolate.zerosize.stroke +// 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); +var g = ctx.createLinearGradient(50, 25, 50, 25); // zero-length line (undefined direction) +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.strokeStyle = g; +ctx.rect(20, 20, 60, 10); +ctx.stroke(); +_assertPixel(canvas, 19,19, 0,255,0,255); +_assertPixel(canvas, 20,19, 0,255,0,255); +_assertPixel(canvas, 21,19, 0,255,0,255); +_assertPixel(canvas, 19,20, 0,255,0,255); +_assertPixel(canvas, 20,20, 0,255,0,255); +_assertPixel(canvas, 21,20, 0,255,0,255); +_assertPixel(canvas, 19,21, 0,255,0,255); +_assertPixel(canvas, 20,21, 0,255,0,255); +_assertPixel(canvas, 21,21, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.strokeRect.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.strokeRect.html new file mode 100644 index 0000000000..91cedc7069 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.strokeRect.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.gradient.interpolate.zerosize.strokeRect</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.interpolate.zerosize.strokeRect</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); +var g = ctx.createLinearGradient(50, 25, 50, 25); // zero-length line (undefined direction) +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.strokeStyle = g; +ctx.strokeRect(20, 20, 60, 10); +_assertPixel(canvas, 19,19, 0,255,0,255); +_assertPixel(canvas, 20,19, 0,255,0,255); +_assertPixel(canvas, 21,19, 0,255,0,255); +_assertPixel(canvas, 19,20, 0,255,0,255); +_assertPixel(canvas, 20,20, 0,255,0,255); +_assertPixel(canvas, 21,20, 0,255,0,255); +_assertPixel(canvas, 19,21, 0,255,0,255); +_assertPixel(canvas, 20,21, 0,255,0,255); +_assertPixel(canvas, 21,21, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.strokeRect.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.strokeRect.worker.js new file mode 100644 index 0000000000..0949fc8a19 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.interpolate.zerosize.strokeRect.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.gradient.interpolate.zerosize.strokeRect +// 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); +var g = ctx.createLinearGradient(50, 25, 50, 25); // zero-length line (undefined direction) +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.strokeStyle = g; +ctx.strokeRect(20, 20, 60, 10); +_assertPixel(canvas, 19,19, 0,255,0,255); +_assertPixel(canvas, 20,19, 0,255,0,255); +_assertPixel(canvas, 21,19, 0,255,0,255); +_assertPixel(canvas, 19,20, 0,255,0,255); +_assertPixel(canvas, 20,20, 0,255,0,255); +_assertPixel(canvas, 21,20, 0,255,0,255); +_assertPixel(canvas, 19,21, 0,255,0,255); +_assertPixel(canvas, 20,21, 0,255,0,255); +_assertPixel(canvas, 21,21, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.nonfinite.html new file mode 100644 index 0000000000..f3c4209be7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.nonfinite.html @@ -0,0 +1,49 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.linear.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.linear.nonfinite</h1> +<p class="desc">createLinearGradient() throws TypeError if arguments are not finite</p> + + +<script> +var t = async_test("createLinearGradient() throws TypeError if arguments are not finite"); +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'); + +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(-Infinity, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(NaN, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, -Infinity, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, NaN, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, -Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, NaN, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1, NaN); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, Infinity, Infinity); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.nonfinite.worker.js new file mode 100644 index 0000000000..9fefcc3215 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.nonfinite.worker.js @@ -0,0 +1,45 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.linear.nonfinite +// Description:createLinearGradient() throws TypeError if arguments are not finite +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("createLinearGradient() throws TypeError if arguments are not finite"); +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'); + +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(-Infinity, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(NaN, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, -Infinity, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, NaN, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, -Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, NaN, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1, NaN); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, Infinity, Infinity); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.transform.1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.transform.1.html new file mode 100644 index 0000000000..5e79107907 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.transform.1.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.gradient.linear.transform.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.linear.transform.1</h1> +<p class="desc">Linear gradient coordinates are relative to the coordinate space at the time of filling</p> + + +<script> +var t = async_test("Linear gradient coordinates are relative to the coordinate space at the time of filling"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var g = ctx.createLinearGradient(0, 0, 200, 0); +g.addColorStop(0, '#f00'); +g.addColorStop(0.25, '#0f0'); +g.addColorStop(0.75, '#0f0'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.translate(-50, 0); +ctx.fillRect(50, 0, 100, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.transform.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.transform.1.worker.js new file mode 100644 index 0000000000..62a96e2f67 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.transform.1.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.linear.transform.1 +// Description:Linear gradient coordinates are relative to the coordinate space at the time of filling +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Linear gradient coordinates are relative to the coordinate space at the time of filling"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var g = ctx.createLinearGradient(0, 0, 200, 0); +g.addColorStop(0, '#f00'); +g.addColorStop(0.25, '#0f0'); +g.addColorStop(0.75, '#0f0'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.translate(-50, 0); +ctx.fillRect(50, 0, 100, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.transform.2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.transform.2.html new file mode 100644 index 0000000000..86fb507334 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.transform.2.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.linear.transform.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.linear.transform.2</h1> +<p class="desc">Linear gradient coordinates are relative to the coordinate space at the time of filling</p> + + +<script> +var t = async_test("Linear gradient coordinates are relative to the coordinate space at the time of filling"); +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.translate(100, 0); +var g = ctx.createLinearGradient(0, 0, 200, 0); +g.addColorStop(0, '#f00'); +g.addColorStop(0.25, '#0f0'); +g.addColorStop(0.75, '#0f0'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.translate(-150, 0); +ctx.fillRect(50, 0, 100, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.transform.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.transform.2.worker.js new file mode 100644 index 0000000000..dace251811 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.transform.2.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.linear.transform.2 +// Description:Linear gradient coordinates are relative to the coordinate space at the time of filling +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Linear gradient coordinates are relative to the coordinate space at the time of filling"); +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.translate(100, 0); +var g = ctx.createLinearGradient(0, 0, 200, 0); +g.addColorStop(0, '#f00'); +g.addColorStop(0.25, '#0f0'); +g.addColorStop(0.75, '#0f0'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.translate(-150, 0); +ctx.fillRect(50, 0, 100, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.transform.3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.transform.3.html new file mode 100644 index 0000000000..ccbc3ab283 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.transform.3.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.linear.transform.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.linear.transform.3</h1> +<p class="desc">Linear gradient transforms do not experience broken caching effects</p> + + +<script> +var t = async_test("Linear gradient transforms do not experience broken caching effects"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var g = ctx.createLinearGradient(0, 0, 200, 0); +g.addColorStop(0, '#f00'); +g.addColorStop(0.25, '#0f0'); +g.addColorStop(0.75, '#0f0'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +ctx.translate(-50, 0); +ctx.fillRect(50, 0, 100, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.transform.3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.transform.3.worker.js new file mode 100644 index 0000000000..8f5a7115ec --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.linear.transform.3.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.linear.transform.3 +// Description:Linear gradient transforms do not experience broken caching effects +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Linear gradient transforms do not experience broken caching effects"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var g = ctx.createLinearGradient(0, 0, 200, 0); +g.addColorStop(0, '#f00'); +g.addColorStop(0.25, '#0f0'); +g.addColorStop(0.75, '#0f0'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +ctx.translate(-50, 0); +ctx.fillRect(50, 0, 100, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.compare.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.compare.html new file mode 100644 index 0000000000..a091c32b2c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.compare.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.object.compare</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.object.compare</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'); + +var g1 = ctx.createLinearGradient(0, 0, 100, 0); +var g2 = ctx.createLinearGradient(0, 0, 100, 0); +_assertDifferent(g1, g2, "g1", "g2"); +ctx.fillStyle = g1; +_assertSame(ctx.fillStyle, g1, "ctx.fillStyle", "g1"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.compare.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.compare.worker.js new file mode 100644 index 0000000000..6c69e1ad35 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.compare.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.object.compare +// 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'); + +var g1 = ctx.createLinearGradient(0, 0, 100, 0); +var g2 = ctx.createLinearGradient(0, 0, 100, 0); +_assertDifferent(g1, g2, "g1", "g2"); +ctx.fillStyle = g1; +_assertSame(ctx.fillStyle, g1, "ctx.fillStyle", "g1"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.crosscanvas.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.crosscanvas.html new file mode 100644 index 0000000000..8d54f95f72 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.crosscanvas.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.object.crosscanvas</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.object.crosscanvas</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); +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var g = offscreenCanvas2.getContext('2d').createLinearGradient(0, 0, 100, 0); +g.addColorStop(0, '#0f0'); +g.addColorStop(1, '#0f0'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.crosscanvas.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.crosscanvas.worker.js new file mode 100644 index 0000000000..fa8cee44ca --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.crosscanvas.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.object.crosscanvas +// 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); +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var g = offscreenCanvas2.getContext('2d').createLinearGradient(0, 0, 100, 0); +g.addColorStop(0, '#0f0'); +g.addColorStop(1, '#0f0'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.invalidcolor.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.invalidcolor.html new file mode 100644 index 0000000000..e812278155 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.invalidcolor.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.object.invalidcolor</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.object.invalidcolor</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'); + +var g = ctx.createLinearGradient(0, 0, 100, 0); +assert_throws_dom("SYNTAX_ERR", function() { g.addColorStop(0, ""); }); +assert_throws_dom("SYNTAX_ERR", function() { g.addColorStop(0, 'null'); }); +assert_throws_dom("SYNTAX_ERR", function() { g.addColorStop(0, 'undefined'); }); +assert_throws_dom("SYNTAX_ERR", function() { g.addColorStop(0, null); }); +assert_throws_dom("SYNTAX_ERR", function() { g.addColorStop(0, undefined); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.invalidcolor.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.invalidcolor.worker.js new file mode 100644 index 0000000000..278df5a0d1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.invalidcolor.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.object.invalidcolor +// 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'); + +var g = ctx.createLinearGradient(0, 0, 100, 0); +assert_throws_dom("SYNTAX_ERR", function() { g.addColorStop(0, ""); }); +assert_throws_dom("SYNTAX_ERR", function() { g.addColorStop(0, 'null'); }); +assert_throws_dom("SYNTAX_ERR", function() { g.addColorStop(0, 'undefined'); }); +assert_throws_dom("SYNTAX_ERR", function() { g.addColorStop(0, null); }); +assert_throws_dom("SYNTAX_ERR", function() { g.addColorStop(0, undefined); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.invalidoffset.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.invalidoffset.html new file mode 100644 index 0000000000..bba405069c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.invalidoffset.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.object.invalidoffset</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.object.invalidoffset</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'); + +var g = ctx.createLinearGradient(0, 0, 100, 0); +assert_throws_dom("INDEX_SIZE_ERR", function() { g.addColorStop(-1, '#000'); }); +assert_throws_dom("INDEX_SIZE_ERR", function() { g.addColorStop(2, '#000'); }); +assert_throws_js(TypeError, function() { g.addColorStop(Infinity, '#000'); }); +assert_throws_js(TypeError, function() { g.addColorStop(-Infinity, '#000'); }); +assert_throws_js(TypeError, function() { g.addColorStop(NaN, '#000'); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.invalidoffset.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.invalidoffset.worker.js new file mode 100644 index 0000000000..f71c8402eb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.invalidoffset.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.object.invalidoffset +// 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'); + +var g = ctx.createLinearGradient(0, 0, 100, 0); +assert_throws_dom("INDEX_SIZE_ERR", function() { g.addColorStop(-1, '#000'); }); +assert_throws_dom("INDEX_SIZE_ERR", function() { g.addColorStop(2, '#000'); }); +assert_throws_js(TypeError, function() { g.addColorStop(Infinity, '#000'); }); +assert_throws_js(TypeError, function() { g.addColorStop(-Infinity, '#000'); }); +assert_throws_js(TypeError, function() { g.addColorStop(NaN, '#000'); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.update.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.update.html new file mode 100644 index 0000000000..05f8e747f2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.update.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.gradient.object.update</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.object.update</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'); + +var g = ctx.createLinearGradient(-100, 0, 200, 0); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +g.addColorStop(0.1, '#0f0'); +g.addColorStop(0.9, '#0f0'); +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.update.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.update.worker.js new file mode 100644 index 0000000000..5960d0afe9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.object.update.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.object.update +// 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'); + +var g = ctx.createLinearGradient(-100, 0, 200, 0); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +g.addColorStop(0.1, '#0f0'); +g.addColorStop(0.9, '#0f0'); +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.behind.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.behind.html new file mode 100644 index 0000000000..537f960d8d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.behind.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.gradient.radial.cone.behind</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.cone.behind</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); +var g = ctx.createRadialGradient(120, 25, 10, 211, 25, 100); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.behind.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.behind.worker.js new file mode 100644 index 0000000000..99711c732d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.behind.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.gradient.radial.cone.behind +// 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); +var g = ctx.createRadialGradient(120, 25, 10, 211, 25, 100); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.beside.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.beside.html new file mode 100644 index 0000000000..360f1ab735 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.beside.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.gradient.radial.cone.beside</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.cone.beside</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); +var g = ctx.createRadialGradient(0, 100, 40, 100, 100, 50); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.beside.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.beside.worker.js new file mode 100644 index 0000000000..6af48259a3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.beside.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.gradient.radial.cone.beside +// 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); +var g = ctx.createRadialGradient(0, 100, 40, 100, 100, 50); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.bottom.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.bottom.html new file mode 100644 index 0000000000..3f3690381d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.bottom.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.gradient.radial.cone.bottom</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.cone.bottom</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); +var g = ctx.createRadialGradient(210, 25, 100, 230, 25, 101); +g.addColorStop(0, '#0f0'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.bottom.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.bottom.worker.js new file mode 100644 index 0000000000..2eca2d573e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.bottom.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.gradient.radial.cone.bottom +// 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); +var g = ctx.createRadialGradient(210, 25, 100, 230, 25, 101); +g.addColorStop(0, '#0f0'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.cylinder.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.cylinder.html new file mode 100644 index 0000000000..700740938c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.cylinder.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.gradient.radial.cone.cylinder</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.cone.cylinder</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); +var g = ctx.createRadialGradient(210, 25, 100, 230, 25, 100); +g.addColorStop(0, '#0f0'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.cylinder.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.cylinder.worker.js new file mode 100644 index 0000000000..25ff9b861d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.cylinder.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.gradient.radial.cone.cylinder +// 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); +var g = ctx.createRadialGradient(210, 25, 100, 230, 25, 100); +g.addColorStop(0, '#0f0'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.front.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.front.html new file mode 100644 index 0000000000..12f14ce005 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.front.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.gradient.radial.cone.front</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.cone.front</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); +var g = ctx.createRadialGradient(311, 25, 10, 210, 25, 100); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#0f0'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.front.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.front.worker.js new file mode 100644 index 0000000000..6053cb40d1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.front.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.gradient.radial.cone.front +// 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); +var g = ctx.createRadialGradient(311, 25, 10, 210, 25, 100); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#0f0'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.shape1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.shape1.html new file mode 100644 index 0000000000..242aaa0128 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.shape1.html @@ -0,0 +1,49 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.radial.cone.shape1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.cone.shape1</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'); + +var tol = 1; // tolerance to avoid antialiasing artifacts +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(30+tol, 40); +ctx.lineTo(110, -20+tol); +ctx.lineTo(110, 100-tol); +ctx.fill(); +var g = ctx.createRadialGradient(30+10*5/2, 40, 10*3/2, 30+10*15/4, 40, 10*9/4); +g.addColorStop(0, '#0f0'); +g.addColorStop(1, '#0f0'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.shape1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.shape1.worker.js new file mode 100644 index 0000000000..15e7a6f696 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.shape1.worker.js @@ -0,0 +1,45 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.radial.cone.shape1 +// 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'); + +var tol = 1; // tolerance to avoid antialiasing artifacts +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(30+tol, 40); +ctx.lineTo(110, -20+tol); +ctx.lineTo(110, 100-tol); +ctx.fill(); +var g = ctx.createRadialGradient(30+10*5/2, 40, 10*3/2, 30+10*15/4, 40, 10*9/4); +g.addColorStop(0, '#0f0'); +g.addColorStop(1, '#0f0'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.shape2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.shape2.html new file mode 100644 index 0000000000..d51a132f82 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.shape2.html @@ -0,0 +1,49 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.radial.cone.shape2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.cone.shape2</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'); + +var tol = 1; // tolerance to avoid antialiasing artifacts +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +var g = ctx.createRadialGradient(30+10*5/2, 40, 10*3/2, 30+10*15/4, 40, 10*9/4); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(30-tol, 40); +ctx.lineTo(110, -20-tol); +ctx.lineTo(110, 100+tol); +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.shape2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.shape2.worker.js new file mode 100644 index 0000000000..793d2513dd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.shape2.worker.js @@ -0,0 +1,45 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.radial.cone.shape2 +// 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'); + +var tol = 1; // tolerance to avoid antialiasing artifacts +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +var g = ctx.createRadialGradient(30+10*5/2, 40, 10*3/2, 30+10*15/4, 40, 10*9/4); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(30-tol, 40); +ctx.lineTo(110, -20-tol); +ctx.lineTo(110, 100+tol); +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.top.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.top.html new file mode 100644 index 0000000000..9759eb3fa9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.top.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.gradient.radial.cone.top</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.cone.top</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); +var g = ctx.createRadialGradient(230, 25, 100, 100, 25, 101); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#0f0'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.top.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.top.worker.js new file mode 100644 index 0000000000..2ee6de3479 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.cone.top.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.gradient.radial.cone.top +// 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); +var g = ctx.createRadialGradient(230, 25, 100, 100, 25, 101); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#0f0'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.equal.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.equal.html new file mode 100644 index 0000000000..465ee976fa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.equal.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.gradient.radial.equal</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.equal</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); +var g = ctx.createRadialGradient(50, 25, 20, 50, 25, 20); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.equal.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.equal.worker.js new file mode 100644 index 0000000000..74567335b4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.equal.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.gradient.radial.equal +// 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); +var g = ctx.createRadialGradient(50, 25, 20, 50, 25, 20); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.inside1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.inside1.html new file mode 100644 index 0000000000..7c6fd31d67 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.inside1.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.gradient.radial.inside1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.inside1</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); +var g = ctx.createRadialGradient(50, 25, 100, 50, 25, 200); +g.addColorStop(0, '#0f0'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.inside1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.inside1.worker.js new file mode 100644 index 0000000000..6d73c0935a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.inside1.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.gradient.radial.inside1 +// 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); +var g = ctx.createRadialGradient(50, 25, 100, 50, 25, 200); +g.addColorStop(0, '#0f0'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.inside2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.inside2.html new file mode 100644 index 0000000000..fbad8b57b5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.inside2.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.gradient.radial.inside2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.inside2</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); +var g = ctx.createRadialGradient(50, 25, 200, 50, 25, 100); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#0f0'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.inside2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.inside2.worker.js new file mode 100644 index 0000000000..aa6ecba5f4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.inside2.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.gradient.radial.inside2 +// 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); +var g = ctx.createRadialGradient(50, 25, 200, 50, 25, 100); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#0f0'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.inside3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.inside3.html new file mode 100644 index 0000000000..54794b13fc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.inside3.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.gradient.radial.inside3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.inside3</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); +var g = ctx.createRadialGradient(50, 25, 200, 50, 25, 100); +g.addColorStop(0, '#f00'); +g.addColorStop(0.993, '#f00'); +g.addColorStop(1, '#0f0'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.inside3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.inside3.worker.js new file mode 100644 index 0000000000..b6d58b656c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.inside3.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.gradient.radial.inside3 +// 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); +var g = ctx.createRadialGradient(50, 25, 200, 50, 25, 100); +g.addColorStop(0, '#f00'); +g.addColorStop(0.993, '#f00'); +g.addColorStop(1, '#0f0'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.negative.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.negative.html new file mode 100644 index 0000000000..1fb6af5228 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.negative.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.radial.negative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.negative</h1> +<p class="desc">createRadialGradient() throws INDEX_SIZE_ERR if either radius is negative</p> + + +<script> +var t = async_test("createRadialGradient() throws INDEX_SIZE_ERR if either radius is negative"); +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'); + +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createRadialGradient(0, 0, -0.1, 0, 0, 1); }); +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createRadialGradient(0, 0, 1, 0, 0, -0.1); }); +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createRadialGradient(0, 0, -0.1, 0, 0, -0.1); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.negative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.negative.worker.js new file mode 100644 index 0000000000..e0d2c7cc33 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.negative.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.gradient.radial.negative +// Description:createRadialGradient() throws INDEX_SIZE_ERR if either radius is negative +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("createRadialGradient() throws INDEX_SIZE_ERR if either radius is negative"); +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'); + +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createRadialGradient(0, 0, -0.1, 0, 0, 1); }); +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createRadialGradient(0, 0, 1, 0, 0, -0.1); }); +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createRadialGradient(0, 0, -0.1, 0, 0, -0.1); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.nonfinite.html new file mode 100644 index 0000000000..75ab5740db --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.nonfinite.html @@ -0,0 +1,101 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.radial.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.nonfinite</h1> +<p class="desc">createRadialGradient() throws TypeError if arguments are not finite</p> + + +<script> +var t = async_test("createRadialGradient() throws TypeError if arguments are not finite"); +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'); + +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(-Infinity, 0, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(NaN, 0, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, -Infinity, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, NaN, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, -Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, NaN, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, -Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, NaN, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, -Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, NaN, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0, NaN); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, Infinity); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.nonfinite.worker.js new file mode 100644 index 0000000000..f09946947c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.nonfinite.worker.js @@ -0,0 +1,97 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.radial.nonfinite +// Description:createRadialGradient() throws TypeError if arguments are not finite +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("createRadialGradient() throws TypeError if arguments are not finite"); +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'); + +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(-Infinity, 0, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(NaN, 0, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, -Infinity, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, NaN, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, -Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, NaN, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, -Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, NaN, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, -Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, NaN, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0, NaN); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, Infinity); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.outside1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.outside1.html new file mode 100644 index 0000000000..44b2aa49fc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.outside1.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.gradient.radial.outside1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.outside1</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); +var g = ctx.createRadialGradient(200, 25, 10, 200, 25, 20); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#0f0'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.outside1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.outside1.worker.js new file mode 100644 index 0000000000..e1d3cddb24 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.outside1.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.gradient.radial.outside1 +// 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); +var g = ctx.createRadialGradient(200, 25, 10, 200, 25, 20); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#0f0'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.outside2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.outside2.html new file mode 100644 index 0000000000..e9e7ce497c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.outside2.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.gradient.radial.outside2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.outside2</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); +var g = ctx.createRadialGradient(200, 25, 20, 200, 25, 10); +g.addColorStop(0, '#0f0'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.outside2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.outside2.worker.js new file mode 100644 index 0000000000..a3f0235ed7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.outside2.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.gradient.radial.outside2 +// 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); +var g = ctx.createRadialGradient(200, 25, 20, 200, 25, 10); +g.addColorStop(0, '#0f0'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.outside3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.outside3.html new file mode 100644 index 0000000000..b66480a52c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.outside3.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.gradient.radial.outside3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.outside3</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); +var g = ctx.createRadialGradient(200, 25, 20, 200, 25, 10); +g.addColorStop(0, '#0f0'); +g.addColorStop(0.001, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.outside3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.outside3.worker.js new file mode 100644 index 0000000000..7b90c87d03 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.outside3.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.gradient.radial.outside3 +// 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); +var g = ctx.createRadialGradient(200, 25, 20, 200, 25, 10); +g.addColorStop(0, '#0f0'); +g.addColorStop(0.001, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.touch1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.touch1.html new file mode 100644 index 0000000000..c042b03b33 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.touch1.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.gradient.radial.touch1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.touch1</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); +var g = ctx.createRadialGradient(150, 25, 50, 200, 25, 100); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.touch1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.touch1.worker.js new file mode 100644 index 0000000000..7465345f6b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.touch1.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.gradient.radial.touch1 +// 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); +var g = ctx.createRadialGradient(150, 25, 50, 200, 25, 100); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.touch2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.touch2.html new file mode 100644 index 0000000000..5da1d592f8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.touch2.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.gradient.radial.touch2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.touch2</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); +var g = ctx.createRadialGradient(-80, 25, 70, 0, 25, 150); +g.addColorStop(0, '#f00'); +g.addColorStop(0.01, '#0f0'); +g.addColorStop(0.99, '#0f0'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.touch2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.touch2.worker.js new file mode 100644 index 0000000000..91dfcb31ac --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.touch2.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.gradient.radial.touch2 +// 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); +var g = ctx.createRadialGradient(-80, 25, 70, 0, 25, 150); +g.addColorStop(0, '#f00'); +g.addColorStop(0.01, '#0f0'); +g.addColorStop(0.99, '#0f0'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.touch3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.touch3.html new file mode 100644 index 0000000000..804589f074 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.touch3.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.gradient.radial.touch3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.touch3</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); +var g = ctx.createRadialGradient(120, -15, 25, 140, -30, 50); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.touch3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.touch3.worker.js new file mode 100644 index 0000000000..11e17fbb80 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.touch3.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.gradient.radial.touch3 +// 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); +var g = ctx.createRadialGradient(120, -15, 25, 140, -30, 50); +g.addColorStop(0, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.transform.1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.transform.1.html new file mode 100644 index 0000000000..c54044c0ea --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.transform.1.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.radial.transform.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.transform.1</h1> +<p class="desc">Radial gradient coordinates are relative to the coordinate space at the time of filling</p> + + +<script> +var t = async_test("Radial gradient coordinates are relative to the coordinate space at the time of filling"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var g = ctx.createRadialGradient(0, 0, 0, 0, 0, 11.2); +g.addColorStop(0, '#0f0'); +g.addColorStop(0.5, '#0f0'); +g.addColorStop(0.51, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.translate(50, 25); +ctx.scale(10, 10); +ctx.fillRect(-5, -2.5, 10, 5); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.transform.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.transform.1.worker.js new file mode 100644 index 0000000000..e2159d269f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.transform.1.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.radial.transform.1 +// Description:Radial gradient coordinates are relative to the coordinate space at the time of filling +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Radial gradient coordinates are relative to the coordinate space at the time of filling"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var g = ctx.createRadialGradient(0, 0, 0, 0, 0, 11.2); +g.addColorStop(0, '#0f0'); +g.addColorStop(0.5, '#0f0'); +g.addColorStop(0.51, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.translate(50, 25); +ctx.scale(10, 10); +ctx.fillRect(-5, -2.5, 10, 5); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.transform.2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.transform.2.html new file mode 100644 index 0000000000..145c2923e9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.transform.2.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.radial.transform.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.transform.2</h1> +<p class="desc">Radial gradient coordinates are relative to the coordinate space at the time of filling</p> + + +<script> +var t = async_test("Radial gradient coordinates are relative to the coordinate space at the time of filling"); +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.translate(100, 0); +var g = ctx.createRadialGradient(0, 0, 0, 0, 0, 11.2); +g.addColorStop(0, '#0f0'); +g.addColorStop(0.5, '#0f0'); +g.addColorStop(0.51, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.translate(-50, 25); +ctx.scale(10, 10); +ctx.fillRect(-5, -2.5, 10, 5); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.transform.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.transform.2.worker.js new file mode 100644 index 0000000000..511b7f362a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.transform.2.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.gradient.radial.transform.2 +// Description:Radial gradient coordinates are relative to the coordinate space at the time of filling +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Radial gradient coordinates are relative to the coordinate space at the time of filling"); +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.translate(100, 0); +var g = ctx.createRadialGradient(0, 0, 0, 0, 0, 11.2); +g.addColorStop(0, '#0f0'); +g.addColorStop(0.5, '#0f0'); +g.addColorStop(0.51, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.translate(-50, 25); +ctx.scale(10, 10); +ctx.fillRect(-5, -2.5, 10, 5); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.transform.3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.transform.3.html new file mode 100644 index 0000000000..01d14cfbfc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.transform.3.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.gradient.radial.transform.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.gradient.radial.transform.3</h1> +<p class="desc">Radial gradient transforms do not experience broken caching effects</p> + + +<script> +var t = async_test("Radial gradient transforms do not experience broken caching effects"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var g = ctx.createRadialGradient(0, 0, 0, 0, 0, 11.2); +g.addColorStop(0, '#0f0'); +g.addColorStop(0.5, '#0f0'); +g.addColorStop(0.51, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +ctx.translate(50, 25); +ctx.scale(10, 10); +ctx.fillRect(-5, -2.5, 10, 5); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.transform.3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.transform.3.worker.js new file mode 100644 index 0000000000..b7bf68a979 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.radial.transform.3.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.gradient.radial.transform.3 +// Description:Radial gradient transforms do not experience broken caching effects +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Radial gradient transforms do not experience broken caching effects"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var g = ctx.createRadialGradient(0, 0, 0, 0, 0, 11.2); +g.addColorStop(0, '#0f0'); +g.addColorStop(0.5, '#0f0'); +g.addColorStop(0.51, '#f00'); +g.addColorStop(1, '#f00'); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +ctx.translate(50, 25); +ctx.scale(10, 10); +ctx.fillRect(-5, -2.5, 10, 5); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.canvas.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.canvas.html new file mode 100644 index 0000000000..80bb946660 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.canvas.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.pattern.basic.canvas</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.basic.canvas</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); +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#0f0'; +ctx2.fillRect(0, 0, 100, 50); +var pattern = ctx.createPattern(offscreenCanvas2, 'no-repeat'); +ctx.fillStyle = pattern; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.canvas.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.canvas.worker.js new file mode 100644 index 0000000000..a2608066ea --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.canvas.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.pattern.basic.canvas +// 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); +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#0f0'; +ctx2.fillRect(0, 0, 100, 50); +var pattern = ctx.createPattern(offscreenCanvas2, 'no-repeat'); +ctx.fillStyle = pattern; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.image.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.image.html new file mode 100644 index 0000000000..965daccd3a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.image.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.basic.image</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.basic.image</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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.image.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.image.worker.js new file mode 100644 index 0000000000..725df51307 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.image.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.basic.image +// 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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.nocontext.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.nocontext.html new file mode 100644 index 0000000000..50cd38ed0f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.nocontext.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.pattern.basic.nocontext</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.basic.nocontext</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'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var pattern = ctx.createPattern(offscreenCanvas2, 'no-repeat'); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillStyle = pattern; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.nocontext.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.nocontext.worker.js new file mode 100644 index 0000000000..8f33ec9d8d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.nocontext.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.basic.nocontext +// 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'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var pattern = ctx.createPattern(offscreenCanvas2, 'no-repeat'); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillStyle = pattern; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.zerocanvas.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.zerocanvas.html new file mode 100644 index 0000000000..5c395ab94e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.zerocanvas.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.pattern.basic.zerocanvas</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.basic.zerocanvas</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'); + +canvas.width = 0; +canvas.height = 10; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 10, "canvas.height", "10"); +assert_throws_dom("INVALID_STATE_ERR", function() { ctx.createPattern(canvas, 'repeat'); }); +canvas.width = 10; +canvas.height = 0; +_assertSame(canvas.width, 10, "canvas.width", "10"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +assert_throws_dom("INVALID_STATE_ERR", function() { ctx.createPattern(canvas, 'repeat'); }); +canvas.width = 0; +canvas.height = 0; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +assert_throws_dom("INVALID_STATE_ERR", function() { ctx.createPattern(canvas, 'repeat'); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.zerocanvas.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.zerocanvas.worker.js new file mode 100644 index 0000000000..b02e3cc232 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.zerocanvas.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.pattern.basic.zerocanvas +// 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'); + +canvas.width = 0; +canvas.height = 10; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 10, "canvas.height", "10"); +assert_throws_dom("INVALID_STATE_ERR", function() { ctx.createPattern(canvas, 'repeat'); }); +canvas.width = 10; +canvas.height = 0; +_assertSame(canvas.width, 10, "canvas.width", "10"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +assert_throws_dom("INVALID_STATE_ERR", function() { ctx.createPattern(canvas, 'repeat'); }); +canvas.width = 0; +canvas.height = 0; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +assert_throws_dom("INVALID_STATE_ERR", function() { ctx.createPattern(canvas, 'repeat'); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.crosscanvas.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.crosscanvas.html new file mode 100644 index 0000000000..c6e0b36092 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.crosscanvas.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.pattern.crosscanvas</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.crosscanvas</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'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var offscreenCanvas2 = new OffscreenCanvas(100, 50); + var pattern = offscreenCanvas2.getContext('2d').createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.crosscanvas.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.crosscanvas.worker.js new file mode 100644 index 0000000000..1a1d045ba6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.crosscanvas.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.pattern.crosscanvas +// 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'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var offscreenCanvas2 = new OffscreenCanvas(100, 50); + var pattern = offscreenCanvas2.getContext('2d').createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.image.null.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.image.null.html new file mode 100644 index 0000000000..e3ad03190d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.image.null.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.image.null</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.image.null</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'); + +assert_throws_js(TypeError, function() { ctx.createPattern(null, 'repeat'); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.image.null.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.image.null.worker.js new file mode 100644 index 0000000000..63dcb8f942 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.image.null.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.image.null +// 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'); + +assert_throws_js(TypeError, function() { ctx.createPattern(null, 'repeat'); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.image.string.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.image.string.html new file mode 100644 index 0000000000..ac202ee2a4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.image.string.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.image.string</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.image.string</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'); + +assert_throws_js(TypeError, function() { ctx.createPattern('../images/red.png', 'repeat'); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.image.string.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.image.string.worker.js new file mode 100644 index 0000000000..c07e7d51ef --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.image.string.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.image.string +// 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'); + +assert_throws_js(TypeError, function() { ctx.createPattern('../images/red.png', 'repeat'); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.image.undefined.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.image.undefined.html new file mode 100644 index 0000000000..0593d41529 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.image.undefined.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.image.undefined</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.image.undefined</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'); + +assert_throws_js(TypeError, function() { ctx.createPattern(undefined, 'repeat'); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.image.undefined.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.image.undefined.worker.js new file mode 100644 index 0000000000..1e94f39ea9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.image.undefined.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.image.undefined +// 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'); + +assert_throws_js(TypeError, function() { ctx.createPattern(undefined, 'repeat'); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.modify.canvas1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.modify.canvas1.html new file mode 100644 index 0000000000..4c27f26347 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.modify.canvas1.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.modify.canvas1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.modify.canvas1</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'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#0f0'; +ctx2.fillRect(0, 0, 100, 50); +var pattern = ctx.createPattern(offscreenCanvas2, 'no-repeat'); +ctx2.fillStyle = '#f00'; +ctx2.fillRect(0, 0, 100, 50); +ctx.fillStyle = pattern; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.modify.canvas1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.modify.canvas1.worker.js new file mode 100644 index 0000000000..c83755c984 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.modify.canvas1.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.pattern.modify.canvas1 +// 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'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#0f0'; +ctx2.fillRect(0, 0, 100, 50); +var pattern = ctx.createPattern(offscreenCanvas2, 'no-repeat'); +ctx2.fillStyle = '#f00'; +ctx2.fillRect(0, 0, 100, 50); +ctx.fillStyle = pattern; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.modify.canvas2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.modify.canvas2.html new file mode 100644 index 0000000000..08a6cd896e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.modify.canvas2.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.pattern.modify.canvas2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.modify.canvas2</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'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#0f0'; +ctx2.fillRect(0, 0, 100, 50); +var pattern = ctx.createPattern(offscreenCanvas2, 'no-repeat'); +ctx.fillStyle = pattern; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx2.fillStyle = '#f00'; +ctx2.fillRect(0, 0, 100, 50); +ctx.fillStyle = pattern; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.modify.canvas2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.modify.canvas2.worker.js new file mode 100644 index 0000000000..a49dd10213 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.modify.canvas2.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.pattern.modify.canvas2 +// 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'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#0f0'; +ctx2.fillRect(0, 0, 100, 50); +var pattern = ctx.createPattern(offscreenCanvas2, 'no-repeat'); +ctx.fillStyle = pattern; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx2.fillStyle = '#f00'; +ctx2.fillRect(0, 0, 100, 50); +ctx.fillStyle = pattern; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.basic.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.basic.html new file mode 100644 index 0000000000..f5d9f5a558 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.basic.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.paint.norepeat.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.pattern.paint.norepeat.basic</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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.basic.worker.js new file mode 100644 index 0000000000..82a49c331b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.basic.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.paint.norepeat.basic +// 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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord1.html new file mode 100644 index 0000000000..87158be57c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord1.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.paint.norepeat.coord1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.paint.norepeat.coord1</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, 50, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(50, 0, 50, 50); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.translate(50, 0); + ctx.fillRect(-50, 0, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord1.worker.js new file mode 100644 index 0000000000..731df50c00 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord1.worker.js @@ -0,0 +1,46 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.paint.norepeat.coord1 +// 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, 50, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(50, 0, 50, 50); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.translate(50, 0); + ctx.fillRect(-50, 0, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord2.html new file mode 100644 index 0000000000..a600e6ef57 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord2.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.paint.norepeat.coord2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.paint.norepeat.coord2</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'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 50, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(50, 0, 50, 50); + ctx.fillStyle = pattern; + ctx.translate(50, 0); + ctx.fillRect(-50, 0, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord2.worker.js new file mode 100644 index 0000000000..bd9c115f0d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord2.worker.js @@ -0,0 +1,46 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.paint.norepeat.coord2 +// 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'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 50, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(50, 0, 50, 50); + ctx.fillStyle = pattern; + ctx.translate(50, 0); + ctx.fillRect(-50, 0, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord3.html new file mode 100644 index 0000000000..c569d87705 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord3.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.paint.norepeat.coord3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.paint.norepeat.coord3</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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.translate(50, 25); + ctx.fillRect(-50, -25, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 25); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord3.worker.js new file mode 100644 index 0000000000..cf88ebab73 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord3.worker.js @@ -0,0 +1,46 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.paint.norepeat.coord3 +// 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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.translate(50, 25); + ctx.fillRect(-50, -25, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 25); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.outside.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.outside.html new file mode 100644 index 0000000000..4242375b03 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.outside.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.pattern.paint.norepeat.outside</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.paint.norepeat.outside</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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = pattern; + ctx.fillRect(0, -50, 100, 50); + ctx.fillRect(-100, 0, 100, 50); + ctx.fillRect(0, 50, 100, 50); + ctx.fillRect(100, 0, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.outside.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.outside.worker.js new file mode 100644 index 0000000000..85a6e43bd1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.outside.worker.js @@ -0,0 +1,48 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.paint.norepeat.outside +// 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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = pattern; + ctx.fillRect(0, -50, 100, 50); + ctx.fillRect(-100, 0, 100, 50); + ctx.fillRect(0, 50, 100, 50); + ctx.fillRect(100, 0, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.orientation.canvas.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.orientation.canvas.html new file mode 100644 index 0000000000..ccad92e529 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.orientation.canvas.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.pattern.paint.orientation.canvas</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.paint.orientation.canvas</h1> +<p class="desc">Canvas patterns do not get flipped when painted</p> + + +<script> +var t = async_test("Canvas patterns do not get flipped when painted"); +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); +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#f00'; +ctx2.fillRect(0, 0, 100, 25); +ctx2.fillStyle = '#0f0'; +ctx2.fillRect(0, 25, 100, 25); +var pattern = ctx.createPattern(offscreenCanvas2, 'no-repeat'); +ctx.fillStyle = pattern; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 25); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.orientation.canvas.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.orientation.canvas.worker.js new file mode 100644 index 0000000000..38fa35f138 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.orientation.canvas.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.pattern.paint.orientation.canvas +// Description:Canvas patterns do not get flipped when painted +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Canvas patterns do not get flipped when painted"); +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); +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#f00'; +ctx2.fillRect(0, 0, 100, 25); +ctx2.fillStyle = '#0f0'; +ctx2.fillRect(0, 25, 100, 25); +var pattern = ctx.createPattern(offscreenCanvas2, 'no-repeat'); +ctx.fillStyle = pattern; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 25); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.orientation.image.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.orientation.image.html new file mode 100644 index 0000000000..377cc58685 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.orientation.image.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.pattern.paint.orientation.image</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.paint.orientation.image</h1> +<p class="desc">Image patterns do not get flipped when painted</p> + + +<script> +var t = async_test("Image patterns do not get flipped when painted"); +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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/rrgg-256x256.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.save(); + ctx.translate(0, -103); + ctx.fillRect(0, 103, 100, 50); + ctx.restore(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 25); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.orientation.image.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.orientation.image.worker.js new file mode 100644 index 0000000000..fccfe70426 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.orientation.image.worker.js @@ -0,0 +1,48 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.paint.orientation.image +// Description:Image patterns do not get flipped when painted +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Image patterns do not get flipped when painted"); +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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/rrgg-256x256.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.save(); + ctx.translate(0, -103); + ctx.fillRect(0, 103, 100, 50); + ctx.restore(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 25); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.basic.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.basic.html new file mode 100644 index 0000000000..b5613c3798 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.basic.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.paint.repeat.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.pattern.paint.repeat.basic</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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green-16x16.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.basic.worker.js new file mode 100644 index 0000000000..1f09d297f9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.basic.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.paint.repeat.basic +// 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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green-16x16.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord1.html new file mode 100644 index 0000000000..a4b2bbdd7d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord1.html @@ -0,0 +1,48 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.paint.repeat.coord1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.paint.repeat.coord1</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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/rgrg-256x256.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.translate(-128, -78); + ctx.fillRect(128, 78, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord1.worker.js new file mode 100644 index 0000000000..ea064ea327 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord1.worker.js @@ -0,0 +1,44 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.paint.repeat.coord1 +// 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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/rgrg-256x256.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.translate(-128, -78); + ctx.fillRect(128, 78, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord2.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord2.html new file mode 100644 index 0000000000..52449506a7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord2.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.pattern.paint.repeat.coord2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.paint.repeat.coord2</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'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/grgr-256x256.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord2.worker.js new file mode 100644 index 0000000000..29c6f8f006 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord2.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.pattern.paint.repeat.coord2 +// 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'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/grgr-256x256.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord3.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord3.html new file mode 100644 index 0000000000..d01acb8a6d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord3.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.paint.repeat.coord3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.paint.repeat.coord3</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'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/rgrg-256x256.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + ctx.translate(-128, -78); + ctx.fillRect(128, 78, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord3.worker.js new file mode 100644 index 0000000000..91c14f98dc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord3.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.paint.repeat.coord3 +// 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'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/rgrg-256x256.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + ctx.translate(-128, -78); + ctx.fillRect(128, 78, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.outside.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.outside.html new file mode 100644 index 0000000000..2c91f1d736 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.outside.html @@ -0,0 +1,48 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.paint.repeat.outside</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.paint.repeat.outside</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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green-16x16.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.translate(50, 25); + ctx.fillRect(-50, -25, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.outside.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.outside.worker.js new file mode 100644 index 0000000000..147eadf8e7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.outside.worker.js @@ -0,0 +1,44 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.paint.repeat.outside +// 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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green-16x16.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'no-repeat'); + ctx.fillStyle = pattern; + ctx.translate(50, 25); + ctx.fillRect(-50, -25, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.basic.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.basic.html new file mode 100644 index 0000000000..ed7cee297d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.basic.html @@ -0,0 +1,49 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.paint.repeatx.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.pattern.paint.repeatx.basic</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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 16); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green-16x16.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat-x'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.basic.worker.js new file mode 100644 index 0000000000..d7efcfa1e1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.basic.worker.js @@ -0,0 +1,45 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.paint.repeatx.basic +// 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 16); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green-16x16.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat-x'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.coord1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.coord1.html new file mode 100644 index 0000000000..342ce06aad --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.coord1.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.pattern.paint.repeatx.coord1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.paint.repeatx.coord1</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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red-16x16.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat-x'); + ctx.fillStyle = pattern; + ctx.translate(0, 16); + ctx.fillRect(0, -16, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 16); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,25, 0,255,0,255); + _assertPixel(canvas, 98,25, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.coord1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.coord1.worker.js new file mode 100644 index 0000000000..351092befd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.coord1.worker.js @@ -0,0 +1,48 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.paint.repeatx.coord1 +// 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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red-16x16.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat-x'); + ctx.fillStyle = pattern; + ctx.translate(0, 16); + ctx.fillRect(0, -16, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 16); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,25, 0,255,0,255); + _assertPixel(canvas, 98,25, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.outside.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.outside.html new file mode 100644 index 0000000000..ad4a4a2461 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.outside.html @@ -0,0 +1,49 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.paint.repeatx.outside</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.paint.repeatx.outside</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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red-16x16.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat-x'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 16); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.outside.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.outside.worker.js new file mode 100644 index 0000000000..0e031109f2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.outside.worker.js @@ -0,0 +1,45 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.paint.repeatx.outside +// 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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red-16x16.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat-x'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 16); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.basic.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.basic.html new file mode 100644 index 0000000000..6069902498 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.basic.html @@ -0,0 +1,49 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.paint.repeaty.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.pattern.paint.repeaty.basic</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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 16, 50); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green-16x16.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat-y'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.basic.worker.js new file mode 100644 index 0000000000..09e9b02394 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.basic.worker.js @@ -0,0 +1,45 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.paint.repeaty.basic +// 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 16, 50); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green-16x16.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat-y'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.coord1.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.coord1.html new file mode 100644 index 0000000000..fd1cca2e95 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.coord1.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.pattern.paint.repeaty.coord1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.paint.repeaty.coord1</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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red-16x16.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat-y'); + ctx.fillStyle = pattern; + ctx.translate(48, 0); + ctx.fillRect(-48, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 16, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 50,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 50,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.coord1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.coord1.worker.js new file mode 100644 index 0000000000..1701d3cc76 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.coord1.worker.js @@ -0,0 +1,48 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.paint.repeaty.coord1 +// 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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red-16x16.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat-y'); + ctx.fillStyle = pattern; + ctx.translate(48, 0); + ctx.fillRect(-48, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 16, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 50,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 50,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.outside.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.outside.html new file mode 100644 index 0000000000..b7fbd9eb87 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.outside.html @@ -0,0 +1,49 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.paint.repeaty.outside</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.paint.repeaty.outside</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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red-16x16.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat-y'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 16, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.outside.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.outside.worker.js new file mode 100644 index 0000000000..7242c8ff48 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.outside.worker.js @@ -0,0 +1,45 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.paint.repeaty.outside +// 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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red-16x16.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat-y'); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 16, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.case.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.case.html new file mode 100644 index 0000000000..5251f93c8f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.case.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.repeat.case</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.repeat.case</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'); + +assert_throws_dom("SYNTAX_ERR", function() { ctx.createPattern(canvas, "Repeat"); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.case.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.case.worker.js new file mode 100644 index 0000000000..6a7dd8d6dd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.case.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.repeat.case +// 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'); + +assert_throws_dom("SYNTAX_ERR", function() { ctx.createPattern(canvas, "Repeat"); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.empty.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.empty.html new file mode 100644 index 0000000000..76e54e9616 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.empty.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.repeat.empty</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.repeat.empty</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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green-1x1.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, ""); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 200, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.empty.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.empty.worker.js new file mode 100644 index 0000000000..e3048881e3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.empty.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.repeat.empty +// 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); +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green-1x1.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, ""); + ctx.fillStyle = pattern; + ctx.fillRect(0, 0, 200, 50); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.null.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.null.html new file mode 100644 index 0000000000..0e97c7aa67 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.null.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.repeat.null</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.repeat.null</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'); + +_assert(ctx.createPattern(canvas, null) != null, "ctx.createPattern(canvas, null) != null"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.null.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.null.worker.js new file mode 100644 index 0000000000..57353f338c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.null.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.repeat.null +// 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'); + +_assert(ctx.createPattern(canvas, null) != null, "ctx.createPattern(canvas, null) != null"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.nullsuffix.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.nullsuffix.html new file mode 100644 index 0000000000..d5166d750b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.nullsuffix.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.repeat.nullsuffix</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.repeat.nullsuffix</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'); + +assert_throws_dom("SYNTAX_ERR", function() { ctx.createPattern(canvas, "repeat\0"); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.nullsuffix.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.nullsuffix.worker.js new file mode 100644 index 0000000000..baafd4b43a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.nullsuffix.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.repeat.nullsuffix +// 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'); + +assert_throws_dom("SYNTAX_ERR", function() { ctx.createPattern(canvas, "repeat\0"); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.undefined.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.undefined.html new file mode 100644 index 0000000000..731ef86f83 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.undefined.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.repeat.undefined</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.repeat.undefined</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'); + +assert_throws_dom("SYNTAX_ERR", function() { ctx.createPattern(canvas, undefined); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.undefined.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.undefined.worker.js new file mode 100644 index 0000000000..1474ac43dc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.undefined.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.repeat.undefined +// 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'); + +assert_throws_dom("SYNTAX_ERR", function() { ctx.createPattern(canvas, undefined); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.unrecognised.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.unrecognised.html new file mode 100644 index 0000000000..793ed67a7c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.unrecognised.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.repeat.unrecognised</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.repeat.unrecognised</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'); + +assert_throws_dom("SYNTAX_ERR", function() { ctx.createPattern(canvas, "invalid"); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.unrecognised.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.unrecognised.worker.js new file mode 100644 index 0000000000..076cba562c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.unrecognised.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.repeat.unrecognised +// 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'); + +assert_throws_dom("SYNTAX_ERR", function() { ctx.createPattern(canvas, "invalid"); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.unrecognisednull.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.unrecognisednull.html new file mode 100644 index 0000000000..59a0be4296 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.unrecognisednull.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.pattern.repeat.unrecognisednull</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.pattern.repeat.unrecognisednull</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'); + +assert_throws_dom("SYNTAX_ERR", function() { ctx.createPattern(canvas, "null"); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.unrecognisednull.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.unrecognisednull.worker.js new file mode 100644 index 0000000000..0adfe9bf41 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.unrecognisednull.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.pattern.repeat.unrecognisednull +// 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'); + +assert_throws_dom("SYNTAX_ERR", function() { ctx.createPattern(canvas, "null"); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.strokeStyle.default.html b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.strokeStyle.default.html new file mode 100644 index 0000000000..70524cb6d9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.strokeStyle.default.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.strokeStyle.default</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.strokeStyle.default</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.strokeStyle, '#000000', "ctx.strokeStyle", "'#000000'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.strokeStyle.default.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.strokeStyle.default.worker.js new file mode 100644 index 0000000000..0d72f35264 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.strokeStyle.default.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.strokeStyle.default +// 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.strokeStyle, '#000000', "ctx.strokeStyle", "'#000000'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html new file mode 100644 index 0000000000..bc476476e4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.filter.canvasFilterObject.blur.exceptions.tentative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.filter.canvasFilterObject.blur.exceptions.tentative</h1> +<p class="desc">Test exceptions on CanvasFilter() blur.object</p> + + +<script> +var t = async_test("Test exceptions on CanvasFilter() blur.object"); +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'); + +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur"}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: undefined}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: "foo"}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: [1,2]}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: NaN}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: {}}); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.worker.js new file mode 100644 index 0000000000..a44868f585 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.filter.canvasFilterObject.blur.exceptions.tentative +// Description:Test exceptions on CanvasFilter() blur.object +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Test exceptions on CanvasFilter() blur.object"); +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'); + +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur"}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: undefined}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: "foo"}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: [1,2]}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: NaN}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: {}}); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html new file mode 100644 index 0000000000..ece8a52216 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.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.filter.canvasFilterObject.colorMatrix.tentative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.filter.canvasFilterObject.colorMatrix.tentative</h1> +<p class="desc">Test the functionality of ColorMatrix filters in CanvasFilter objects</p> + + +<script> +var t = async_test("Test the functionality of ColorMatrix filters in CanvasFilter objects"); +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'); + +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: undefined}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: "foo"}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: null}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: [1, 2, 3]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, "a"]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, Infinity]}); }); +ctx.fillStyle = "#f00"; +ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 0}); +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 10,10, 255,0,0,255, 2); +ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 90}); +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 10,10, 0,91,0,255, 2); +ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 180}); +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 10,10, 0,109,109,255, 2); +ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 270}); +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 10,10, 109,18,255,255, 2); +ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "saturate", values: 0.5}); +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 10,10, 155,27,27,255, 2); +ctx.clearRect(0, 0, 100, 50); +ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "luminanceToAlpha"}); +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 10,10, 0,0,0,54, 2); +ctx.filter = new CanvasFilter({filter: "colorMatrix", values: [ + 0, 0, 0, 0, 0, + 1, 1, 1, 1, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0 +]}); +ctx.fillRect(0, 0, 50, 25); +ctx.fillStyle = "#0f0"; +ctx.fillRect(50, 0, 50, 25); +ctx.fillStyle = "#00f"; +ctx.fillRect(0, 25, 50, 25); +ctx.fillStyle = "#fff"; +ctx.fillRect(50, 25, 50, 25); +_assertPixelApprox(canvas, 10,10, 0,255,0,255, 2); +_assertPixelApprox(canvas, 60,10, 0,255,0,255, 2); +_assertPixelApprox(canvas, 10,30, 0,255,0,255, 2); +_assertPixelApprox(canvas, 60,30, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.worker.js new file mode 100644 index 0000000000..105f312b9c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.worker.js @@ -0,0 +1,65 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.filter.canvasFilterObject.colorMatrix.tentative +// Description:Test the functionality of ColorMatrix filters in CanvasFilter objects +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Test the functionality of ColorMatrix filters in CanvasFilter objects"); +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'); + +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: undefined}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: "foo"}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: null}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: [1, 2, 3]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, "a"]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, Infinity]}); }); +ctx.fillStyle = "#f00"; +ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 0}); +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 10,10, 255,0,0,255, 2); +ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 90}); +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 10,10, 0,91,0,255, 2); +ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 180}); +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 10,10, 0,109,109,255, 2); +ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 270}); +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 10,10, 109,18,255,255, 2); +ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "saturate", values: 0.5}); +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 10,10, 155,27,27,255, 2); +ctx.clearRect(0, 0, 100, 50); +ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "luminanceToAlpha"}); +ctx.fillRect(0, 0, 100, 50); +_assertPixelApprox(canvas, 10,10, 0,0,0,54, 2); +ctx.filter = new CanvasFilter({filter: "colorMatrix", values: [ + 0, 0, 0, 0, 0, + 1, 1, 1, 1, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0 +]}); +ctx.fillRect(0, 0, 50, 25); +ctx.fillStyle = "#0f0"; +ctx.fillRect(50, 0, 50, 25); +ctx.fillStyle = "#00f"; +ctx.fillRect(0, 25, 50, 25); +ctx.fillStyle = "#fff"; +ctx.fillRect(50, 25, 50, 25); +_assertPixelApprox(canvas, 10,10, 0,255,0,255, 2); +_assertPixelApprox(canvas, 60,10, 0,255,0,255, 2); +_assertPixelApprox(canvas, 10,30, 0,255,0,255, 2); +_assertPixelApprox(canvas, 60,30, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html new file mode 100644 index 0000000000..eaaa12f0a7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html @@ -0,0 +1,67 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.filter.canvasFilterObject.componentTransfer.discrete.tentative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.filter.canvasFilterObject.componentTransfer.discrete.tentative</h1> +<p class="desc">Test pixels on CanvasFilter() componentTransfer with discrete type</p> + + +<script> +var t = async_test("Test pixels on CanvasFilter() componentTransfer with discrete type"); +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'); + +// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement +function getTransformedValue(C, V) { + // Get the right interval + const n = V.length; + const k = C == 1 ? n - 1 : Math.floor(C * n); + return V[k]; +} + +function getColor(inputColor, tableValues) { + const result = [0, 0, 0]; + for (const i in inputColor) { + const C = inputColor[i]/255; + const Cprime = getTransformedValue(C, tableValues[i]); + result[i] = Math.max(0, Math.min(1, Cprime)) * 255; + } + return result; +} + +tableValuesR = [0, 0, 1, 1]; +tableValuesG = [2, 0, 0.5, 3]; +tableValuesB = [1, -1, 5, 0]; +ctx.filter = new CanvasFilter({filter: "componentTransfer", + funcR: {type: "discrete", tableValues: tableValuesR}, + funcG: {type: "discrete", tableValues: tableValuesG}, + funcB: {type: "discrete", tableValues: tableValuesB}, +}); + +const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], +]; + +for (const color of inputColors) { + let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); +} +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.worker.js new file mode 100644 index 0000000000..f1274f1425 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.worker.js @@ -0,0 +1,63 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.filter.canvasFilterObject.componentTransfer.discrete.tentative +// Description:Test pixels on CanvasFilter() componentTransfer with discrete type +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Test pixels on CanvasFilter() componentTransfer with discrete type"); +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'); + +// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement +function getTransformedValue(C, V) { + // Get the right interval + const n = V.length; + const k = C == 1 ? n - 1 : Math.floor(C * n); + return V[k]; +} + +function getColor(inputColor, tableValues) { + const result = [0, 0, 0]; + for (const i in inputColor) { + const C = inputColor[i]/255; + const Cprime = getTransformedValue(C, tableValues[i]); + result[i] = Math.max(0, Math.min(1, Cprime)) * 255; + } + return result; +} + +tableValuesR = [0, 0, 1, 1]; +tableValuesG = [2, 0, 0.5, 3]; +tableValuesB = [1, -1, 5, 0]; +ctx.filter = new CanvasFilter({filter: "componentTransfer", + funcR: {type: "discrete", tableValues: tableValuesR}, + funcG: {type: "discrete", tableValues: tableValuesG}, + funcB: {type: "discrete", tableValues: tableValuesB}, +}); + +const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], +]; + +for (const color of inputColors) { + let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); +} +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html new file mode 100644 index 0000000000..6c5b04ab8a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html @@ -0,0 +1,58 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.filter.canvasFilterObject.componentTransfer.gamma.tentative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.filter.canvasFilterObject.componentTransfer.gamma.tentative</h1> +<p class="desc">Test pixels on CanvasFilter() componentTransfer with gamma type</p> + + +<script> +var t = async_test("Test pixels on CanvasFilter() componentTransfer with gamma type"); +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'); + +// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement +function getColor(inputColor, amplitude, exponent, offset) { + return [ + Math.max(0, Math.min(1, Math.pow(inputColor[0]/255, exponent[0]) * amplitude[0] + offset[0])) * 255, + Math.max(0, Math.min(1, Math.pow(inputColor[1]/255, exponent[1]) * amplitude[1] + offset[1])) * 255, + Math.max(0, Math.min(1, Math.pow(inputColor[2]/255, exponent[2]) * amplitude[2] + offset[2])) * 255, + ]; +} + +const amplitudes = [2, 1.1, 0.5]; +const exponents = [5, 3, 1]; +const offsets = [0.25, 0, 0.5]; +ctx.filter = new CanvasFilter({filter: "componentTransfer", + funcR: {type: "gamma", amplitude: amplitudes[0], exponent: exponents[0], offset: offsets[0]}, + funcG: {type: "gamma", amplitude: amplitudes[1], exponent: exponents[1], offset: offsets[1]}, + funcB: {type: "gamma", amplitude: amplitudes[2], exponent: exponents[2], offset: offsets[2]}, +}); + +const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], +]; + +for (const color of inputColors) { + let outputColor = getColor(color, amplitudes, exponents, offsets); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); +} +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.worker.js new file mode 100644 index 0000000000..14bf50f89d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.worker.js @@ -0,0 +1,54 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.filter.canvasFilterObject.componentTransfer.gamma.tentative +// Description:Test pixels on CanvasFilter() componentTransfer with gamma type +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Test pixels on CanvasFilter() componentTransfer with gamma type"); +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'); + +// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement +function getColor(inputColor, amplitude, exponent, offset) { + return [ + Math.max(0, Math.min(1, Math.pow(inputColor[0]/255, exponent[0]) * amplitude[0] + offset[0])) * 255, + Math.max(0, Math.min(1, Math.pow(inputColor[1]/255, exponent[1]) * amplitude[1] + offset[1])) * 255, + Math.max(0, Math.min(1, Math.pow(inputColor[2]/255, exponent[2]) * amplitude[2] + offset[2])) * 255, + ]; +} + +const amplitudes = [2, 1.1, 0.5]; +const exponents = [5, 3, 1]; +const offsets = [0.25, 0, 0.5]; +ctx.filter = new CanvasFilter({filter: "componentTransfer", + funcR: {type: "gamma", amplitude: amplitudes[0], exponent: exponents[0], offset: offsets[0]}, + funcG: {type: "gamma", amplitude: amplitudes[1], exponent: exponents[1], offset: offsets[1]}, + funcB: {type: "gamma", amplitude: amplitudes[2], exponent: exponents[2], offset: offsets[2]}, +}); + +const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], +]; + +for (const color of inputColors) { + let outputColor = getColor(color, amplitudes, exponents, offsets); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); +} +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html new file mode 100644 index 0000000000..a6a7a3615a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.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.filter.canvasFilterObject.componentTransfer.identity.tentative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.filter.canvasFilterObject.componentTransfer.identity.tentative</h1> +<p class="desc">Test pixels on CanvasFilter() componentTransfer with identity type</p> + + +<script> +var t = async_test("Test pixels on CanvasFilter() componentTransfer with identity type"); +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.filter = new CanvasFilter({filter: "componentTransfer", + funcR: {type: "identity"}, + funcG: {type: "identity"}, + funcB: {type: "identity"}, +}); + +const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], +]; + +for (const color of inputColors) { + ctx.fillStyle = `rgba(${color[0]}, ${color[1]}, ${color[2]}, 1)`, + ctx.fillRect(0, 0, 10, 10); + _assertPixel(canvas, 5, 5, color[0],color[1],color[2],255); +} +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.worker.js new file mode 100644 index 0000000000..ae749673f4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.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.filter.canvasFilterObject.componentTransfer.identity.tentative +// Description:Test pixels on CanvasFilter() componentTransfer with identity type +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Test pixels on CanvasFilter() componentTransfer with identity type"); +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.filter = new CanvasFilter({filter: "componentTransfer", + funcR: {type: "identity"}, + funcG: {type: "identity"}, + funcB: {type: "identity"}, +}); + +const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], +]; + +for (const color of inputColors) { + ctx.fillStyle = `rgba(${color[0]}, ${color[1]}, ${color[2]}, 1)`, + ctx.fillRect(0, 0, 10, 10); + _assertPixel(canvas, 5, 5, color[0],color[1],color[2],255); +} +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html new file mode 100644 index 0000000000..f2218b7a1d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.filter.canvasFilterObject.componentTransfer.linear.tentative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.filter.canvasFilterObject.componentTransfer.linear.tentative</h1> +<p class="desc">Test pixels on CanvasFilter() componentTransfer with linear type</p> + + +<script> +var t = async_test("Test pixels on CanvasFilter() componentTransfer with linear type"); +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'); + +// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement +function getColor(inputColor, slopes, intercepts) { + return [ + Math.max(0, Math.min(1, inputColor[0]/255 * slopes[0] + intercepts[0])) * 255, + Math.max(0, Math.min(1, inputColor[1]/255 * slopes[1] + intercepts[1])) * 255, + Math.max(0, Math.min(1, inputColor[2]/255 * slopes[2] + intercepts[2])) * 255, + ]; +} + +const slopes = [0.5, 1.2, -0.2]; +const intercepts = [0.25, 0, 0.5]; +ctx.filter = new CanvasFilter({filter: "componentTransfer", + funcR: {type: "linear", slope: slopes[0], intercept: intercepts[0]}, + funcG: {type: "linear", slope: slopes[1], intercept: intercepts[1]}, + funcB: {type: "linear", slope: slopes[2], intercept: intercepts[2]}, +}); + +const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], +]; + +for (const color of inputColors) { + let outputColor = getColor(color, slopes, intercepts); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); +} +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.worker.js new file mode 100644 index 0000000000..5117d4a1b3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.worker.js @@ -0,0 +1,53 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.filter.canvasFilterObject.componentTransfer.linear.tentative +// Description:Test pixels on CanvasFilter() componentTransfer with linear type +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Test pixels on CanvasFilter() componentTransfer with linear type"); +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'); + +// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement +function getColor(inputColor, slopes, intercepts) { + return [ + Math.max(0, Math.min(1, inputColor[0]/255 * slopes[0] + intercepts[0])) * 255, + Math.max(0, Math.min(1, inputColor[1]/255 * slopes[1] + intercepts[1])) * 255, + Math.max(0, Math.min(1, inputColor[2]/255 * slopes[2] + intercepts[2])) * 255, + ]; +} + +const slopes = [0.5, 1.2, -0.2]; +const intercepts = [0.25, 0, 0.5]; +ctx.filter = new CanvasFilter({filter: "componentTransfer", + funcR: {type: "linear", slope: slopes[0], intercept: intercepts[0]}, + funcG: {type: "linear", slope: slopes[1], intercept: intercepts[1]}, + funcB: {type: "linear", slope: slopes[2], intercept: intercepts[2]}, +}); + +const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], +]; + +for (const color of inputColors) { + let outputColor = getColor(color, slopes, intercepts); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); +} +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html new file mode 100644 index 0000000000..9c4c16db85 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html @@ -0,0 +1,67 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.filter.canvasFilterObject.componentTransfer.table.tentative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.filter.canvasFilterObject.componentTransfer.table.tentative</h1> +<p class="desc">Test pixels on CanvasFilter() componentTransfer with table type</p> + + +<script> +var t = async_test("Test pixels on CanvasFilter() componentTransfer with table type"); +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'); + +// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement +function getTransformedValue(C, V) { + // Get the right interval + const n = V.length - 1; + const k = C == 1 ? n - 1 : Math.floor(C * n); + return V[k] + (C - k/n) * n * (V[k + 1] - V[k]); +} + +function getColor(inputColor, tableValues) { + const result = [0, 0, 0]; + for (const i in inputColor) { + const C = inputColor[i]/255; + const Cprime = getTransformedValue(C, tableValues[i]); + result[i] = Math.max(0, Math.min(1, Cprime)) * 255; + } + return result; +} + +tableValuesR = [0, 0, 1, 1]; +tableValuesG = [2, 0, 0.5, 3]; +tableValuesB = [1, -1, 5, 0]; +ctx.filter = new CanvasFilter({filter: "componentTransfer", + funcR: {type: "table", tableValues: tableValuesR}, + funcG: {type: "table", tableValues: tableValuesG}, + funcB: {type: "table", tableValues: tableValuesB}, +}); + +const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], +]; + +for (const color of inputColors) { + let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); +} +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.worker.js new file mode 100644 index 0000000000..e2463eb9e7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.worker.js @@ -0,0 +1,63 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.filter.canvasFilterObject.componentTransfer.table.tentative +// Description:Test pixels on CanvasFilter() componentTransfer with table type +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Test pixels on CanvasFilter() componentTransfer with table type"); +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'); + +// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement +function getTransformedValue(C, V) { + // Get the right interval + const n = V.length - 1; + const k = C == 1 ? n - 1 : Math.floor(C * n); + return V[k] + (C - k/n) * n * (V[k + 1] - V[k]); +} + +function getColor(inputColor, tableValues) { + const result = [0, 0, 0]; + for (const i in inputColor) { + const C = inputColor[i]/255; + const Cprime = getTransformedValue(C, tableValues[i]); + result[i] = Math.max(0, Math.min(1, Cprime)) * 255; + } + return result; +} + +tableValuesR = [0, 0, 1, 1]; +tableValuesG = [2, 0, 0.5, 3]; +tableValuesB = [1, -1, 5, 0]; +ctx.filter = new CanvasFilter({filter: "componentTransfer", + funcR: {type: "table", tableValues: tableValuesR}, + funcG: {type: "table", tableValues: tableValuesG}, + funcB: {type: "table", tableValues: tableValuesB}, +}); + +const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], +]; + +for (const color of inputColors) { + let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); +} +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html new file mode 100644 index 0000000000..b44b074af1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.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.filter.canvasFilterObject.convolveMatrix.exceptions.tentative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative</h1> +<p class="desc">Test exceptions on CanvasFilter() convolveMatrix</p> + + +<script> +var t = async_test("Test exceptions on CanvasFilter() convolveMatrix"); +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'); + +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix"}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", divisor: 2}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: null}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: 1}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 0], [0]]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, "a"], [0]]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 0], 0]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 0], [0, Infinity]]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: []}); }); +// This should not throw an error +ctx.filter = new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[]]}); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.worker.js new file mode 100644 index 0000000000..be361ee7aa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative +// Description:Test exceptions on CanvasFilter() convolveMatrix +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Test exceptions on CanvasFilter() convolveMatrix"); +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'); + +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix"}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", divisor: 2}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: null}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: 1}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 0], [0]]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, "a"], [0]]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 0], 0]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 0], [0, Infinity]]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: []}); }); +// This should not throw an error +ctx.filter = new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[]]}); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.html new file mode 100644 index 0000000000..e4e06f27d2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.filter.canvasFilterObject.tentative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.filter.canvasFilterObject.tentative</h1> +<p class="desc">Test CanvasFilter() object</p> + + +<script> +var t = async_test("Test CanvasFilter() object"); +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'); + +_assert(ctx.filter == 'none', "ctx.filter == 'none'"); +ctx.filter = 'blur(5px)'; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); +ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: 5}); +_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); +ctx.filter = new CanvasFilter([ + {filter: "gaussianBlur", stdDeviation: 5}, + {filter: "gaussianBlur", stdDeviation: 10} +]); +_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); +var canvas2 = new OffscreenCanvas(100, 50); +var ctx2 = canvas2.getContext('2d'); +ctx2.filter = ctx.filter; +_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); +ctx.filter = 'blur(5px)'; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); +ctx.filter = 'none'; +_assert(ctx.filter == 'none', "ctx.filter == 'none'"); +ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: 5}); +ctx.filter = "this string is not a filter and should do nothing"; +_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.worker.js new file mode 100644 index 0000000000..30772a39d1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.filter.canvasFilterObject.tentative +// Description:Test CanvasFilter() object +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Test CanvasFilter() object"); +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'); + +_assert(ctx.filter == 'none', "ctx.filter == 'none'"); +ctx.filter = 'blur(5px)'; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); +ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: 5}); +_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); +ctx.filter = new CanvasFilter([ + {filter: "gaussianBlur", stdDeviation: 5}, + {filter: "gaussianBlur", stdDeviation: 10} +]); +_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); +var canvas2 = new OffscreenCanvas(100, 50); +var ctx2 = canvas2.getContext('2d'); +ctx2.filter = ctx.filter; +_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); +ctx.filter = 'blur(5px)'; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); +ctx.filter = 'none'; +_assert(ctx.filter == 'none', "ctx.filter == 'none'"); +ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: 5}); +ctx.filter = "this string is not a filter and should do nothing"; +_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html new file mode 100644 index 0000000000..d5123476b5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html @@ -0,0 +1,130 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.filter.canvasFilterObject.turbulence.inputTypes.tentative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.filter.canvasFilterObject.turbulence.inputTypes.tentative</h1> +<p class="desc">Test exceptions on CanvasFilter() turbulence object</p> + + +<script> +var t = async_test("Test exceptions on CanvasFilter() turbulence object"); +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'); + +const errorTestCases = [ + {baseFrequency: {}}, + {baseFrequency: -1}, + {baseFrequency: [0, -1]}, + {baseFrequency: NaN}, + {baseFrequency: Infinity}, + {baseFrequency: undefined}, + {baseFrequency: -Infinity}, + {baseFrequency: "test"}, + + {numOctaves: {}}, + {numOctaves: -1}, + {numOctaves: NaN}, + {numOctaves: Infinity}, + {numOctaves: undefined}, + {numOctaves: -Infinity}, + {numOctaves: [1, 1]}, + {numOctaves: "test"}, + + {seed: {}}, + {seed: NaN}, + {seed: Infinity}, + {seed: undefined}, + {seed: -Infinity}, + {seed: [1, 1]}, + {seed: "test"}, + + {stitchTiles: {}}, + {stitchTiles: NaN}, + {stitchTiles: Infinity}, + {stitchTiles: undefined}, + {stitchTiles: -Infinity}, + {stitchTiles: [1, 1]}, + {stitchTiles: "test"}, + {stitchTiles: null}, + {stitchTiles: []}, + {stitchTiles: [10]}, + {stitchTiles: 30}, + {stitchTiles: false}, + {stitchTiles: true}, + {stitchTiles: "10"}, + {stitchTiles: -1}, + + {type: {}}, + {type: NaN}, + {type: Infinity}, + {type: undefined}, + {type: -Infinity}, + {type: [1, 1]}, + {type: "test"}, + {type: null}, + {type: []}, + {type: [10]}, + {type: 30}, + {type: false}, + {type: true}, + {type: "10"}, + {type: -1}, +] + +// null and [] = 0 when parsed as number +const workingTestCases = [ + {baseFrequency: null}, + {baseFrequency: []}, + {baseFrequency: [10]}, + {baseFrequency: [10, 3]}, + {baseFrequency: 30}, + {baseFrequency: false}, + {baseFrequency: true}, + {baseFrequency: "10"}, + + {numOctaves: null}, + {numOctaves: []}, + {numOctaves: [10]}, + {numOctaves: 30}, + {numOctaves: false}, + {numOctaves: true}, + {numOctaves: "10"}, + + {seed: null}, + {seed: []}, + {seed: [10]}, + {seed: 30}, + {seed: false}, + {seed: true}, + {seed: "10"}, + {seed: -1}, + + {stitchTiles: "stitch"}, + {stitchTiles: "noStitch"}, + + {type: "fractalNoise"}, + {type: "turbulence"}, +] + +for (testCase of errorTestCases) { + const filterOptions = {...{filter: "turbulence"}, ...testCase}; + assert_throws_js(TypeError, function() { CanvasFilter(filterOptions); }); +} + +for (testCase of workingTestCases) { + const filterOptions = {...{filter: "turbulence"}, ...testCase}; + _assert(new CanvasFilter(filterOptions) != null, "new CanvasFilter(filterOptions) != null"); +} +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.worker.js new file mode 100644 index 0000000000..bd1cd162fe --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.worker.js @@ -0,0 +1,126 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.filter.canvasFilterObject.turbulence.inputTypes.tentative +// Description:Test exceptions on CanvasFilter() turbulence object +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Test exceptions on CanvasFilter() turbulence object"); +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'); + +const errorTestCases = [ + {baseFrequency: {}}, + {baseFrequency: -1}, + {baseFrequency: [0, -1]}, + {baseFrequency: NaN}, + {baseFrequency: Infinity}, + {baseFrequency: undefined}, + {baseFrequency: -Infinity}, + {baseFrequency: "test"}, + + {numOctaves: {}}, + {numOctaves: -1}, + {numOctaves: NaN}, + {numOctaves: Infinity}, + {numOctaves: undefined}, + {numOctaves: -Infinity}, + {numOctaves: [1, 1]}, + {numOctaves: "test"}, + + {seed: {}}, + {seed: NaN}, + {seed: Infinity}, + {seed: undefined}, + {seed: -Infinity}, + {seed: [1, 1]}, + {seed: "test"}, + + {stitchTiles: {}}, + {stitchTiles: NaN}, + {stitchTiles: Infinity}, + {stitchTiles: undefined}, + {stitchTiles: -Infinity}, + {stitchTiles: [1, 1]}, + {stitchTiles: "test"}, + {stitchTiles: null}, + {stitchTiles: []}, + {stitchTiles: [10]}, + {stitchTiles: 30}, + {stitchTiles: false}, + {stitchTiles: true}, + {stitchTiles: "10"}, + {stitchTiles: -1}, + + {type: {}}, + {type: NaN}, + {type: Infinity}, + {type: undefined}, + {type: -Infinity}, + {type: [1, 1]}, + {type: "test"}, + {type: null}, + {type: []}, + {type: [10]}, + {type: 30}, + {type: false}, + {type: true}, + {type: "10"}, + {type: -1}, +] + +// null and [] = 0 when parsed as number +const workingTestCases = [ + {baseFrequency: null}, + {baseFrequency: []}, + {baseFrequency: [10]}, + {baseFrequency: [10, 3]}, + {baseFrequency: 30}, + {baseFrequency: false}, + {baseFrequency: true}, + {baseFrequency: "10"}, + + {numOctaves: null}, + {numOctaves: []}, + {numOctaves: [10]}, + {numOctaves: 30}, + {numOctaves: false}, + {numOctaves: true}, + {numOctaves: "10"}, + + {seed: null}, + {seed: []}, + {seed: [10]}, + {seed: 30}, + {seed: false}, + {seed: true}, + {seed: "10"}, + {seed: -1}, + + {stitchTiles: "stitch"}, + {stitchTiles: "noStitch"}, + + {type: "fractalNoise"}, + {type: "turbulence"}, +] + +for (testCase of errorTestCases) { + const filterOptions = {...{filter: "turbulence"}, ...testCase}; + assert_throws_js(TypeError, function() { CanvasFilter(filterOptions); }); +} + +for (testCase of workingTestCases) { + const filterOptions = {...{filter: "turbulence"}, ...testCase}; + _assert(new CanvasFilter(filterOptions) != null, "new CanvasFilter(filterOptions) != null"); +} +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.value.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.value.html new file mode 100644 index 0000000000..8f06eb42fa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.value.html @@ -0,0 +1,56 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.filter.value</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.filter.value</h1> +<p class="desc">test if ctx.filter works correctly</p> + + +<script> +var t = async_test("test if ctx.filter works 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'); + +_assert(ctx.filter == 'none', "ctx.filter == 'none'"); +ctx.filter = 'blur(5px)'; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); +ctx.save(); +ctx.filter = 'none'; +_assert(ctx.filter == 'none', "ctx.filter == 'none'"); +ctx.restore(); +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + +ctx.filter = 'blur(10)'; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); +ctx.filter = 'blur 10px'; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + +ctx.filter = 'inherit'; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); +ctx.filter = 'initial'; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); +ctx.filter = 'unset'; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + +ctx.filter = ''; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); +ctx.filter = null; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); +ctx.filter = undefined; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + +ctx.filter = 'blur( 5px)'; +assert_equals(ctx.filter, 'blur( 5px)'); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.value.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.value.worker.js new file mode 100644 index 0000000000..01403f398c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.value.worker.js @@ -0,0 +1,52 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.filter.value +// Description:test if ctx.filter works correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("test if ctx.filter works 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'); + +_assert(ctx.filter == 'none', "ctx.filter == 'none'"); +ctx.filter = 'blur(5px)'; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); +ctx.save(); +ctx.filter = 'none'; +_assert(ctx.filter == 'none', "ctx.filter == 'none'"); +ctx.restore(); +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + +ctx.filter = 'blur(10)'; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); +ctx.filter = 'blur 10px'; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + +ctx.filter = 'inherit'; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); +ctx.filter = 'initial'; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); +ctx.filter = 'unset'; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + +ctx.filter = ''; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); +ctx.filter = null; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); +ctx.filter = undefined; +_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + +ctx.filter = 'blur( 5px)'; +assert_equals(ctx.filter, 'blur( 5px)'); +t.done(); + +}); +done(); 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..7f34def564 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.butt.html @@ -0,0 +1,56 @@ +<!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..3eacba11a3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.butt.worker.js @@ -0,0 +1,52 @@ +// 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..0a3f3fcab7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.closed.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.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..24bace4c27 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.closed.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.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..f02cfcc758 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.invalid.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.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..4ef69f35af --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.invalid.worker.js @@ -0,0 +1,42 @@ +// 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..00b72b62d2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.open.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.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..621de99a83 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.open.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.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..9f6c66567e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.round.html @@ -0,0 +1,65 @@ +<!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..e744d2906f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.round.worker.js @@ -0,0 +1,61 @@ +// 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..0fd4b2c71a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.square.html @@ -0,0 +1,56 @@ +<!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..7684bbbc85 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.square.worker.js @@ -0,0 +1,52 @@ +// 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..ce7b4c8ad6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.valid.html @@ -0,0 +1,32 @@ +<!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..7fa84f4d6f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cap.valid.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.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..09d3a00b31 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cross.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.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..82b289bdea --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.cross.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.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..64c21c563e --- /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..77116b4454 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.defaults.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.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.join.bevel.html b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.bevel.html new file mode 100644 index 0000000000..45c8d3eb54 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.bevel.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.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..2dfbf34f15 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.bevel.worker.js @@ -0,0 +1,65 @@ +// 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..5e88ad0d01 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.closed.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.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..f2b029ecaf --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.closed.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.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..a54861205e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.invalid.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.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..23dfe67230 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.invalid.worker.js @@ -0,0 +1,42 @@ +// 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..64918eca38 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.miter.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.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..02712a806e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.miter.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.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..48154df59b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.open.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.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..133854bf54 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.open.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.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..fdda123dd8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.parallel.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.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..68ed957b6d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.parallel.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.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..ebc71c30f8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.round.html @@ -0,0 +1,67 @@ +<!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..c7da3520b3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.round.worker.js @@ -0,0 +1,63 @@ +// 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..eaa7c24967 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.valid.html @@ -0,0 +1,32 @@ +<!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..4e7154358a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.join.valid.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.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..fd6902ca4d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.acute.html @@ -0,0 +1,48 @@ +<!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..ef2954a7fe --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.acute.worker.js @@ -0,0 +1,44 @@ +// 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..fd0e7a1ca2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.exceeded.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.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..2e0fbd4910 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.exceeded.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.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..35bda1a11a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.invalid.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.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"); +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..ef4c17eea2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.invalid.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.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"); +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..292ed560de --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.lineedge.html @@ -0,0 +1,38 @@ +<!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..c7fa1e6d17 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.lineedge.worker.js @@ -0,0 +1,34 @@ +// 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..4e60253ddc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.obtuse.html @@ -0,0 +1,48 @@ +<!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..3cf78ed21e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.obtuse.worker.js @@ -0,0 +1,44 @@ +// 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..33cbe5d02c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.rightangle.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.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..895318c3ef --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.rightangle.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.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..1d034052aa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.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.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..b34561407e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.valid.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.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..4af7c84a6a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.within.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.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..64fe4312c2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.miter.within.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.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..60defee7cb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.union.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.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..ed26237337 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.union.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.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..9b81b1c386 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.basic.html @@ -0,0 +1,59 @@ +<!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..e822679c63 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.basic.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.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..439af5ecf2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.invalid.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.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"); +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..d87b87e901 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.invalid.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.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"); +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..7813997858 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.scaledefault.html @@ -0,0 +1,38 @@ +<!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..f9506c4acc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.scaledefault.worker.js @@ -0,0 +1,34 @@ +// 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..e75cccd991 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.transformed.html @@ -0,0 +1,65 @@ +<!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..f377d03ca7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.transformed.worker.js @@ -0,0 +1,61 @@ +// 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..adaabccc11 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.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.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..f409e1fa8b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/line-styles/2d.line.width.valid.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.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(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/convert-to-blob/offscreencanvas.convert.to.blob.html b/testing/web-platform/tests/html/canvas/offscreen/manual/convert-to-blob/offscreencanvas.convert.to.blob.html new file mode 100644 index 0000000000..1cc0e5bffd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/convert-to-blob/offscreencanvas.convert.to.blob.html @@ -0,0 +1,165 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<link rel="help" href="https://html.spec.whatwg.org/#dom-offscreencanvas-converttoblob"> +<script id="myWorker" type="text/worker"> +self.onmessage = function(e) { +}; +</script> +<script> +function makeWorker(script) +{ + var blob = new Blob([script]); + return new Worker(URL.createObjectURL(blob)); +} + +function drawCanvas(ctx) +{ + ctx.fillStyle = "red"; + ctx.fillRect(0, 0, 5, 5); + ctx.fillStyle = "green"; + ctx.fillRect(5, 0, 5, 5); + ctx.fillStyle = "blue"; + ctx.fillRect(0, 5, 5, 5); + ctx.fillStyle = "black"; + ctx.fillRect(5, 5, 5, 5); +} + +function compareImages(image1, image2) +{ + var canvas1 = document.createElement('canvas'); + var canvas2 = document.createElement('canvas'); + canvas1.width = canvas1.height = 10; + canvas2.width = canvas2.height = 10; + var ctx1 = canvas1.getContext('2d'); + var ctx2 = canvas1.getContext('2d'); + ctx1.drawImage(image1, 0, 0); + ctx2.drawImage(image2, 0, 0); + var data1 = ctx1.getImageData(0, 0, 10, 10).data; + var data2 = ctx2.getImageData(0, 0, 10, 10).data; + assert_equals(data1.length, data2.length); + var imageMatched = true; + for (var i = 0; i < data1.length; i++) { + if (data1[i] != data2[i]) { + imageMatched = false; + break; + } + } + assert_true(imageMatched); +} + +function testConvertToBlob(t, typeVal, qualityVal) { + var offscreenCanvas = new OffscreenCanvas(10, 10); + var oCtx = offscreenCanvas.getContext('2d'); + drawCanvas(oCtx); + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + drawCanvas(ctx); + var imageLoadedCounter = 0; + + var image1 = new Image(); + var image2 = new Image(); + var promise; + if (typeVal == "empty" && qualityVal == "empty") + promise = offscreenCanvas.convertToBlob(); + else if (typeVal == "empty" && qualityVal != "empty") + promise = offscreenCanvas.convertToBlob({quality: qualityVal}); + else if (typeVal != "empty" && qualityVal == "empty") + promise = offscreenCanvas.convertToBlob({type: typeVal}); + else + promise = offscreenCanvas.convertToBlob({type: typeVal, quality: qualityVal}); + promise.then(function(blob2) { + image2.src = URL.createObjectURL(blob2); + if (typeVal == "empty" && qualityVal == "empty") { + canvas.toBlob(function(blob1) { + image1.src = URL.createObjectURL(blob1); + }); + } else if (typeVal == "empty" && qualityVal != "empty") { + canvas.toBlob(function(blob1) { + image1.src = URL.createObjectURL(blob1); + }, "image/png", qualityVal); + } else if (typeVal != "empty" && qualityVal == "empty") { + canvas.toBlob(function(blob1) { + image1.src = URL.createObjectURL(blob1); + }, typeVal, 1.0); + } else { + canvas.toBlob(function(blob1) { + image1.src = URL.createObjectURL(blob1); + }, typeVal, qualityVal); + } + image1.onload = image2.onload = t.step_func(function() { + imageLoadedCounter++; + if (imageLoadedCounter == 2) { + compareImages(image1, image2); + t.done(); + } + }); + }); +} + +async_test(function(t) { + testConvertToBlob(t, "empty", "empty"); + testConvertToBlob(t, "empty", 1.0); + testConvertToBlob(t, "empty", 0.2); +}, "Test that convertToBlob with default type produces correct result"); + +async_test(function(t) { + testConvertToBlob(t, "image/png", "empty"); + testConvertToBlob(t, "image/png", 1.0); + testConvertToBlob(t, "image/png", 0.2); +}, "Test that convertToBlob with png produces correct result"); + +async_test(function(t) { + testConvertToBlob(t, "image/jpeg", "empty"); + testConvertToBlob(t, "image/jpeg", 1.0); + testConvertToBlob(t, "image/jpeg", 0.2); +}, "Test that convertToBlob with jpge produces correct result"); + +async_test(function(t) { + testConvertToBlob(t, "image/webp", "empty"); + testConvertToBlob(t, "image/webp", 1.0); + testConvertToBlob(t, "image/webp", 0.2); +}, "Test that convertToBlob with webp produces correct result"); + +async_test(function(t) { + var worker = makeWorker(document.getElementById("myWorker").textContent); + var offscreenCanvas = new OffscreenCanvas(10, 10); + worker.postMessage({offscreenCanvas}, [offscreenCanvas]); + offscreenCanvas.convertToBlob().then(t.step_func_done(function() { + assert_false("convertToBlob didn't throw, but should be"); + }), t.step_func_done(function(e) { + assert_true(e instanceof DOMException); + assert_equals(e.name, "InvalidStateError"); + })); +}, "Test that call convertToBlob on a detached OffscreenCanvas throws exception"); + +async_test(function(t) { + var offscreenCanvas = new OffscreenCanvas(0, 0); + offscreenCanvas.convertToBlob().then(t.step_func_done(function() { + assert_false("convertToBlob didn't throw, but should be"); + }), t.step_func_done(function(e) { + assert_true(e instanceof DOMException); + assert_equals(e.name, "IndexSizeError"); + })); +}, "Test that call convertToBlob on a OffscreenCanvas with size 0 throws exception"); + +async_test(function(t) { + var img = new Image(); + img.src = "/images/green.png"; + img.crossOrigin = "anonymous"; + img.onload = t.step_func_done(() => { + var offscreenCanvas = new OffscreenCanvas(10, 10); + var ctx = offscreenCanvas.getContext("2d"); + ctx.drawImage(img, 0, 0); + offscreenCanvas.convertToBlob().then(t.step_func_done(function() { + assert_false("convertToBlob didn't throw, but should"); + }), t.step_func_done(function(e) { + assert_true(e instanceof DOMException); + assert_equals(e.name, "SecurityError"); + })); + }); +}, "Test that call convertToBlob on a OffscreenCanvas with tainted origin throws exception"); + +</script> + diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/convert-to-blob/offscreencanvas.convert.to.blob.w.html b/testing/web-platform/tests/html/canvas/offscreen/manual/convert-to-blob/offscreencanvas.convert.to.blob.w.html new file mode 100644 index 0000000000..5c1fa4cf40 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/convert-to-blob/offscreencanvas.convert.to.blob.w.html @@ -0,0 +1,337 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<link rel="help" href="https://html.spec.whatwg.org/#dom-offscreencanvas-converttoblob"> +<script id="myWorker" type="text/worker"> +function drawCanvas(ctx) +{ + ctx.fillStyle = "red"; + ctx.fillRect(0, 0, 5, 5); + ctx.fillStyle = "green"; + ctx.fillRect(5, 0, 5, 5); + ctx.fillStyle = "blue"; + ctx.fillRect(0, 5, 5, 5); + ctx.fillStyle = "black"; + ctx.fillRect(5, 5, 5, 5); +} + +function testConvertToBlob(typeVal, qualityVal) { + var offscreenCanvas = new OffscreenCanvas(10, 10); + var oCtx = offscreenCanvas.getContext('2d'); + drawCanvas(oCtx); + + var promise; + if (typeVal == "empty" && qualityVal == "empty") + promise = offscreenCanvas.convertToBlob(); + else if (typeVal == "empty" && qualityVal != "empty") + promise = offscreenCanvas.convertToBlob({quality: qualityVal}); + else if (typeVal != "empty" && qualityVal == "empty") + promise = offscreenCanvas.convertToBlob({type: typeVal}); + else + promise = offscreenCanvas.convertToBlob({type: typeVal, quality: qualityVal}); + promise.then(function(blob) { + self.postMessage(blob); + }); +} + +function testConvertToBlobException1() +{ + var offscreenCanvas = new OffscreenCanvas(10, 10); + self.postMessage({offscreenCanvas}, [offscreenCanvas]); + offscreenCanvas.convertToBlob().then(function() { + self.postMessage(false); + }, function(e) { + self.postMessage(e instanceof DOMException && e.name == "InvalidStateError"); + }); +} + +function testConvertToBlobException2() +{ + var offscreenCanvas = new OffscreenCanvas(0, 0); + offscreenCanvas.convertToBlob().then(function() { + self.postMessage(false); + }, function(e) { + self.postMessage(e instanceof DOMException && e.name == "IndexSizeError"); + }); +} + +function testConvertToBlobException3(bitmap) +{ + var offscreenCanvas = new OffscreenCanvas(10, 10); + var ctx = offscreenCanvas.getContext("2d"); + ctx.drawImage(bitmap, 0, 0); + offscreenCanvas.convertToBlob().then(function() { + self.postMessage(false); + }, function(e) { + self.postMessage(e instanceof DOMException && e.name == "SecurityError"); + }); +} + +self.onmessage = function(e) { + if (e.data instanceof ImageBitmap) { + testConvertToBlobException3(e.data); + return; + } + + switch(e.data) { + case 'test1': + testConvertToBlob("empty", "empty"); + break; + case 'test2': + testConvertToBlob("empty", 1.0); + break; + case 'test3': + testConvertToBlob("empty", 0.2); + break; + case 'test4': + testConvertToBlob("image/png", "empty"); + break; + case 'test5': + testConvertToBlob("image/png", 1.0); + break; + case 'test6': + testConvertToBlob("image/png", 0.2); + break; + case 'test7': + testConvertToBlob("image/jpeg", "empty"); + break; + case 'test8': + testConvertToBlob("image/jpeg", 1.0); + break; + case 'test9': + testConvertToBlob("image/jpeg", 0.2); + break; + case 'test10': + testConvertToBlob("image/webp", "empty"); + break; + case 'test11': + testConvertToBlob("image/webp", 1.0); + break; + case 'test12': + testConvertToBlob("image/webp", 0.2); + break; + case 'test13': + testConvertToBlobException1(); + break; + case 'test14': + testConvertToBlobException2(); + break; + } +}; + +</script> + +<script> +function makeWorker(test) { + var blob = new Blob([document.getElementById("myWorker").textContent]); + var worker = new Worker(URL.createObjectURL(blob)); + worker.onerror = test.unreached_func("error"); + return worker; +} + +function drawCanvas(ctx) +{ + ctx.fillStyle = "red"; + ctx.fillRect(0, 0, 5, 5); + ctx.fillStyle = "green"; + ctx.fillRect(5, 0, 5, 5); + ctx.fillStyle = "blue"; + ctx.fillRect(0, 5, 5, 5); + ctx.fillStyle = "black"; + ctx.fillRect(5, 5, 5, 5); +} + +function compareImages(image1, image2) +{ + var canvas1 = document.createElement('canvas'); + var canvas2 = document.createElement('canvas'); + canvas1.width = canvas1.height = 10; + canvas2.width = canvas2.height = 10; + var ctx1 = canvas1.getContext('2d'); + var ctx2 = canvas1.getContext('2d'); + ctx1.drawImage(image1, 0, 0); + ctx2.drawImage(image2, 0, 0); + var data1 = ctx1.getImageData(0, 0, 10, 10).data; + var data2 = ctx2.getImageData(0, 0, 10, 10).data; + assert_equals(data1.length, data2.length); + var imageMatched = true; + for (var i = 0; i < data1.length; i++) { + if (data1[i] != data2[i]) { + imageMatched = false; + break; + } + } + assert_true(imageMatched); +} + +function compareWithToBlob(t, typeVal, qualityVal, blob2) +{ + var image1 = new Image(); + var image2 = new Image(); + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + drawCanvas(ctx); + var imageLoadedCounter = 0; + + if (typeVal == "empty" && qualityVal == "empty") { + canvas.toBlob(function(blob1) { + image1.src = URL.createObjectURL(blob1); + }); + } else if (typeVal == "empty" && qualityVal != "empty") { + canvas.toBlob(function(blob1) { + image1.src = URL.createObjectURL(blob1); + }, "image/png", qualityVal); + } else if (typeVal != "empty" && qualityVal == "empty") { + canvas.toBlob(function(blob1) { + image1.src = URL.createObjectURL(blob1); + }, typeVal, 1.0); + } else { + canvas.toBlob(function(blob1) { + image1.src = URL.createObjectURL(blob1); + }, typeVal, qualityVal); + } + image2.src = URL.createObjectURL(blob2); + image1.onload = image2.onload = t.step_func(function() { + imageLoadedCounter++; + if (imageLoadedCounter == 2) { + compareImages(image1, image2); + t.done(); + } + }); +} + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func(function(msg) { + compareWithToBlob(t, "empty", "empty", msg.data); + })); + worker.postMessage('test1'); +}, "Test that convertToBlob with default arguments produces correct result in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func(function(msg) { + compareWithToBlob(t, "empty", 1.0, msg.data); + })); + worker.postMessage('test2'); +}, "Test that convertToBlob with default type/1.0 quality produces correct result in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func(function(msg) { + compareWithToBlob(t, "empty", 0.2, msg.data); + })); + worker.postMessage('test3'); +}, "Test that convertToBlob with default type/0.2 quality produces correct result in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func(function(msg) { + compareWithToBlob(t, "image/png", "empty", msg.data); + })); + worker.postMessage('test4'); +}, "Test that convertToBlob with png/default quality produces correct result in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func(function(msg) { + compareWithToBlob(t, "image/png", 1.0, msg.data); + })); + worker.postMessage('test5'); +}, "Test that convertToBlob with png/1.0 quality produces correct result in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func(function(msg) { + compareWithToBlob(t, "image/png", 0.2, msg.data); + })); + worker.postMessage('test6'); +}, "Test that convertToBlob with png/0.2 quality produces correct result in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func(function(msg) { + compareWithToBlob(t, "image/jpeg", "empty", msg.data); + })); + worker.postMessage('test7'); +}, "Test that convertToBlob with jpeg/default quality produces correct result in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func(function(msg) { + compareWithToBlob(t, "image/jpeg", 1.0, msg.data); + })); + worker.postMessage('test8'); +}, "Test that convertToBlob with jpeg/1.0 quality produces correct result in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func(function(msg) { + compareWithToBlob(t, "image/jpeg", 0.2, msg.data); + })); + worker.postMessage('test9'); +}, "Test that convertToBlob with jpeg/0.2 quality produces correct result in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func(function(msg) { + compareWithToBlob(t, "image/webp", "empty", msg.data); + })); + worker.postMessage('test10'); +}, "Test that convertToBlob with webp/default quality produces correct result in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func(function(msg) { + compareWithToBlob(t, "image/webp", 1.0, msg.data); + })); + worker.postMessage('test11'); +}, "Test that convertToBlob with webp/1.0 quality produces correct result in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func(function(msg) { + compareWithToBlob(t, "image/webp", 0.2, msg.data); + })); + worker.postMessage('test12'); +}, "Test that convertToBlob with webp/0.2 quality produces correct result in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func_done(function(msg) { + if (msg.data instanceof Object) + return; + assert_true(msg.data); + t.done(); + })); + worker.postMessage('test13'); +}, "Test that call convertToBlob on a detached OffscreenCanvas throws exception in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func_done(function(msg) { + assert_true(msg.data); + t.done(); + })); + worker.postMessage('test14'); +}, "Test that call convertToBlob on a OffscreenCanvas with size 0 throws exception in a worker"); + +async_test(function(t) { + var img = new Image(); + img.src = "/images/green.png"; + img.crossOrigin = "anonymous"; + img.onload = t.step_func_done(() => { + createImageBitmap(img).then(t.step_func_done(bitmap => { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func_done(function(msg) { + assert_true(msg.data); + t.done(); + })); + worker.postMessage(bitmap); + })); + }); +}, "Test that call convertToBlob on a OffscreenCanvas with tainted origin throws exception in a worker"); + +</script> + diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.html b/testing/web-platform/tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.html new file mode 100644 index 0000000000..a5fd7ab066 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.html @@ -0,0 +1,49 @@ +<!DOCTYPE html> +<title>OffscreenCanvas test: 2d.text.draw.generic.family</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<script> +function drawCanvas(ctx, family) +{ + ctx.font = '16px ' + family; + ctx.fillText(family, 0, 16); +} + +function testDrawGenericFamily(family) +{ + let offscreenCanvas = new OffscreenCanvas(88, 24); + let oCtx = offscreenCanvas.getContext('2d'); + drawCanvas(oCtx, family); + let canvas = document.createElement('canvas'); + let ctx = canvas.getContext('2d'); + drawCanvas(ctx, family); + + let data1 = oCtx.getImageData(0, 0, 88, 24).data; + let data2 = ctx.getImageData(0, 0, 88, 24).data; + assert_array_equals(data1, data2, + "The image data generated by drawing generic font family '" + family + + "' should be the same for both OffscreenCanvas and regular canvas"); +} + +test(function() { + testDrawGenericFamily('sans-serif'); +}, "Test that drawing sans-serif produces the same result between canvas and OffscreenCanvas"); + +test(function() { + testDrawGenericFamily('serif'); +}, "Test that drawing serif produces the same result between canvas and OffscreenCanvas"); + +test(function() { + testDrawGenericFamily('cursive'); +}, "Test that drawing cursive produces the same result between canvas and OffscreenCanvas"); + +test(function() { + testDrawGenericFamily('fantasy'); +}, "Test that drawing fantasy produces the same result between canvas and OffscreenCanvas"); + +test(function() { + testDrawGenericFamily('monospace'); +}, "Test that drawing monospace produces the same result between canvas and OffscreenCanvas"); +</script> + diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.w.html b/testing/web-platform/tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.w.html new file mode 100644 index 0000000000..7a88c032ad --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.w.html @@ -0,0 +1,52 @@ +<!DOCTYPE html> +<title>OffscreenCanvas test: 2d.text.draw.generic.family.w</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<script id='myWorker' type='text/worker'> +self.onmessage = function(e) { + let oc = new OffscreenCanvas(88, 24); + let ctx = oc.getContext('2d'); + ctx.font = '32px ' + e.data.family; + ctx.fillText(e.data.family, 0, 16); + self.postMessage(ctx.getImageData(0, 0, 88, 24).data); +}; +</script> +<script> +function testDrawGenericFamily(t, family) +{ + let blob = new Blob([document.getElementById('myWorker').textContent]); + let worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + let ctx = document.createElement('canvas').getContext('2d'); + ctx.font = '32px ' + family; + ctx.fillText(family, 0, 16); + assert_array_equals(ctx.getImageData(0, 0, 88, 24).data, msg.data, + "The image data generated by drawing generic font family '" + family + + "' should be the same for both OffscreenCanvas and regular canvas"); + t.done(); + }); + worker.postMessage({family: family}); +} + +async_test(function(t) { + testDrawGenericFamily(t, 'sans-serif'); +}, "Test that drawing sans-serif produces the same result between canvas and OffscreenCanvas in a Worker"); + +async_test(function(t) { + testDrawGenericFamily(t, 'serif'); +}, "Test that drawing serif produces the same result between canvas and OffscreenCanvas in a Worker"); + +async_test(function(t) { + testDrawGenericFamily(t, 'cursive'); +}, "Test that drawing cursive produces the same result between canvas and OffscreenCanvas in a Worker"); + +async_test(function(t) { + testDrawGenericFamily(t, 'fantasy'); +}, "Test that drawing fantasy produces the same result between canvas and OffscreenCanvas in a Worker"); + +async_test(function(t) { + testDrawGenericFamily(t, 'monospace'); +}, "Test that drawing monospace produces the same result between canvas and OffscreenCanvas in a Worker"); +</script> + diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/filter/offscreencanvas.filter.html b/testing/web-platform/tests/html/canvas/offscreen/manual/filter/offscreencanvas.filter.html new file mode 100644 index 0000000000..25691983f1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/filter/offscreencanvas.filter.html @@ -0,0 +1,27 @@ +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="offscreencanvas.filter.js"></script> +<script> +var patternCanvas = createPatternCanvas(); + +var getOffscreenContextForFilter = function(filter, pattern) { + var oc = new OffscreenCanvas(80, 80); + var offCtx = oc.getContext('2d'); + offCtx.filter = filter; + offCtx.drawImage(pattern, 5, 5); + offCtx.drawImage(pattern, 25, 25); + offCtx.drawImage(pattern, 45, 45); + return offCtx; +}; + +var testFilter = function(filter) { + var offCtx = getOffscreenContextForFilter(filter, patternCanvas); + var ctx = getRegularContextForFilter(filter, patternCanvas); + var offImageData = offCtx.getImageData(0, 0, 80, 80).data; + var imageData = ctx.getImageData(0, 0, 80, 80).data; + matchImageDataResults(offImageData, imageData, filter); +}; + +generate_tests(testFilter, [filters]); + +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/filter/offscreencanvas.filter.js b/testing/web-platform/tests/html/canvas/offscreen/manual/filter/offscreencanvas.filter.js new file mode 100644 index 0000000000..cb2e245803 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/filter/offscreencanvas.filter.js @@ -0,0 +1,48 @@ +var getRegularContextForFilter = function(filter, pattern) { + var c = document.createElement("canvas"); + c.width = c.height = 80; + var ctx = c.getContext('2d'); + ctx.filter = filter; + ctx.drawImage(pattern, 5, 5); + ctx.drawImage(pattern, 25, 25); + ctx.drawImage(pattern, 45, 45); + return ctx; +}; + +var matchImageDataResults = function(offscreenImage, regularImage, filter) { + assert_array_equals(offscreenImage, regularImage, + "The image data generated by filter " + + filter + + " should be the same for both OffscreenCanvas and regular canvas"); +}; + +var createPatternCanvas = function() { + var patternCanvas = document.createElement('canvas'); + patternCanvas.width = 20; + patternCanvas.height = 20; + var patternCtx = patternCanvas.getContext('2d'); + patternCtx.fillStyle = '#A00'; + patternCtx.fillRect(0, 0, 10, 10); + patternCtx.fillStyle = '#0A0'; + patternCtx.fillRect(10, 0, 10, 10); + patternCtx.fillStyle = '#00A'; + patternCtx.fillRect(0, 10, 10, 10); + patternCtx.fillStyle = "#AA0"; + patternCtx.fillRect(10, 10, 10, 10); + return patternCanvas; +}; + +var filters = [ "none" , + "blur(10px)" , + "brightness(40%)" , + "contrast(20%)" , + "drop-shadow(0 0 5px green)" , + "grayscale(100%)" , + "invert(100%)" , + "opacity(50%)" , + "saturate(20%)" , + "sepia(100%)" , + "sepia(1) hue-rotate(200deg)", + "url(#url)" ]; + + diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/filter/offscreencanvas.filter.w.html b/testing/web-platform/tests/html/canvas/offscreen/manual/filter/offscreencanvas.filter.w.html new file mode 100644 index 0000000000..d6ed915b53 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/filter/offscreencanvas.filter.w.html @@ -0,0 +1,54 @@ +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="offscreencanvas.filter.js"></script> +<script id='myWorker' type='text/worker'> +self.onmessage = function(e) { + var getOffscreenCanvasForFilter = function(filter, pattern) { + var oc = new OffscreenCanvas(80, 80); + var offCtx = oc.getContext('2d'); + offCtx.filter = filter; + offCtx.drawImage(pattern, 5, 5); + offCtx.drawImage(pattern, 25, 25); + offCtx.drawImage(pattern, 45, 45); + return oc; + }; + + var filters = e.data.filters; + var pattern = e.data.pattern; + var ret = []; + for (var i = 0; i < filters.length; i++) { + var oc = getOffscreenCanvasForFilter(filters[i], pattern); + var imageBitmap = oc.transferToImageBitmap(); + ret.push(imageBitmap); + } + self.postMessage(ret, ret); +}; +</script> +<script> +var patternCanvas = createPatternCanvas(); + +// Build a list of image data on regular canvas with different filters +var listCanvasImageData = []; +for (var j = 0; j < filters.length; j++) { + var ctx = getRegularContextForFilter(filters[j], patternCanvas); + listCanvasImageData.push(ctx.getImageData(0, 0, 80, 80).data); +} + +function consumeImageBitmap(patternImage) { + async_test(t => { + var blob = new Blob([document.getElementById('myWorker').textContent]); + var worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + for (var i = 0; i < msg.data.length; ++i) { + var outputCtx = document.createElement("canvas").getContext('2d'); + outputCtx.drawImage(msg.data[i], 0, 0, 80, 80); + matchImageDataResults(outputCtx.getImageData(0, 0, 80, 80).data, listCanvasImageData[i], filters[i]); + } + t.done(); + }); + worker.postMessage({filters: filters, pattern: patternImage}, [patternImage]); + }); +} + +createImageBitmap(patternCanvas).then(consumeImageBitmap); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/image-smoothing/image.smoothing.html b/testing/web-platform/tests/html/canvas/offscreen/manual/image-smoothing/image.smoothing.html new file mode 100644 index 0000000000..a78524c51d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/image-smoothing/image.smoothing.html @@ -0,0 +1,128 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>OffscreenCanvasRenderingContext2D imageSmoothingEnabled test</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<link rel="help" href="https://html.spec.whatwg.org/#the-offscreen-2d-rendering-context"> +<script> +function createTestImage() { + var image = new OffscreenCanvas(100, 50); + var imgctx = image.getContext('2d'); + imgctx.fillStyle = "#F00"; + imgctx.fillRect(0, 0, 2, 2); + imgctx.fillStyle = "#0F0"; + imgctx.fillRect(0, 0, 1, 1); + return image; +} + +test(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + assert_true(ctx.imageSmoothingEnabled); +}, "When the context is created, imageSmoothingEnabled must be set to true."); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + ctx.imageSmoothingEnabled = false; + assert_false(ctx.imageSmoothingEnabled); +}, "On getting imageSmoothingEnabled, the user agent must return the last value it was set to."); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + var image = createTestImage(); + ctx.scale(10, 10); + ctx.drawImage(image, 0, 0); + var pixels = ctx.getImageData(9, 9, 1, 1).data; + assert_not_equals(pixels[0], 0); + assert_not_equals(pixels[1], 255); +}, "Test that image smoothing is actually on by default."); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + ctx.imageSmoothingEnabled = true; + var image = createTestImage(); + ctx.scale(10, 10); + ctx.drawImage(image, 0, 0); + var pixels = ctx.getImageData(9, 9, 1, 1).data; + assert_not_equals(pixels[0], 0); + assert_not_equals(pixels[1], 255); +}, "Test that image smoothing works when imageSmoothingEnabled is set to true"); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + var image = createTestImage(); + ctx.imageSmoothingEnabled = false; + ctx.scale(10, 10); + ctx.drawImage(image, 0, 0); + var pixels = ctx.getImageData(9, 9, 1, 1).data; + assert_array_equals(pixels, [0, 255, 0, 255]); +}, "Test that imageSmoothingEnabled = false (nearest-neighbor interpolation) works with drawImage()."); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + var image = createTestImage(); + ctx.imageSmoothingEnabled = false; + ctx.scale(10, 10); + ctx.fillStyle = ctx.createPattern(image, 'repeat'); + ctx.fillRect(0, 0, 10, 10); + var pixels = ctx.getImageData(9, 9, 1, 1).data; + assert_array_equals(pixels, [0, 255, 0, 255]); +}, "Test that imageSmoothingEnabled = false (nearest-neighbor interpolation) works with fillRect and createPattern()."); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + var image = createTestImage(); + ctx.imageSmoothingEnabled = false; + ctx.fillStyle = ctx.createPattern(image, 'repeat'); + ctx.scale(10, 10); + ctx.rect(0, 0, 10, 10); + ctx.fill(); + var pixels = ctx.getImageData(9, 9, 1, 1).data; + assert_array_equals(pixels, [0, 255, 0, 255]); +}, "Test that imageSmoothingEnabled = false (nearest-neighbor interpolation) works with fill() and createPattern()."); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + var image = createTestImage(); + ctx.strokeStyle = ctx.createPattern(image, 'repeat'); + ctx.lineWidth = 5; + ctx.imageSmoothingEnabled = false; + ctx.scale(10, 10); + ctx.beginPath(); + ctx.moveTo(0, 0); + ctx.lineTo(10, 10); + ctx.stroke(); + var pixels = ctx.getImageData(9, 9, 1, 1).data; + assert_array_equals(pixels, [0, 255, 0, 255]); +}, "Test that imageSmoothingEnabled = false (nearest-neighbor interpolation) works with stroke() and createPattern()."); + +test(function() { + var repaints = 5; + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + + function draw() { + ctx.clearRect(0, 0, 10, 10); + ctx.setTransform(1, 0, 0, 1, 0, 0); + var image = createTestImage(); + ctx.imageSmoothingEnabled = false; + ctx.scale(10, 10); + ctx.drawImage(image, 0, 0); + var pixels = ctx.getImageData(9, 9, 1, 1).data; + assert_array_equals(pixels, [0, 255, 0, 255]); + } + + while (repaints > 0) { + draw(); + repaints = repaints - 1; + } + +}, "Test that imageSmoothingEnabled = false (nearest-neighbor interpolation) still works after repaints."); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/image-smoothing/image.smoothing.worker.js b/testing/web-platform/tests/html/canvas/offscreen/manual/image-smoothing/image.smoothing.worker.js new file mode 100644 index 0000000000..4c37e84b1f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/image-smoothing/image.smoothing.worker.js @@ -0,0 +1,126 @@ +// spec link: https://html.spec.whatwg.org/#the-offscreen-2d-rendering-context + +importScripts("/resources/testharness.js"); + +function createTestImage() { + var image = new OffscreenCanvas(100, 50); + var imgctx = image.getContext('2d'); + imgctx.fillStyle = "#F00"; + imgctx.fillRect(0, 0, 2, 2); + imgctx.fillStyle = "#0F0"; + imgctx.fillRect(0, 0, 1, 1); + return image; +} + +test(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + assert_true(ctx.imageSmoothingEnabled); +}, "When the context is created, imageSmoothingEnabled must be set to true."); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + ctx.imageSmoothingEnabled = false; + assert_false(ctx.imageSmoothingEnabled); +}, "On getting imageSmoothingEnabled, the user agent must return the last value it was set to."); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + var image = createTestImage(); + ctx.scale(10, 10); + ctx.drawImage(image, 0, 0); + var pixels = ctx.getImageData(9, 9, 1, 1).data; + assert_not_equals(pixels[0], 0); + assert_not_equals(pixels[1], 255); +}, "Test that image smoothing is actually on by default."); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + ctx.imageSmoothingEnabled = true; + var image = createTestImage(); + ctx.scale(10, 10); + ctx.drawImage(image, 0, 0); + var pixels = ctx.getImageData(9, 9, 1, 1).data; + assert_not_equals(pixels[0], 0); + assert_not_equals(pixels[1], 255); +}, "Test that image smoothing works when imageSmoothingEnabled is set to true"); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + var image = createTestImage(); + ctx.imageSmoothingEnabled = false; + ctx.scale(10, 10); + ctx.drawImage(image, 0, 0); + var pixels = ctx.getImageData(9, 9, 1, 1).data; + assert_array_equals(pixels, [0, 255, 0, 255]); +}, "Test that imageSmoothingEnabled = false (nearest-neighbor interpolation) works with drawImage()."); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + var image = createTestImage(); + ctx.imageSmoothingEnabled = false; + ctx.scale(10, 10); + ctx.fillStyle = ctx.createPattern(image, 'repeat'); + ctx.fillRect(0, 0, 10, 10); + var pixels = ctx.getImageData(9, 9, 1, 1).data; + assert_array_equals(pixels, [0, 255, 0, 255]); +}, "Test that imageSmoothingEnabled = false (nearest-neighbor interpolation) works with fillRect and createPattern()."); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + var image = createTestImage(); + ctx.imageSmoothingEnabled = false; + ctx.fillStyle = ctx.createPattern(image, 'repeat'); + ctx.scale(10, 10); + ctx.rect(0, 0, 10, 10); + ctx.fill(); + var pixels = ctx.getImageData(9, 9, 1, 1).data; + assert_array_equals(pixels, [0, 255, 0, 255]); +}, "Test that imageSmoothingEnabled = false (nearest-neighbor interpolation) works with fill() and createPattern()."); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + var image = createTestImage(); + ctx.strokeStyle = ctx.createPattern(image, 'repeat'); + ctx.lineWidth = 5; + ctx.imageSmoothingEnabled = false; + ctx.scale(10, 10); + ctx.beginPath(); + ctx.moveTo(0, 0); + ctx.lineTo(10, 10); + ctx.stroke(); + var pixels = ctx.getImageData(9, 9, 1, 1).data; + assert_array_equals(pixels, [0, 255, 0, 255]); +}, "Test that imageSmoothingEnabled = false (nearest-neighbor interpolation) works with stroke() and createPattern()."); + +test(function() { + var repaints = 5; + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + + function draw() { + ctx.clearRect(0, 0, 10, 10); + ctx.setTransform(1, 0, 0, 1, 0, 0); + var image = createTestImage(); + ctx.imageSmoothingEnabled = false; + ctx.scale(10, 10); + ctx.drawImage(image, 0, 0); + var pixels = ctx.getImageData(9, 9, 1, 1).data; + assert_array_equals(pixels, [0, 255, 0, 255]); + } + + while (repaints > 0) { + draw(); + repaints = repaints - 1; + } + +}, "Test that imageSmoothingEnabled = false (nearest-neighbor interpolation) still works after repaints."); + +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.commit.html b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.commit.html new file mode 100644 index 0000000000..4ee68b430f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.commit.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<link rel="help" href="https://html.spec.whatwg.org/#offscreencontext2d-commit"> +<script> + +function verifyPlaceholder(placeholder, expectedR, expectedG, expectedB, expectedA, expectedClrStr) +{ + var canvas = document.createElement('canvas'); + canvas.width = canvas.height = 10; + var ctx = canvas.getContext('2d'); + ctx.drawImage(placeholder, 0, 0); + _assertPixel(canvas, 5,5, expectedR, expectedG, expectedB, expectedA); +} + +async_test(function(t) { + var placeholder = document.createElement('canvas'); + placeholder.width = placeholder.height = 10; + var offscreenCanvas = placeholder.transferControlToOffscreen(); + var ctx = offscreenCanvas.getContext('2d'); + ctx.fillStyle = "#0f0"; + ctx.fillRect(0, 0, 10, 10); + // commit() propagation is taken care of by an async task, which means the + // place holder contents should still be transparent black at this moment. + verifyPlaceholder(placeholder, 0,0,0,0, "0,0,0,0"); + // Set timeout acts as a sync barrier to allow commit to propagate + t.step_timeout(function() { + verifyPlaceholder(placeholder, 0,255,0,255, "0,255,0,255"); + t.done(); + }, 0); +}, "Test that calling OffscreenCanvas's commit pushes its contents to its placeholder."); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(10, 10); + var ctx = offscreenCanvas.getContext('2d'); + ctx.fillStyle = "#0f0"; + ctx.fillRect(0, 0, 10, 10); + ctx.commit(); +}, "Test that calling commit on an OffscreenCanvas that is not transferred from a HTMLCanvasElement is a noop."); + +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.commit.w.html b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.commit.w.html new file mode 100644 index 0000000000..7d1d2c85f9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.commit.w.html @@ -0,0 +1,79 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<link rel="help" href="https://html.spec.whatwg.org/#offscreencontext2d-commit"> + +<script id="myWorker" type="text/worker"> + +function testCommitPushesContents(offscreenCanvas) { + try { + var ctx = offscreenCanvas.getContext('2d'); + ctx.fillStyle = "#0f0"; + ctx.fillRect(0, 0, 10, 10); + ctx.commit(); + return true; + } catch(e) { + return false; + } +} + +function testCommitException() { + var offscreenCanvas = new OffscreenCanvas(10, 10); + var ctx = offscreenCanvas.getContext('2d'); + ctx.fillStyle = "#0f0"; + ctx.fillRect(0, 0, 10, 10); + return true; +} + +self.onmessage = function(e) { + switch (e.data.msg) { + case 'test1': + self.postMessage(testCommitPushesContents(e.data.data)); + break; + case 'test2': + self.postMessage(testCommitException()); + break; + } +}; + +</script> + +<script> + +function verifyPlaceholder(placeholder) { + var canvas = document.createElement('canvas'); + canvas.width = canvas.height = 10; + var ctx = canvas.getContext('2d'); + ctx.drawImage(placeholder, 0, 0); + _assertPixel(canvas, 5,5, 0,255,0,255); +} + +function makeWorker(test) { + var blob = new Blob([document.getElementById("myWorker").textContent]); + var worker = new Worker(URL.createObjectURL(blob)); + worker.onerror = test.unreached_func("error"); + return worker; +} + +async_test(function(t) { + var placeholder = document.createElement('canvas'); + placeholder.width = placeholder.height = 10; + var offscreenCanvas = placeholder.transferControlToOffscreen(); + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func_done(function(msg) { + assert_true(msg.data); + verifyPlaceholder(placeholder); + })); + worker.postMessage({msg: 'test1', data: offscreenCanvas}, [offscreenCanvas]); +}, "Test that calling OffscreenCanvas's commit pushes its contents to its placeholder."); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func_done(function(msg) { + assert_true(msg.data); + })); + worker.postMessage({msg: 'test2'}); +}, "Test that calling commit on an OffscreenCanvas that is not transferred from a HTMLCanvasElement throws an exception in a worker."); + +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.constructor.html b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.constructor.html new file mode 100644 index 0000000000..0665f7452c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.constructor.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<link rel="help" href="https://html.spec.whatwg.org/#dom-offscreencanvas"> +<script> + +test(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + assert_equals(offscreenCanvas.width, 100); + assert_equals(offscreenCanvas.height, 50); + + offscreenCanvas.width = 50; + offscreenCanvas.height = 100; + assert_equals(offscreenCanvas.width, 50); + assert_equals(offscreenCanvas.height, 100); +}, "Test that calling OffscreenCanvas's constructor generates correct width and height."); + +test(function() { + var offscreenCanvas1 = new OffscreenCanvas(1, 1); + + offscreenCanvas1.width = null; + offscreenCanvas1.height = null; + assert_equals(offscreenCanvas1.width, 0); + assert_equals(offscreenCanvas1.height, 0); + + assert_throws_js(TypeError, function() { new OffscreenCanvas(-1, -1); }); + + var offscreenCanvas2 = new OffscreenCanvas(null, null); + assert_equals(offscreenCanvas2.width, 0); + assert_equals(offscreenCanvas2.height, 0); + + assert_throws_js(TypeError, function() { offscreenCanvas2.width = -1; }); + assert_throws_js(TypeError, function() { offscreenCanvas2.height = -1; }); + + var obj = {Name: "John Doe", Age: 30}; + assert_throws_js(TypeError, function() { offscreenCanvas2.width = obj; }); + assert_throws_js(TypeError, function() { offscreenCanvas2.height = obj; }); + assert_throws_js(TypeError, function() { new OffscreenCanvas(obj, obj); }); +}, "Test that OffscreenCanvas constructor handles invalid arguments correctly"); + +</script> + diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.constructor.worker.js b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.constructor.worker.js new file mode 100644 index 0000000000..72cfb728f0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.constructor.worker.js @@ -0,0 +1,45 @@ +// spec link: https://html.spec.whatwg.org/#dom-offscreencanvas + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t1 = async_test("Test that calling OffscreenCanvas's constructor generates correct width and height."); +t1.step(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + assert_equals(offscreenCanvas.width, 100); + assert_equals(offscreenCanvas.height, 50); + + offscreenCanvas.width = 50; + offscreenCanvas.height = 100; + assert_equals(offscreenCanvas.width, 50); + assert_equals(offscreenCanvas.height, 100); + t1.done(); +}); + +var t2 = async_test("Test that OffscreenCanvas constructor handles invalid arguments correctly in a worker"); +t2.step(function() { + var offscreenCanvas1 = new OffscreenCanvas(1, 1); + + offscreenCanvas1.width = null; + offscreenCanvas1.height = null; + assert_equals(offscreenCanvas1.width, 0); + assert_equals(offscreenCanvas1.height, 0); + + assert_throws_js(TypeError, function() { new OffscreenCanvas(-1, -1); }); + + var offscreenCanvas2 = new OffscreenCanvas(null, null); + assert_equals(offscreenCanvas2.width, 0); + assert_equals(offscreenCanvas2.height, 0); + + assert_throws_js(TypeError, function() { offscreenCanvas2.width = -1; }); + assert_throws_js(TypeError, function() { offscreenCanvas2.height = -1; }); + + var obj = {Name: "John Doe", Age: 30}; + assert_throws_js(TypeError, function() { offscreenCanvas2.width = obj; }); + assert_throws_js(TypeError, function() { offscreenCanvas2.height = obj; }); + assert_throws_js(TypeError, function() { new OffscreenCanvas(obj, obj); }); + t2.done(); +}); + +done(); + diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.html b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.html new file mode 100644 index 0000000000..51c167ddca --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.html @@ -0,0 +1,80 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<link rel="help" href="https://html.spec.whatwg.org/#dom-offscreencanvas-getcontext"> +<script> + +test(function() { + var offscreenCanvas = new OffscreenCanvas(1, 1); + assert_throws_js(TypeError, function() { offscreenCanvas.getContext('3d'); }); +}, "Test that getContext with un-supported string throws a TypeError."); + +test(function() { + var offscreenCanvas1 = new OffscreenCanvas(1, 1); + var ctx1 = offscreenCanvas1.getContext('2d'); + assert_true(ctx1 instanceof OffscreenCanvasRenderingContext2D); + + var offscreenCanvas2 = new OffscreenCanvas(1, 1); + var ctx2 = offscreenCanvas2.getContext('webgl'); + assert_true(ctx2 instanceof WebGLRenderingContext); + + var offscreenCanvas3 = new OffscreenCanvas(1, 1); + var ctx3 = offscreenCanvas3.getContext('webgl2'); + assert_true(ctx3 instanceof WebGL2RenderingContext); +}, "Test that getContext with supported string returns correct results"); + +test(function() { + var offscreenCanvas1 = new OffscreenCanvas(1, 1); + var ctx1 = offscreenCanvas1.getContext('2d'); + var ctx2 = offscreenCanvas1.getContext('webgl'); + assert_equals(ctx2, null); + + var offscreenCanvas2 = new OffscreenCanvas(1, 1); + var ctx3 = offscreenCanvas2.getContext('webgl'); + var ctx4 = offscreenCanvas2.getContext('2d'); + assert_equals(ctx4, null); +}, "Test that getContext twice with different context type returns null the second time"); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(1, 2); + var ctx = offscreenCanvas.getContext('2d'); + var dstCanvas = ctx.canvas; + assert_equals(dstCanvas.width, 1); + assert_equals(dstCanvas.height, 2); +}, "Test that 2dcontext.canvas should return the original OffscreenCanvas"); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(1, 2); + var ctx = offscreenCanvas.getContext('webgl'); + var dstCanvas = ctx.canvas; + assert_equals(dstCanvas.width, 1); + assert_equals(dstCanvas.height, 2); +}, "Test that webglcontext.canvas should return the original OffscreenCanvas"); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(10, 10); + var ctx = offscreenCanvas.getContext('2d', {alpha: false}); + ctx.fillStyle = 'rgba(0, 255, 0, 0.5)'; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(offscreenCanvas, 5,5, 0,127,0,255, 2); +}, "Test that OffscreenCanvasRenderingContext2D with alpha disabled makes the OffscreenCanvas opaque"); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(10, 10); + var ctx = offscreenCanvas.getContext('2d', {alpha: true}); + ctx.fillStyle = 'rgba(0, 255, 0, 0.5)'; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,127, 2); +}, "Test that OffscreenCanvasRenderingContext2D with alpha enabled preserves the alpha"); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(10, 10); + var ctx = offscreenCanvas.getContext('2d'); + ctx.fillStyle = 'rgba(0, 255, 0, 0.5)'; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,127, 2); +}, "Test that 'alpha' context creation attribute is true by default"); + +</script> + diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.worker.js b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.worker.js new file mode 100644 index 0000000000..c413791f61 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.getcontext.worker.js @@ -0,0 +1,77 @@ +// spec link: https://html.spec.whatwg.org/#dom-offscreencanvas-getcontext + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(1, 1); + assert_throws_js(TypeError, function() { offscreenCanvas.getContext('3d'); }); +}, "Test that getContext with un-supported string throws a TypeError."); + +test(function() { + var offscreenCanvas1 = new OffscreenCanvas(1, 1); + var ctx1 = offscreenCanvas1.getContext('2d'); + assert_true(ctx1 instanceof OffscreenCanvasRenderingContext2D); + + var offscreenCanvas2 = new OffscreenCanvas(1, 1); + var ctx2 = offscreenCanvas2.getContext('webgl'); + assert_true(ctx2 instanceof WebGLRenderingContext); + + var offscreenCanvas3 = new OffscreenCanvas(1, 1); + var ctx3 = offscreenCanvas3.getContext('webgl2'); + assert_true(ctx3 instanceof WebGL2RenderingContext); +}, "Test that getContext with supported string returns correct results"); + +test(function() { + var offscreenCanvas1 = new OffscreenCanvas(1, 1); + var ctx1 = offscreenCanvas1.getContext('2d'); + var ctx2 = offscreenCanvas1.getContext('webgl'); + assert_equals(ctx2, null); + + var offscreenCanvas2 = new OffscreenCanvas(1, 1); + var ctx3 = offscreenCanvas2.getContext('webgl'); + var ctx4 = offscreenCanvas2.getContext('2d'); + assert_equals(ctx4, null); +}, "Test that getContext twice with different context type returns null the second time"); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(1, 2); + var ctx = offscreenCanvas.getContext('2d'); + var dstCanvas = ctx.canvas; + assert_equals(dstCanvas.width, 1); + assert_equals(dstCanvas.height, 2); +}, "Test that 2dcontext.canvas should return the original OffscreenCanvas"); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(1, 2); + var ctx = offscreenCanvas.getContext('webgl'); + var dstCanvas = ctx.canvas; + assert_equals(dstCanvas.width, 1); + assert_equals(dstCanvas.height, 2); +}, "Test that webglcontext.canvas should return the original OffscreenCanvas"); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(10, 10); + var ctx = offscreenCanvas.getContext('2d', {alpha: false}); + ctx.fillStyle = 'rgba(0, 255, 0, 0.5)'; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(offscreenCanvas, 5,5, 0,127,0,255, 2); +}, "Test that OffscreenCanvasRenderingContext2D with alpha disabled makes the OffscreenCanvas opaque"); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(10, 10); + var ctx = offscreenCanvas.getContext('2d', {alpha: true}); + ctx.fillStyle = 'rgba(0, 255, 0, 0.5)'; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,127, 2); +}, "Test that OffscreenCanvasRenderingContext2D with alpha enabled preserves the alpha"); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(10, 10); + var ctx = offscreenCanvas.getContext('2d'); + ctx.fillStyle = 'rgba(0, 255, 0, 0.5)'; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,127, 2); +}, "Test that 'alpha' context creation attribute is true by default"); + +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.resize.html b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.resize.html new file mode 100644 index 0000000000..e259f79ca2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.resize.html @@ -0,0 +1,236 @@ +<!DOCTYPE html> +<title>Test resizing an OffscreenCanvas with a 2d context</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<body></body> +<script> +test(function() { + var canvas = new OffscreenCanvas(10, 20); + canvas.width = 30; + canvas.height = 40; + assert_equals(canvas.width, 30); + assert_equals(canvas.height, 40); +}, "Verify that writing to the width and height attributes of an OffscreenCanvas works when there is no context attached."); + +test(function() { + var canvas = new OffscreenCanvas(10, 20); + canvas.getContext('2d'); + canvas.width = 30; + canvas.height = 40; + assert_equals(canvas.width, 30); + assert_equals(canvas.height, 40); + var image = canvas.transferToImageBitmap(); + assert_equals(image.width, 30); + assert_equals(image.height, 40); +}, "Verify that writing to the width and height attributes of an OffscreenCanvas works when there is a 2d context attached."); + +test(function() { + var canvas = new OffscreenCanvas(10, 20); + canvas.getContext('webgl'); + canvas.width = 30; + canvas.height = 40; + assert_equals(canvas.width, 30); + assert_equals(canvas.height, 40); + var image = canvas.transferToImageBitmap(); + assert_equals(image.width, 30); + assert_equals(image.height, 40); +}, "Verify that writing to the width and height attributes of an OffscreenCanvas works when there is a webgl context attached."); + +test(function() { + var placeholder = document.createElement('canvas'); + placeholder.width = 2; + placeholder.height = 2; + var offscreen = placeholder.transferControlToOffscreen(); + assert_throws_dom("InvalidStateError", () => { placeholder.width = 1; }); + assert_throws_dom("InvalidStateError", () => { placeholder.height = 1; }); +}, "Verify that writing to the width or height attribute of a placeholder canvas throws an exception"); + +test(function() { + var placeholder = document.createElement('canvas'); + placeholder.width = 1; + placeholder.height = 1; + var offscreen = placeholder.transferControlToOffscreen(); + assert_throws_dom("InvalidStateError", () => { placeholder.width = 1; }); + assert_throws_dom("InvalidStateError", () => { placeholder.height = 1; }); +}, "Verify that writing to the width or height attribute of a placeholder canvas throws an exception even when not changing the value of the attribute."); + +test(function() { + var canvas = new OffscreenCanvas(10, 20); + var ctx = canvas.getContext('2d'); + ctx.lineWidth = 5; + canvas.width = 30; + assert_equals(ctx.lineWidth, 1); + ctx.lineWidth = 5; + canvas.height = 40; + assert_equals(ctx.lineWidth, 1); +}, "Verify that resizing a 2d context resets its state."); + +test(function() { + var canvas = new OffscreenCanvas(10, 20); + var ctx = canvas.getContext('2d'); + ctx.lineWidth = 5; + canvas.width = canvas.width; + assert_equals(ctx.lineWidth, 1); + ctx.lineWidth = 5; + canvas.height = canvas.height; + assert_equals(ctx.lineWidth, 1); +}, "Verify that setting the size of a 2d context to the same size it already had resets its state."); + +async_test(function(t) { + var placeholder = document.createElement('canvas'); + document.body.appendChild(placeholder); // So that we can check computed style/ + placeholder.width = 10; + placeholder.height = 20; + var offscreen = placeholder.transferControlToOffscreen(); + var ctx = offscreen.getContext('2d'); + t.step(function() { + // Verify that setting the size of an OffscreenCanvas that has a placeholder works. + offscreen.width = 30; + offscreen.height = 40; + assert_equals(offscreen.width, 30); + assert_equals(offscreen.height, 40); + var image = offscreen.transferToImageBitmap(); + assert_equals(image.width, 30); + assert_equals(image.height, 40); + }); + t.step(function() { + // Verify that setting the size of an OffscreenCanvas does not directly update the size of its placeholder canvas. + assert_equals(placeholder.width, 10); + assert_equals(placeholder.height, 20); + }); + var asyncStepsCompleted = 0; + createImageBitmap(placeholder).then(image => { + t.step(function() { + // Verify that the placeholder was not updated synchronously. + assert_equals(image.width, 10); + assert_equals(image.height, 20); + }); + asyncStepsCompleted = asyncStepsCompleted + 1; + if (asyncStepsCompleted == 2) { + t.done(); + } + }); + // We wait for up to 3 frames before checking the information has propagated. + requestAnimationFrame(() => { + requestAnimationFrame(() => { + requestAnimationFrame(() => { + t.step(function() { + // Verify that updates the size of its placeholder canvas. + assert_equals(placeholder.width, 30); + assert_equals(placeholder.height, 40); + var computedStyle = window.getComputedStyle(placeholder); + assert_equals(computedStyle.getPropertyValue('width'), "30px"); + assert_equals(computedStyle.getPropertyValue('height'), "40px"); + }); + createImageBitmap(placeholder).then(image => { + t.step(function() { + // Verify that an image grabbed from the placeholder has the correct dimensions + assert_equals(image.width, 30); + assert_equals(image.height, 40); + }); + asyncStepsCompleted = asyncStepsCompleted + 1; + if (asyncStepsCompleted == 2) { + t.done(); + } + }); + }); + }); + }); +}, "Verify that resizing an OffscreenCanvas with a 2d context propagates the new size to its placeholder canvas asynchronously."); + +async_test(function(t) { + var placeholder = document.createElement('canvas'); + document.body.appendChild(placeholder); // So that we can check computed style/ + placeholder.width = 10; + placeholder.height = 20; + var offscreen = placeholder.transferControlToOffscreen(); + var ctx = offscreen.getContext('webgl'); + t.step(function() { + // Verify that setting the size of an OffscreenCanvas that has a placeholder works. + offscreen.width = 30; + offscreen.height = 40; + assert_equals(offscreen.width, 30); + assert_equals(offscreen.height, 40); + var image = offscreen.transferToImageBitmap(); + assert_equals(image.width, 30); + assert_equals(image.height, 40); + }); + t.step(function() { + // Verify that setting the size of an OffscreenCanvas does not directly update the size of its placeholder canvas. + assert_equals(placeholder.width, 10); + assert_equals(placeholder.height, 20); + }); + var asyncStepsCompleted = 0; + createImageBitmap(placeholder).then(image => { + t.step(function() { + // Verify that the placeholder was not updated synchronously. + assert_equals(image.width, 10); + assert_equals(image.height, 20); + }); + asyncStepsCompleted = asyncStepsCompleted + 1; + if (asyncStepsCompleted == 2) { + t.done(); + } + }); + // We wait for up to 3 frames before checking the information has propagated. + requestAnimationFrame(() => { + requestAnimationFrame(() => { + requestAnimationFrame(() => { + t.step(function() { + // Verify that updates the size of its placeholder canvas. + assert_equals(placeholder.width, 30); + assert_equals(placeholder.height, 40); + var computedStyle = window.getComputedStyle(placeholder); + assert_equals(computedStyle.getPropertyValue('width'), "30px"); + assert_equals(computedStyle.getPropertyValue('height'), "40px"); + }); + createImageBitmap(placeholder).then(image => { + t.step(function() { + // Verify that an image grabbed from the placeholder has the correct dimensions + assert_equals(image.width, 30); + assert_equals(image.height, 40); + }); + asyncStepsCompleted = asyncStepsCompleted + 1; + if (asyncStepsCompleted == 2) { + t.done(); + } + }); + }); + }); + }); +}, "Verify that resizing an OffscreenCanvas with a webgl context propagates the new size to its placeholder canvas asynchronously."); + +async_test(function(t){ + var placeholder = document.createElement('canvas'); + placeholder.width = 1; + placeholder.height = 1; + var offscreen = placeholder.transferControlToOffscreen(); + var ctx = offscreen.getContext('2d'); + offscreen.width = offscreen.height = 10; + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 10, 10); + // We wait for up to 3 frames before checking the information has propagated. + requestAnimationFrame(() => { + requestAnimationFrame(() => { + requestAnimationFrame(() => { + var testCanvas = document.createElement('canvas'); + testCanvas.width = testCanvas.height = 20; + testCtx = testCanvas.getContext('2d'); + testCtx.drawImage(placeholder, 0, 0); + var pixel1 = testCtx.getImageData(9, 9, 1, 1).data; + var pixel2 = testCtx.getImageData(9, 10, 1, 1).data; + var pixel3 = testCtx.getImageData(10, 9, 1, 1).data; + t.step(function() { + assert_equals(placeholder.width, 10); + assert_equals(placeholder.height, 10); + assert_array_equals(pixel1, [0, 255, 0, 255]); + assert_array_equals(pixel2, [0, 0, 0, 0]); + assert_array_equals(pixel3, [0, 0, 0, 0]); + }); + t.done(); + }); + }); + }); +}, "Verify that drawImage uses the size of the frame as the intinsic size of a placeholder canvas."); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.lowlatency.nocrash.html b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.lowlatency.nocrash.html new file mode 100644 index 0000000000..1960841564 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.lowlatency.nocrash.html @@ -0,0 +1,12 @@ +<title>Transfer Low-Latency Canvas</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<body></body> + +<script> +test(function(t) { + var ctx = document.createElement("canvas").getContext('2d', {desynchronized:true}); + assert_throws_dom("InvalidStateError", () => { ctx.canvas.transferControlToOffscreen(); }); +}, "Tests that transferring a low latency canvas does not cause a crash. See crbug.com/1255153"); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.html b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.html new file mode 100644 index 0000000000..6e1adf9591 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.html @@ -0,0 +1,112 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<link rel="help" href="https://html.spec.whatwg.org/#dom-offscreencanvas-transfertoimagebitmap"> + +<script id="myWorker" type="text/worker"> + +self.onmessage = function(e) { +}; + +</script> + +<script> +function makeWorker(script) +{ + var blob = new Blob([script]); + return new Worker(URL.createObjectURL(blob)); +} + +test(function() { + function testSize(contextType) { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext(contextType); + var image = offscreenCanvas.transferToImageBitmap(); + assert_equals(image.width, 100); + assert_equals(image.height, 50); + } + + testSize('2d'); + testSize('webgl'); +}, "Test that transferToImageBitmap returns an ImageBitmap with correct width and height"); + +test(function() { + function testImageBitmapClr(shouldCallTwice, alphaVal) { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d', {alpha: alphaVal}); + ctx.fillStyle = "#0f0"; + ctx.fillRect(0, 0, 100, 50); + var image = offscreenCanvas.transferToImageBitmap(); + + if (shouldCallTwice) + image = offscreenCanvas.transferToImageBitmap(); + + var drawCanvas = document.createElement('canvas'); + drawCanvas.width = 100; + drawCanvas.height = 50; + var dCtx = drawCanvas.getContext('2d'); + dCtx.drawImage(image, 0, 0); + + if (shouldCallTwice) { + if (alphaVal) + _assertPixel(drawCanvas, 50,25, 0,0,0,0); + else + _assertPixel(drawCanvas, 50,25, 0,0,0,255); + } else { + _assertPixel(drawCanvas, 50,25, 0,255,0,255); + } + } + + testImageBitmapClr(false, true); + testImageBitmapClr(true, true); + testImageBitmapClr(true, false); +}, "Test that transferToImageBitmap returns an ImageBitmap with correct color"); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + ctx.lineWidth = 10; + var image = offscreenCanvas.transferToImageBitmap(); + assert_equals(ctx.lineWidth, 10); +}, "Test that transferToImageBitmap won't change context's property"); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + ctx.rect(0, 0, 25, 50); + ctx.clip(); + ctx.translate(20, 20); + + ctx.fillStyle = '#0f0'; + var image1 = offscreenCanvas.transferToImageBitmap(); + // trasnform should be preserved + ctx.fillRect(0, 0, 10, 10); + var image2 = offscreenCanvas.transferToImageBitmap(); + + var drawCanvas = document.createElement('canvas'); + drawCanvas.width = 100; + drawCanvas.height = 50; + var dCtx = drawCanvas.getContext('2d'); + dCtx.drawImage(image2, 0, 0); + // Verify that transform was carried over. + _assertPixel(drawCanvas, 23,25, 0,255,0,255); + // Verify that clip was carried over. + _assertPixel(drawCanvas, 27,25, 0,0,0,0); +}, "Test that transferToImageBitmap preserves transform"); + +async_test(function(t) { + var worker = makeWorker(document.getElementById("myWorker").textContent); + var offscreenCanvas = new OffscreenCanvas(10, 10); + worker.postMessage(offscreenCanvas, [offscreenCanvas]); + assert_throws_dom("InvalidStateError", function() { offscreenCanvas.transferToImageBitmap(); }); + t.done(); +}, "Test that call transferToImageBitmap on a detached OffscreenCanvas throws an exception"); + +test(function() { + var offscreenCanvas = new OffscreenCanvas(10, 10); + assert_throws_dom("InvalidStateError", function() { offscreenCanvas.transferToImageBitmap(); }); +}, "Test that transferToImageBitmap without a context throws an exception"); + +</script> + diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.nocrash.html b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.nocrash.html new file mode 100644 index 0000000000..09a388ed35 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.nocrash.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<body> + <p>Tests that an ImageBitmap in Offscreen without content does not crash.</p> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> + +async_test(function(t) { + var v1 = document.createElement("canvas"); + var v2 = v1.transferControlToOffscreen(); + var v3 = v2.getContext("bitmaprenderer"); + v2.width = 67; + t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.w.html b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.w.html new file mode 100644 index 0000000000..b51ce0efa2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.w.html @@ -0,0 +1,201 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<link rel="help" href="https://html.spec.whatwg.org/#dom-offscreencanvas-transfertoimagebitmap"> + +<script id="myWorker" type="text/worker"> + +function testSize(contextType) +{ + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext(contextType); + var image = offscreenCanvas.transferToImageBitmap(); + if (image.width == 100 && image.height == 50) + return true; + return false; +} + +function testImageBitmapClr(shouldCallTwice, alphaVal) { + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d', {alpha: alphaVal}); + ctx.fillStyle = "#0f0"; + ctx.fillRect(0, 0, 100, 50); + var image = offscreenCanvas.transferToImageBitmap(); + + if (shouldCallTwice) + image = offscreenCanvas.transferToImageBitmap(); + return image; +} + +function isInvalidStateError(funcStr, offscreenCanvas) +{ + try { + eval(funcStr); + } catch (e) { + if (e instanceof DOMException && e.name == "InvalidStateError") + return true; + return false; + } +} + +function testImageBitmapSize() +{ + return testSize('2d') && testSize('webgl'); +} + +function testLineWidthNotAltered() +{ + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + ctx.lineWidth = 10; + var image = offscreenCanvas.transferToImageBitmap(); + return ctx.lineWidth == 10; +} + +function testTransformPreserved() +{ + var offscreenCanvas = new OffscreenCanvas(100, 50); + var ctx = offscreenCanvas.getContext('2d'); + ctx.rect(0, 0, 25, 50); + ctx.clip(); + ctx.translate(20, 20); + + ctx.fillStyle = '#0f0'; + var image1 = offscreenCanvas.transferToImageBitmap(); + // trasnform should be preserved + ctx.fillRect(0, 0, 10, 10); + var image2 = offscreenCanvas.transferToImageBitmap(); + return image2; +} + +function testException() +{ + var offscreenCanvas = new OffscreenCanvas(10, 10); + return isInvalidStateError("offscreenCanvas.transferToImageBitmap()", offscreenCanvas); +} + +self.onmessage = function(e) { + switch (e.data) { + case 'test1': + self.postMessage(testImageBitmapSize()); + break; + case 'test2': + self.postMessage(testImageBitmapClr(false, true)); + break; + case 'test3': + self.postMessage(testImageBitmapClr(true, true)); + break; + case 'test4': + self.postMessage(testImageBitmapClr(true, false)); + break; + case 'test5': + self.postMessage(testLineWidthNotAltered()); + break; + case 'test6': + self.postMessage(testTransformPreserved()); + break; + case 'test7': + var offscreenCanvas = new OffscreenCanvas(10, 10); + self.postMessage({offscreenCanvas: offscreenCanvas}, [offscreenCanvas]); + self.postMessage(isInvalidStateError("offscreenCanvas.transferToImageBitmap()", offscreenCanvas)); + break; + case 'test8': + self.postMessage(testException()); + break; + } +}; + +</script> + +<script> +function makeWorker(test) { + var blob = new Blob([document.getElementById("myWorker").textContent]); + var worker = new Worker(URL.createObjectURL(blob)); + worker.onerror = test.unreached_func("error"); + return worker; +} + +function drawImageBitmap(image, x, y) +{ + var drawCanvas = document.createElement('canvas'); + drawCanvas.width = 100; + drawCanvas.height = 50; + var dCtx = drawCanvas.getContext('2d'); + dCtx.drawImage(image, 0, 0); + return dCtx.getImageData(x, y, 1, 1).data; +} + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func_done(function(msg) { + assert_true(msg.data); + })); + worker.postMessage('test1'); +}, "Test that transferToImageBitmap returns an ImageBitmap with correct width and height in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func_done(function(msg) { + var clr = drawImageBitmap(msg.data, 50, 25); + assert_array_equals(clr, [0, 255, 0, 255]); + })); + worker.postMessage('test2'); +}, "Test that transferToImageBitmap returns an ImageBitmap with correct color in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func_done(function(msg) { + var clr = drawImageBitmap(msg.data, 50, 25); + assert_array_equals(clr, [0, 0, 0, 0]); + })); + worker.postMessage('test3'); +}, "Test that call transferToImageBitmap twice returns an ImageBitmap with correct color in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func_done(function(msg) { + var clr = drawImageBitmap(msg.data, 50, 25); + assert_array_equals(clr, [0, 0, 0, 255]); + })); + worker.postMessage('test4'); +}, "Test that call transferToImageBitmap twice on a alpha-disabled context returns an ImageBitmap with correct color in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func_done(function(msg) { + assert_true(msg.data); + })); + worker.postMessage('test5'); +}, "Test that transferToImageBitmap won't change context's property in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func_done(function(msg) { + var clr1 = drawImageBitmap(msg.data, 23, 25); + assert_array_equals(clr1, [0, 255, 0, 255]); + var clr2 = drawImageBitmap(msg.data, 27, 25); + assert_array_equals(clr2, [0, 0, 0, 0]); + })); + worker.postMessage('test6'); +}, "Test that call transferToImageBitmap preserves transform in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func_done(function(msg) { + if (msg.data == true || msg.data == false) + assert_true(msg.data); + })); + worker.postMessage('test7'); +}, "Test that call transferToImageBitmap on a detached OffscreenCanvas throws an exception in a worker"); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func_done(function(msg) { + assert_true(msg.data); + })); + worker.postMessage('test8'); +}, "Test that call transferToImageBitmap without a context throws an exception in a worker"); + +</script> + diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfercontrol.to.offscreen.html b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfercontrol.to.offscreen.html new file mode 100644 index 0000000000..fea375b2ad --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfercontrol.to.offscreen.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<link rel="help" href="https://html.spec.whatwg.org/#dom-canvas-transfercontroltooffscreen"> +<script> + +test(function() { + var placeholder = document.createElement('canvas'); + placeholder.width = 100; + placeholder.height = 50; + var offscreenCanvas = placeholder.transferControlToOffscreen(); + assert_equals(offscreenCanvas.width, 100); + assert_equals(offscreenCanvas.height, 50); +}, "Test that an OffscreenCanvas generated by transferControlToOffscreen gets correct width and height"); + +test(function() { + var placeholder = document.createElement('canvas'); + placeholder.width = 100; + placeholder.height = 50; + var offscreenCanvas = placeholder.transferControlToOffscreen(); + assert_throws_dom("InvalidStateError", function() { placeholder.getContext('2d'); }); +}, "Test that calling getContext on a placeholder canvas that has already transferred its control throws an exception"); + +test(function() { + var placeholder = document.createElement('canvas'); + placeholder.width = 100; + placeholder.height = 50; + var offscreenCanvas = placeholder.transferControlToOffscreen(); + assert_throws_dom("InvalidStateError", function() { placeholder.transferControlToOffscreen(); }); +}, "Test that calling transferControlToOffscreen twice throws an exception"); + +</script> + diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfercontrol.to.offscreen.w.html b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfercontrol.to.offscreen.w.html new file mode 100644 index 0000000000..1347e7b50b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfercontrol.to.offscreen.w.html @@ -0,0 +1,76 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<link rel="help" href="https://html.spec.whatwg.org/#dom-canvas-transfercontroltooffscreen"> + +<script id="myWorker" type="text/worker"> + +function testSize(offscreenCanvas) +{ + if (offscreenCanvas.width == 100 && offscreenCanvas.height == 50) + return true; + return false; +} + +self.onmessage = function(e) { + switch (e.data.msg) { + case 'test1': + self.postMessage(testSize(e.data.data)); + break; + case 'test2': + self.postMessage(""); + break; + case 'test3': + self.postMessage(""); + break; + } +}; + +</script> + +<script> +function makeWorker(script) +{ + var blob = new Blob([script]); + return new Worker(URL.createObjectURL(blob)); +} + +async_test(function(t) { + var placeholder = document.createElement('canvas'); + placeholder.width = 100; + placeholder.height = 50; + var offscreenCanvas = placeholder.transferControlToOffscreen(); + var worker = makeWorker(document.getElementById("myWorker").textContent); + worker.addEventListener('message', t.step_func_done(function(msg) { + assert_true(msg.data); + })); + worker.postMessage({msg: 'test1', data: offscreenCanvas}, [offscreenCanvas]); +}, "Test that an OffscreenCanvas generated by transferControlToOffscreen gets correct width and height when it is transferred to a worker"); + +async_test(function(t) { + var placeholder = document.createElement('canvas'); + placeholder.width = 100; + placeholder.height = 50; + var offscreenCanvas = placeholder.transferControlToOffscreen(); + var worker = makeWorker(document.getElementById("myWorker").textContent); + worker.addEventListener('message', t.step_func_done(function(msg) { + assert_throws_dom("InvalidStateError", function() { placeholder.getContext('2d'); }); + })); + worker.postMessage({msg: 'test2', data: offscreenCanvas}, [offscreenCanvas]); +}, "Test that calling getContext on a placeholder canvas that is transferred its control to an OffscreenCanvas throws an exception, when the OffscreenCanvas is transferred to a worker"); + +async_test(function(t) { + var placeholder = document.createElement('canvas'); + placeholder.width = 100; + placeholder.height = 50; + var offscreenCanvas = placeholder.transferControlToOffscreen(); + var worker = makeWorker(document.getElementById("myWorker").textContent); + worker.addEventListener('message', t.step_func_done(function(msg) { + assert_throws_dom("InvalidStateError", function() { placeholder.transferControlToOffscreen(); }); + })); + worker.postMessage({msg: 'test3', data: offscreenCanvas}, [offscreenCanvas]); +}, "Test that calling transferControlToOffscreen twice throws an exception, when its associated OffscreenCanvas is transferred to a worker"); + +</script> + diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transferrable.html b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transferrable.html new file mode 100644 index 0000000000..d321c324fa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transferrable.html @@ -0,0 +1,83 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<link rel="help" href="https://html.spec.whatwg.org/#offscreencanvas"> + +<script id="myWorker" type="text/worker"> + +function test1(offscreenCanvas) +{ + return offscreenCanvas.width == 10 && offscreenCanvas.height == 10; +} + +self.onmessage = function(e) { + switch(e.data.msg) { + case 'test1': + self.postMessage(test1(e.data.data)); + break; + } +}; + +</script> + +<script> +function makeWorker(script) +{ + var blob = new Blob([script]); + return new Worker(URL.createObjectURL(blob)); +} + +async_test(function(t) { + var worker = makeWorker(document.getElementById("myWorker").textContent); + var offscreenCanvas = new OffscreenCanvas(10, 10); + worker.postMessage({msg: 'test1', data: offscreenCanvas}, [offscreenCanvas]); + worker.addEventListener('message', t.step_func_done(function(msg) { + assert_true(msg.data); + })); + assert_equals(offscreenCanvas.width, 0); + assert_equals(offscreenCanvas.height, 0); +}, "Test that offscreenCanvas's size is correct after being transferred to a worker."); + +test(function() { + function testException(contextType) { + var worker = makeWorker(document.getElementById("myWorker").textContent); + var offscreenCanvas = new OffscreenCanvas(10, 10); + var ctx = offscreenCanvas.getContext(contextType); + assert_throws_dom("InvalidStateError", function() { + worker.postMessage({offscreenCanvas}, [offscreenCanvas]); + }); + } + testException('2d'); + testException('webgl'); +}, "Test that transfer an OffscreenCanvas that has a context throws exception."); + +test(function() { + var worker = makeWorker(document.getElementById("myWorker").textContent); + var offscreenCanvas = new OffscreenCanvas(10, 10); + worker.postMessage({offscreenCanvas}, [offscreenCanvas]); + assert_throws_dom("InvalidStateError", function() { + worker.postMessage({offscreenCanvas}, [offscreenCanvas]); + }); +}, "Test that transfer an OffscreenCanvas twice throws exception."); + +test(function() { + var worker = makeWorker(document.getElementById("myWorker").textContent); + var offscreenCanvas = new OffscreenCanvas(10, 10); + worker.postMessage({offscreenCanvas}, [offscreenCanvas]); + assert_throws_dom("InvalidStateError", function() { + offscreenCanvas.getContext('2d'); + }); +}, "Test that calling getContext('2d') on a detached OffscreenCanvas throws exception."); + +test(function() { + var worker = makeWorker(document.getElementById("myWorker").textContent); + var offscreenCanvas = new OffscreenCanvas(10, 10); + worker.postMessage({offscreenCanvas}, [offscreenCanvas]); + assert_throws_dom("InvalidStateError", function() { + offscreenCanvas.getContext('webgl'); + }); +}, "Test that calling getContext('webgl') on a detached OffscreenCanvas throws exception."); + +</script> + diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transferrable.w.html b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transferrable.w.html new file mode 100644 index 0000000000..38f981e8f0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transferrable.w.html @@ -0,0 +1,142 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<link rel="help" href="https://html.spec.whatwg.org/#offscreencanvas"> + +<script id="myWorker" type="text/worker"> + +function isInvalidStateError(funcStr, offscreenCanvas) +{ + try { + eval(funcStr); + } catch (e) { + if (e instanceof DOMException && e.name == "InvalidStateError") + return true; + return false; + } +} + +function testExceptionWith2DContext() +{ + var offscreenCanvas = new OffscreenCanvas(10, 10); + var ctx = offscreenCanvas.getContext('2d'); + return isInvalidStateError("self.postMessage(offscreenCanvas, [offscreenCanvas])", offscreenCanvas); +} + +function testExceptionWithWebGLContext() +{ + var offscreenCanvas = new OffscreenCanvas(10, 10); + var ctx = offscreenCanvas.getContext('webgl'); + return isInvalidStateError("self.postMessage(offscreenCanvas, [offscreenCanvas])", offscreenCanvas); +} + +function testExceptionWithDetachedOffscreenCanvas1() +{ + var offscreenCanvas = new OffscreenCanvas(10, 10); + self.postMessage(offscreenCanvas, [offscreenCanvas]); + return isInvalidStateError("self.postMessage(offscreenCanvas, [offscreenCanvas])", offscreenCanvas); +} + +function testExceptionWithDetachedOffscreenCanvas2() +{ + var offscreenCanvas = new OffscreenCanvas(10, 10); + self.postMessage(offscreenCanvas, [offscreenCanvas]); + return isInvalidStateError("offscreenCanvas.getContext('2d')", offscreenCanvas); +} + +function testExceptionWithDetachedOffscreenCanvas3() +{ + var offscreenCanvas = new OffscreenCanvas(10, 10); + self.postMessage(offscreenCanvas, [offscreenCanvas]); + return isInvalidStateError("offscreenCanvas.getContext('webgl')", offscreenCanvas); +} + +self.onmessage = function(e) { + switch(e.data) { + case 'test1': + var offscreenCanvas = new OffscreenCanvas(10, 10); + self.postMessage(offscreenCanvas, [offscreenCanvas]); + break; + case 'test2': + self.postMessage(testExceptionWith2DContext()); + break; + case 'test3': + self.postMessage(testExceptionWithWebGLContext()); + break; + case 'test4': + self.postMessage(testExceptionWithDetachedOffscreenCanvas1()); + break; + case 'test5': + self.postMessage(testExceptionWithDetachedOffscreenCanvas2()); + break; + case 'test6': + self.postMessage(testExceptionWithDetachedOffscreenCanvas3()); + break; + } +}; + +</script> + +<script> +function makeWorker(test) { + var blob = new Blob([document.getElementById("myWorker").textContent]); + var worker = new Worker(URL.createObjectURL(blob)); + worker.onerror = test.unreached_func("error"); + return worker; +} + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func_done(function(msg) { + assert_equals(msg.data.width, 10); + assert_equals(msg.data.height, 10); + })); + worker.postMessage('test1'); +}, "Test that OffscreenCanvas's size is correct after being transferred from a worker."); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func_done(function(msg) { + assert_true(msg.data); + })); + worker.postMessage('test2'); +}, "Test that transfer an OffscreenCanvas that has a 2d context throws exception in a worker."); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func_done(function(msg) { + assert_true(msg.data); + })); + worker.postMessage('test3'); +}, "Test that transfer an OffscreenCanvas that has a webgl context throws exception in a worker."); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func_done(function(msg) { + if (msg.data == true || msg.data == false) + assert_true(msg.data); + })); + worker.postMessage('test4'); +}, "Test that transfer an OffscreenCanvas twice throws exception in a worker."); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func_done(function(msg) { + if (msg.data == true || msg.data == false) + assert_true(msg.data); + })); + worker.postMessage('test5'); +}, "Test that calling getContext('2d') on a detached OffscreenCanvas throws exception in a worker."); + +async_test(function(t) { + var worker = makeWorker(t); + worker.addEventListener('message', t.step_func_done(function(msg) { + if (msg.data == true || msg.data == false) + assert_true(msg.data); + })); + worker.postMessage('test6'); +}, "Test that calling getContext('webgl') on a detached OffscreenCanvas throws exception in a worker."); + +</script> + diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/transformations/2d.transformation.getTransform.html b/testing/web-platform/tests/html/canvas/offscreen/manual/transformations/2d.transformation.getTransform.html new file mode 100644 index 0000000000..b3b70ac208 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/transformations/2d.transformation.getTransform.html @@ -0,0 +1,40 @@ +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<script> +// Ensure that context2d.getTransform works +const epsilon = 1e-5; +const canvas = new OffscreenCanvas(300, 150); +const ctx = canvas.getContext('2d'); + +test(function(t) { + + assert_array_equals(ctx.getTransform().toFloat32Array(), + [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], + "Assert that an untransformed matrix is identity"); + + ctx.scale(2, 3); + transform = ctx.getTransform(); + assert_array_equals(ctx.getTransform().toFloat32Array(), + [2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], + "Assert that context2d scaling works"); + + ctx.rotate(Math.PI/2); + transform = ctx.getTransform(); + assert_array_approx_equals(ctx.getTransform().toFloat32Array(), + [0, 3, 0, 0, -2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], epsilon, + "Assert that context2d rotate works"); + + ctx.translate(1, -1); + transform = ctx.getTransform(); + assert_array_approx_equals(ctx.getTransform().toFloat32Array(), + [0, 3, 0, 0, -2, 0, 0, 0, 0, 0, 1, 0, 2, 3, 0, 1], epsilon, + "Assert context2d translate works."); + + ctx.resetTransform(); + assert_array_equals(ctx.getTransform().toFloat32Array(), + [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], + "Assert that a reset matrix is identity"); +}, 'This test ensures that getTransform works correctly.'); +</script> +</body> diff --git a/testing/web-platform/tests/html/canvas/offscreen/manual/wide-gamut-canvas/2d.color.space.p3.convertToBlobp3.canvas.html b/testing/web-platform/tests/html/canvas/offscreen/manual/wide-gamut-canvas/2d.color.space.p3.convertToBlobp3.canvas.html new file mode 100644 index 0000000000..9fc63a9f49 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/manual/wide-gamut-canvas/2d.color.space.p3.convertToBlobp3.canvas.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<title>OffscreenCanvas test: 2d.color.space.p3.convertToBlob.p3.canvas</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.color.space.p3.convertToBlob.p3.canvas</h1> +<p class="desc">test if toblob returns p3 data from p3 color space canvas</p> + + +<script> +var t = async_test("test if toblob returns p3 data from p3 color space canvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var offscreenCanvas = new OffscreenCanvas(100, 50); +var ctx = offscreenCanvas.getContext('2d', {colorSpace: "display-p3"}); + +ctx.fillStyle = "rgba(155, 27, 27, 1)"; +ctx.fillRect(0, 0, 1, 1); +ctx.fillStyle = "rgba(27, 155, 27, 0)"; +ctx.fillRect(1, 0, 1, 1); +ctx.fillStyle = "rgba(27, 27, 155, 0.5)"; +ctx.fillRect(0, 1, 1, 1); +ctx.fillStyle = "rgba(27, 27, 27, 0.5)"; +ctx.fillRect(1, 1, 1, 1); +expectedPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; + +var image = new Image(); +image.onload = t.step_func_done(function() { + var dstCanvas = document.createElement("canvas"); + dstCanvas.width = 2; + dstCanvas.height = 2; + var ctx = dstCanvas.getContext('2d', {colorSpace: "display-p3"}); + ctx.drawImage(image, 0, 0); + var actualPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; + assert_array_approx_equals(actualPixels, expectedPixels, 2); +}); + +offscreenCanvas.convertToBlob(function(blob) { + var urlCreator = window.URL || window.webkitURL; + image.src = urlCreator.createObjectURL(blob); +}, 'image/png', 1); +t.done() + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.1.html new file mode 100644 index 0000000000..cf358e38fc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.1.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.path.arc.angle.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.angle.1</h1> +<p class="desc">arc() draws pi/2 .. -pi anticlockwise correctly</p> + + +<script> +var t = async_test("arc() draws pi/2 .. -pi anticlockwise 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.fillStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(100, 0); +ctx.arc(100, 0, 150, Math.PI/2, -Math.PI, true); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.1.worker.js new file mode 100644 index 0000000000..5a1f54c4c2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.1.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.angle.1 +// Description:arc() draws pi/2 .. -pi anticlockwise correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() draws pi/2 .. -pi anticlockwise 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.fillStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(100, 0); +ctx.arc(100, 0, 150, Math.PI/2, -Math.PI, true); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.2.html new file mode 100644 index 0000000000..9b3983fb37 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.2.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.path.arc.angle.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.angle.2</h1> +<p class="desc">arc() draws -3pi/2 .. -pi anticlockwise correctly</p> + + +<script> +var t = async_test("arc() draws -3pi/2 .. -pi anticlockwise 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.fillStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(100, 0); +ctx.arc(100, 0, 150, -3*Math.PI/2, -Math.PI, true); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.2.worker.js new file mode 100644 index 0000000000..15bf295b2d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.2.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.angle.2 +// Description:arc() draws -3pi/2 .. -pi anticlockwise correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() draws -3pi/2 .. -pi anticlockwise 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.fillStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(100, 0); +ctx.arc(100, 0, 150, -3*Math.PI/2, -Math.PI, true); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.3.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.3.html new file mode 100644 index 0000000000..a757b31efb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.3.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.path.arc.angle.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.angle.3</h1> +<p class="desc">arc() wraps angles mod 2pi when anticlockwise and end > start+2pi</p> + + +<script> +var t = async_test("arc() wraps angles mod 2pi when anticlockwise and end > start+2pi"); +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.beginPath(); +ctx.moveTo(100, 0); +ctx.arc(100, 0, 150, (512+1/2)*Math.PI, (1024-1)*Math.PI, true); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.3.worker.js new file mode 100644 index 0000000000..646349fb99 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.3.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.angle.3 +// Description:arc() wraps angles mod 2pi when anticlockwise and end > start+2pi +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() wraps angles mod 2pi when anticlockwise and end > start+2pi"); +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.beginPath(); +ctx.moveTo(100, 0); +ctx.arc(100, 0, 150, (512+1/2)*Math.PI, (1024-1)*Math.PI, true); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.4.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.4.html new file mode 100644 index 0000000000..b8e4d54027 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.4.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.path.arc.angle.4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.angle.4</h1> +<p class="desc">arc() draws a full circle when clockwise and end > start+2pi</p> + + +<script> +var t = async_test("arc() draws a full circle when clockwise and end > start+2pi"); +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.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.arc(50, 25, 60, (512+1/2)*Math.PI, (1024-1)*Math.PI, false); +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.4.worker.js new file mode 100644 index 0000000000..8fa2ef137d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.4.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.angle.4 +// Description:arc() draws a full circle when clockwise and end > start+2pi +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() draws a full circle when clockwise and end > start+2pi"); +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.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.arc(50, 25, 60, (512+1/2)*Math.PI, (1024-1)*Math.PI, false); +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.5.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.5.html new file mode 100644 index 0000000000..f13a2e41c9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.5.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.path.arc.angle.5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.angle.5</h1> +<p class="desc">arc() wraps angles mod 2pi when clockwise and start > end+2pi</p> + + +<script> +var t = async_test("arc() wraps angles mod 2pi when clockwise and start > end+2pi"); +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.beginPath(); +ctx.moveTo(100, 0); +ctx.arc(100, 0, 150, (1024-1)*Math.PI, (512+1/2)*Math.PI, false); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.5.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.5.worker.js new file mode 100644 index 0000000000..50b23cd9ba --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.5.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.angle.5 +// Description:arc() wraps angles mod 2pi when clockwise and start > end+2pi +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() wraps angles mod 2pi when clockwise and start > end+2pi"); +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.beginPath(); +ctx.moveTo(100, 0); +ctx.arc(100, 0, 150, (1024-1)*Math.PI, (512+1/2)*Math.PI, false); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.6.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.6.html new file mode 100644 index 0000000000..88184b8d77 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.6.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.path.arc.angle.6</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.angle.6</h1> +<p class="desc">arc() draws a full circle when anticlockwise and start > end+2pi</p> + + +<script> +var t = async_test("arc() draws a full circle when anticlockwise and start > end+2pi"); +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.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.arc(50, 25, 60, (1024-1)*Math.PI, (512+1/2)*Math.PI, true); +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.6.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.6.worker.js new file mode 100644 index 0000000000..38bd40489b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.6.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.angle.6 +// Description:arc() draws a full circle when anticlockwise and start > end+2pi +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() draws a full circle when anticlockwise and start > end+2pi"); +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.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.arc(50, 25, 60, (1024-1)*Math.PI, (512+1/2)*Math.PI, true); +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.default.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.default.html new file mode 100644 index 0000000000..848f20c32f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.default.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.path.arc.default</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.default</h1> +<p class="desc">arc() with missing last argument defaults to clockwise</p> + + +<script> +var t = async_test("arc() with missing last argument defaults to clockwise"); +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.beginPath(); +ctx.moveTo(100, 0); +ctx.arc(100, 0, 150, -Math.PI, Math.PI/2); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.default.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.default.worker.js new file mode 100644 index 0000000000..c73829a0ee --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.default.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.default +// Description:arc() with missing last argument defaults to clockwise +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() with missing last argument defaults to clockwise"); +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.beginPath(); +ctx.moveTo(100, 0); +ctx.arc(100, 0, 150, -Math.PI, Math.PI/2); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.empty.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.empty.html new file mode 100644 index 0000000000..9098b7fe02 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.empty.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.path.arc.empty</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.empty</h1> +<p class="desc">arc() with an empty path does not draw a straight line to the start point</p> + + +<script> +var t = async_test("arc() with an empty path does not draw a straight line to the start point"); +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 = 50; +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.arc(200, 25, 5, 0, 2*Math.PI, true); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.empty.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.empty.worker.js new file mode 100644 index 0000000000..82281ea4b0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.empty.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.empty +// Description:arc() with an empty path does not draw a straight line to the start point +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() with an empty path does not draw a straight line to the start point"); +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 = 50; +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.arc(200, 25, 5, 0, 2*Math.PI, true); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.end.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.end.html new file mode 100644 index 0000000000..12be27afa6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.end.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.arc.end</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.end</h1> +<p class="desc">arc() adds the end point of the arc to the subpath</p> + + +<script> +var t = async_test("arc() adds the end point of the arc to the subpath"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(-100, 0); +ctx.arc(-100, 0, 25, -Math.PI/2, Math.PI/2, true); +ctx.lineTo(100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.end.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.end.worker.js new file mode 100644 index 0000000000..a2519f0bad --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.end.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.path.arc.end +// Description:arc() adds the end point of the arc to the subpath +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() adds the end point of the arc to the subpath"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(-100, 0); +ctx.arc(-100, 0, 25, -Math.PI/2, Math.PI/2, true); +ctx.lineTo(100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.negative.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.negative.html new file mode 100644 index 0000000000..77f1b07bf5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.negative.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.arc.negative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.negative</h1> +<p class="desc">arc() with negative radius throws INDEX_SIZE_ERR</p> + + +<script> +var t = async_test("arc() with negative radius throws INDEX_SIZE_ERR"); +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'); + +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.arc(0, 0, -1, 0, 0, true); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.negative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.negative.worker.js new file mode 100644 index 0000000000..c1abffa8e9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.negative.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.negative +// Description:arc() with negative radius throws INDEX_SIZE_ERR +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() with negative radius throws INDEX_SIZE_ERR"); +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'); + +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.arc(0, 0, -1, 0, 0, true); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.nonempty.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.nonempty.html new file mode 100644 index 0000000000..542940435a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.nonempty.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.arc.nonempty</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.nonempty</h1> +<p class="desc">arc() with a non-empty path does draw a straight line to the start point</p> + + +<script> +var t = async_test("arc() with a non-empty path does draw a straight line to the start point"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arc(200, 25, 5, 0, 2*Math.PI, true); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.nonempty.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.nonempty.worker.js new file mode 100644 index 0000000000..1d7de77486 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.nonempty.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.nonempty +// Description:arc() with a non-empty path does draw a straight line to the start point +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() with a non-empty path does draw a straight line to the start point"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arc(200, 25, 5, 0, 2*Math.PI, true); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.nonfinite.html new file mode 100644 index 0000000000..c65af631b5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.nonfinite.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.path.arc.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.nonfinite</h1> +<p class="desc">arc() with Infinity/NaN is ignored</p> + + +<script> +var t = async_test("arc() with Infinity/NaN 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.arc(Infinity, 0, 50, 0, 2*Math.PI, true); +ctx.arc(-Infinity, 0, 50, 0, 2*Math.PI, true); +ctx.arc(NaN, 0, 50, 0, 2*Math.PI, true); +ctx.arc(0, Infinity, 50, 0, 2*Math.PI, true); +ctx.arc(0, -Infinity, 50, 0, 2*Math.PI, true); +ctx.arc(0, NaN, 50, 0, 2*Math.PI, true); +ctx.arc(0, 0, Infinity, 0, 2*Math.PI, true); +ctx.arc(0, 0, -Infinity, 0, 2*Math.PI, true); +ctx.arc(0, 0, NaN, 0, 2*Math.PI, true); +ctx.arc(0, 0, 50, Infinity, 2*Math.PI, true); +ctx.arc(0, 0, 50, -Infinity, 2*Math.PI, true); +ctx.arc(0, 0, 50, NaN, 2*Math.PI, true); +ctx.arc(0, 0, 50, 0, Infinity, true); +ctx.arc(0, 0, 50, 0, -Infinity, true); +ctx.arc(0, 0, 50, 0, NaN, true); +ctx.arc(Infinity, Infinity, 50, 0, 2*Math.PI, true); +ctx.arc(Infinity, Infinity, Infinity, 0, 2*Math.PI, true); +ctx.arc(Infinity, Infinity, Infinity, Infinity, 2*Math.PI, true); +ctx.arc(Infinity, Infinity, Infinity, Infinity, Infinity, true); +ctx.arc(Infinity, Infinity, Infinity, 0, Infinity, true); +ctx.arc(Infinity, Infinity, 50, Infinity, 2*Math.PI, true); +ctx.arc(Infinity, Infinity, 50, Infinity, Infinity, true); +ctx.arc(Infinity, Infinity, 50, 0, Infinity, true); +ctx.arc(Infinity, 0, Infinity, 0, 2*Math.PI, true); +ctx.arc(Infinity, 0, Infinity, Infinity, 2*Math.PI, true); +ctx.arc(Infinity, 0, Infinity, Infinity, Infinity, true); +ctx.arc(Infinity, 0, Infinity, 0, Infinity, true); +ctx.arc(Infinity, 0, 50, Infinity, 2*Math.PI, true); +ctx.arc(Infinity, 0, 50, Infinity, Infinity, true); +ctx.arc(Infinity, 0, 50, 0, Infinity, true); +ctx.arc(0, Infinity, Infinity, 0, 2*Math.PI, true); +ctx.arc(0, Infinity, Infinity, Infinity, 2*Math.PI, true); +ctx.arc(0, Infinity, Infinity, Infinity, Infinity, true); +ctx.arc(0, Infinity, Infinity, 0, Infinity, true); +ctx.arc(0, Infinity, 50, Infinity, 2*Math.PI, true); +ctx.arc(0, Infinity, 50, Infinity, Infinity, true); +ctx.arc(0, Infinity, 50, 0, Infinity, true); +ctx.arc(0, 0, Infinity, Infinity, 2*Math.PI, true); +ctx.arc(0, 0, Infinity, Infinity, Infinity, true); +ctx.arc(0, 0, Infinity, 0, Infinity, true); +ctx.arc(0, 0, 50, Infinity, Infinity, true); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 90,45, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.nonfinite.worker.js new file mode 100644 index 0000000000..f83dcf1080 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.nonfinite.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.path.arc.nonfinite +// Description:arc() with Infinity/NaN is ignored +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() with Infinity/NaN 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.arc(Infinity, 0, 50, 0, 2*Math.PI, true); +ctx.arc(-Infinity, 0, 50, 0, 2*Math.PI, true); +ctx.arc(NaN, 0, 50, 0, 2*Math.PI, true); +ctx.arc(0, Infinity, 50, 0, 2*Math.PI, true); +ctx.arc(0, -Infinity, 50, 0, 2*Math.PI, true); +ctx.arc(0, NaN, 50, 0, 2*Math.PI, true); +ctx.arc(0, 0, Infinity, 0, 2*Math.PI, true); +ctx.arc(0, 0, -Infinity, 0, 2*Math.PI, true); +ctx.arc(0, 0, NaN, 0, 2*Math.PI, true); +ctx.arc(0, 0, 50, Infinity, 2*Math.PI, true); +ctx.arc(0, 0, 50, -Infinity, 2*Math.PI, true); +ctx.arc(0, 0, 50, NaN, 2*Math.PI, true); +ctx.arc(0, 0, 50, 0, Infinity, true); +ctx.arc(0, 0, 50, 0, -Infinity, true); +ctx.arc(0, 0, 50, 0, NaN, true); +ctx.arc(Infinity, Infinity, 50, 0, 2*Math.PI, true); +ctx.arc(Infinity, Infinity, Infinity, 0, 2*Math.PI, true); +ctx.arc(Infinity, Infinity, Infinity, Infinity, 2*Math.PI, true); +ctx.arc(Infinity, Infinity, Infinity, Infinity, Infinity, true); +ctx.arc(Infinity, Infinity, Infinity, 0, Infinity, true); +ctx.arc(Infinity, Infinity, 50, Infinity, 2*Math.PI, true); +ctx.arc(Infinity, Infinity, 50, Infinity, Infinity, true); +ctx.arc(Infinity, Infinity, 50, 0, Infinity, true); +ctx.arc(Infinity, 0, Infinity, 0, 2*Math.PI, true); +ctx.arc(Infinity, 0, Infinity, Infinity, 2*Math.PI, true); +ctx.arc(Infinity, 0, Infinity, Infinity, Infinity, true); +ctx.arc(Infinity, 0, Infinity, 0, Infinity, true); +ctx.arc(Infinity, 0, 50, Infinity, 2*Math.PI, true); +ctx.arc(Infinity, 0, 50, Infinity, Infinity, true); +ctx.arc(Infinity, 0, 50, 0, Infinity, true); +ctx.arc(0, Infinity, Infinity, 0, 2*Math.PI, true); +ctx.arc(0, Infinity, Infinity, Infinity, 2*Math.PI, true); +ctx.arc(0, Infinity, Infinity, Infinity, Infinity, true); +ctx.arc(0, Infinity, Infinity, 0, Infinity, true); +ctx.arc(0, Infinity, 50, Infinity, 2*Math.PI, true); +ctx.arc(0, Infinity, 50, Infinity, Infinity, true); +ctx.arc(0, Infinity, 50, 0, Infinity, true); +ctx.arc(0, 0, Infinity, Infinity, 2*Math.PI, true); +ctx.arc(0, 0, Infinity, Infinity, Infinity, true); +ctx.arc(0, 0, Infinity, 0, Infinity, true); +ctx.arc(0, 0, 50, Infinity, Infinity, true); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 90,45, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.1.html new file mode 100644 index 0000000000..3b0aed390f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.1.html @@ -0,0 +1,53 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.arc.scale.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.scale.1</h1> +<p class="desc">Non-uniformly scaled arcs are the right shape</p> + + +<script> +var t = async_test("Non-uniformly scaled arcs are the right shape"); +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(2, 0.5); +ctx.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.arc(25, 50, 56, 0, 2*Math.PI, false); +ctx.fill(); +ctx.fillStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(-25, 50); +ctx.arc(-25, 50, 24, 0, 2*Math.PI, false); +ctx.moveTo(75, 50); +ctx.arc(75, 50, 24, 0, 2*Math.PI, false); +ctx.moveTo(25, -25); +ctx.arc(25, -25, 24, 0, 2*Math.PI, false); +ctx.moveTo(25, 125); +ctx.arc(25, 125, 24, 0, 2*Math.PI, false); +ctx.fill(); +_assertPixel(canvas, 0,0, 0,255,0,255); +_assertPixel(canvas, 50,0, 0,255,0,255); +_assertPixel(canvas, 99,0, 0,255,0,255); +_assertPixel(canvas, 0,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 99,25, 0,255,0,255); +_assertPixel(canvas, 0,49, 0,255,0,255); +_assertPixel(canvas, 50,49, 0,255,0,255); +_assertPixel(canvas, 99,49, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.1.worker.js new file mode 100644 index 0000000000..ec300985c8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.1.worker.js @@ -0,0 +1,49 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.scale.1 +// Description:Non-uniformly scaled arcs are the right shape +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Non-uniformly scaled arcs are the right shape"); +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(2, 0.5); +ctx.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.arc(25, 50, 56, 0, 2*Math.PI, false); +ctx.fill(); +ctx.fillStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(-25, 50); +ctx.arc(-25, 50, 24, 0, 2*Math.PI, false); +ctx.moveTo(75, 50); +ctx.arc(75, 50, 24, 0, 2*Math.PI, false); +ctx.moveTo(25, -25); +ctx.arc(25, -25, 24, 0, 2*Math.PI, false); +ctx.moveTo(25, 125); +ctx.arc(25, 125, 24, 0, 2*Math.PI, false); +ctx.fill(); +_assertPixel(canvas, 0,0, 0,255,0,255); +_assertPixel(canvas, 50,0, 0,255,0,255); +_assertPixel(canvas, 99,0, 0,255,0,255); +_assertPixel(canvas, 0,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 99,25, 0,255,0,255); +_assertPixel(canvas, 0,49, 0,255,0,255); +_assertPixel(canvas, 50,49, 0,255,0,255); +_assertPixel(canvas, 99,49, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.2.html new file mode 100644 index 0000000000..f6822f8203 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.2.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.path.arc.scale.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.scale.2</h1> +<p class="desc">Highly scaled arcs are the right shape</p> + + +<script> +var t = async_test("Highly scaled arcs are the right shape"); +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(100, 100); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 1.2; +ctx.beginPath(); +ctx.arc(0, 0, 0.6, 0, Math.PI/2, false); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.2.worker.js new file mode 100644 index 0000000000..d946f7f0fe --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.2.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.path.arc.scale.2 +// Description:Highly scaled arcs are the right shape +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Highly scaled arcs are the right shape"); +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(100, 100); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 1.2; +ctx.beginPath(); +ctx.arc(0, 0, 0.6, 0, Math.PI/2, false); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.1.html new file mode 100644 index 0000000000..9e8803a102 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.1.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.arc.selfintersect.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.selfintersect.1</h1> +<p class="desc">arc() with lineWidth > 2*radius is drawn sensibly</p> + + +<script> +var t = async_test("arc() with lineWidth > 2*radius is drawn sensibly"); +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.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.arc(100, 50, 25, 0, -Math.PI/2, true); +ctx.stroke(); +ctx.beginPath(); +ctx.arc(0, 0, 25, 0, -Math.PI/2, true); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.1.worker.js new file mode 100644 index 0000000000..84cb983f1a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.1.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.selfintersect.1 +// Description:arc() with lineWidth > 2*radius is drawn sensibly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() with lineWidth > 2*radius is drawn sensibly"); +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.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.arc(100, 50, 25, 0, -Math.PI/2, true); +ctx.stroke(); +ctx.beginPath(); +ctx.arc(0, 0, 25, 0, -Math.PI/2, true); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.2.html new file mode 100644 index 0000000000..f2118ef29b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.2.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.path.arc.selfintersect.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.selfintersect.2</h1> +<p class="desc">arc() with lineWidth > 2*radius is drawn sensibly</p> + + +<script> +var t = async_test("arc() with lineWidth > 2*radius is drawn sensibly"); +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 = 180; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.arc(-50, 50, 25, 0, -Math.PI/2, true); +ctx.stroke(); +ctx.beginPath(); +ctx.arc(100, 0, 25, 0, -Math.PI/2, true); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 90,10, 0,255,0,255); +_assertPixel(canvas, 97,1, 0,255,0,255); +_assertPixel(canvas, 97,2, 0,255,0,255); +_assertPixel(canvas, 97,3, 0,255,0,255); +_assertPixel(canvas, 2,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.2.worker.js new file mode 100644 index 0000000000..be7f13aee7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.2.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.path.arc.selfintersect.2 +// Description:arc() with lineWidth > 2*radius is drawn sensibly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() with lineWidth > 2*radius is drawn sensibly"); +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 = 180; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.arc(-50, 50, 25, 0, -Math.PI/2, true); +ctx.stroke(); +ctx.beginPath(); +ctx.arc(100, 0, 25, 0, -Math.PI/2, true); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 90,10, 0,255,0,255); +_assertPixel(canvas, 97,1, 0,255,0,255); +_assertPixel(canvas, 97,2, 0,255,0,255); +_assertPixel(canvas, 97,3, 0,255,0,255); +_assertPixel(canvas, 2,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.1.html new file mode 100644 index 0000000000..42242536e2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.1.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.arc.shape.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.shape.1</h1> +<p class="desc">arc() from 0 to pi does not draw anything in the wrong half</p> + + +<script> +var t = async_test("arc() from 0 to pi does not draw anything in the wrong half"); +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 = 50; +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.arc(50, 50, 50, 0, Math.PI, false); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 20,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.1.worker.js new file mode 100644 index 0000000000..b41863bfb7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.1.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.path.arc.shape.1 +// Description:arc() from 0 to pi does not draw anything in the wrong half +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() from 0 to pi does not draw anything in the wrong half"); +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 = 50; +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.arc(50, 50, 50, 0, Math.PI, false); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 20,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.2.html new file mode 100644 index 0000000000..1e33a02416 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.2.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.arc.shape.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.shape.2</h1> +<p class="desc">arc() from 0 to pi draws stuff in the right half</p> + + +<script> +var t = async_test("arc() from 0 to pi draws stuff in the right half"); +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.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.arc(50, 50, 50, 0, Math.PI, true); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 20,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.2.worker.js new file mode 100644 index 0000000000..d5d6cb7b7e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.2.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.path.arc.shape.2 +// Description:arc() from 0 to pi draws stuff in the right half +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() from 0 to pi draws stuff in the right half"); +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.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.arc(50, 50, 50, 0, Math.PI, true); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 20,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.3.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.3.html new file mode 100644 index 0000000000..b90284e579 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.3.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.arc.shape.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.shape.3</h1> +<p class="desc">arc() from 0 to -pi/2 does not draw anything in the wrong quadrant</p> + + +<script> +var t = async_test("arc() from 0 to -pi/2 does not draw anything in the wrong quadrant"); +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 = 100; +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.arc(0, 50, 50, 0, -Math.PI/2, false); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.3.worker.js new file mode 100644 index 0000000000..5d0cf80539 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.3.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.shape.3 +// Description:arc() from 0 to -pi/2 does not draw anything in the wrong quadrant +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() from 0 to -pi/2 does not draw anything in the wrong quadrant"); +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 = 100; +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.arc(0, 50, 50, 0, -Math.PI/2, false); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.4.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.4.html new file mode 100644 index 0000000000..dce9547a6b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.4.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.arc.shape.4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.shape.4</h1> +<p class="desc">arc() from 0 to -pi/2 draws stuff in the right quadrant</p> + + +<script> +var t = async_test("arc() from 0 to -pi/2 draws stuff in the right quadrant"); +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 = 150; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.arc(-50, 50, 100, 0, -Math.PI/2, true); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.4.worker.js new file mode 100644 index 0000000000..8bd028b0bd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.4.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.shape.4 +// Description:arc() from 0 to -pi/2 draws stuff in the right quadrant +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() from 0 to -pi/2 draws stuff in the right quadrant"); +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 = 150; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.arc(-50, 50, 100, 0, -Math.PI/2, true); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.5.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.5.html new file mode 100644 index 0000000000..bd7e54af3b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.5.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.arc.shape.5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.shape.5</h1> +<p class="desc">arc() from 0 to 5pi does not draw crazy things</p> + + +<script> +var t = async_test("arc() from 0 to 5pi does not draw crazy things"); +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.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.arc(300, 0, 100, 0, 5*Math.PI, false); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.5.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.5.worker.js new file mode 100644 index 0000000000..0584590afb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.5.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.shape.5 +// Description:arc() from 0 to 5pi does not draw crazy things +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() from 0 to 5pi does not draw crazy things"); +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.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.arc(300, 0, 100, 0, 5*Math.PI, false); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.1.html new file mode 100644 index 0000000000..ddf200c88b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.1.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.path.arc.twopie.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.twopie.1</h1> +<p class="desc">arc() draws nothing when end = start + 2pi-e and anticlockwise</p> + + +<script> +var t = async_test("arc() draws nothing when end = start + 2pi-e and anticlockwise"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, true); +ctx.stroke(); +_assertPixel(canvas, 50,20, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.1.worker.js new file mode 100644 index 0000000000..c56d25c70b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.1.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.twopie.1 +// Description:arc() draws nothing when end = start + 2pi-e and anticlockwise +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() draws nothing when end = start + 2pi-e and anticlockwise"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, true); +ctx.stroke(); +_assertPixel(canvas, 50,20, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.2.html new file mode 100644 index 0000000000..0a9e0c782a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.2.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.path.arc.twopie.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.twopie.2</h1> +<p class="desc">arc() draws a full circle when end = start + 2pi-e and clockwise</p> + + +<script> +var t = async_test("arc() draws a full circle when end = start + 2pi-e and clockwise"); +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 = 100; +ctx.beginPath(); +ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, false); +ctx.stroke(); +_assertPixel(canvas, 50,20, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.2.worker.js new file mode 100644 index 0000000000..5db75de2a2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.2.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.twopie.2 +// Description:arc() draws a full circle when end = start + 2pi-e and clockwise +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() draws a full circle when end = start + 2pi-e and clockwise"); +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 = 100; +ctx.beginPath(); +ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, false); +ctx.stroke(); +_assertPixel(canvas, 50,20, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.3.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.3.html new file mode 100644 index 0000000000..df1e45480d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.3.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.path.arc.twopie.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.twopie.3</h1> +<p class="desc">arc() draws a full circle when end = start + 2pi+e and anticlockwise</p> + + +<script> +var t = async_test("arc() draws a full circle when end = start + 2pi+e and anticlockwise"); +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 = 100; +ctx.beginPath(); +ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, true); +ctx.stroke(); +_assertPixel(canvas, 50,20, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.3.worker.js new file mode 100644 index 0000000000..0c984884c9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.3.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.twopie.3 +// Description:arc() draws a full circle when end = start + 2pi+e and anticlockwise +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() draws a full circle when end = start + 2pi+e and anticlockwise"); +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 = 100; +ctx.beginPath(); +ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, true); +ctx.stroke(); +_assertPixel(canvas, 50,20, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.4.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.4.html new file mode 100644 index 0000000000..8afa122c7c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.4.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.path.arc.twopie.4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.twopie.4</h1> +<p class="desc">arc() draws nothing when end = start + 2pi+e and clockwise</p> + + +<script> +var t = async_test("arc() draws nothing when end = start + 2pi+e and clockwise"); +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 = 100; +ctx.beginPath(); +ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, false); +ctx.stroke(); +_assertPixel(canvas, 50,20, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.4.worker.js new file mode 100644 index 0000000000..3158528f65 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.4.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.twopie.4 +// Description:arc() draws nothing when end = start + 2pi+e and clockwise +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() draws nothing when end = start + 2pi+e and clockwise"); +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 = 100; +ctx.beginPath(); +ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, false); +ctx.stroke(); +_assertPixel(canvas, 50,20, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.1.html new file mode 100644 index 0000000000..f26162f223 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.1.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.path.arc.zero.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.zero.1</h1> +<p class="desc">arc() draws nothing when startAngle = endAngle and anticlockwise</p> + + +<script> +var t = async_test("arc() draws nothing when startAngle = endAngle and anticlockwise"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.arc(50, 25, 50, 0, 0, true); +ctx.stroke(); +_assertPixel(canvas, 50,20, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.1.worker.js new file mode 100644 index 0000000000..efb137a92a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.1.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.zero.1 +// Description:arc() draws nothing when startAngle = endAngle and anticlockwise +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() draws nothing when startAngle = endAngle and anticlockwise"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.arc(50, 25, 50, 0, 0, true); +ctx.stroke(); +_assertPixel(canvas, 50,20, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.2.html new file mode 100644 index 0000000000..f2eda4b8a2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.2.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.path.arc.zero.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.zero.2</h1> +<p class="desc">arc() draws nothing when startAngle = endAngle and clockwise</p> + + +<script> +var t = async_test("arc() draws nothing when startAngle = endAngle and clockwise"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.arc(50, 25, 50, 0, 0, false); +ctx.stroke(); +_assertPixel(canvas, 50,20, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.2.worker.js new file mode 100644 index 0000000000..28f4f3759a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.2.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.zero.2 +// Description:arc() draws nothing when startAngle = endAngle and clockwise +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() draws nothing when startAngle = endAngle and clockwise"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.arc(50, 25, 50, 0, 0, false); +ctx.stroke(); +_assertPixel(canvas, 50,20, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.zeroradius.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.zeroradius.html new file mode 100644 index 0000000000..2d56e369b8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.zeroradius.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.arc.zeroradius</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arc.zeroradius</h1> +<p class="desc">arc() with zero radius draws a line to the start point</p> + + +<script> +var t = async_test("arc() with zero radius draws a line to the start point"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arc(200, 25, 0, 0, Math.PI, true); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.zeroradius.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.zeroradius.worker.js new file mode 100644 index 0000000000..c57046ab94 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arc.zeroradius.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arc.zeroradius +// Description:arc() with zero radius draws a line to the start point +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arc() with zero radius draws a line to the start point"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arc(200, 25, 0, 0, Math.PI, true); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.1.html new file mode 100644 index 0000000000..58b2635699 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.1.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.path.arcTo.coincide.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arcTo.coincide.1</h1> +<p class="desc">arcTo() has no effect if P0 = P1</p> + + +<script> +var t = async_test("arcTo() has no effect if P0 = P1"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(0, 25, 50, 1000, 1); +ctx.lineTo(100, 25); +ctx.stroke(); +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.arcTo(50, 25, 100, 25, 1); +ctx.stroke(); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.1.worker.js new file mode 100644 index 0000000000..44926712fc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.1.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.path.arcTo.coincide.1 +// Description:arcTo() has no effect if P0 = P1 +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arcTo() has no effect if P0 = P1"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(0, 25, 50, 1000, 1); +ctx.lineTo(100, 25); +ctx.stroke(); +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.arcTo(50, 25, 100, 25, 1); +ctx.stroke(); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.2.html new file mode 100644 index 0000000000..d85e310c85 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.2.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.arcTo.coincide.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arcTo.coincide.2</h1> +<p class="desc">arcTo() draws a straight line to P1 if P1 = P2</p> + + +<script> +var t = async_test("arcTo() draws a straight line to P1 if P1 = P2"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(100, 25, 100, 25, 1); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.2.worker.js new file mode 100644 index 0000000000..c8b336a494 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.2.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arcTo.coincide.2 +// Description:arcTo() draws a straight line to P1 if P1 = P2 +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arcTo() draws a straight line to P1 if P1 = P2"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(100, 25, 100, 25, 1); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.1.html new file mode 100644 index 0000000000..5531ca62ae --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.1.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.path.arcTo.collinear.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arcTo.collinear.1</h1> +<p class="desc">arcTo() with all points on a line, and P1 between P0/P2, draws a straight line to P1</p> + + +<script> +var t = async_test("arcTo() with all points on a line, and P1 between P0/P2, draws a straight line to P1"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(100, 25, 200, 25, 1); +ctx.stroke(); +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(-100, 25); +ctx.arcTo(0, 25, 100, 25, 1); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.1.worker.js new file mode 100644 index 0000000000..3864a311db --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.1.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.path.arcTo.collinear.1 +// Description:arcTo() with all points on a line, and P1 between P0/P2, draws a straight line to P1 +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arcTo() with all points on a line, and P1 between P0/P2, draws a straight line to P1"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(100, 25, 200, 25, 1); +ctx.stroke(); +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(-100, 25); +ctx.arcTo(0, 25, 100, 25, 1); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.2.html new file mode 100644 index 0000000000..a78d626ef0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.2.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.path.arcTo.collinear.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arcTo.collinear.2</h1> +<p class="desc">arcTo() with all points on a line, and P2 between P0/P1, draws a straight line to P1</p> + + +<script> +var t = async_test("arcTo() with all points on a line, and P2 between P0/P1, draws a straight line to P1"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(100, 25, 10, 25, 1); +ctx.stroke(); +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(100, 25); +ctx.arcTo(200, 25, 110, 25, 1); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.2.worker.js new file mode 100644 index 0000000000..6f4c2aa8c6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.2.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.path.arcTo.collinear.2 +// Description:arcTo() with all points on a line, and P2 between P0/P1, draws a straight line to P1 +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arcTo() with all points on a line, and P2 between P0/P1, draws a straight line to P1"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(100, 25, 10, 25, 1); +ctx.stroke(); +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(100, 25); +ctx.arcTo(200, 25, 110, 25, 1); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.3.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.3.html new file mode 100644 index 0000000000..f2d52e4241 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.3.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.path.arcTo.collinear.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arcTo.collinear.3</h1> +<p class="desc">arcTo() with all points on a line, and P0 between P1/P2, draws a straight line to P1</p> + + +<script> +var t = async_test("arcTo() with all points on a line, and P0 between P1/P2, draws a straight line to P1"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(100, 25, -100, 25, 1); +ctx.stroke(); +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(100, 25); +ctx.arcTo(200, 25, 0, 25, 1); +ctx.stroke(); +ctx.beginPath(); +ctx.moveTo(-100, 25); +ctx.arcTo(0, 25, -200, 25, 1); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.3.worker.js new file mode 100644 index 0000000000..2d152b0d83 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.3.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.path.arcTo.collinear.3 +// Description:arcTo() with all points on a line, and P0 between P1/P2, draws a straight line to P1 +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arcTo() with all points on a line, and P0 between P1/P2, draws a straight line to P1"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(100, 25, -100, 25, 1); +ctx.stroke(); +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(100, 25); +ctx.arcTo(200, 25, 0, 25, 1); +ctx.stroke(); +ctx.beginPath(); +ctx.moveTo(-100, 25); +ctx.arcTo(0, 25, -200, 25, 1); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.1.html new file mode 100644 index 0000000000..81dc7b1bd8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.1.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.path.arcTo.ensuresubpath.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arcTo.ensuresubpath.1</h1> +<p class="desc">If there is no subpath, the first control point is added (and nothing is drawn up to it)</p> + + +<script> +var t = async_test("If there is no subpath, the first control point is added (and nothing is drawn up to it)"); +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 = 50; +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.arcTo(100, 50, 200, 50, 0.1); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.1.worker.js new file mode 100644 index 0000000000..99354ac735 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.1.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arcTo.ensuresubpath.1 +// Description:If there is no subpath, the first control point is added (and nothing is drawn up to it) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("If there is no subpath, the first control point is added (and nothing is drawn up to it)"); +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 = 50; +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.arcTo(100, 50, 200, 50, 0.1); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.2.html new file mode 100644 index 0000000000..43c9aec294 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.2.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.arcTo.ensuresubpath.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arcTo.ensuresubpath.2</h1> +<p class="desc">If there is no subpath, the first control point is added</p> + + +<script> +var t = async_test("If there is no subpath, the first control point is added"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.arcTo(0, 25, 50, 250, 0.1); // adds (x1,y1), draws nothing +ctx.lineTo(100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.2.worker.js new file mode 100644 index 0000000000..aad3d006c9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.2.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arcTo.ensuresubpath.2 +// Description:If there is no subpath, the first control point is added +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("If there is no subpath, the first control point is added"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.arcTo(0, 25, 50, 250, 0.1); // adds (x1,y1), draws nothing +ctx.lineTo(100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.negative.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.negative.html new file mode 100644 index 0000000000..59cf973977 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.negative.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.arcTo.negative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arcTo.negative</h1> +<p class="desc">arcTo() with negative radius throws an exception</p> + + +<script> +var t = async_test("arcTo() with negative radius throws an exception"); +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'); + +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.arcTo(0, 0, 0, 0, -1); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.negative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.negative.worker.js new file mode 100644 index 0000000000..60813e88bc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.negative.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arcTo.negative +// Description:arcTo() with negative radius throws an exception +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arcTo() with negative radius throws an exception"); +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'); + +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.arcTo(0, 0, 0, 0, -1); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.nonfinite.html new file mode 100644 index 0000000000..982ad4a964 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.nonfinite.html @@ -0,0 +1,75 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.arcTo.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arcTo.nonfinite</h1> +<p class="desc">arcTo() with Infinity/NaN is ignored</p> + + +<script> +var t = async_test("arcTo() with Infinity/NaN 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.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.arcTo(Infinity, 50, 0, 50, 0); +ctx.arcTo(-Infinity, 50, 0, 50, 0); +ctx.arcTo(NaN, 50, 0, 50, 0); +ctx.arcTo(0, Infinity, 0, 50, 0); +ctx.arcTo(0, -Infinity, 0, 50, 0); +ctx.arcTo(0, NaN, 0, 50, 0); +ctx.arcTo(0, 50, Infinity, 50, 0); +ctx.arcTo(0, 50, -Infinity, 50, 0); +ctx.arcTo(0, 50, NaN, 50, 0); +ctx.arcTo(0, 50, 0, Infinity, 0); +ctx.arcTo(0, 50, 0, -Infinity, 0); +ctx.arcTo(0, 50, 0, NaN, 0); +ctx.arcTo(0, 50, 0, 50, Infinity); +ctx.arcTo(0, 50, 0, 50, -Infinity); +ctx.arcTo(0, 50, 0, 50, NaN); +ctx.arcTo(Infinity, Infinity, 0, 50, 0); +ctx.arcTo(Infinity, Infinity, Infinity, 50, 0); +ctx.arcTo(Infinity, Infinity, Infinity, Infinity, 0); +ctx.arcTo(Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.arcTo(Infinity, Infinity, Infinity, 50, Infinity); +ctx.arcTo(Infinity, Infinity, 0, Infinity, 0); +ctx.arcTo(Infinity, Infinity, 0, Infinity, Infinity); +ctx.arcTo(Infinity, Infinity, 0, 50, Infinity); +ctx.arcTo(Infinity, 50, Infinity, 50, 0); +ctx.arcTo(Infinity, 50, Infinity, Infinity, 0); +ctx.arcTo(Infinity, 50, Infinity, Infinity, Infinity); +ctx.arcTo(Infinity, 50, Infinity, 50, Infinity); +ctx.arcTo(Infinity, 50, 0, Infinity, 0); +ctx.arcTo(Infinity, 50, 0, Infinity, Infinity); +ctx.arcTo(Infinity, 50, 0, 50, Infinity); +ctx.arcTo(0, Infinity, Infinity, 50, 0); +ctx.arcTo(0, Infinity, Infinity, Infinity, 0); +ctx.arcTo(0, Infinity, Infinity, Infinity, Infinity); +ctx.arcTo(0, Infinity, Infinity, 50, Infinity); +ctx.arcTo(0, Infinity, 0, Infinity, 0); +ctx.arcTo(0, Infinity, 0, Infinity, Infinity); +ctx.arcTo(0, Infinity, 0, 50, Infinity); +ctx.arcTo(0, 50, Infinity, Infinity, 0); +ctx.arcTo(0, 50, Infinity, Infinity, Infinity); +ctx.arcTo(0, 50, Infinity, 50, Infinity); +ctx.arcTo(0, 50, 0, Infinity, Infinity); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 90,45, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.nonfinite.worker.js new file mode 100644 index 0000000000..6aa674fc90 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.nonfinite.worker.js @@ -0,0 +1,71 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arcTo.nonfinite +// Description:arcTo() with Infinity/NaN is ignored +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arcTo() with Infinity/NaN 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.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.arcTo(Infinity, 50, 0, 50, 0); +ctx.arcTo(-Infinity, 50, 0, 50, 0); +ctx.arcTo(NaN, 50, 0, 50, 0); +ctx.arcTo(0, Infinity, 0, 50, 0); +ctx.arcTo(0, -Infinity, 0, 50, 0); +ctx.arcTo(0, NaN, 0, 50, 0); +ctx.arcTo(0, 50, Infinity, 50, 0); +ctx.arcTo(0, 50, -Infinity, 50, 0); +ctx.arcTo(0, 50, NaN, 50, 0); +ctx.arcTo(0, 50, 0, Infinity, 0); +ctx.arcTo(0, 50, 0, -Infinity, 0); +ctx.arcTo(0, 50, 0, NaN, 0); +ctx.arcTo(0, 50, 0, 50, Infinity); +ctx.arcTo(0, 50, 0, 50, -Infinity); +ctx.arcTo(0, 50, 0, 50, NaN); +ctx.arcTo(Infinity, Infinity, 0, 50, 0); +ctx.arcTo(Infinity, Infinity, Infinity, 50, 0); +ctx.arcTo(Infinity, Infinity, Infinity, Infinity, 0); +ctx.arcTo(Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.arcTo(Infinity, Infinity, Infinity, 50, Infinity); +ctx.arcTo(Infinity, Infinity, 0, Infinity, 0); +ctx.arcTo(Infinity, Infinity, 0, Infinity, Infinity); +ctx.arcTo(Infinity, Infinity, 0, 50, Infinity); +ctx.arcTo(Infinity, 50, Infinity, 50, 0); +ctx.arcTo(Infinity, 50, Infinity, Infinity, 0); +ctx.arcTo(Infinity, 50, Infinity, Infinity, Infinity); +ctx.arcTo(Infinity, 50, Infinity, 50, Infinity); +ctx.arcTo(Infinity, 50, 0, Infinity, 0); +ctx.arcTo(Infinity, 50, 0, Infinity, Infinity); +ctx.arcTo(Infinity, 50, 0, 50, Infinity); +ctx.arcTo(0, Infinity, Infinity, 50, 0); +ctx.arcTo(0, Infinity, Infinity, Infinity, 0); +ctx.arcTo(0, Infinity, Infinity, Infinity, Infinity); +ctx.arcTo(0, Infinity, Infinity, 50, Infinity); +ctx.arcTo(0, Infinity, 0, Infinity, 0); +ctx.arcTo(0, Infinity, 0, Infinity, Infinity); +ctx.arcTo(0, Infinity, 0, 50, Infinity); +ctx.arcTo(0, 50, Infinity, Infinity, 0); +ctx.arcTo(0, 50, Infinity, Infinity, Infinity); +ctx.arcTo(0, 50, Infinity, 50, Infinity); +ctx.arcTo(0, 50, 0, Infinity, Infinity); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 90,45, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.scale.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.scale.html new file mode 100644 index 0000000000..7139455bda --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.scale.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.path.arcTo.scale</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arcTo.scale</h1> +<p class="desc">arcTo scales the curve, not just the control points</p> + + +<script> +var t = async_test("arcTo scales the curve, not just the control points"); +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.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 50); +ctx.translate(100, 0); +ctx.scale(0.1, 1); +ctx.arcTo(50, 50, 50, 0, 50); +ctx.lineTo(-1000, 0); +ctx.fill(); +_assertPixel(canvas, 0,0, 0,255,0,255); +_assertPixel(canvas, 50,0, 0,255,0,255); +_assertPixel(canvas, 99,0, 0,255,0,255); +_assertPixel(canvas, 0,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 99,25, 0,255,0,255); +_assertPixel(canvas, 0,49, 0,255,0,255); +_assertPixel(canvas, 50,49, 0,255,0,255); +_assertPixel(canvas, 99,49, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.scale.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.scale.worker.js new file mode 100644 index 0000000000..b06c8f935c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.scale.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.path.arcTo.scale +// Description:arcTo scales the curve, not just the control points +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arcTo scales the curve, not just the control points"); +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.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 50); +ctx.translate(100, 0); +ctx.scale(0.1, 1); +ctx.arcTo(50, 50, 50, 0, 50); +ctx.lineTo(-1000, 0); +ctx.fill(); +_assertPixel(canvas, 0,0, 0,255,0,255); +_assertPixel(canvas, 50,0, 0,255,0,255); +_assertPixel(canvas, 99,0, 0,255,0,255); +_assertPixel(canvas, 0,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 99,25, 0,255,0,255); +_assertPixel(canvas, 0,49, 0,255,0,255); +_assertPixel(canvas, 50,49, 0,255,0,255); +_assertPixel(canvas, 99,49, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve1.html new file mode 100644 index 0000000000..659b02ceed --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve1.html @@ -0,0 +1,56 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.arcTo.shape.curve1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arcTo.shape.curve1</h1> +<p class="desc">arcTo() curves in the right kind of shape</p> + + +<script> +var t = async_test("arcTo() curves in the right kind of shape"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var tol = 1.5; // tolerance to avoid antialiasing artifacts +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 10; +ctx.beginPath(); +ctx.moveTo(10, 25); +ctx.arcTo(75, 25, 75, 60, 20); +ctx.stroke(); +ctx.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.rect(10, 20, 45, 10); +ctx.moveTo(80, 45); +ctx.arc(55, 45, 25+tol, 0, -Math.PI/2, true); +ctx.arc(55, 45, 15-tol, -Math.PI/2, 0, false); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 55,19, 0,255,0,255); +_assertPixel(canvas, 55,20, 0,255,0,255); +_assertPixel(canvas, 55,21, 0,255,0,255); +_assertPixel(canvas, 64,22, 0,255,0,255); +_assertPixel(canvas, 65,21, 0,255,0,255); +_assertPixel(canvas, 72,28, 0,255,0,255); +_assertPixel(canvas, 73,27, 0,255,0,255); +_assertPixel(canvas, 78,36, 0,255,0,255); +_assertPixel(canvas, 79,35, 0,255,0,255); +_assertPixel(canvas, 80,44, 0,255,0,255); +_assertPixel(canvas, 80,45, 0,255,0,255); +_assertPixel(canvas, 80,46, 0,255,0,255); +_assertPixel(canvas, 65,45, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve1.worker.js new file mode 100644 index 0000000000..5223b55abb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve1.worker.js @@ -0,0 +1,52 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arcTo.shape.curve1 +// Description:arcTo() curves in the right kind of shape +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arcTo() curves in the right kind of shape"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var tol = 1.5; // tolerance to avoid antialiasing artifacts +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 10; +ctx.beginPath(); +ctx.moveTo(10, 25); +ctx.arcTo(75, 25, 75, 60, 20); +ctx.stroke(); +ctx.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.rect(10, 20, 45, 10); +ctx.moveTo(80, 45); +ctx.arc(55, 45, 25+tol, 0, -Math.PI/2, true); +ctx.arc(55, 45, 15-tol, -Math.PI/2, 0, false); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 55,19, 0,255,0,255); +_assertPixel(canvas, 55,20, 0,255,0,255); +_assertPixel(canvas, 55,21, 0,255,0,255); +_assertPixel(canvas, 64,22, 0,255,0,255); +_assertPixel(canvas, 65,21, 0,255,0,255); +_assertPixel(canvas, 72,28, 0,255,0,255); +_assertPixel(canvas, 73,27, 0,255,0,255); +_assertPixel(canvas, 78,36, 0,255,0,255); +_assertPixel(canvas, 79,35, 0,255,0,255); +_assertPixel(canvas, 80,44, 0,255,0,255); +_assertPixel(canvas, 80,45, 0,255,0,255); +_assertPixel(canvas, 80,46, 0,255,0,255); +_assertPixel(canvas, 65,45, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve2.html new file mode 100644 index 0000000000..02ab6c1437 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve2.html @@ -0,0 +1,55 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.arcTo.shape.curve2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arcTo.shape.curve2</h1> +<p class="desc">arcTo() curves in the right kind of shape</p> + + +<script> +var t = async_test("arcTo() curves in the right kind of shape"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var tol = 1.5; // tolerance to avoid antialiasing artifacts +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.beginPath(); +ctx.rect(10, 20, 45, 10); +ctx.moveTo(80, 45); +ctx.arc(55, 45, 25-tol, 0, -Math.PI/2, true); +ctx.arc(55, 45, 15+tol, -Math.PI/2, 0, false); +ctx.fill(); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 10; +ctx.beginPath(); +ctx.moveTo(10, 25); +ctx.arcTo(75, 25, 75, 60, 20); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 55,19, 0,255,0,255); +_assertPixel(canvas, 55,20, 0,255,0,255); +_assertPixel(canvas, 55,21, 0,255,0,255); +_assertPixel(canvas, 64,22, 0,255,0,255); +_assertPixel(canvas, 65,21, 0,255,0,255); +_assertPixel(canvas, 72,28, 0,255,0,255); +_assertPixel(canvas, 73,27, 0,255,0,255); +_assertPixel(canvas, 78,36, 0,255,0,255); +_assertPixel(canvas, 79,35, 0,255,0,255); +_assertPixel(canvas, 80,44, 0,255,0,255); +_assertPixel(canvas, 80,45, 0,255,0,255); +_assertPixel(canvas, 80,46, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve2.worker.js new file mode 100644 index 0000000000..f06c2cdc33 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve2.worker.js @@ -0,0 +1,51 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.arcTo.shape.curve2 +// Description:arcTo() curves in the right kind of shape +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arcTo() curves in the right kind of shape"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var tol = 1.5; // tolerance to avoid antialiasing artifacts +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.beginPath(); +ctx.rect(10, 20, 45, 10); +ctx.moveTo(80, 45); +ctx.arc(55, 45, 25-tol, 0, -Math.PI/2, true); +ctx.arc(55, 45, 15+tol, -Math.PI/2, 0, false); +ctx.fill(); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 10; +ctx.beginPath(); +ctx.moveTo(10, 25); +ctx.arcTo(75, 25, 75, 60, 20); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 55,19, 0,255,0,255); +_assertPixel(canvas, 55,20, 0,255,0,255); +_assertPixel(canvas, 55,21, 0,255,0,255); +_assertPixel(canvas, 64,22, 0,255,0,255); +_assertPixel(canvas, 65,21, 0,255,0,255); +_assertPixel(canvas, 72,28, 0,255,0,255); +_assertPixel(canvas, 73,27, 0,255,0,255); +_assertPixel(canvas, 78,36, 0,255,0,255); +_assertPixel(canvas, 79,35, 0,255,0,255); +_assertPixel(canvas, 80,44, 0,255,0,255); +_assertPixel(canvas, 80,45, 0,255,0,255); +_assertPixel(canvas, 80,46, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.end.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.end.html new file mode 100644 index 0000000000..0871c39157 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.end.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.arcTo.shape.end</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arcTo.shape.end</h1> +<p class="desc">arcTo() does not draw anything from P1 to P2</p> + + +<script> +var t = async_test("arcTo() does not draw anything from P1 to P2"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.moveTo(-100, -100); +ctx.arcTo(-100, 25, 200, 25, 10); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.end.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.end.worker.js new file mode 100644 index 0000000000..f3addb0a0c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.end.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.path.arcTo.shape.end +// Description:arcTo() does not draw anything from P1 to P2 +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arcTo() does not draw anything from P1 to P2"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.moveTo(-100, -100); +ctx.arcTo(-100, 25, 200, 25, 10); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.start.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.start.html new file mode 100644 index 0000000000..5040462ada --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.start.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.arcTo.shape.start</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arcTo.shape.start</h1> +<p class="desc">arcTo() draws a straight line from P0 to P1</p> + + +<script> +var t = async_test("arcTo() draws a straight line from P0 to P1"); +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 = 50; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(200, 25, 200, 50, 10); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.start.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.start.worker.js new file mode 100644 index 0000000000..36706d600e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.start.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.path.arcTo.shape.start +// Description:arcTo() draws a straight line from P0 to P1 +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arcTo() draws a straight line from P0 to P1"); +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 = 50; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(200, 25, 200, 50, 10); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.transformation.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.transformation.html new file mode 100644 index 0000000000..bea6374ea4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.transformation.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.path.arcTo.transformation</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arcTo.transformation</h1> +<p class="desc">arcTo joins up to the last subpath point correctly</p> + + +<script> +var t = async_test("arcTo joins up to the last subpath point 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 50); +ctx.translate(100, 0); +ctx.arcTo(50, 50, 50, 0, 50); +ctx.lineTo(-100, 0); +ctx.fill(); +_assertPixel(canvas, 0,0, 0,255,0,255); +_assertPixel(canvas, 50,0, 0,255,0,255); +_assertPixel(canvas, 99,0, 0,255,0,255); +_assertPixel(canvas, 0,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 99,25, 0,255,0,255); +_assertPixel(canvas, 0,49, 0,255,0,255); +_assertPixel(canvas, 50,49, 0,255,0,255); +_assertPixel(canvas, 99,49, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.transformation.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.transformation.worker.js new file mode 100644 index 0000000000..925140b675 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.transformation.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.path.arcTo.transformation +// Description:arcTo joins up to the last subpath point correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arcTo joins up to the last subpath point 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 50); +ctx.translate(100, 0); +ctx.arcTo(50, 50, 50, 0, 50); +ctx.lineTo(-100, 0); +ctx.fill(); +_assertPixel(canvas, 0,0, 0,255,0,255); +_assertPixel(canvas, 50,0, 0,255,0,255); +_assertPixel(canvas, 99,0, 0,255,0,255); +_assertPixel(canvas, 0,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 99,25, 0,255,0,255); +_assertPixel(canvas, 0,49, 0,255,0,255); +_assertPixel(canvas, 50,49, 0,255,0,255); +_assertPixel(canvas, 99,49, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.1.html new file mode 100644 index 0000000000..00541a938b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.1.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.path.arcTo.zero.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arcTo.zero.1</h1> +<p class="desc">arcTo() with zero radius draws a straight line from P0 to P1</p> + + +<script> +var t = async_test("arcTo() with zero radius draws a straight line from P0 to P1"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(100, 25, 100, 100, 0); +ctx.stroke(); +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(0, -25); +ctx.arcTo(50, -25, 50, 50, 0); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.1.worker.js new file mode 100644 index 0000000000..cee6d1c5ba --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.1.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.path.arcTo.zero.1 +// Description:arcTo() with zero radius draws a straight line from P0 to P1 +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arcTo() with zero radius draws a straight line from P0 to P1"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(100, 25, 100, 100, 0); +ctx.stroke(); +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(0, -25); +ctx.arcTo(50, -25, 50, 50, 0); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.2.html new file mode 100644 index 0000000000..e10fe5ce95 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.2.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.path.arcTo.zero.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.arcTo.zero.2</h1> +<p class="desc">arcTo() with zero radius draws a straight line from P0 to P1, even when all points are collinear</p> + + +<script> +var t = async_test("arcTo() with zero radius draws a straight line from P0 to P1, even when all points are collinear"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(100, 25, -100, 25, 0); +ctx.stroke(); +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(100, 25); +ctx.arcTo(200, 25, 50, 25, 0); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.2.worker.js new file mode 100644 index 0000000000..d0cc4a1484 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.2.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.path.arcTo.zero.2 +// Description:arcTo() with zero radius draws a straight line from P0 to P1, even when all points are collinear +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("arcTo() with zero radius draws a straight line from P0 to P1, even when all points are collinear"); +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 = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(100, 25, -100, 25, 0); +ctx.stroke(); +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(100, 25); +ctx.arcTo(200, 25, 50, 25, 0); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.beginPath.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.beginPath.html new file mode 100644 index 0000000000..8b9c4cdc7a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.beginPath.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.beginPath</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.beginPath</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.rect(0, 0, 100, 50); +ctx.beginPath(); +ctx.fillStyle = '#f00'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.beginPath.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.beginPath.worker.js new file mode 100644 index 0000000000..18b81afa5c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.beginPath.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.path.beginPath +// 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.rect(0, 0, 100, 50); +ctx.beginPath(); +ctx.fillStyle = '#f00'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.basic.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.basic.html new file mode 100644 index 0000000000..6917287432 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.basic.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.bezierCurveTo.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.path.bezierCurveTo.basic</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.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.bezierCurveTo(100, 25, 100, 25, 100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.basic.worker.js new file mode 100644 index 0000000000..a365372c9e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.basic.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.bezierCurveTo.basic +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.bezierCurveTo(100, 25, 100, 25, 100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.html new file mode 100644 index 0000000000..67dd771fcb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.bezierCurveTo.ensuresubpath.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.bezierCurveTo.ensuresubpath.1</h1> +<p class="desc">If there is no subpath, the first control point is added (and nothing is drawn up to it)</p> + + +<script> +var t = async_test("If there is no subpath, the first control point is added (and nothing is drawn up to it)"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.bezierCurveTo(100, 50, 200, 50, 200, 50); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 95,45, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.worker.js new file mode 100644 index 0000000000..beb275ba37 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.bezierCurveTo.ensuresubpath.1 +// Description:If there is no subpath, the first control point is added (and nothing is drawn up to it) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("If there is no subpath, the first control point is added (and nothing is drawn up to it)"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.bezierCurveTo(100, 50, 200, 50, 200, 50); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 95,45, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.html new file mode 100644 index 0000000000..d4f99e1e2a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.bezierCurveTo.ensuresubpath.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.bezierCurveTo.ensuresubpath.2</h1> +<p class="desc">If there is no subpath, the first control point is added</p> + + +<script> +var t = async_test("If there is no subpath, the first control point is added"); +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 = 50; +ctx.beginPath(); +ctx.bezierCurveTo(0, 25, 100, 25, 100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 5,45, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.worker.js new file mode 100644 index 0000000000..7176dba078 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.bezierCurveTo.ensuresubpath.2 +// Description:If there is no subpath, the first control point is added +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("If there is no subpath, the first control point is added"); +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 = 50; +ctx.beginPath(); +ctx.bezierCurveTo(0, 25, 100, 25, 100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 5,45, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.nonfinite.html new file mode 100644 index 0000000000..4c5abfbdc1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.nonfinite.html @@ -0,0 +1,109 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.bezierCurveTo.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.bezierCurveTo.nonfinite</h1> +<p class="desc">bezierCurveTo() with Infinity/NaN is ignored</p> + + +<script> +var t = async_test("bezierCurveTo() with Infinity/NaN 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.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, 50); +ctx.bezierCurveTo(-Infinity, 50, 0, 50, 0, 50); +ctx.bezierCurveTo(NaN, 50, 0, 50, 0, 50); +ctx.bezierCurveTo(0, Infinity, 0, 50, 0, 50); +ctx.bezierCurveTo(0, -Infinity, 0, 50, 0, 50); +ctx.bezierCurveTo(0, NaN, 0, 50, 0, 50); +ctx.bezierCurveTo(0, 50, Infinity, 50, 0, 50); +ctx.bezierCurveTo(0, 50, -Infinity, 50, 0, 50); +ctx.bezierCurveTo(0, 50, NaN, 50, 0, 50); +ctx.bezierCurveTo(0, 50, 0, Infinity, 0, 50); +ctx.bezierCurveTo(0, 50, 0, -Infinity, 0, 50); +ctx.bezierCurveTo(0, 50, 0, NaN, 0, 50); +ctx.bezierCurveTo(0, 50, 0, 50, Infinity, 50); +ctx.bezierCurveTo(0, 50, 0, 50, -Infinity, 50); +ctx.bezierCurveTo(0, 50, 0, 50, NaN, 50); +ctx.bezierCurveTo(0, 50, 0, 50, 0, Infinity); +ctx.bezierCurveTo(0, 50, 0, 50, 0, -Infinity); +ctx.bezierCurveTo(0, 50, 0, 50, 0, NaN); +ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, 50); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, 50); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, 50); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, 50); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, 50); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, 50); +ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, 50); +ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, 50); +ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, Infinity); +ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, 50); +ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, 50); +ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, 50); +ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, Infinity); +ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, 50); +ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, Infinity); +ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, 50); +ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, 50); +ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, Infinity); +ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, 50); +ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, Infinity); +ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, 50); +ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, 50); +ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, 50); +ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, Infinity); +ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, 50); +ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, Infinity); +ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, Infinity); +ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, 50); +ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, 50); +ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, Infinity); +ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, 50); +ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, Infinity); +ctx.bezierCurveTo(0, Infinity, 0, 50, 0, Infinity); +ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, 50); +ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, 50); +ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, Infinity); +ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, 50); +ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, Infinity); +ctx.bezierCurveTo(0, 50, Infinity, 50, 0, Infinity); +ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, 50); +ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(0, 50, 0, Infinity, 0, Infinity); +ctx.bezierCurveTo(0, 50, 0, 50, Infinity, Infinity); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 90,45, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.nonfinite.worker.js new file mode 100644 index 0000000000..752cb1b0ab --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.nonfinite.worker.js @@ -0,0 +1,105 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.bezierCurveTo.nonfinite +// Description:bezierCurveTo() with Infinity/NaN is ignored +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("bezierCurveTo() with Infinity/NaN 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.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, 50); +ctx.bezierCurveTo(-Infinity, 50, 0, 50, 0, 50); +ctx.bezierCurveTo(NaN, 50, 0, 50, 0, 50); +ctx.bezierCurveTo(0, Infinity, 0, 50, 0, 50); +ctx.bezierCurveTo(0, -Infinity, 0, 50, 0, 50); +ctx.bezierCurveTo(0, NaN, 0, 50, 0, 50); +ctx.bezierCurveTo(0, 50, Infinity, 50, 0, 50); +ctx.bezierCurveTo(0, 50, -Infinity, 50, 0, 50); +ctx.bezierCurveTo(0, 50, NaN, 50, 0, 50); +ctx.bezierCurveTo(0, 50, 0, Infinity, 0, 50); +ctx.bezierCurveTo(0, 50, 0, -Infinity, 0, 50); +ctx.bezierCurveTo(0, 50, 0, NaN, 0, 50); +ctx.bezierCurveTo(0, 50, 0, 50, Infinity, 50); +ctx.bezierCurveTo(0, 50, 0, 50, -Infinity, 50); +ctx.bezierCurveTo(0, 50, 0, 50, NaN, 50); +ctx.bezierCurveTo(0, 50, 0, 50, 0, Infinity); +ctx.bezierCurveTo(0, 50, 0, 50, 0, -Infinity); +ctx.bezierCurveTo(0, 50, 0, 50, 0, NaN); +ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, 50); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, 50); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, 50); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, 50); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, 50); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, 50); +ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, 50); +ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, 50); +ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, Infinity); +ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, 50); +ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, 50); +ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, 50); +ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, Infinity); +ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, 50); +ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, Infinity); +ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, 50); +ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, 50); +ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, Infinity); +ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, 50); +ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, Infinity); +ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, 50); +ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, 50); +ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, 50); +ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, Infinity); +ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, 50); +ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, Infinity); +ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, Infinity); +ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, 50); +ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, 50); +ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, Infinity); +ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, 50); +ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, Infinity); +ctx.bezierCurveTo(0, Infinity, 0, 50, 0, Infinity); +ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, 50); +ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, 50); +ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, Infinity); +ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, 50); +ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, Infinity); +ctx.bezierCurveTo(0, 50, Infinity, 50, 0, Infinity); +ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, 50); +ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(0, 50, 0, Infinity, 0, Infinity); +ctx.bezierCurveTo(0, 50, 0, 50, Infinity, Infinity); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 90,45, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.scaled.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.scaled.html new file mode 100644 index 0000000000..2608237a6c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.scaled.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.path.bezierCurveTo.scaled</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.bezierCurveTo.scaled</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.scale(1000, 1000); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 0.055; +ctx.beginPath(); +ctx.moveTo(-2, 3.1); +ctx.bezierCurveTo(-2, -1, 2.1, -1, 2.1, 3.1); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.scaled.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.scaled.worker.js new file mode 100644 index 0000000000..641cccf4b4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.scaled.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.path.bezierCurveTo.scaled +// 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.scale(1000, 1000); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 0.055; +ctx.beginPath(); +ctx.moveTo(-2, 3.1); +ctx.bezierCurveTo(-2, -1, 2.1, -1, 2.1, 3.1); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.shape.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.shape.html new file mode 100644 index 0000000000..5f8f8daac2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.shape.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.bezierCurveTo.shape</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.bezierCurveTo.shape</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.strokeStyle = '#0f0'; +ctx.lineWidth = 55; +ctx.beginPath(); +ctx.moveTo(-2000, 3100); +ctx.bezierCurveTo(-2000, -1000, 2100, -1000, 2100, 3100); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.shape.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.shape.worker.js new file mode 100644 index 0000000000..ee42982f2f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.shape.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.path.bezierCurveTo.shape +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 55; +ctx.beginPath(); +ctx.moveTo(-2000, 3100); +ctx.bezierCurveTo(-2000, -1000, 2100, -1000, 2100, 3100); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.1.html new file mode 100644 index 0000000000..cca53f6be6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.1.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.path.clip.basic.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.clip.basic.1</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.beginPath(); +ctx.rect(0, 0, 100, 50); +ctx.clip(); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.1.worker.js new file mode 100644 index 0000000000..cf5a5d3b63 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.1.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.clip.basic.1 +// 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.beginPath(); +ctx.rect(0, 0, 100, 50); +ctx.clip(); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.2.html new file mode 100644 index 0000000000..d5ef79bf1a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.2.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.path.clip.basic.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.clip.basic.2</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.beginPath(); +ctx.rect(-100, 0, 100, 50); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.2.worker.js new file mode 100644 index 0000000000..bad906d4b7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.2.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.clip.basic.2 +// 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.beginPath(); +ctx.rect(-100, 0, 100, 50); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.empty.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.empty.html new file mode 100644 index 0000000000..d74fff0d81 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.empty.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.clip.empty</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.clip.empty</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.beginPath(); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.empty.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.empty.worker.js new file mode 100644 index 0000000000..51beb6426a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.empty.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.path.clip.empty +// 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.beginPath(); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.intersect.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.intersect.html new file mode 100644 index 0000000000..3b269ce102 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.intersect.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.path.clip.intersect</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.clip.intersect</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.beginPath(); +ctx.rect(0, 0, 50, 50); +ctx.clip(); +ctx.beginPath(); +ctx.rect(50, 0, 50, 50) +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.intersect.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.intersect.worker.js new file mode 100644 index 0000000000..791c1bb784 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.intersect.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.clip.intersect +// 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.beginPath(); +ctx.rect(0, 0, 50, 50); +ctx.clip(); +ctx.beginPath(); +ctx.rect(50, 0, 50, 50) +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.unaffected.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.unaffected.html new file mode 100644 index 0000000000..a0ba94fb8a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.unaffected.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.clip.unaffected</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.clip.unaffected</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.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 0); +ctx.lineTo(0, 50); +ctx.lineTo(100, 50); +ctx.lineTo(100, 0); +ctx.clip(); +ctx.lineTo(0, 0); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.unaffected.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.unaffected.worker.js new file mode 100644 index 0000000000..e03257021c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.unaffected.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.clip.unaffected +// 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.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 0); +ctx.lineTo(0, 50); +ctx.lineTo(100, 50); +ctx.lineTo(100, 0); +ctx.clip(); +ctx.lineTo(0, 0); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.1.html new file mode 100644 index 0000000000..9a20e493db --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.1.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.path.clip.winding.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.clip.winding.1</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.beginPath(); +ctx.moveTo(-10, -10); +ctx.lineTo(110, -10); +ctx.lineTo(110, 60); +ctx.lineTo(-10, 60); +ctx.lineTo(-10, -10); +ctx.lineTo(0, 0); +ctx.lineTo(0, 50); +ctx.lineTo(100, 50); +ctx.lineTo(100, 0); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.1.worker.js new file mode 100644 index 0000000000..02565fcc8b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.1.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.path.clip.winding.1 +// 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.beginPath(); +ctx.moveTo(-10, -10); +ctx.lineTo(110, -10); +ctx.lineTo(110, 60); +ctx.lineTo(-10, 60); +ctx.lineTo(-10, -10); +ctx.lineTo(0, 0); +ctx.lineTo(0, 50); +ctx.lineTo(100, 50); +ctx.lineTo(100, 0); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.2.html new file mode 100644 index 0000000000..1f223a3b38 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.2.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.path.clip.winding.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.clip.winding.2</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.beginPath(); +ctx.moveTo(-10, -10); +ctx.lineTo(110, -10); +ctx.lineTo(110, 60); +ctx.lineTo(-10, 60); +ctx.lineTo(-10, -10); +ctx.clip(); +ctx.beginPath(); +ctx.moveTo(0, 0); +ctx.lineTo(0, 50); +ctx.lineTo(100, 50); +ctx.lineTo(100, 0); +ctx.lineTo(0, 0); +ctx.clip(); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.2.worker.js new file mode 100644 index 0000000000..e7e8c5039d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.2.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.path.clip.winding.2 +// 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.beginPath(); +ctx.moveTo(-10, -10); +ctx.lineTo(110, -10); +ctx.lineTo(110, 60); +ctx.lineTo(-10, 60); +ctx.lineTo(-10, -10); +ctx.clip(); +ctx.beginPath(); +ctx.moveTo(0, 0); +ctx.lineTo(0, 50); +ctx.lineTo(100, 50); +ctx.lineTo(100, 0); +ctx.lineTo(0, 0); +ctx.clip(); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.closePath.empty.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.closePath.empty.html new file mode 100644 index 0000000000..50ea865696 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.closePath.empty.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.closePath.empty</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.closePath.empty</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.closePath(); +ctx.fillStyle = '#f00'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.closePath.empty.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.closePath.empty.worker.js new file mode 100644 index 0000000000..c06ce48635 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.closePath.empty.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.closePath.empty +// 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.closePath(); +ctx.fillStyle = '#f00'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.closePath.newline.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.closePath.newline.html new file mode 100644 index 0000000000..dca2e01b7e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.closePath.newline.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.path.closePath.newline</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.closePath.newline</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.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.moveTo(-100, 25); +ctx.lineTo(-100, -100); +ctx.lineTo(200, -100); +ctx.lineTo(200, 25); +ctx.closePath(); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.closePath.newline.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.closePath.newline.worker.js new file mode 100644 index 0000000000..5d27821f55 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.closePath.newline.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.closePath.newline +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.moveTo(-100, 25); +ctx.lineTo(-100, -100); +ctx.lineTo(200, -100); +ctx.lineTo(200, 25); +ctx.closePath(); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.closePath.nextpoint.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.closePath.nextpoint.html new file mode 100644 index 0000000000..4cf02d2b64 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.closePath.nextpoint.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.closePath.nextpoint</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.closePath.nextpoint</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.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.moveTo(-100, 25); +ctx.lineTo(-100, -1000); +ctx.closePath(); +ctx.lineTo(1000, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.closePath.nextpoint.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.closePath.nextpoint.worker.js new file mode 100644 index 0000000000..8a84ce7d83 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.closePath.nextpoint.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.path.closePath.nextpoint +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.moveTo(-100, 25); +ctx.lineTo(-100, -1000); +ctx.closePath(); +ctx.lineTo(1000, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.basic.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.basic.html new file mode 100644 index 0000000000..72e755f7e8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.basic.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.fill.closed.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.path.fill.closed.basic</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.fillStyle = '#0f0'; +ctx.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.basic.worker.js new file mode 100644 index 0000000000..2c63e1ec97 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.basic.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.fill.closed.basic +// 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.fillStyle = '#0f0'; +ctx.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.unaffected.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.unaffected.html new file mode 100644 index 0000000000..9d54512539 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.unaffected.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.fill.closed.unaffected</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.fill.closed.unaffected</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 = '#00f'; +ctx.fillRect(0, 0, 100, 50); +ctx.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.lineTo(100, 50); +ctx.fillStyle = '#f00'; +ctx.fill(); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 90,10, 0,255,0,255); +_assertPixel(canvas, 10,40, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.unaffected.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.unaffected.worker.js new file mode 100644 index 0000000000..6b4aa9244f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.unaffected.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.fill.closed.unaffected +// 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 = '#00f'; +ctx.fillRect(0, 0, 100, 50); +ctx.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.lineTo(100, 50); +ctx.fillStyle = '#f00'; +ctx.fill(); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 90,10, 0,255,0,255); +_assertPixel(canvas, 10,40, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.overlap.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.overlap.html new file mode 100644 index 0000000000..6eaf88edcd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.overlap.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.path.fill.overlap</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.fill.overlap</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 = '#000'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = 'rgba(0, 255, 0, 0.5)'; +ctx.rect(0, 0, 100, 50); +ctx.closePath(); +ctx.rect(10, 10, 80, 30); +ctx.fill(); +_assertPixelApprox(canvas, 50,25, 0,127,0,255, 1); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.overlap.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.overlap.worker.js new file mode 100644 index 0000000000..e1d64fe40b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.overlap.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.fill.overlap +// 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 = '#000'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = 'rgba(0, 255, 0, 0.5)'; +ctx.rect(0, 0, 100, 50); +ctx.closePath(); +ctx.rect(10, 10, 80, 30); +ctx.fill(); +_assertPixelApprox(canvas, 50,25, 0,127,0,255, 1); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.add.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.add.html new file mode 100644 index 0000000000..c5f64924da --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.add.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.path.fill.winding.add</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.fill.winding.add</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.fillStyle = '#0f0'; +ctx.moveTo(-10, -10); +ctx.lineTo(110, -10); +ctx.lineTo(110, 60); +ctx.lineTo(-10, 60); +ctx.lineTo(-10, -10); +ctx.lineTo(0, 0); +ctx.lineTo(100, 0); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.add.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.add.worker.js new file mode 100644 index 0000000000..b40e170623 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.add.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.path.fill.winding.add +// 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.fillStyle = '#0f0'; +ctx.moveTo(-10, -10); +ctx.lineTo(110, -10); +ctx.lineTo(110, 60); +ctx.lineTo(-10, 60); +ctx.lineTo(-10, -10); +ctx.lineTo(0, 0); +ctx.lineTo(100, 0); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.1.html new file mode 100644 index 0000000000..4f553f2bc3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.1.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.path.fill.winding.subtract.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.fill.winding.subtract.1</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.fillStyle = '#f00'; +ctx.moveTo(-10, -10); +ctx.lineTo(110, -10); +ctx.lineTo(110, 60); +ctx.lineTo(-10, 60); +ctx.lineTo(-10, -10); +ctx.lineTo(0, 0); +ctx.lineTo(0, 50); +ctx.lineTo(100, 50); +ctx.lineTo(100, 0); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.1.worker.js new file mode 100644 index 0000000000..a820915413 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.1.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.path.fill.winding.subtract.1 +// 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.fillStyle = '#f00'; +ctx.moveTo(-10, -10); +ctx.lineTo(110, -10); +ctx.lineTo(110, 60); +ctx.lineTo(-10, 60); +ctx.lineTo(-10, -10); +ctx.lineTo(0, 0); +ctx.lineTo(0, 50); +ctx.lineTo(100, 50); +ctx.lineTo(100, 0); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.2.html new file mode 100644 index 0000000000..cf1fcaa2d4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.2.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.fill.winding.subtract.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.fill.winding.subtract.2</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.fillStyle = '#f00'; +ctx.moveTo(-10, -10); +ctx.lineTo(110, -10); +ctx.lineTo(110, 60); +ctx.lineTo(-10, 60); +ctx.moveTo(0, 0); +ctx.lineTo(0, 50); +ctx.lineTo(100, 50); +ctx.lineTo(100, 0); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.2.worker.js new file mode 100644 index 0000000000..2c83a41ae8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.2.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.path.fill.winding.subtract.2 +// 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.fillStyle = '#f00'; +ctx.moveTo(-10, -10); +ctx.lineTo(110, -10); +ctx.lineTo(110, 60); +ctx.lineTo(-10, 60); +ctx.moveTo(0, 0); +ctx.lineTo(0, 50); +ctx.lineTo(100, 50); +ctx.lineTo(100, 0); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.3.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.3.html new file mode 100644 index 0000000000..ffcbfe2518 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.3.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.path.fill.winding.subtract.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.fill.winding.subtract.3</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.fillStyle = '#0f0'; +ctx.moveTo(-10, -10); +ctx.lineTo(110, -10); +ctx.lineTo(110, 60); +ctx.lineTo(-10, 60); +ctx.lineTo(-10, -10); +ctx.lineTo(-20, -20); +ctx.lineTo(120, -20); +ctx.lineTo(120, 70); +ctx.lineTo(-20, 70); +ctx.lineTo(-20, -20); +ctx.lineTo(0, 0); +ctx.lineTo(0, 50); +ctx.lineTo(100, 50); +ctx.lineTo(100, 0); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.3.worker.js new file mode 100644 index 0000000000..ca5510abf2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.3.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.path.fill.winding.subtract.3 +// 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.fillStyle = '#0f0'; +ctx.moveTo(-10, -10); +ctx.lineTo(110, -10); +ctx.lineTo(110, 60); +ctx.lineTo(-10, 60); +ctx.lineTo(-10, -10); +ctx.lineTo(-20, -20); +ctx.lineTo(120, -20); +ctx.lineTo(120, 70); +ctx.lineTo(-20, 70); +ctx.lineTo(-20, -20); +ctx.lineTo(0, 0); +ctx.lineTo(0, 50); +ctx.lineTo(100, 50); +ctx.lineTo(100, 0); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.initial.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.initial.html new file mode 100644 index 0000000000..35c96cdab5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.initial.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.initial</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.initial</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.closePath(); +ctx.fillStyle = '#f00'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.initial.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.initial.worker.js new file mode 100644 index 0000000000..de8597fbc3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.initial.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.initial +// 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.closePath(); +ctx.fillStyle = '#f00'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.arc.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.arc.html new file mode 100644 index 0000000000..fe12f9457a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.arc.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.isPointInPath.arc</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInPath.arc</h1> +<p class="desc">isPointInPath() works on arcs</p> + + +<script> +var t = async_test("isPointInPath() works on arcs"); +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.arc(50, 25, 10, 0, Math.PI, false); +_assertSame(ctx.isPointInPath(50, 10), false, "ctx.isPointInPath(50, 10)", "false"); +_assertSame(ctx.isPointInPath(50, 20), false, "ctx.isPointInPath(50, 20)", "false"); +_assertSame(ctx.isPointInPath(50, 30), true, "ctx.isPointInPath(50, 30)", "true"); +_assertSame(ctx.isPointInPath(50, 40), false, "ctx.isPointInPath(50, 40)", "false"); +_assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); +_assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); +_assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); +_assertSame(ctx.isPointInPath(70, 30), false, "ctx.isPointInPath(70, 30)", "false"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.arc.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.arc.worker.js new file mode 100644 index 0000000000..2803e39325 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.arc.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.isPointInPath.arc +// Description:isPointInPath() works on arcs +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("isPointInPath() works on arcs"); +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.arc(50, 25, 10, 0, Math.PI, false); +_assertSame(ctx.isPointInPath(50, 10), false, "ctx.isPointInPath(50, 10)", "false"); +_assertSame(ctx.isPointInPath(50, 20), false, "ctx.isPointInPath(50, 20)", "false"); +_assertSame(ctx.isPointInPath(50, 30), true, "ctx.isPointInPath(50, 30)", "true"); +_assertSame(ctx.isPointInPath(50, 40), false, "ctx.isPointInPath(50, 40)", "false"); +_assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); +_assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); +_assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); +_assertSame(ctx.isPointInPath(70, 30), false, "ctx.isPointInPath(70, 30)", "false"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.1.html new file mode 100644 index 0000000000..3cd24f5487 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.1.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.isPointInPath.basic.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInPath.basic.1</h1> +<p class="desc">isPointInPath() detects whether the point is inside the path</p> + + +<script> +var t = async_test("isPointInPath() detects whether the point is inside the path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.rect(0, 0, 20, 20); +_assertSame(ctx.isPointInPath(10, 10), true, "ctx.isPointInPath(10, 10)", "true"); +_assertSame(ctx.isPointInPath(30, 10), false, "ctx.isPointInPath(30, 10)", "false"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.1.worker.js new file mode 100644 index 0000000000..93dd86a5f7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.1.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.path.isPointInPath.basic.1 +// Description:isPointInPath() detects whether the point is inside the path +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("isPointInPath() detects whether the point is inside the path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.rect(0, 0, 20, 20); +_assertSame(ctx.isPointInPath(10, 10), true, "ctx.isPointInPath(10, 10)", "true"); +_assertSame(ctx.isPointInPath(30, 10), false, "ctx.isPointInPath(30, 10)", "false"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.2.html new file mode 100644 index 0000000000..42381d3f55 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.2.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.isPointInPath.basic.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInPath.basic.2</h1> +<p class="desc">isPointInPath() detects whether the point is inside the path</p> + + +<script> +var t = async_test("isPointInPath() detects whether the point is inside the path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.rect(20, 0, 20, 20); +_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); +_assertSame(ctx.isPointInPath(30, 10), true, "ctx.isPointInPath(30, 10)", "true"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.2.worker.js new file mode 100644 index 0000000000..7dbc5fc6fb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.2.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.path.isPointInPath.basic.2 +// Description:isPointInPath() detects whether the point is inside the path +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("isPointInPath() detects whether the point is inside the path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.rect(20, 0, 20, 20); +_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); +_assertSame(ctx.isPointInPath(30, 10), true, "ctx.isPointInPath(30, 10)", "true"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bezier.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bezier.html new file mode 100644 index 0000000000..f336fe4c7f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bezier.html @@ -0,0 +1,48 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.isPointInPath.bezier</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInPath.bezier</h1> +<p class="desc">isPointInPath() works on Bezier curves</p> + + +<script> +var t = async_test("isPointInPath() works on Bezier curves"); +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.moveTo(25, 25); +ctx.bezierCurveTo(50, -50, 50, 100, 75, 25); +_assertSame(ctx.isPointInPath(25, 20), false, "ctx.isPointInPath(25, 20)", "false"); +_assertSame(ctx.isPointInPath(25, 30), false, "ctx.isPointInPath(25, 30)", "false"); +_assertSame(ctx.isPointInPath(30, 20), true, "ctx.isPointInPath(30, 20)", "true"); +_assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); +_assertSame(ctx.isPointInPath(40, 2), false, "ctx.isPointInPath(40, 2)", "false"); +_assertSame(ctx.isPointInPath(40, 20), true, "ctx.isPointInPath(40, 20)", "true"); +_assertSame(ctx.isPointInPath(40, 30), false, "ctx.isPointInPath(40, 30)", "false"); +_assertSame(ctx.isPointInPath(40, 47), false, "ctx.isPointInPath(40, 47)", "false"); +_assertSame(ctx.isPointInPath(45, 20), true, "ctx.isPointInPath(45, 20)", "true"); +_assertSame(ctx.isPointInPath(45, 30), false, "ctx.isPointInPath(45, 30)", "false"); +_assertSame(ctx.isPointInPath(55, 20), false, "ctx.isPointInPath(55, 20)", "false"); +_assertSame(ctx.isPointInPath(55, 30), true, "ctx.isPointInPath(55, 30)", "true"); +_assertSame(ctx.isPointInPath(60, 2), false, "ctx.isPointInPath(60, 2)", "false"); +_assertSame(ctx.isPointInPath(60, 20), false, "ctx.isPointInPath(60, 20)", "false"); +_assertSame(ctx.isPointInPath(60, 30), true, "ctx.isPointInPath(60, 30)", "true"); +_assertSame(ctx.isPointInPath(60, 47), false, "ctx.isPointInPath(60, 47)", "false"); +_assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); +_assertSame(ctx.isPointInPath(70, 30), true, "ctx.isPointInPath(70, 30)", "true"); +_assertSame(ctx.isPointInPath(75, 20), false, "ctx.isPointInPath(75, 20)", "false"); +_assertSame(ctx.isPointInPath(75, 30), false, "ctx.isPointInPath(75, 30)", "false"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bezier.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bezier.worker.js new file mode 100644 index 0000000000..6017efc286 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bezier.worker.js @@ -0,0 +1,44 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.isPointInPath.bezier +// Description:isPointInPath() works on Bezier curves +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("isPointInPath() works on Bezier curves"); +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.moveTo(25, 25); +ctx.bezierCurveTo(50, -50, 50, 100, 75, 25); +_assertSame(ctx.isPointInPath(25, 20), false, "ctx.isPointInPath(25, 20)", "false"); +_assertSame(ctx.isPointInPath(25, 30), false, "ctx.isPointInPath(25, 30)", "false"); +_assertSame(ctx.isPointInPath(30, 20), true, "ctx.isPointInPath(30, 20)", "true"); +_assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); +_assertSame(ctx.isPointInPath(40, 2), false, "ctx.isPointInPath(40, 2)", "false"); +_assertSame(ctx.isPointInPath(40, 20), true, "ctx.isPointInPath(40, 20)", "true"); +_assertSame(ctx.isPointInPath(40, 30), false, "ctx.isPointInPath(40, 30)", "false"); +_assertSame(ctx.isPointInPath(40, 47), false, "ctx.isPointInPath(40, 47)", "false"); +_assertSame(ctx.isPointInPath(45, 20), true, "ctx.isPointInPath(45, 20)", "true"); +_assertSame(ctx.isPointInPath(45, 30), false, "ctx.isPointInPath(45, 30)", "false"); +_assertSame(ctx.isPointInPath(55, 20), false, "ctx.isPointInPath(55, 20)", "false"); +_assertSame(ctx.isPointInPath(55, 30), true, "ctx.isPointInPath(55, 30)", "true"); +_assertSame(ctx.isPointInPath(60, 2), false, "ctx.isPointInPath(60, 2)", "false"); +_assertSame(ctx.isPointInPath(60, 20), false, "ctx.isPointInPath(60, 20)", "false"); +_assertSame(ctx.isPointInPath(60, 30), true, "ctx.isPointInPath(60, 30)", "true"); +_assertSame(ctx.isPointInPath(60, 47), false, "ctx.isPointInPath(60, 47)", "false"); +_assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); +_assertSame(ctx.isPointInPath(70, 30), true, "ctx.isPointInPath(70, 30)", "true"); +_assertSame(ctx.isPointInPath(75, 20), false, "ctx.isPointInPath(75, 20)", "false"); +_assertSame(ctx.isPointInPath(75, 30), false, "ctx.isPointInPath(75, 30)", "false"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bigarc.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bigarc.html new file mode 100644 index 0000000000..2e6e78fedb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bigarc.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.isPointInPath.bigarc</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInPath.bigarc</h1> +<p class="desc">isPointInPath() works on unclosed arcs larger than 2pi</p> + + +<script> +var t = async_test("isPointInPath() works on unclosed arcs larger than 2pi"); +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.arc(50, 25, 10, 0, 7, false); +_assertSame(ctx.isPointInPath(50, 10), false, "ctx.isPointInPath(50, 10)", "false"); +_assertSame(ctx.isPointInPath(50, 20), true, "ctx.isPointInPath(50, 20)", "true"); +_assertSame(ctx.isPointInPath(50, 30), true, "ctx.isPointInPath(50, 30)", "true"); +_assertSame(ctx.isPointInPath(50, 40), false, "ctx.isPointInPath(50, 40)", "false"); +_assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); +_assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); +_assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); +_assertSame(ctx.isPointInPath(70, 30), false, "ctx.isPointInPath(70, 30)", "false"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bigarc.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bigarc.worker.js new file mode 100644 index 0000000000..1ee0010215 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bigarc.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.isPointInPath.bigarc +// Description:isPointInPath() works on unclosed arcs larger than 2pi +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("isPointInPath() works on unclosed arcs larger than 2pi"); +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.arc(50, 25, 10, 0, 7, false); +_assertSame(ctx.isPointInPath(50, 10), false, "ctx.isPointInPath(50, 10)", "false"); +_assertSame(ctx.isPointInPath(50, 20), true, "ctx.isPointInPath(50, 20)", "true"); +_assertSame(ctx.isPointInPath(50, 30), true, "ctx.isPointInPath(50, 30)", "true"); +_assertSame(ctx.isPointInPath(50, 40), false, "ctx.isPointInPath(50, 40)", "false"); +_assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); +_assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); +_assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); +_assertSame(ctx.isPointInPath(70, 30), false, "ctx.isPointInPath(70, 30)", "false"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.edge.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.edge.html new file mode 100644 index 0000000000..bcd4eaefd9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.edge.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.isPointInPath.edge</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInPath.edge</h1> +<p class="desc">isPointInPath() counts points on the path as being inside</p> + + +<script> +var t = async_test("isPointInPath() counts points on the path as being inside"); +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.rect(0, 0, 20, 20); +_assertSame(ctx.isPointInPath(0, 0), true, "ctx.isPointInPath(0, 0)", "true"); +_assertSame(ctx.isPointInPath(10, 0), true, "ctx.isPointInPath(10, 0)", "true"); +_assertSame(ctx.isPointInPath(20, 0), true, "ctx.isPointInPath(20, 0)", "true"); +_assertSame(ctx.isPointInPath(20, 10), true, "ctx.isPointInPath(20, 10)", "true"); +_assertSame(ctx.isPointInPath(20, 20), true, "ctx.isPointInPath(20, 20)", "true"); +_assertSame(ctx.isPointInPath(10, 20), true, "ctx.isPointInPath(10, 20)", "true"); +_assertSame(ctx.isPointInPath(0, 20), true, "ctx.isPointInPath(0, 20)", "true"); +_assertSame(ctx.isPointInPath(0, 10), true, "ctx.isPointInPath(0, 10)", "true"); +_assertSame(ctx.isPointInPath(10, -0.01), false, "ctx.isPointInPath(10, -0.01)", "false"); +_assertSame(ctx.isPointInPath(10, 20.01), false, "ctx.isPointInPath(10, 20.01)", "false"); +_assertSame(ctx.isPointInPath(-0.01, 10), false, "ctx.isPointInPath(-0.01, 10)", "false"); +_assertSame(ctx.isPointInPath(20.01, 10), false, "ctx.isPointInPath(20.01, 10)", "false"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.edge.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.edge.worker.js new file mode 100644 index 0000000000..21222ebc4f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.edge.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.path.isPointInPath.edge +// Description:isPointInPath() counts points on the path as being inside +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("isPointInPath() counts points on the path as being inside"); +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.rect(0, 0, 20, 20); +_assertSame(ctx.isPointInPath(0, 0), true, "ctx.isPointInPath(0, 0)", "true"); +_assertSame(ctx.isPointInPath(10, 0), true, "ctx.isPointInPath(10, 0)", "true"); +_assertSame(ctx.isPointInPath(20, 0), true, "ctx.isPointInPath(20, 0)", "true"); +_assertSame(ctx.isPointInPath(20, 10), true, "ctx.isPointInPath(20, 10)", "true"); +_assertSame(ctx.isPointInPath(20, 20), true, "ctx.isPointInPath(20, 20)", "true"); +_assertSame(ctx.isPointInPath(10, 20), true, "ctx.isPointInPath(10, 20)", "true"); +_assertSame(ctx.isPointInPath(0, 20), true, "ctx.isPointInPath(0, 20)", "true"); +_assertSame(ctx.isPointInPath(0, 10), true, "ctx.isPointInPath(0, 10)", "true"); +_assertSame(ctx.isPointInPath(10, -0.01), false, "ctx.isPointInPath(10, -0.01)", "false"); +_assertSame(ctx.isPointInPath(10, 20.01), false, "ctx.isPointInPath(10, 20.01)", "false"); +_assertSame(ctx.isPointInPath(-0.01, 10), false, "ctx.isPointInPath(-0.01, 10)", "false"); +_assertSame(ctx.isPointInPath(20.01, 10), false, "ctx.isPointInPath(20.01, 10)", "false"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.empty.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.empty.html new file mode 100644 index 0000000000..9a875097b0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.empty.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.isPointInPath.empty</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInPath.empty</h1> +<p class="desc">isPointInPath() works when there is no path</p> + + +<script> +var t = async_test("isPointInPath() works when there is no path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +_assertSame(ctx.isPointInPath(0, 0), false, "ctx.isPointInPath(0, 0)", "false"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.empty.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.empty.worker.js new file mode 100644 index 0000000000..e449ee2e69 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.empty.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.isPointInPath.empty +// Description:isPointInPath() works when there is no path +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("isPointInPath() works when there is no path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +_assertSame(ctx.isPointInPath(0, 0), false, "ctx.isPointInPath(0, 0)", "false"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.nonfinite.html new file mode 100644 index 0000000000..8dc4c1df3a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.nonfinite.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.path.isPointInPath.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInPath.nonfinite</h1> +<p class="desc">isPointInPath() returns false for non-finite arguments</p> + + +<script> +var t = async_test("isPointInPath() returns false for non-finite arguments"); +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.rect(-100, -50, 200, 100); +_assertSame(ctx.isPointInPath(Infinity, 0), false, "ctx.isPointInPath(Infinity, 0)", "false"); +_assertSame(ctx.isPointInPath(-Infinity, 0), false, "ctx.isPointInPath(-Infinity, 0)", "false"); +_assertSame(ctx.isPointInPath(NaN, 0), false, "ctx.isPointInPath(NaN, 0)", "false"); +_assertSame(ctx.isPointInPath(0, Infinity), false, "ctx.isPointInPath(0, Infinity)", "false"); +_assertSame(ctx.isPointInPath(0, -Infinity), false, "ctx.isPointInPath(0, -Infinity)", "false"); +_assertSame(ctx.isPointInPath(0, NaN), false, "ctx.isPointInPath(0, NaN)", "false"); +_assertSame(ctx.isPointInPath(NaN, NaN), false, "ctx.isPointInPath(NaN, NaN)", "false"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.nonfinite.worker.js new file mode 100644 index 0000000000..70a4ece162 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.nonfinite.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.isPointInPath.nonfinite +// Description:isPointInPath() returns false for non-finite arguments +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("isPointInPath() returns false for non-finite arguments"); +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.rect(-100, -50, 200, 100); +_assertSame(ctx.isPointInPath(Infinity, 0), false, "ctx.isPointInPath(Infinity, 0)", "false"); +_assertSame(ctx.isPointInPath(-Infinity, 0), false, "ctx.isPointInPath(-Infinity, 0)", "false"); +_assertSame(ctx.isPointInPath(NaN, 0), false, "ctx.isPointInPath(NaN, 0)", "false"); +_assertSame(ctx.isPointInPath(0, Infinity), false, "ctx.isPointInPath(0, Infinity)", "false"); +_assertSame(ctx.isPointInPath(0, -Infinity), false, "ctx.isPointInPath(0, -Infinity)", "false"); +_assertSame(ctx.isPointInPath(0, NaN), false, "ctx.isPointInPath(0, NaN)", "false"); +_assertSame(ctx.isPointInPath(NaN, NaN), false, "ctx.isPointInPath(NaN, NaN)", "false"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.outside.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.outside.html new file mode 100644 index 0000000000..d1a1d86a02 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.outside.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.path.isPointInPath.outside</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInPath.outside</h1> +<p class="desc">isPointInPath() works on paths outside the canvas</p> + + +<script> +var t = async_test("isPointInPath() works on paths outside the canvas"); +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.rect(0, -100, 20, 20); +ctx.rect(20, -10, 20, 20); +_assertSame(ctx.isPointInPath(10, -110), false, "ctx.isPointInPath(10, -110)", "false"); +_assertSame(ctx.isPointInPath(10, -90), true, "ctx.isPointInPath(10, -90)", "true"); +_assertSame(ctx.isPointInPath(10, -70), false, "ctx.isPointInPath(10, -70)", "false"); +_assertSame(ctx.isPointInPath(30, -20), false, "ctx.isPointInPath(30, -20)", "false"); +_assertSame(ctx.isPointInPath(30, 0), true, "ctx.isPointInPath(30, 0)", "true"); +_assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.outside.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.outside.worker.js new file mode 100644 index 0000000000..6d07105046 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.outside.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.isPointInPath.outside +// Description:isPointInPath() works on paths outside the canvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("isPointInPath() works on paths outside the canvas"); +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.rect(0, -100, 20, 20); +ctx.rect(20, -10, 20, 20); +_assertSame(ctx.isPointInPath(10, -110), false, "ctx.isPointInPath(10, -110)", "false"); +_assertSame(ctx.isPointInPath(10, -90), true, "ctx.isPointInPath(10, -90)", "true"); +_assertSame(ctx.isPointInPath(10, -70), false, "ctx.isPointInPath(10, -70)", "false"); +_assertSame(ctx.isPointInPath(30, -20), false, "ctx.isPointInPath(30, -20)", "false"); +_assertSame(ctx.isPointInPath(30, 0), true, "ctx.isPointInPath(30, 0)", "true"); +_assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.subpath.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.subpath.html new file mode 100644 index 0000000000..b0ea1f9a0f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.subpath.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.path.isPointInPath.subpath</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInPath.subpath</h1> +<p class="desc">isPointInPath() uses the current path, not just the subpath</p> + + +<script> +var t = async_test("isPointInPath() uses the current path, not just the subpath"); +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.rect(0, 0, 20, 20); +ctx.beginPath(); +ctx.rect(20, 0, 20, 20); +ctx.closePath(); +ctx.rect(40, 0, 20, 20); +_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); +_assertSame(ctx.isPointInPath(30, 10), true, "ctx.isPointInPath(30, 10)", "true"); +_assertSame(ctx.isPointInPath(50, 10), true, "ctx.isPointInPath(50, 10)", "true"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.subpath.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.subpath.worker.js new file mode 100644 index 0000000000..4a82fcc08a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.subpath.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.isPointInPath.subpath +// Description:isPointInPath() uses the current path, not just the subpath +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("isPointInPath() uses the current path, not just the subpath"); +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.rect(0, 0, 20, 20); +ctx.beginPath(); +ctx.rect(20, 0, 20, 20); +ctx.closePath(); +ctx.rect(40, 0, 20, 20); +_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); +_assertSame(ctx.isPointInPath(30, 10), true, "ctx.isPointInPath(30, 10)", "true"); +_assertSame(ctx.isPointInPath(50, 10), true, "ctx.isPointInPath(50, 10)", "true"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.1.html new file mode 100644 index 0000000000..9b7b2e5ee0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.1.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.path.isPointInPath.transform.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInPath.transform.1</h1> +<p class="desc">isPointInPath() handles transformations correctly</p> + + +<script> +var t = async_test("isPointInPath() handles transformations 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.translate(50, 0); +ctx.rect(0, 0, 20, 20); +_assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); +_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); +_assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); +_assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); +_assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); +_assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.1.worker.js new file mode 100644 index 0000000000..2fafbe910e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.1.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.isPointInPath.transform.1 +// Description:isPointInPath() handles transformations correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("isPointInPath() handles transformations 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.translate(50, 0); +ctx.rect(0, 0, 20, 20); +_assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); +_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); +_assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); +_assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); +_assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); +_assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.2.html new file mode 100644 index 0000000000..45b884f2b5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.2.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.path.isPointInPath.transform.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInPath.transform.2</h1> +<p class="desc">isPointInPath() handles transformations correctly</p> + + +<script> +var t = async_test("isPointInPath() handles transformations 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.rect(50, 0, 20, 20); +ctx.translate(50, 0); +_assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); +_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); +_assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); +_assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); +_assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); +_assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.2.worker.js new file mode 100644 index 0000000000..3f37e62057 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.2.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.isPointInPath.transform.2 +// Description:isPointInPath() handles transformations correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("isPointInPath() handles transformations 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.rect(50, 0, 20, 20); +ctx.translate(50, 0); +_assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); +_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); +_assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); +_assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); +_assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); +_assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.3.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.3.html new file mode 100644 index 0000000000..923da480e8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.3.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.path.isPointInPath.transform.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInPath.transform.3</h1> +<p class="desc">isPointInPath() handles transformations correctly</p> + + +<script> +var t = async_test("isPointInPath() handles transformations 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.scale(-1, 1); +ctx.rect(-70, 0, 20, 20); +_assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); +_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); +_assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); +_assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); +_assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); +_assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.3.worker.js new file mode 100644 index 0000000000..172d0a72a4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.3.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.isPointInPath.transform.3 +// Description:isPointInPath() handles transformations correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("isPointInPath() handles transformations 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.scale(-1, 1); +ctx.rect(-70, 0, 20, 20); +_assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); +_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); +_assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); +_assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); +_assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); +_assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.4.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.4.html new file mode 100644 index 0000000000..0f87cc2b21 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.4.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.isPointInPath.transform.4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInPath.transform.4</h1> +<p class="desc">isPointInPath() handles transformations correctly</p> + + +<script> +var t = async_test("isPointInPath() handles transformations 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.translate(50, 0); +ctx.rect(50, 0, 20, 20); +ctx.translate(0, 50); +_assertSame(ctx.isPointInPath(60, 10), false, "ctx.isPointInPath(60, 10)", "false"); +_assertSame(ctx.isPointInPath(110, 10), true, "ctx.isPointInPath(110, 10)", "true"); +_assertSame(ctx.isPointInPath(110, 60), false, "ctx.isPointInPath(110, 60)", "false"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.4.worker.js new file mode 100644 index 0000000000..993148110a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.4.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.isPointInPath.transform.4 +// Description:isPointInPath() handles transformations correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("isPointInPath() handles transformations 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.translate(50, 0); +ctx.rect(50, 0, 20, 20); +ctx.translate(0, 50); +_assertSame(ctx.isPointInPath(60, 10), false, "ctx.isPointInPath(60, 10)", "false"); +_assertSame(ctx.isPointInPath(110, 10), true, "ctx.isPointInPath(110, 10)", "true"); +_assertSame(ctx.isPointInPath(110, 60), false, "ctx.isPointInPath(110, 60)", "false"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.unclosed.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.unclosed.html new file mode 100644 index 0000000000..098370f0f7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.unclosed.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.isPointInPath.unclosed</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInPath.unclosed</h1> +<p class="desc">isPointInPath() works on unclosed subpaths</p> + + +<script> +var t = async_test("isPointInPath() works on unclosed subpaths"); +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.moveTo(0, 0); +ctx.lineTo(20, 0); +ctx.lineTo(20, 20); +ctx.lineTo(0, 20); +_assertSame(ctx.isPointInPath(10, 10), true, "ctx.isPointInPath(10, 10)", "true"); +_assertSame(ctx.isPointInPath(30, 10), false, "ctx.isPointInPath(30, 10)", "false"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.unclosed.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.unclosed.worker.js new file mode 100644 index 0000000000..ad4ac8781b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.unclosed.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.isPointInPath.unclosed +// Description:isPointInPath() works on unclosed subpaths +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("isPointInPath() works on unclosed subpaths"); +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.moveTo(0, 0); +ctx.lineTo(20, 0); +ctx.lineTo(20, 20); +ctx.lineTo(0, 20); +_assertSame(ctx.isPointInPath(10, 10), true, "ctx.isPointInPath(10, 10)", "true"); +_assertSame(ctx.isPointInPath(30, 10), false, "ctx.isPointInPath(30, 10)", "false"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.winding.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.winding.html new file mode 100644 index 0000000000..9698017e4f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.winding.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.path.isPointInPath.winding</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInPath.winding</h1> +<p class="desc">isPointInPath() uses the non-zero winding number rule</p> + + +<script> +var t = async_test("isPointInPath() uses the non-zero winding number rule"); +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'); + +// Create a square ring, using opposite windings to make a hole in the centre +ctx.moveTo(0, 0); +ctx.lineTo(50, 0); +ctx.lineTo(50, 50); +ctx.lineTo(0, 50); +ctx.lineTo(0, 0); +ctx.lineTo(10, 10); +ctx.lineTo(10, 40); +ctx.lineTo(40, 40); +ctx.lineTo(40, 10); +ctx.lineTo(10, 10); +_assertSame(ctx.isPointInPath(5, 5), true, "ctx.isPointInPath(5, 5)", "true"); +_assertSame(ctx.isPointInPath(25, 5), true, "ctx.isPointInPath(25, 5)", "true"); +_assertSame(ctx.isPointInPath(45, 5), true, "ctx.isPointInPath(45, 5)", "true"); +_assertSame(ctx.isPointInPath(5, 25), true, "ctx.isPointInPath(5, 25)", "true"); +_assertSame(ctx.isPointInPath(25, 25), false, "ctx.isPointInPath(25, 25)", "false"); +_assertSame(ctx.isPointInPath(45, 25), true, "ctx.isPointInPath(45, 25)", "true"); +_assertSame(ctx.isPointInPath(5, 45), true, "ctx.isPointInPath(5, 45)", "true"); +_assertSame(ctx.isPointInPath(25, 45), true, "ctx.isPointInPath(25, 45)", "true"); +_assertSame(ctx.isPointInPath(45, 45), true, "ctx.isPointInPath(45, 45)", "true"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.winding.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.winding.worker.js new file mode 100644 index 0000000000..6ef758114a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.winding.worker.js @@ -0,0 +1,42 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.isPointInPath.winding +// Description:isPointInPath() uses the non-zero winding number rule +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("isPointInPath() uses the non-zero winding number rule"); +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'); + +// Create a square ring, using opposite windings to make a hole in the centre +ctx.moveTo(0, 0); +ctx.lineTo(50, 0); +ctx.lineTo(50, 50); +ctx.lineTo(0, 50); +ctx.lineTo(0, 0); +ctx.lineTo(10, 10); +ctx.lineTo(10, 40); +ctx.lineTo(40, 40); +ctx.lineTo(40, 10); +ctx.lineTo(10, 10); +_assertSame(ctx.isPointInPath(5, 5), true, "ctx.isPointInPath(5, 5)", "true"); +_assertSame(ctx.isPointInPath(25, 5), true, "ctx.isPointInPath(25, 5)", "true"); +_assertSame(ctx.isPointInPath(45, 5), true, "ctx.isPointInPath(45, 5)", "true"); +_assertSame(ctx.isPointInPath(5, 25), true, "ctx.isPointInPath(5, 25)", "true"); +_assertSame(ctx.isPointInPath(25, 25), false, "ctx.isPointInPath(25, 25)", "false"); +_assertSame(ctx.isPointInPath(45, 25), true, "ctx.isPointInPath(45, 25)", "true"); +_assertSame(ctx.isPointInPath(5, 45), true, "ctx.isPointInPath(5, 45)", "true"); +_assertSame(ctx.isPointInPath(25, 45), true, "ctx.isPointInPath(25, 45)", "true"); +_assertSame(ctx.isPointInPath(45, 45), true, "ctx.isPointInPath(45, 45)", "true"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInStroke.basic.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInStroke.basic.html new file mode 100644 index 0000000000..95f7fd721d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInStroke.basic.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.isPointInStroke.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.path.isPointInStroke.basic</h1> +<p class="desc">detects whether point is in the area contained by the stroke of the path</p> + + +<script> +var t = async_test("detects whether point is in the area contained by the stroke of the path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.rect(0, 0, 20, 20); +_assertSame(ctx.isPointInStroke(0, 0), true, "ctx.isPointInStroke(0, 0)", "true"); +_assertSame(ctx.isPointInStroke(30, 10), false, "ctx.isPointInStroke(30, 10)", "false"); + +var path = new Path2D(); +path.rect(20, 20, 100, 100); +_assertSame(ctx.isPointInStroke(path, 20, 20), true, "ctx.isPointInStroke(path, 20, 20)", "true"); +_assertSame(ctx.isPointInStroke(path, 120, 20), true, "ctx.isPointInStroke(path, 120, 20)", "true"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInStroke.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInStroke.basic.worker.js new file mode 100644 index 0000000000..844f0ef154 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.isPointInStroke.basic.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.path.isPointInStroke.basic +// Description:detects whether point is in the area contained by the stroke of the path +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("detects whether point is in the area contained by the stroke of the path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.rect(0, 0, 20, 20); +_assertSame(ctx.isPointInStroke(0, 0), true, "ctx.isPointInStroke(0, 0)", "true"); +_assertSame(ctx.isPointInStroke(30, 10), false, "ctx.isPointInStroke(30, 10)", "false"); + +var path = new Path2D(); +path.rect(20, 20, 100, 100); +_assertSame(ctx.isPointInStroke(path, 20, 20), true, "ctx.isPointInStroke(path, 20, 20)", "true"); +_assertSame(ctx.isPointInStroke(path, 120, 20), true, "ctx.isPointInStroke(path, 120, 20)", "true"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.basic.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.basic.html new file mode 100644 index 0000000000..3247ededcc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.basic.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.lineTo.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.path.lineTo.basic</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.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.lineTo(100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.basic.worker.js new file mode 100644 index 0000000000..980de5c1b2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.basic.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.lineTo.basic +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.lineTo(100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.1.html new file mode 100644 index 0000000000..5a15f9ece4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.1.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.path.lineTo.ensuresubpath.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.lineTo.ensuresubpath.1</h1> +<p class="desc">If there is no subpath, the point is added and nothing is drawn</p> + + +<script> +var t = async_test("If there is no subpath, the point is added and nothing is drawn"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.lineTo(100, 50); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.1.worker.js new file mode 100644 index 0000000000..024754ca0e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.1.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.lineTo.ensuresubpath.1 +// Description:If there is no subpath, the point is added and nothing is drawn +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("If there is no subpath, the point is added and nothing is drawn"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.lineTo(100, 50); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.2.html new file mode 100644 index 0000000000..eaad8dabcc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.2.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.lineTo.ensuresubpath.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.lineTo.ensuresubpath.2</h1> +<p class="desc">If there is no subpath, the point is added and used for subsequent drawing</p> + + +<script> +var t = async_test("If there is no subpath, the point is added and used for subsequent drawing"); +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 = 50; +ctx.beginPath(); +ctx.lineTo(0, 25); +ctx.lineTo(100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.2.worker.js new file mode 100644 index 0000000000..2a15c9e14d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.2.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.lineTo.ensuresubpath.2 +// Description:If there is no subpath, the point is added and used for subsequent drawing +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("If there is no subpath, the point is added and used for subsequent drawing"); +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 = 50; +ctx.beginPath(); +ctx.lineTo(0, 25); +ctx.lineTo(100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nextpoint.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nextpoint.html new file mode 100644 index 0000000000..fc697b9be5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nextpoint.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.lineTo.nextpoint</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.lineTo.nextpoint</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.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.moveTo(-100, -100); +ctx.lineTo(0, 25); +ctx.lineTo(100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nextpoint.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nextpoint.worker.js new file mode 100644 index 0000000000..de9d56be06 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nextpoint.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.path.lineTo.nextpoint +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.moveTo(-100, -100); +ctx.lineTo(0, 25); +ctx.lineTo(100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.details.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.details.html new file mode 100644 index 0000000000..82270be534 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.details.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.lineTo.nonfinite.details</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.lineTo.nonfinite.details</h1> +<p class="desc">lineTo() with Infinity/NaN for first arg still converts the second arg</p> + + +<script> +var t = async_test("lineTo() with Infinity/NaN for first arg still converts the second arg"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +for (var arg1 of [Infinity, -Infinity, NaN]) { + var converted = false; + ctx.lineTo(arg1, { valueOf: function() { converted = true; return 0; } }); + _assert(converted, "converted"); +} +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.details.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.details.worker.js new file mode 100644 index 0000000000..bf74ee5b50 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.details.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.lineTo.nonfinite.details +// Description:lineTo() with Infinity/NaN for first arg still converts the second arg +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("lineTo() with Infinity/NaN for first arg still converts the second arg"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +for (var arg1 of [Infinity, -Infinity, NaN]) { + var converted = false; + ctx.lineTo(arg1, { valueOf: function() { converted = true; return 0; } }); + _assert(converted, "converted"); +} +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.html new file mode 100644 index 0000000000..02d77163fd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.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.path.lineTo.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.lineTo.nonfinite</h1> +<p class="desc">lineTo() with Infinity/NaN is ignored</p> + + +<script> +var t = async_test("lineTo() with Infinity/NaN 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.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.lineTo(Infinity, 50); +ctx.lineTo(-Infinity, 50); +ctx.lineTo(NaN, 50); +ctx.lineTo(0, Infinity); +ctx.lineTo(0, -Infinity); +ctx.lineTo(0, NaN); +ctx.lineTo(Infinity, Infinity); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 90,45, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.worker.js new file mode 100644 index 0000000000..5161b4e432 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.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.path.lineTo.nonfinite +// Description:lineTo() with Infinity/NaN is ignored +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("lineTo() with Infinity/NaN 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.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.lineTo(Infinity, 50); +ctx.lineTo(-Infinity, 50); +ctx.lineTo(NaN, 50); +ctx.lineTo(0, Infinity); +ctx.lineTo(0, -Infinity); +ctx.lineTo(0, NaN); +ctx.lineTo(Infinity, Infinity); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 90,45, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.basic.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.basic.html new file mode 100644 index 0000000000..8363792c70 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.basic.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.moveTo.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.path.moveTo.basic</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.rect(0, 0, 10, 50); +ctx.moveTo(100, 0); +ctx.lineTo(10, 0); +ctx.lineTo(10, 50); +ctx.lineTo(100, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 90,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.basic.worker.js new file mode 100644 index 0000000000..eca39660bc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.basic.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.path.moveTo.basic +// 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.rect(0, 0, 10, 50); +ctx.moveTo(100, 0); +ctx.lineTo(10, 0); +ctx.lineTo(10, 50); +ctx.lineTo(100, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 90,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.multiple.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.multiple.html new file mode 100644 index 0000000000..928c9783d4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.multiple.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.moveTo.multiple</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.moveTo.multiple</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.moveTo(0, 25); +ctx.moveTo(100, 25); +ctx.moveTo(0, 25); +ctx.lineTo(100, 25); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.multiple.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.multiple.worker.js new file mode 100644 index 0000000000..686f5ae84a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.multiple.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.path.moveTo.multiple +// 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.moveTo(0, 25); +ctx.moveTo(100, 25); +ctx.moveTo(0, 25); +ctx.lineTo(100, 25); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.newsubpath.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.newsubpath.html new file mode 100644 index 0000000000..89fda23ffc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.newsubpath.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.moveTo.newsubpath</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.moveTo.newsubpath</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.beginPath(); +ctx.moveTo(0, 0); +ctx.moveTo(100, 0); +ctx.moveTo(100, 50); +ctx.moveTo(0, 50); +ctx.fillStyle = '#f00'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.newsubpath.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.newsubpath.worker.js new file mode 100644 index 0000000000..d00491c42b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.newsubpath.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.path.moveTo.newsubpath +// 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.beginPath(); +ctx.moveTo(0, 0); +ctx.moveTo(100, 0); +ctx.moveTo(100, 50); +ctx.moveTo(0, 50); +ctx.fillStyle = '#f00'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.nonfinite.html new file mode 100644 index 0000000000..1a2e6cfe83 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.nonfinite.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.path.moveTo.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.moveTo.nonfinite</h1> +<p class="desc">moveTo() with Infinity/NaN is ignored</p> + + +<script> +var t = async_test("moveTo() with Infinity/NaN 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.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.moveTo(Infinity, 50); +ctx.moveTo(-Infinity, 50); +ctx.moveTo(NaN, 50); +ctx.moveTo(0, Infinity); +ctx.moveTo(0, -Infinity); +ctx.moveTo(0, NaN); +ctx.moveTo(Infinity, Infinity); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.nonfinite.worker.js new file mode 100644 index 0000000000..ced534fb95 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.moveTo.nonfinite.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.path.moveTo.nonfinite +// Description:moveTo() with Infinity/NaN is ignored +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("moveTo() with Infinity/NaN 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.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.moveTo(Infinity, 50); +ctx.moveTo(-Infinity, 50); +ctx.moveTo(NaN, 50); +ctx.moveTo(0, Infinity); +ctx.moveTo(0, -Infinity); +ctx.moveTo(0, NaN); +ctx.moveTo(Infinity, Infinity); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.basic.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.basic.html new file mode 100644 index 0000000000..46a83e112c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.basic.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.quadraticCurveTo.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.path.quadraticCurveTo.basic</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.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.quadraticCurveTo(100, 25, 100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.basic.worker.js new file mode 100644 index 0000000000..a1dfa045d9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.basic.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.quadraticCurveTo.basic +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.quadraticCurveTo(100, 25, 100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.html new file mode 100644 index 0000000000..37662e4618 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.quadraticCurveTo.ensuresubpath.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.quadraticCurveTo.ensuresubpath.1</h1> +<p class="desc">If there is no subpath, the first control point is added (and nothing is drawn up to it)</p> + + +<script> +var t = async_test("If there is no subpath, the first control point is added (and nothing is drawn up to it)"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.quadraticCurveTo(100, 50, 200, 50); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 95,45, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.worker.js new file mode 100644 index 0000000000..fe20e7b890 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.quadraticCurveTo.ensuresubpath.1 +// Description:If there is no subpath, the first control point is added (and nothing is drawn up to it) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("If there is no subpath, the first control point is added (and nothing is drawn up to it)"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.quadraticCurveTo(100, 50, 200, 50); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 95,45, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.html new file mode 100644 index 0000000000..2f18424749 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.quadraticCurveTo.ensuresubpath.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.quadraticCurveTo.ensuresubpath.2</h1> +<p class="desc">If there is no subpath, the first control point is added</p> + + +<script> +var t = async_test("If there is no subpath, the first control point is added"); +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 = 50; +ctx.beginPath(); +ctx.quadraticCurveTo(0, 25, 100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 5,45, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.worker.js new file mode 100644 index 0000000000..f840168f98 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.quadraticCurveTo.ensuresubpath.2 +// Description:If there is no subpath, the first control point is added +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("If there is no subpath, the first control point is added"); +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 = 50; +ctx.beginPath(); +ctx.quadraticCurveTo(0, 25, 100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 5,45, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.nonfinite.html new file mode 100644 index 0000000000..1083f027e2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.nonfinite.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.quadraticCurveTo.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.quadraticCurveTo.nonfinite</h1> +<p class="desc">quadraticCurveTo() with Infinity/NaN is ignored</p> + + +<script> +var t = async_test("quadraticCurveTo() with Infinity/NaN 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.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.quadraticCurveTo(Infinity, 50, 0, 50); +ctx.quadraticCurveTo(-Infinity, 50, 0, 50); +ctx.quadraticCurveTo(NaN, 50, 0, 50); +ctx.quadraticCurveTo(0, Infinity, 0, 50); +ctx.quadraticCurveTo(0, -Infinity, 0, 50); +ctx.quadraticCurveTo(0, NaN, 0, 50); +ctx.quadraticCurveTo(0, 50, Infinity, 50); +ctx.quadraticCurveTo(0, 50, -Infinity, 50); +ctx.quadraticCurveTo(0, 50, NaN, 50); +ctx.quadraticCurveTo(0, 50, 0, Infinity); +ctx.quadraticCurveTo(0, 50, 0, -Infinity); +ctx.quadraticCurveTo(0, 50, 0, NaN); +ctx.quadraticCurveTo(Infinity, Infinity, 0, 50); +ctx.quadraticCurveTo(Infinity, Infinity, Infinity, 50); +ctx.quadraticCurveTo(Infinity, Infinity, Infinity, Infinity); +ctx.quadraticCurveTo(Infinity, Infinity, 0, Infinity); +ctx.quadraticCurveTo(Infinity, 50, Infinity, 50); +ctx.quadraticCurveTo(Infinity, 50, Infinity, Infinity); +ctx.quadraticCurveTo(Infinity, 50, 0, Infinity); +ctx.quadraticCurveTo(0, Infinity, Infinity, 50); +ctx.quadraticCurveTo(0, Infinity, Infinity, Infinity); +ctx.quadraticCurveTo(0, Infinity, 0, Infinity); +ctx.quadraticCurveTo(0, 50, Infinity, Infinity); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 90,45, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.nonfinite.worker.js new file mode 100644 index 0000000000..df17bd6d36 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.nonfinite.worker.js @@ -0,0 +1,53 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.quadraticCurveTo.nonfinite +// Description:quadraticCurveTo() with Infinity/NaN is ignored +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("quadraticCurveTo() with Infinity/NaN 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.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.quadraticCurveTo(Infinity, 50, 0, 50); +ctx.quadraticCurveTo(-Infinity, 50, 0, 50); +ctx.quadraticCurveTo(NaN, 50, 0, 50); +ctx.quadraticCurveTo(0, Infinity, 0, 50); +ctx.quadraticCurveTo(0, -Infinity, 0, 50); +ctx.quadraticCurveTo(0, NaN, 0, 50); +ctx.quadraticCurveTo(0, 50, Infinity, 50); +ctx.quadraticCurveTo(0, 50, -Infinity, 50); +ctx.quadraticCurveTo(0, 50, NaN, 50); +ctx.quadraticCurveTo(0, 50, 0, Infinity); +ctx.quadraticCurveTo(0, 50, 0, -Infinity); +ctx.quadraticCurveTo(0, 50, 0, NaN); +ctx.quadraticCurveTo(Infinity, Infinity, 0, 50); +ctx.quadraticCurveTo(Infinity, Infinity, Infinity, 50); +ctx.quadraticCurveTo(Infinity, Infinity, Infinity, Infinity); +ctx.quadraticCurveTo(Infinity, Infinity, 0, Infinity); +ctx.quadraticCurveTo(Infinity, 50, Infinity, 50); +ctx.quadraticCurveTo(Infinity, 50, Infinity, Infinity); +ctx.quadraticCurveTo(Infinity, 50, 0, Infinity); +ctx.quadraticCurveTo(0, Infinity, Infinity, 50); +ctx.quadraticCurveTo(0, Infinity, Infinity, Infinity); +ctx.quadraticCurveTo(0, Infinity, 0, Infinity); +ctx.quadraticCurveTo(0, 50, Infinity, Infinity); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 90,45, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.scaled.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.scaled.html new file mode 100644 index 0000000000..60ba483f14 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.scaled.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.path.quadraticCurveTo.scaled</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.quadraticCurveTo.scaled</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.scale(1000, 1000); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 0.055; +ctx.beginPath(); +ctx.moveTo(-1, 1.05); +ctx.quadraticCurveTo(0, -1, 1.2, 1.05); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.scaled.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.scaled.worker.js new file mode 100644 index 0000000000..298001b212 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.scaled.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.path.quadraticCurveTo.scaled +// 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.scale(1000, 1000); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 0.055; +ctx.beginPath(); +ctx.moveTo(-1, 1.05); +ctx.quadraticCurveTo(0, -1, 1.2, 1.05); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.shape.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.shape.html new file mode 100644 index 0000000000..21cb175d59 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.shape.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.quadraticCurveTo.shape</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.quadraticCurveTo.shape</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.strokeStyle = '#0f0'; +ctx.lineWidth = 55; +ctx.beginPath(); +ctx.moveTo(-1000, 1050); +ctx.quadraticCurveTo(0, -1000, 1200, 1050); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.shape.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.shape.worker.js new file mode 100644 index 0000000000..f7aac9135a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.shape.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.path.quadraticCurveTo.shape +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 55; +ctx.beginPath(); +ctx.moveTo(-1000, 1050); +ctx.quadraticCurveTo(0, -1000, 1200, 1050); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.basic.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.basic.html new file mode 100644 index 0000000000..5214bd8dc0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.basic.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.rect.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.path.rect.basic</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.fillStyle = '#0f0'; +ctx.rect(0, 0, 100, 50); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.basic.worker.js new file mode 100644 index 0000000000..dcf3dc2a4b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.basic.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.rect.basic +// 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.fillStyle = '#0f0'; +ctx.rect(0, 0, 100, 50); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.closed.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.closed.html new file mode 100644 index 0000000000..70db3725a1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.closed.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.path.rect.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.path.rect.closed</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.strokeStyle = '#0f0'; +ctx.lineWidth = 200; +ctx.lineJoin = 'miter'; +ctx.rect(100, 50, 100, 100); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.closed.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.closed.worker.js new file mode 100644 index 0000000000..6ee09ef8d4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.closed.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.rect.closed +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 200; +ctx.lineJoin = 'miter'; +ctx.rect(100, 50, 100, 100); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.end.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.end.1.html new file mode 100644 index 0000000000..bb4bfc0c90 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.end.1.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.path.rect.end.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.rect.end.1</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.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.rect(200, 100, 400, 1000); +ctx.lineTo(-2000, -1000); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.end.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.end.1.worker.js new file mode 100644 index 0000000000..f576ac4366 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.end.1.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.rect.end.1 +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.rect(200, 100, 400, 1000); +ctx.lineTo(-2000, -1000); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.end.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.end.2.html new file mode 100644 index 0000000000..1f945a858e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.end.2.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.rect.end.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.rect.end.2</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.strokeStyle = '#0f0'; +ctx.lineWidth = 450; +ctx.lineCap = 'round'; +ctx.lineJoin = 'bevel'; +ctx.rect(150, 150, 2000, 2000); +ctx.lineTo(160, 160); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.end.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.end.2.worker.js new file mode 100644 index 0000000000..8813ed8152 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.end.2.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.path.rect.end.2 +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 450; +ctx.lineCap = 'round'; +ctx.lineJoin = 'bevel'; +ctx.rect(150, 150, 2000, 2000); +ctx.lineTo(160, 160); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.negative.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.negative.html new file mode 100644 index 0000000000..8c9effe2a5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.negative.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.rect.negative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.rect.negative</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.beginPath(); +ctx.fillStyle = '#0f0'; +ctx.rect(0, 0, 50, 25); +ctx.rect(100, 0, -50, 25); +ctx.rect(0, 50, 50, -25); +ctx.rect(100, 50, -50, -25); +ctx.fill(); +_assertPixel(canvas, 25,12, 0,255,0,255); +_assertPixel(canvas, 75,12, 0,255,0,255); +_assertPixel(canvas, 25,37, 0,255,0,255); +_assertPixel(canvas, 75,37, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.negative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.negative.worker.js new file mode 100644 index 0000000000..ea01c6d3f0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.negative.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.path.rect.negative +// 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.beginPath(); +ctx.fillStyle = '#0f0'; +ctx.rect(0, 0, 50, 25); +ctx.rect(100, 0, -50, 25); +ctx.rect(0, 50, 50, -25); +ctx.rect(100, 50, -50, -25); +ctx.fill(); +_assertPixel(canvas, 25,12, 0,255,0,255); +_assertPixel(canvas, 75,12, 0,255,0,255); +_assertPixel(canvas, 25,37, 0,255,0,255); +_assertPixel(canvas, 75,37, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.newsubpath.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.newsubpath.html new file mode 100644 index 0000000000..1dcfbe9486 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.newsubpath.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.rect.newsubpath</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.rect.newsubpath</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.beginPath(); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.moveTo(-100, 25); +ctx.lineTo(-50, 25); +ctx.rect(200, 25, 1, 1); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.newsubpath.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.newsubpath.worker.js new file mode 100644 index 0000000000..44962c5f2f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.newsubpath.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.path.rect.newsubpath +// 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.beginPath(); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.moveTo(-100, 25); +ctx.lineTo(-50, 25); +ctx.rect(200, 25, 1, 1); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.nonfinite.html new file mode 100644 index 0000000000..7f92cf5e48 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.nonfinite.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.rect.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.rect.nonfinite</h1> +<p class="desc">rect() with Infinity/NaN is ignored</p> + + +<script> +var t = async_test("rect() with Infinity/NaN 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.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.rect(Infinity, 50, 1, 1); +ctx.rect(-Infinity, 50, 1, 1); +ctx.rect(NaN, 50, 1, 1); +ctx.rect(0, Infinity, 1, 1); +ctx.rect(0, -Infinity, 1, 1); +ctx.rect(0, NaN, 1, 1); +ctx.rect(0, 50, Infinity, 1); +ctx.rect(0, 50, -Infinity, 1); +ctx.rect(0, 50, NaN, 1); +ctx.rect(0, 50, 1, Infinity); +ctx.rect(0, 50, 1, -Infinity); +ctx.rect(0, 50, 1, NaN); +ctx.rect(Infinity, Infinity, 1, 1); +ctx.rect(Infinity, Infinity, Infinity, 1); +ctx.rect(Infinity, Infinity, Infinity, Infinity); +ctx.rect(Infinity, Infinity, 1, Infinity); +ctx.rect(Infinity, 50, Infinity, 1); +ctx.rect(Infinity, 50, Infinity, Infinity); +ctx.rect(Infinity, 50, 1, Infinity); +ctx.rect(0, Infinity, Infinity, 1); +ctx.rect(0, Infinity, Infinity, Infinity); +ctx.rect(0, Infinity, 1, Infinity); +ctx.rect(0, 50, Infinity, Infinity); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 90,45, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.nonfinite.worker.js new file mode 100644 index 0000000000..6fa1e82ae4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.nonfinite.worker.js @@ -0,0 +1,53 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.rect.nonfinite +// Description:rect() with Infinity/NaN is ignored +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("rect() with Infinity/NaN 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.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.rect(Infinity, 50, 1, 1); +ctx.rect(-Infinity, 50, 1, 1); +ctx.rect(NaN, 50, 1, 1); +ctx.rect(0, Infinity, 1, 1); +ctx.rect(0, -Infinity, 1, 1); +ctx.rect(0, NaN, 1, 1); +ctx.rect(0, 50, Infinity, 1); +ctx.rect(0, 50, -Infinity, 1); +ctx.rect(0, 50, NaN, 1); +ctx.rect(0, 50, 1, Infinity); +ctx.rect(0, 50, 1, -Infinity); +ctx.rect(0, 50, 1, NaN); +ctx.rect(Infinity, Infinity, 1, 1); +ctx.rect(Infinity, Infinity, Infinity, 1); +ctx.rect(Infinity, Infinity, Infinity, Infinity); +ctx.rect(Infinity, Infinity, 1, Infinity); +ctx.rect(Infinity, 50, Infinity, 1); +ctx.rect(Infinity, 50, Infinity, Infinity); +ctx.rect(Infinity, 50, 1, Infinity); +ctx.rect(0, Infinity, Infinity, 1); +ctx.rect(0, Infinity, Infinity, Infinity); +ctx.rect(0, Infinity, 1, Infinity); +ctx.rect(0, 50, Infinity, Infinity); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 90,45, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.selfintersect.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.selfintersect.html new file mode 100644 index 0000000000..36c3f07419 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.selfintersect.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.path.rect.selfintersect</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.rect.selfintersect</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.strokeStyle = '#0f0'; +ctx.lineWidth = 90; +ctx.beginPath(); +ctx.rect(45, 20, 10, 10); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.selfintersect.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.selfintersect.worker.js new file mode 100644 index 0000000000..84c2687f30 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.selfintersect.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.rect.selfintersect +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 90; +ctx.beginPath(); +ctx.rect(45, 20, 10, 10); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.winding.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.winding.html new file mode 100644 index 0000000000..c4f4128188 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.winding.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.rect.winding</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.rect.winding</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.beginPath(); +ctx.fillStyle = '#f00'; +ctx.rect(0, 0, 50, 50); +ctx.rect(100, 50, -50, -50); +ctx.rect(0, 25, 100, -25); +ctx.rect(100, 25, -100, 25); +ctx.fill(); +_assertPixel(canvas, 25,12, 0,255,0,255); +_assertPixel(canvas, 75,12, 0,255,0,255); +_assertPixel(canvas, 25,37, 0,255,0,255); +_assertPixel(canvas, 75,37, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.winding.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.winding.worker.js new file mode 100644 index 0000000000..90a3d05e8b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.winding.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.path.rect.winding +// 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.beginPath(); +ctx.fillStyle = '#f00'; +ctx.rect(0, 0, 50, 50); +ctx.rect(100, 50, -50, -50); +ctx.rect(0, 25, 100, -25); +ctx.rect(100, 25, -100, 25); +ctx.fill(); +_assertPixel(canvas, 25,12, 0,255,0,255); +_assertPixel(canvas, 75,12, 0,255,0,255); +_assertPixel(canvas, 25,37, 0,255,0,255); +_assertPixel(canvas, 75,37, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.1.html new file mode 100644 index 0000000000..90c0bb1f68 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.1.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.path.rect.zero.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.rect.zero.1</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.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.rect(0, 50, 100, 0); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.1.worker.js new file mode 100644 index 0000000000..4d080710d0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.1.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.rect.zero.1 +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.rect(0, 50, 100, 0); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.2.html new file mode 100644 index 0000000000..4c3ae6f6dd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.2.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.path.rect.zero.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.rect.zero.2</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.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.rect(50, -100, 0, 250); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.2.worker.js new file mode 100644 index 0000000000..93d5a52875 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.2.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.rect.zero.2 +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.rect(50, -100, 0, 250); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.3.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.3.html new file mode 100644 index 0000000000..86bd749418 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.3.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.path.rect.zero.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.rect.zero.3</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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.rect(50, 25, 0, 0); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.3.worker.js new file mode 100644 index 0000000000..6403de43c0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.3.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.rect.zero.3 +// 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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.rect(50, 25, 0, 0); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.4.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.4.html new file mode 100644 index 0000000000..063ef2ba1d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.4.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.path.rect.zero.4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.rect.zero.4</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.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.rect(100, 25, 0, 0); +ctx.lineTo(0, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.4.worker.js new file mode 100644 index 0000000000..87fd698566 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.4.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.rect.zero.4 +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.rect(100, 25, 0, 0); +ctx.lineTo(0, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.5.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.5.html new file mode 100644 index 0000000000..0fa0b07550 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.5.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.path.rect.zero.5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.rect.zero.5</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.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.moveTo(0, 0); +ctx.rect(100, 25, 0, 0); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.5.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.5.worker.js new file mode 100644 index 0000000000..77851f54d3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.5.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.rect.zero.5 +// 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.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.moveTo(0, 0); +ctx.rect(100, 25, 0, 0); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.6.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.6.html new file mode 100644 index 0000000000..a3cf7b60ac --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.6.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.rect.zero.6</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.rect.zero.6</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.strokeStyle = '#f00'; +ctx.lineJoin = 'miter'; +ctx.miterLimit = 1.5; +ctx.lineWidth = 200; +ctx.beginPath(); +ctx.rect(100, 25, 1000, 0); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.6.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.6.worker.js new file mode 100644 index 0000000000..5db284837c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.6.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.path.rect.zero.6 +// 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.strokeStyle = '#f00'; +ctx.lineJoin = 'miter'; +ctx.miterLimit = 1.5; +ctx.lineWidth = 200; +ctx.beginPath(); +ctx.rect(100, 25, 1000, 0); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.html new file mode 100644 index 0000000000..479ab00cd7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.html @@ -0,0 +1,55 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.1.radius.dompoint</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.1.radius.dompoint</h1> +<p class="desc">Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottom-left corners.</p> + + +<script> +var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottom-left corners."); +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.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20)]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-left corner +_assertPixel(canvas, 20,1, 255,0,0,255); +_assertPixel(canvas, 41,1, 0,255,0,255); +_assertPixel(canvas, 1,10, 255,0,0,255); +_assertPixel(canvas, 1,21, 0,255,0,255); + +// top-right corner +_assertPixel(canvas, 79,1, 255,0,0,255); +_assertPixel(canvas, 58,1, 0,255,0,255); +_assertPixel(canvas, 98,10, 255,0,0,255); +_assertPixel(canvas, 98,21, 0,255,0,255); + +// bottom-right corner +_assertPixel(canvas, 79,48, 255,0,0,255); +_assertPixel(canvas, 58,48, 0,255,0,255); +_assertPixel(canvas, 98,39, 255,0,0,255); +_assertPixel(canvas, 98,28, 0,255,0,255); + +// bottom-left corner +_assertPixel(canvas, 20,48, 255,0,0,255); +_assertPixel(canvas, 41,48, 0,255,0,255); +_assertPixel(canvas, 1,39, 255,0,0,255); +_assertPixel(canvas, 1,28, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.worker.js new file mode 100644 index 0000000000..ba4fb4e611 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.worker.js @@ -0,0 +1,51 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.1.radius.dompoint +// Description:Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottom-left corners. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottom-left corners."); +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.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20)]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-left corner +_assertPixel(canvas, 20,1, 255,0,0,255); +_assertPixel(canvas, 41,1, 0,255,0,255); +_assertPixel(canvas, 1,10, 255,0,0,255); +_assertPixel(canvas, 1,21, 0,255,0,255); + +// top-right corner +_assertPixel(canvas, 79,1, 255,0,0,255); +_assertPixel(canvas, 58,1, 0,255,0,255); +_assertPixel(canvas, 98,10, 255,0,0,255); +_assertPixel(canvas, 98,21, 0,255,0,255); + +// bottom-right corner +_assertPixel(canvas, 79,48, 255,0,0,255); +_assertPixel(canvas, 58,48, 0,255,0,255); +_assertPixel(canvas, 98,39, 255,0,0,255); +_assertPixel(canvas, 98,28, 0,255,0,255); + +// bottom-left corner +_assertPixel(canvas, 20,48, 255,0,0,255); +_assertPixel(canvas, 41,48, 0,255,0,255); +_assertPixel(canvas, 1,39, 255,0,0,255); +_assertPixel(canvas, 1,28, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.html new file mode 100644 index 0000000000..18ff259e66 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.html @@ -0,0 +1,55 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.1.radius.dompointinit</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.1.radius.dompointinit</h1> +<p class="desc">Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottomInit-left corners.</p> + + +<script> +var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottomInit-left corners."); +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.roundRect(0, 0, 100, 50, [{x: 40, y: 20}]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-left corner +_assertPixel(canvas, 20,1, 255,0,0,255); +_assertPixel(canvas, 41,1, 0,255,0,255); +_assertPixel(canvas, 1,10, 255,0,0,255); +_assertPixel(canvas, 1,21, 0,255,0,255); + +// top-right corner +_assertPixel(canvas, 79,1, 255,0,0,255); +_assertPixel(canvas, 58,1, 0,255,0,255); +_assertPixel(canvas, 98,10, 255,0,0,255); +_assertPixel(canvas, 98,21, 0,255,0,255); + +// bottom-right corner +_assertPixel(canvas, 79,48, 255,0,0,255); +_assertPixel(canvas, 58,48, 0,255,0,255); +_assertPixel(canvas, 98,39, 255,0,0,255); +_assertPixel(canvas, 98,28, 0,255,0,255); + +// bottom-left corner +_assertPixel(canvas, 20,48, 255,0,0,255); +_assertPixel(canvas, 41,48, 0,255,0,255); +_assertPixel(canvas, 1,39, 255,0,0,255); +_assertPixel(canvas, 1,28, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.worker.js new file mode 100644 index 0000000000..589950c04e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.worker.js @@ -0,0 +1,51 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.1.radius.dompointinit +// Description:Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottomInit-left corners. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottomInit-left corners."); +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.roundRect(0, 0, 100, 50, [{x: 40, y: 20}]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-left corner +_assertPixel(canvas, 20,1, 255,0,0,255); +_assertPixel(canvas, 41,1, 0,255,0,255); +_assertPixel(canvas, 1,10, 255,0,0,255); +_assertPixel(canvas, 1,21, 0,255,0,255); + +// top-right corner +_assertPixel(canvas, 79,1, 255,0,0,255); +_assertPixel(canvas, 58,1, 0,255,0,255); +_assertPixel(canvas, 98,10, 255,0,0,255); +_assertPixel(canvas, 98,21, 0,255,0,255); + +// bottom-right corner +_assertPixel(canvas, 79,48, 255,0,0,255); +_assertPixel(canvas, 58,48, 0,255,0,255); +_assertPixel(canvas, 98,39, 255,0,0,255); +_assertPixel(canvas, 98,28, 0,255,0,255); + +// bottom-left corner +_assertPixel(canvas, 20,48, 255,0,0,255); +_assertPixel(canvas, 41,48, 0,255,0,255); +_assertPixel(canvas, 1,39, 255,0,0,255); +_assertPixel(canvas, 1,28, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.html new file mode 100644 index 0000000000..4761bb5e5e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.1.radius.double</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.1.radius.double</h1> +<p class="desc">Verify that when one radius is given to roundRect(), specified as a double, it applies to all corners.</p> + + +<script> +var t = async_test("Verify that when one radius is given to roundRect(), specified as a double, it applies to all corners."); +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.roundRect(0, 0, 100, 50, [20]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 255,0,0,255); +_assertPixel(canvas, 98,1, 255,0,0,255); +_assertPixel(canvas, 98,48, 255,0,0,255); +_assertPixel(canvas, 1,48, 255,0,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.worker.js new file mode 100644 index 0000000000..57f28c7778 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.1.radius.double +// Description:Verify that when one radius is given to roundRect(), specified as a double, it applies to all corners. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when one radius is given to roundRect(), specified as a double, it applies to all corners."); +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.roundRect(0, 0, 100, 50, [20]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 255,0,0,255); +_assertPixel(canvas, 98,1, 255,0,0,255); +_assertPixel(canvas, 98,48, 255,0,0,255); +_assertPixel(canvas, 1,48, 255,0,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompoint.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompoint.html new file mode 100644 index 0000000000..c96ed08f05 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompoint.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.2.radii.1.dompoint</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.2.radii.1.dompoint</h1> +<p class="desc">Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottom-right corners.</p> + + +<script> +var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottom-right corners."); +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.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-left corner +_assertPixel(canvas, 20,1, 255,0,0,255); +_assertPixel(canvas, 41,1, 0,255,0,255); +_assertPixel(canvas, 1,10, 255,0,0,255); +_assertPixel(canvas, 1,21, 0,255,0,255); + +// bottom-right corner +_assertPixel(canvas, 79,48, 255,0,0,255); +_assertPixel(canvas, 58,48, 0,255,0,255); +_assertPixel(canvas, 98,39, 255,0,0,255); +_assertPixel(canvas, 98,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 98,1, 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/path-objects/2d.path.roundrect.2.radii.1.dompoint.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompoint.worker.js new file mode 100644 index 0000000000..7e7a4efddc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompoint.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.2.radii.1.dompoint +// Description:Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottom-right corners. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottom-right corners."); +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.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-left corner +_assertPixel(canvas, 20,1, 255,0,0,255); +_assertPixel(canvas, 41,1, 0,255,0,255); +_assertPixel(canvas, 1,10, 255,0,0,255); +_assertPixel(canvas, 1,21, 0,255,0,255); + +// bottom-right corner +_assertPixel(canvas, 79,48, 255,0,0,255); +_assertPixel(canvas, 58,48, 0,255,0,255); +_assertPixel(canvas, 98,39, 255,0,0,255); +_assertPixel(canvas, 98,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 98,1, 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/path-objects/2d.path.roundrect.2.radii.1.dompointinit.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompointinit.html new file mode 100644 index 0000000000..02b889c759 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompointinit.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.2.radii.1.dompointinit</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.2.radii.1.dompointinit</h1> +<p class="desc">Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottomInit-right corners.</p> + + +<script> +var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottomInit-right corners."); +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.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-left corner +_assertPixel(canvas, 20,1, 255,0,0,255); +_assertPixel(canvas, 41,1, 0,255,0,255); +_assertPixel(canvas, 1,10, 255,0,0,255); +_assertPixel(canvas, 1,21, 0,255,0,255); + +// bottom-right corner +_assertPixel(canvas, 79,48, 255,0,0,255); +_assertPixel(canvas, 58,48, 0,255,0,255); +_assertPixel(canvas, 98,39, 255,0,0,255); +_assertPixel(canvas, 98,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 98,1, 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/path-objects/2d.path.roundrect.2.radii.1.dompointinit.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompointinit.worker.js new file mode 100644 index 0000000000..fcc3cb088a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompointinit.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.2.radii.1.dompointinit +// Description:Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottomInit-right corners. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottomInit-right corners."); +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.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-left corner +_assertPixel(canvas, 20,1, 255,0,0,255); +_assertPixel(canvas, 41,1, 0,255,0,255); +_assertPixel(canvas, 1,10, 255,0,0,255); +_assertPixel(canvas, 1,21, 0,255,0,255); + +// bottom-right corner +_assertPixel(canvas, 79,48, 255,0,0,255); +_assertPixel(canvas, 58,48, 0,255,0,255); +_assertPixel(canvas, 98,39, 255,0,0,255); +_assertPixel(canvas, 98,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 98,1, 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/path-objects/2d.path.roundrect.2.radii.1.double.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.double.html new file mode 100644 index 0000000000..2a6a030237 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.double.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.2.radii.1.double</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.2.radii.1.double</h1> +<p class="desc">Verify that when two radii are given to roundRect(), the first radius, specified as a double, applies to the top-left and bottom-right corners.</p> + + +<script> +var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a double, applies to the top-left and bottom-right corners."); +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.roundRect(0, 0, 100, 50, [20, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 255,0,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 255,0,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.double.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.double.worker.js new file mode 100644 index 0000000000..6d4d029b1c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.double.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.2.radii.1.double +// Description:Verify that when two radii are given to roundRect(), the first radius, specified as a double, applies to the top-left and bottom-right corners. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a double, applies to the top-left and bottom-right corners."); +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.roundRect(0, 0, 100, 50, [20, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 255,0,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 255,0,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompoint.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompoint.html new file mode 100644 index 0000000000..bc6e27c683 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompoint.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.2.radii.2.dompoint</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.2.radii.2.dompoint</h1> +<p class="desc">Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottom-left corners.</p> + + +<script> +var t = async_test("Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottom-left corners."); +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.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20)]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-right corner +_assertPixel(canvas, 79,1, 255,0,0,255); +_assertPixel(canvas, 58,1, 0,255,0,255); +_assertPixel(canvas, 98,10, 255,0,0,255); +_assertPixel(canvas, 98,21, 0,255,0,255); + +// bottom-left corner +_assertPixel(canvas, 20,48, 255,0,0,255); +_assertPixel(canvas, 41,48, 0,255,0,255); +_assertPixel(canvas, 1,39, 255,0,0,255); +_assertPixel(canvas, 1,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompoint.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompoint.worker.js new file mode 100644 index 0000000000..fead59e863 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompoint.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.2.radii.2.dompoint +// Description:Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottom-left corners. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottom-left corners."); +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.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20)]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-right corner +_assertPixel(canvas, 79,1, 255,0,0,255); +_assertPixel(canvas, 58,1, 0,255,0,255); +_assertPixel(canvas, 98,10, 255,0,0,255); +_assertPixel(canvas, 98,21, 0,255,0,255); + +// bottom-left corner +_assertPixel(canvas, 20,48, 255,0,0,255); +_assertPixel(canvas, 41,48, 0,255,0,255); +_assertPixel(canvas, 1,39, 255,0,0,255); +_assertPixel(canvas, 1,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompointinit.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompointinit.html new file mode 100644 index 0000000000..fcca1c739f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompointinit.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.2.radii.2.dompointinit</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.2.radii.2.dompointinit</h1> +<p class="desc">Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottomInit-left corners.</p> + + +<script> +var t = async_test("Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottomInit-left corners."); +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.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-right corner +_assertPixel(canvas, 79,1, 255,0,0,255); +_assertPixel(canvas, 58,1, 0,255,0,255); +_assertPixel(canvas, 98,10, 255,0,0,255); +_assertPixel(canvas, 98,21, 0,255,0,255); + +// bottom-left corner +_assertPixel(canvas, 20,48, 255,0,0,255); +_assertPixel(canvas, 41,48, 0,255,0,255); +_assertPixel(canvas, 1,39, 255,0,0,255); +_assertPixel(canvas, 1,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompointinit.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompointinit.worker.js new file mode 100644 index 0000000000..ab334e4ca0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompointinit.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.2.radii.2.dompointinit +// Description:Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottomInit-left corners. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottomInit-left corners."); +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.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-right corner +_assertPixel(canvas, 79,1, 255,0,0,255); +_assertPixel(canvas, 58,1, 0,255,0,255); +_assertPixel(canvas, 98,10, 255,0,0,255); +_assertPixel(canvas, 98,21, 0,255,0,255); + +// bottom-left corner +_assertPixel(canvas, 20,48, 255,0,0,255); +_assertPixel(canvas, 41,48, 0,255,0,255); +_assertPixel(canvas, 1,39, 255,0,0,255); +_assertPixel(canvas, 1,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.double.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.double.html new file mode 100644 index 0000000000..2bc6737566 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.double.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.2.radii.2.double</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.2.radii.2.double</h1> +<p class="desc">Verify that when two radii are given to roundRect(), the second radius, specified as a double, applies to the top-right and bottom-left corners.</p> + + +<script> +var t = async_test("Verify that when two radii are given to roundRect(), the second radius, specified as a double, applies to the top-right and bottom-left corners."); +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.roundRect(0, 0, 100, 50, [0, 20]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 255,0,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +_assertPixel(canvas, 1,48, 255,0,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.double.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.double.worker.js new file mode 100644 index 0000000000..d355852a5c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.double.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.2.radii.2.double +// Description:Verify that when two radii are given to roundRect(), the second radius, specified as a double, applies to the top-right and bottom-left corners. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when two radii are given to roundRect(), the second radius, specified as a double, applies to the top-right and bottom-left corners."); +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.roundRect(0, 0, 100, 50, [0, 20]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 255,0,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +_assertPixel(canvas, 1,48, 255,0,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompoint.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompoint.html new file mode 100644 index 0000000000..f3388e6562 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompoint.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.path.roundrect.3.radii.1.dompoint</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.3.radii.1.dompoint</h1> +<p class="desc">Verify that when three radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left corner.</p> + + +<script> +var t = async_test("Verify that when three radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left corner."); +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.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-left corner +_assertPixel(canvas, 20,1, 255,0,0,255); +_assertPixel(canvas, 41,1, 0,255,0,255); +_assertPixel(canvas, 1,10, 255,0,0,255); +_assertPixel(canvas, 1,21, 0,255,0,255); + +// other corners +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,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/path-objects/2d.path.roundrect.3.radii.1.dompoint.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompoint.worker.js new file mode 100644 index 0000000000..36c6401bf3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompoint.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.path.roundrect.3.radii.1.dompoint +// Description:Verify that when three radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left corner. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when three radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left corner."); +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.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-left corner +_assertPixel(canvas, 20,1, 255,0,0,255); +_assertPixel(canvas, 41,1, 0,255,0,255); +_assertPixel(canvas, 1,10, 255,0,0,255); +_assertPixel(canvas, 1,21, 0,255,0,255); + +// other corners +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,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/path-objects/2d.path.roundrect.3.radii.1.dompointinit.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompointinit.html new file mode 100644 index 0000000000..dd96e859ea --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompointinit.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.path.roundrect.3.radii.1.dompointinit</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.3.radii.1.dompointinit</h1> +<p class="desc">Verify that when three radii are given to roundRect(), the first radius, specified as a DOMPointInit, applies to the top-left corner.</p> + + +<script> +var t = async_test("Verify that when three radii are given to roundRect(), the first radius, specified as a DOMPointInit, applies to the top-left corner."); +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.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-left corner +_assertPixel(canvas, 20,1, 255,0,0,255); +_assertPixel(canvas, 41,1, 0,255,0,255); +_assertPixel(canvas, 1,10, 255,0,0,255); +_assertPixel(canvas, 1,21, 0,255,0,255); + +// other corners +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,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/path-objects/2d.path.roundrect.3.radii.1.dompointinit.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompointinit.worker.js new file mode 100644 index 0000000000..a497d5788b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompointinit.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.path.roundrect.3.radii.1.dompointinit +// Description:Verify that when three radii are given to roundRect(), the first radius, specified as a DOMPointInit, applies to the top-left corner. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when three radii are given to roundRect(), the first radius, specified as a DOMPointInit, applies to the top-left corner."); +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.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-left corner +_assertPixel(canvas, 20,1, 255,0,0,255); +_assertPixel(canvas, 41,1, 0,255,0,255); +_assertPixel(canvas, 1,10, 255,0,0,255); +_assertPixel(canvas, 1,21, 0,255,0,255); + +// other corners +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,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/path-objects/2d.path.roundrect.3.radii.1.double.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.double.html new file mode 100644 index 0000000000..4c5f57122c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.double.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.3.radii.1.double</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.3.radii.1.double</h1> +<p class="desc">Verify that when three radii are given to roundRect(), the first radius, specified as a double, applies to the top-left corner.</p> + + +<script> +var t = async_test("Verify that when three radii are given to roundRect(), the first radius, specified as a double, applies to the top-left corner."); +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.roundRect(0, 0, 100, 50, [20, 0, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 255,0,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,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/path-objects/2d.path.roundrect.3.radii.1.double.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.double.worker.js new file mode 100644 index 0000000000..171a2ae5e6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.double.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.3.radii.1.double +// Description:Verify that when three radii are given to roundRect(), the first radius, specified as a double, applies to the top-left corner. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when three radii are given to roundRect(), the first radius, specified as a double, applies to the top-left corner."); +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.roundRect(0, 0, 100, 50, [20, 0, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 255,0,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,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/path-objects/2d.path.roundrect.3.radii.2.dompoint.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompoint.html new file mode 100644 index 0000000000..3459ac27bb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompoint.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.3.radii.2.dompoint</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.3.radii.2.dompoint</h1> +<p class="desc">Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottom-left corners.</p> + + +<script> +var t = async_test("Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottom-left corners."); +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.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20), 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-right corner +_assertPixel(canvas, 79,1, 255,0,0,255); +_assertPixel(canvas, 58,1, 0,255,0,255); +_assertPixel(canvas, 98,10, 255,0,0,255); +_assertPixel(canvas, 98,21, 0,255,0,255); + +// bottom-left corner +_assertPixel(canvas, 20,48, 255,0,0,255); +_assertPixel(canvas, 41,48, 0,255,0,255); +_assertPixel(canvas, 1,39, 255,0,0,255); +_assertPixel(canvas, 1,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompoint.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompoint.worker.js new file mode 100644 index 0000000000..9588780f97 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompoint.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.3.radii.2.dompoint +// Description:Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottom-left corners. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottom-left corners."); +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.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20), 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-right corner +_assertPixel(canvas, 79,1, 255,0,0,255); +_assertPixel(canvas, 58,1, 0,255,0,255); +_assertPixel(canvas, 98,10, 255,0,0,255); +_assertPixel(canvas, 98,21, 0,255,0,255); + +// bottom-left corner +_assertPixel(canvas, 20,48, 255,0,0,255); +_assertPixel(canvas, 41,48, 0,255,0,255); +_assertPixel(canvas, 1,39, 255,0,0,255); +_assertPixel(canvas, 1,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompointinit.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompointinit.html new file mode 100644 index 0000000000..6476be489f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompointinit.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.3.radii.2.dompointinit</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.3.radii.2.dompointinit</h1> +<p class="desc">Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottomInit-left corners.</p> + + +<script> +var t = async_test("Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottomInit-left corners."); +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.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-right corner +_assertPixel(canvas, 79,1, 255,0,0,255); +_assertPixel(canvas, 58,1, 0,255,0,255); +_assertPixel(canvas, 98,10, 255,0,0,255); +_assertPixel(canvas, 98,21, 0,255,0,255); + +// bottom-left corner +_assertPixel(canvas, 20,48, 255,0,0,255); +_assertPixel(canvas, 41,48, 0,255,0,255); +_assertPixel(canvas, 1,39, 255,0,0,255); +_assertPixel(canvas, 1,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompointinit.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompointinit.worker.js new file mode 100644 index 0000000000..42dead8509 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompointinit.worker.js @@ -0,0 +1,43 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.3.radii.2.dompointinit +// Description:Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottomInit-left corners. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottomInit-left corners."); +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.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-right corner +_assertPixel(canvas, 79,1, 255,0,0,255); +_assertPixel(canvas, 58,1, 0,255,0,255); +_assertPixel(canvas, 98,10, 255,0,0,255); +_assertPixel(canvas, 98,21, 0,255,0,255); + +// bottom-left corner +_assertPixel(canvas, 20,48, 255,0,0,255); +_assertPixel(canvas, 41,48, 0,255,0,255); +_assertPixel(canvas, 1,39, 255,0,0,255); +_assertPixel(canvas, 1,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.double.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.double.html new file mode 100644 index 0000000000..652745e0be --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.double.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.3.radii.2.double</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.3.radii.2.double</h1> +<p class="desc">Verify that when three radii are given to roundRect(), the second radius, specified as a double, applies to the top-right and bottom-left corners.</p> + + +<script> +var t = async_test("Verify that when three radii are given to roundRect(), the second radius, specified as a double, applies to the top-right and bottom-left corners."); +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.roundRect(0, 0, 100, 50, [0, 20, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 255,0,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +_assertPixel(canvas, 1,48, 255,0,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.double.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.double.worker.js new file mode 100644 index 0000000000..e3929fbfdb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.double.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.3.radii.2.double +// Description:Verify that when three radii are given to roundRect(), the second radius, specified as a double, applies to the top-right and bottom-left corners. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when three radii are given to roundRect(), the second radius, specified as a double, applies to the top-right and bottom-left corners."); +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.roundRect(0, 0, 100, 50, [0, 20, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 255,0,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +_assertPixel(canvas, 1,48, 255,0,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompoint.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompoint.html new file mode 100644 index 0000000000..1c295143c8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompoint.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.path.roundrect.3.radii.3.dompoint</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.3.radii.3.dompoint</h1> +<p class="desc">Verify that when three radii are given to roundRect(), the third radius, specified as a DOMPoint, applies to the bottom-right corner.</p> + + +<script> +var t = async_test("Verify that when three radii are given to roundRect(), the third radius, specified as a DOMPoint, applies to the bottom-right corner."); +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.roundRect(0, 0, 100, 50, [0, 0, new DOMPoint(40, 20)]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// bottom-right corner +_assertPixel(canvas, 79,48, 255,0,0,255); +_assertPixel(canvas, 58,48, 0,255,0,255); +_assertPixel(canvas, 98,39, 255,0,0,255); +_assertPixel(canvas, 98,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 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/path-objects/2d.path.roundrect.3.radii.3.dompoint.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompoint.worker.js new file mode 100644 index 0000000000..c8e08ec297 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompoint.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.path.roundrect.3.radii.3.dompoint +// Description:Verify that when three radii are given to roundRect(), the third radius, specified as a DOMPoint, applies to the bottom-right corner. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when three radii are given to roundRect(), the third radius, specified as a DOMPoint, applies to the bottom-right corner."); +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.roundRect(0, 0, 100, 50, [0, 0, new DOMPoint(40, 20)]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// bottom-right corner +_assertPixel(canvas, 79,48, 255,0,0,255); +_assertPixel(canvas, 58,48, 0,255,0,255); +_assertPixel(canvas, 98,39, 255,0,0,255); +_assertPixel(canvas, 98,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 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/path-objects/2d.path.roundrect.3.radii.3.dompointinit.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompointinit.html new file mode 100644 index 0000000000..f8e62a5bf6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompointinit.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.path.roundrect.3.radii.3.dompointinit</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.3.radii.3.dompointinit</h1> +<p class="desc">Verify that when three radii are given to roundRect(), the third radius, specified as a DOMPointInit, applies to the bottom-right corner.</p> + + +<script> +var t = async_test("Verify that when three radii are given to roundRect(), the third radius, specified as a DOMPointInit, applies to the bottom-right corner."); +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.roundRect(0, 0, 100, 50, [0, 0, {x: 40, y: 20}]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// bottom-right corner +_assertPixel(canvas, 79,48, 255,0,0,255); +_assertPixel(canvas, 58,48, 0,255,0,255); +_assertPixel(canvas, 98,39, 255,0,0,255); +_assertPixel(canvas, 98,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 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/path-objects/2d.path.roundrect.3.radii.3.dompointinit.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompointinit.worker.js new file mode 100644 index 0000000000..0fe2b89877 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompointinit.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.path.roundrect.3.radii.3.dompointinit +// Description:Verify that when three radii are given to roundRect(), the third radius, specified as a DOMPointInit, applies to the bottom-right corner. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when three radii are given to roundRect(), the third radius, specified as a DOMPointInit, applies to the bottom-right corner."); +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.roundRect(0, 0, 100, 50, [0, 0, {x: 40, y: 20}]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// bottom-right corner +_assertPixel(canvas, 79,48, 255,0,0,255); +_assertPixel(canvas, 58,48, 0,255,0,255); +_assertPixel(canvas, 98,39, 255,0,0,255); +_assertPixel(canvas, 98,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 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/path-objects/2d.path.roundrect.3.radii.3.double.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.double.html new file mode 100644 index 0000000000..ff1301d9cd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.double.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.3.radii.3.double</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.3.radii.3.double</h1> +<p class="desc">Verify that when three radii are given to roundRect(), the third radius, specified as a double, applies to the bottom-right corner.</p> + + +<script> +var t = async_test("Verify that when three radii are given to roundRect(), the third radius, specified as a double, applies to the bottom-right corner."); +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.roundRect(0, 0, 100, 50, [0, 0, 20]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 255,0,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.double.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.double.worker.js new file mode 100644 index 0000000000..2422435d52 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.double.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.3.radii.3.double +// Description:Verify that when three radii are given to roundRect(), the third radius, specified as a double, applies to the bottom-right corner. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when three radii are given to roundRect(), the third radius, specified as a double, applies to the bottom-right corner."); +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.roundRect(0, 0, 100, 50, [0, 0, 20]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 255,0,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompoint.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompoint.html new file mode 100644 index 0000000000..3110983f7f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompoint.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.path.roundrect.4.radii.1.dompoint</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.4.radii.1.dompoint</h1> +<p class="desc">Verify that when four radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left corner.</p> + + +<script> +var t = async_test("Verify that when four radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left corner."); +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.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0, 0, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-left corner +_assertPixel(canvas, 20,1, 255,0,0,255); +_assertPixel(canvas, 41,1, 0,255,0,255); +_assertPixel(canvas, 1,10, 255,0,0,255); +_assertPixel(canvas, 1,21, 0,255,0,255); + +// other corners +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,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/path-objects/2d.path.roundrect.4.radii.1.dompoint.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompoint.worker.js new file mode 100644 index 0000000000..3bdb12e029 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompoint.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.path.roundrect.4.radii.1.dompoint +// Description:Verify that when four radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left corner. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when four radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left corner."); +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.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0, 0, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-left corner +_assertPixel(canvas, 20,1, 255,0,0,255); +_assertPixel(canvas, 41,1, 0,255,0,255); +_assertPixel(canvas, 1,10, 255,0,0,255); +_assertPixel(canvas, 1,21, 0,255,0,255); + +// other corners +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,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/path-objects/2d.path.roundrect.4.radii.1.dompointinit.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompointinit.html new file mode 100644 index 0000000000..976b39a102 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompointinit.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.path.roundrect.4.radii.1.dompointinit</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.4.radii.1.dompointinit</h1> +<p class="desc">Verify that when four radii are given to roundRect(), the first radius, specified as a DOMPointInit, applies to the top-left corner.</p> + + +<script> +var t = async_test("Verify that when four radii are given to roundRect(), the first radius, specified as a DOMPointInit, applies to the top-left corner."); +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.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0, 0, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-left corner +_assertPixel(canvas, 20,1, 255,0,0,255); +_assertPixel(canvas, 41,1, 0,255,0,255); +_assertPixel(canvas, 1,10, 255,0,0,255); +_assertPixel(canvas, 1,21, 0,255,0,255); + +// other corners +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,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/path-objects/2d.path.roundrect.4.radii.1.dompointinit.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompointinit.worker.js new file mode 100644 index 0000000000..86b43ad2a1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompointinit.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.path.roundrect.4.radii.1.dompointinit +// Description:Verify that when four radii are given to roundRect(), the first radius, specified as a DOMPointInit, applies to the top-left corner. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when four radii are given to roundRect(), the first radius, specified as a DOMPointInit, applies to the top-left corner."); +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.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0, 0, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-left corner +_assertPixel(canvas, 20,1, 255,0,0,255); +_assertPixel(canvas, 41,1, 0,255,0,255); +_assertPixel(canvas, 1,10, 255,0,0,255); +_assertPixel(canvas, 1,21, 0,255,0,255); + +// other corners +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,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/path-objects/2d.path.roundrect.4.radii.1.double.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.double.html new file mode 100644 index 0000000000..c75d6420c9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.double.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.4.radii.1.double</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.4.radii.1.double</h1> +<p class="desc">Verify that when four radii are given to roundRect(), the first radius, specified as a double, applies to the top-left corner.</p> + + +<script> +var t = async_test("Verify that when four radii are given to roundRect(), the first radius, specified as a double, applies to the top-left corner."); +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.roundRect(0, 0, 100, 50, [20, 0, 0, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 255,0,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,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/path-objects/2d.path.roundrect.4.radii.1.double.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.double.worker.js new file mode 100644 index 0000000000..925c93b0c9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.double.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.4.radii.1.double +// Description:Verify that when four radii are given to roundRect(), the first radius, specified as a double, applies to the top-left corner. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when four radii are given to roundRect(), the first radius, specified as a double, applies to the top-left corner."); +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.roundRect(0, 0, 100, 50, [20, 0, 0, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 255,0,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,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/path-objects/2d.path.roundrect.4.radii.2.dompoint.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompoint.html new file mode 100644 index 0000000000..33d861d6dc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompoint.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.path.roundrect.4.radii.2.dompoint</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.4.radii.2.dompoint</h1> +<p class="desc">Verify that when four radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right corner.</p> + + +<script> +var t = async_test("Verify that when four radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right corner."); +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.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20), 0, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-right corner +_assertPixel(canvas, 79,1, 255,0,0,255); +_assertPixel(canvas, 58,1, 0,255,0,255); +_assertPixel(canvas, 98,10, 255,0,0,255); +_assertPixel(canvas, 98,21, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,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/path-objects/2d.path.roundrect.4.radii.2.dompoint.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompoint.worker.js new file mode 100644 index 0000000000..12d1a8c8e6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompoint.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.path.roundrect.4.radii.2.dompoint +// Description:Verify that when four radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right corner. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when four radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right corner."); +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.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20), 0, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-right corner +_assertPixel(canvas, 79,1, 255,0,0,255); +_assertPixel(canvas, 58,1, 0,255,0,255); +_assertPixel(canvas, 98,10, 255,0,0,255); +_assertPixel(canvas, 98,21, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,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/path-objects/2d.path.roundrect.4.radii.2.dompointinit.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompointinit.html new file mode 100644 index 0000000000..b088c2e717 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompointinit.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.path.roundrect.4.radii.2.dompointinit</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.4.radii.2.dompointinit</h1> +<p class="desc">Verify that when four radii are given to roundRect(), the second radius, specified as a DOMPointInit, applies to the top-right corner.</p> + + +<script> +var t = async_test("Verify that when four radii are given to roundRect(), the second radius, specified as a DOMPointInit, applies to the top-right corner."); +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.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}, 0, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-right corner +_assertPixel(canvas, 79,1, 255,0,0,255); +_assertPixel(canvas, 58,1, 0,255,0,255); +_assertPixel(canvas, 98,10, 255,0,0,255); +_assertPixel(canvas, 98,21, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,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/path-objects/2d.path.roundrect.4.radii.2.dompointinit.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompointinit.worker.js new file mode 100644 index 0000000000..49a247a266 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompointinit.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.path.roundrect.4.radii.2.dompointinit +// Description:Verify that when four radii are given to roundRect(), the second radius, specified as a DOMPointInit, applies to the top-right corner. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when four radii are given to roundRect(), the second radius, specified as a DOMPointInit, applies to the top-right corner."); +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.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}, 0, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// top-right corner +_assertPixel(canvas, 79,1, 255,0,0,255); +_assertPixel(canvas, 58,1, 0,255,0,255); +_assertPixel(canvas, 98,10, 255,0,0,255); +_assertPixel(canvas, 98,21, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,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/path-objects/2d.path.roundrect.4.radii.2.double.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.double.html new file mode 100644 index 0000000000..71395e0e9e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.double.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.4.radii.2.double</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.4.radii.2.double</h1> +<p class="desc">Verify that when four radii are given to roundRect(), the second radius, specified as a double, applies to the top-right corner.</p> + + +<script> +var t = async_test("Verify that when four radii are given to roundRect(), the second radius, specified as a double, applies to the top-right corner."); +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.roundRect(0, 0, 100, 50, [0, 20, 0, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 255,0,0,255); +_assertPixel(canvas, 98,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/path-objects/2d.path.roundrect.4.radii.2.double.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.double.worker.js new file mode 100644 index 0000000000..f868c6272e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.double.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.4.radii.2.double +// Description:Verify that when four radii are given to roundRect(), the second radius, specified as a double, applies to the top-right corner. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when four radii are given to roundRect(), the second radius, specified as a double, applies to the top-right corner."); +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.roundRect(0, 0, 100, 50, [0, 20, 0, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 255,0,0,255); +_assertPixel(canvas, 98,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/path-objects/2d.path.roundrect.4.radii.3.dompoint.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompoint.html new file mode 100644 index 0000000000..4922bf37f2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompoint.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.path.roundrect.4.radii.3.dompoint</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.4.radii.3.dompoint</h1> +<p class="desc">Verify that when four radii are given to roundRect(), the third radius, specified as a DOMPoint, applies to the bottom-right corner.</p> + + +<script> +var t = async_test("Verify that when four radii are given to roundRect(), the third radius, specified as a DOMPoint, applies to the bottom-right corner."); +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.roundRect(0, 0, 100, 50, [0, 0, new DOMPoint(40, 20), 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// bottom-right corner +_assertPixel(canvas, 79,48, 255,0,0,255); +_assertPixel(canvas, 58,48, 0,255,0,255); +_assertPixel(canvas, 98,39, 255,0,0,255); +_assertPixel(canvas, 98,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 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/path-objects/2d.path.roundrect.4.radii.3.dompoint.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompoint.worker.js new file mode 100644 index 0000000000..2da2f3591c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompoint.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.path.roundrect.4.radii.3.dompoint +// Description:Verify that when four radii are given to roundRect(), the third radius, specified as a DOMPoint, applies to the bottom-right corner. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when four radii are given to roundRect(), the third radius, specified as a DOMPoint, applies to the bottom-right corner."); +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.roundRect(0, 0, 100, 50, [0, 0, new DOMPoint(40, 20), 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// bottom-right corner +_assertPixel(canvas, 79,48, 255,0,0,255); +_assertPixel(canvas, 58,48, 0,255,0,255); +_assertPixel(canvas, 98,39, 255,0,0,255); +_assertPixel(canvas, 98,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 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/path-objects/2d.path.roundrect.4.radii.3.dompointinit.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompointinit.html new file mode 100644 index 0000000000..3b6f2fd863 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompointinit.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.path.roundrect.4.radii.3.dompointinit</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.4.radii.3.dompointinit</h1> +<p class="desc">Verify that when four radii are given to roundRect(), the third radius, specified as a DOMPointInit, applies to the bottom-right corner.</p> + + +<script> +var t = async_test("Verify that when four radii are given to roundRect(), the third radius, specified as a DOMPointInit, applies to the bottom-right corner."); +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.roundRect(0, 0, 100, 50, [0, 0, {x: 40, y: 20}, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// bottom-right corner +_assertPixel(canvas, 79,48, 255,0,0,255); +_assertPixel(canvas, 58,48, 0,255,0,255); +_assertPixel(canvas, 98,39, 255,0,0,255); +_assertPixel(canvas, 98,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 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/path-objects/2d.path.roundrect.4.radii.3.dompointinit.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompointinit.worker.js new file mode 100644 index 0000000000..65a3feb36f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompointinit.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.path.roundrect.4.radii.3.dompointinit +// Description:Verify that when four radii are given to roundRect(), the third radius, specified as a DOMPointInit, applies to the bottom-right corner. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when four radii are given to roundRect(), the third radius, specified as a DOMPointInit, applies to the bottom-right corner."); +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.roundRect(0, 0, 100, 50, [0, 0, {x: 40, y: 20}, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// bottom-right corner +_assertPixel(canvas, 79,48, 255,0,0,255); +_assertPixel(canvas, 58,48, 0,255,0,255); +_assertPixel(canvas, 98,39, 255,0,0,255); +_assertPixel(canvas, 98,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 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/path-objects/2d.path.roundrect.4.radii.3.double.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.double.html new file mode 100644 index 0000000000..3dd2af9800 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.double.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.4.radii.3.double</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.4.radii.3.double</h1> +<p class="desc">Verify that when four radii are given to roundRect(), the third radius, specified as a double, applies to the bottom-right corner.</p> + + +<script> +var t = async_test("Verify that when four radii are given to roundRect(), the third radius, specified as a double, applies to the bottom-right corner."); +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.roundRect(0, 0, 100, 50, [0, 0, 20, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 255,0,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.double.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.double.worker.js new file mode 100644 index 0000000000..a327ceac15 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.double.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.4.radii.3.double +// Description:Verify that when four radii are given to roundRect(), the third radius, specified as a double, applies to the bottom-right corner. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when four radii are given to roundRect(), the third radius, specified as a double, applies to the bottom-right corner."); +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.roundRect(0, 0, 100, 50, [0, 0, 20, 0]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 255,0,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompoint.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompoint.html new file mode 100644 index 0000000000..d61a3133cc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompoint.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.path.roundrect.4.radii.4.dompoint</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.4.radii.4.dompoint</h1> +<p class="desc">Verify that when four radii are given to roundRect(), the fourth radius, specified as a DOMPoint, applies to the bottom-left corner.</p> + + +<script> +var t = async_test("Verify that when four radii are given to roundRect(), the fourth radius, specified as a DOMPoint, applies to the bottom-left corner."); +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.roundRect(0, 0, 100, 50, [0, 0, 0, new DOMPoint(40, 20)]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// bottom-left corner +_assertPixel(canvas, 20,48, 255,0,0,255); +_assertPixel(canvas, 41,48, 0,255,0,255); +_assertPixel(canvas, 1,39, 255,0,0,255); +_assertPixel(canvas, 1,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompoint.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompoint.worker.js new file mode 100644 index 0000000000..d8a121e6da --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompoint.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.path.roundrect.4.radii.4.dompoint +// Description:Verify that when four radii are given to roundRect(), the fourth radius, specified as a DOMPoint, applies to the bottom-left corner. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when four radii are given to roundRect(), the fourth radius, specified as a DOMPoint, applies to the bottom-left corner."); +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.roundRect(0, 0, 100, 50, [0, 0, 0, new DOMPoint(40, 20)]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// bottom-left corner +_assertPixel(canvas, 20,48, 255,0,0,255); +_assertPixel(canvas, 41,48, 0,255,0,255); +_assertPixel(canvas, 1,39, 255,0,0,255); +_assertPixel(canvas, 1,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompointinit.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompointinit.html new file mode 100644 index 0000000000..94ffc00433 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompointinit.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.path.roundrect.4.radii.4.dompointinit</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.4.radii.4.dompointinit</h1> +<p class="desc">Verify that when four radii are given to roundRect(), the fourth radius, specified as a DOMPointInit, applies to the bottom-left corner.</p> + + +<script> +var t = async_test("Verify that when four radii are given to roundRect(), the fourth radius, specified as a DOMPointInit, applies to the bottom-left corner."); +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.roundRect(0, 0, 100, 50, [0, 0, 0, {x: 40, y: 20}]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// bottom-left corner +_assertPixel(canvas, 20,48, 255,0,0,255); +_assertPixel(canvas, 41,48, 0,255,0,255); +_assertPixel(canvas, 1,39, 255,0,0,255); +_assertPixel(canvas, 1,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompointinit.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompointinit.worker.js new file mode 100644 index 0000000000..b7babb5296 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompointinit.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.path.roundrect.4.radii.4.dompointinit +// Description:Verify that when four radii are given to roundRect(), the fourth radius, specified as a DOMPointInit, applies to the bottom-left corner. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when four radii are given to roundRect(), the fourth radius, specified as a DOMPointInit, applies to the bottom-left corner."); +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.roundRect(0, 0, 100, 50, [0, 0, 0, {x: 40, y: 20}]); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +// bottom-left corner +_assertPixel(canvas, 20,48, 255,0,0,255); +_assertPixel(canvas, 41,48, 0,255,0,255); +_assertPixel(canvas, 1,39, 255,0,0,255); +_assertPixel(canvas, 1,28, 0,255,0,255); + +// other corners +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.double.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.double.html new file mode 100644 index 0000000000..4ab2581847 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.double.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.4.radii.4.double</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.4.radii.4.double</h1> +<p class="desc">Verify that when four radii are given to roundRect(), the fourth radius, specified as a double, applies to the bottom-left corner.</p> + + +<script> +var t = async_test("Verify that when four radii are given to roundRect(), the fourth radius, specified as a double, applies to the bottom-left corner."); +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.roundRect(0, 0, 100, 50, [0, 0, 0, 20]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +_assertPixel(canvas, 1,48, 255,0,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.double.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.double.worker.js new file mode 100644 index 0000000000..ad4cca4953 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.double.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.4.radii.4.double +// Description:Verify that when four radii are given to roundRect(), the fourth radius, specified as a double, applies to the bottom-left corner. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when four radii are given to roundRect(), the fourth radius, specified as a double, applies to the bottom-left corner."); +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.roundRect(0, 0, 100, 50, [0, 0, 0, 20]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +_assertPixel(canvas, 1,48, 255,0,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.closed.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.closed.html new file mode 100644 index 0000000000..1b4abf012c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.closed.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.path.roundrect.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.path.roundrect.closed</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.strokeStyle = '#0f0'; +ctx.lineWidth = 200; +ctx.lineJoin = 'miter'; +ctx.roundRect(100, 50, 100, 100, [0]); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.closed.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.closed.worker.js new file mode 100644 index 0000000000..e0f1b81aa4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.closed.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.closed +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 200; +ctx.lineJoin = 'miter'; +ctx.roundRect(100, 50, 100, 100, [0]); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.1.html new file mode 100644 index 0000000000..5c6b3cd537 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.1.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.path.roundrect.end.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.end.1</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.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.roundRect(200, 100, 400, 1000, [0]); +ctx.lineTo(-2000, -1000); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.1.worker.js new file mode 100644 index 0000000000..1ec22bdb6a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.1.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.end.1 +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.roundRect(200, 100, 400, 1000, [0]); +ctx.lineTo(-2000, -1000); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.2.html new file mode 100644 index 0000000000..3913f69d41 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.2.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.end.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.end.2</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.strokeStyle = '#0f0'; +ctx.lineWidth = 450; +ctx.lineCap = 'round'; +ctx.lineJoin = 'bevel'; +ctx.roundRect(150, 150, 2000, 2000, [0]); +ctx.lineTo(160, 160); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.2.worker.js new file mode 100644 index 0000000000..c3085d53c3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.2.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.path.roundrect.end.2 +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 450; +ctx.lineCap = 'round'; +ctx.lineJoin = 'bevel'; +ctx.roundRect(150, 150, 2000, 2000, [0]); +ctx.lineTo(160, 160); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.3.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.3.html new file mode 100644 index 0000000000..349f13485c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.3.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.path.roundrect.end.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.end.3</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.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.roundRect(101, 51, 2000, 2000, [500, 500, 500, 500]); +ctx.lineTo(-1, -1); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.3.worker.js new file mode 100644 index 0000000000..52b9c44283 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.3.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.end.3 +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.roundRect(101, 51, 2000, 2000, [500, 500, 500, 500]); +ctx.lineTo(-1, -1); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.4.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.4.html new file mode 100644 index 0000000000..3c99e3970a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.4.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.path.roundrect.end.4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.end.4</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.strokeStyle = '#f00'; +ctx.lineWidth = 10; +ctx.roundRect(-1, -1, 2000, 2000, [1000, 1000, 1000, 1000]); +ctx.lineTo(-150, -150); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.4.worker.js new file mode 100644 index 0000000000..1d57b8978f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.4.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.end.4 +// 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.strokeStyle = '#f00'; +ctx.lineWidth = 10; +ctx.roundRect(-1, -1, 2000, 2000, [1000, 1000, 1000, 1000]); +ctx.lineTo(-150, -150); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 98,1, 0,255,0,255); +_assertPixel(canvas, 1,48, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.negative.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.negative.html new file mode 100644 index 0000000000..e3696ca1a5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.negative.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.path.roundrect.negative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.negative</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.beginPath(); +ctx.fillStyle = '#0f0'; +ctx.roundRect(0, 0, 50, 25, [10, 0, 0, 0]); +ctx.roundRect(100, 0, -50, 25, [10, 0, 0, 0]); +ctx.roundRect(0, 50, 50, -25, [10, 0, 0, 0]); +ctx.roundRect(100, 50, -50, -25, [10, 0, 0, 0]); +ctx.fill(); +// All rects drawn +_assertPixel(canvas, 25,12, 0,255,0,255); +_assertPixel(canvas, 75,12, 0,255,0,255); +_assertPixel(canvas, 25,37, 0,255,0,255); +_assertPixel(canvas, 75,37, 0,255,0,255); +// Correct corners are rounded. +_assertPixel(canvas, 1,1, 255,0,0,255); +_assertPixel(canvas, 98,1, 255,0,0,255); +_assertPixel(canvas, 1,48, 255,0,0,255); +_assertPixel(canvas, 98,48, 255,0,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.negative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.negative.worker.js new file mode 100644 index 0000000000..c34c20397a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.negative.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.path.roundrect.negative +// 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.beginPath(); +ctx.fillStyle = '#0f0'; +ctx.roundRect(0, 0, 50, 25, [10, 0, 0, 0]); +ctx.roundRect(100, 0, -50, 25, [10, 0, 0, 0]); +ctx.roundRect(0, 50, 50, -25, [10, 0, 0, 0]); +ctx.roundRect(100, 50, -50, -25, [10, 0, 0, 0]); +ctx.fill(); +// All rects drawn +_assertPixel(canvas, 25,12, 0,255,0,255); +_assertPixel(canvas, 75,12, 0,255,0,255); +_assertPixel(canvas, 25,37, 0,255,0,255); +_assertPixel(canvas, 75,37, 0,255,0,255); +// Correct corners are rounded. +_assertPixel(canvas, 1,1, 255,0,0,255); +_assertPixel(canvas, 98,1, 255,0,0,255); +_assertPixel(canvas, 1,48, 255,0,0,255); +_assertPixel(canvas, 98,48, 255,0,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.newsubpath.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.newsubpath.html new file mode 100644 index 0000000000..6d0a814907 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.newsubpath.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.newsubpath</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.newsubpath</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.beginPath(); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.moveTo(-100, 25); +ctx.lineTo(-50, 25); +ctx.roundRect(200, 25, 1, 1, [0]); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.newsubpath.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.newsubpath.worker.js new file mode 100644 index 0000000000..c6f7934bee --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.newsubpath.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.path.roundrect.newsubpath +// 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.beginPath(); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.moveTo(-100, 25); +ctx.lineTo(-50, 25); +ctx.roundRect(200, 25, 1, 1, [0]); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.nonfinite.html new file mode 100644 index 0000000000..2977350301 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.nonfinite.html @@ -0,0 +1,116 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.nonfinite</h1> +<p class="desc">roundRect() with Infinity/NaN is ignored</p> + + +<script> +var t = async_test("roundRect() with Infinity/NaN 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50) +ctx.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.roundRect(Infinity, 50, 1, 1, [0]); +ctx.roundRect(-Infinity, 50, 1, 1, [0]); +ctx.roundRect(NaN, 50, 1, 1, [0]); +ctx.roundRect(0, Infinity, 1, 1, [0]); +ctx.roundRect(0, -Infinity, 1, 1, [0]); +ctx.roundRect(0, NaN, 1, 1, [0]); +ctx.roundRect(0, 50, Infinity, 1, [0]); +ctx.roundRect(0, 50, -Infinity, 1, [0]); +ctx.roundRect(0, 50, NaN, 1, [0]); +ctx.roundRect(0, 50, 1, Infinity, [0]); +ctx.roundRect(0, 50, 1, -Infinity, [0]); +ctx.roundRect(0, 50, 1, NaN, [0]); +ctx.roundRect(0, 50, 1, 1, [Infinity]); +ctx.roundRect(0, 50, 1, 1, [-Infinity]); +ctx.roundRect(0, 50, 1, 1, [NaN]); +ctx.roundRect(0, 50, 1, 1, [Infinity,0]); +ctx.roundRect(0, 50, 1, 1, [-Infinity,0]); +ctx.roundRect(0, 50, 1, 1, [NaN,0]); +ctx.roundRect(0, 50, 1, 1, [0,Infinity]); +ctx.roundRect(0, 50, 1, 1, [0,-Infinity]); +ctx.roundRect(0, 50, 1, 1, [0,NaN]); +ctx.roundRect(0, 50, 1, 1, [Infinity,0,0]); +ctx.roundRect(0, 50, 1, 1, [-Infinity,0,0]); +ctx.roundRect(0, 50, 1, 1, [NaN,0,0]); +ctx.roundRect(0, 50, 1, 1, [0,Infinity,0]); +ctx.roundRect(0, 50, 1, 1, [0,-Infinity,0]); +ctx.roundRect(0, 50, 1, 1, [0,NaN,0]); +ctx.roundRect(0, 50, 1, 1, [0,0,Infinity]); +ctx.roundRect(0, 50, 1, 1, [0,0,-Infinity]); +ctx.roundRect(0, 50, 1, 1, [0,0,NaN]); +ctx.roundRect(0, 50, 1, 1, [Infinity,0,0,0]); +ctx.roundRect(0, 50, 1, 1, [-Infinity,0,0,0]); +ctx.roundRect(0, 50, 1, 1, [NaN,0,0,0]); +ctx.roundRect(0, 50, 1, 1, [0,Infinity,0,0]); +ctx.roundRect(0, 50, 1, 1, [0,-Infinity,0,0]); +ctx.roundRect(0, 50, 1, 1, [0,NaN,0,0]); +ctx.roundRect(0, 50, 1, 1, [0,0,Infinity,0]); +ctx.roundRect(0, 50, 1, 1, [0,0,-Infinity,0]); +ctx.roundRect(0, 50, 1, 1, [0,0,NaN,0]); +ctx.roundRect(0, 50, 1, 1, [0,0,0,Infinity]); +ctx.roundRect(0, 50, 1, 1, [0,0,0,-Infinity]); +ctx.roundRect(0, 50, 1, 1, [0,0,0,NaN]); +ctx.roundRect(Infinity, Infinity, 1, 1, [0]); +ctx.roundRect(Infinity, Infinity, Infinity, 1, [0]); +ctx.roundRect(Infinity, Infinity, Infinity, Infinity, [0]); +ctx.roundRect(Infinity, Infinity, Infinity, Infinity, [Infinity]); +ctx.roundRect(Infinity, Infinity, Infinity, 1, [Infinity]); +ctx.roundRect(Infinity, Infinity, 1, Infinity, [0]); +ctx.roundRect(Infinity, Infinity, 1, Infinity, [Infinity]); +ctx.roundRect(Infinity, Infinity, 1, 1, [Infinity]); +ctx.roundRect(Infinity, 50, Infinity, 1, [0]); +ctx.roundRect(Infinity, 50, Infinity, Infinity, [0]); +ctx.roundRect(Infinity, 50, Infinity, Infinity, [Infinity]); +ctx.roundRect(Infinity, 50, Infinity, 1, [Infinity]); +ctx.roundRect(Infinity, 50, 1, Infinity, [0]); +ctx.roundRect(Infinity, 50, 1, Infinity, [Infinity]); +ctx.roundRect(Infinity, 50, 1, 1, [Infinity]); +ctx.roundRect(0, Infinity, Infinity, 1, [0]); +ctx.roundRect(0, Infinity, Infinity, Infinity, [0]); +ctx.roundRect(0, Infinity, Infinity, Infinity, [Infinity]); +ctx.roundRect(0, Infinity, Infinity, 1, [Infinity]); +ctx.roundRect(0, Infinity, 1, Infinity, [0]); +ctx.roundRect(0, Infinity, 1, Infinity, [Infinity]); +ctx.roundRect(0, Infinity, 1, 1, [Infinity]); +ctx.roundRect(0, 50, Infinity, Infinity, [0]); +ctx.roundRect(0, 50, Infinity, Infinity, [Infinity]); +ctx.roundRect(0, 50, Infinity, 1, [Infinity]); +ctx.roundRect(0, 50, 1, Infinity, [Infinity]); +ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, Infinity)]); +ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, -Infinity)]); +ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, NaN)]); +ctx.roundRect(0, 0, 100, 100, [new DOMPoint(Infinity, 10)]); +ctx.roundRect(0, 0, 100, 100, [new DOMPoint(-Infinity, 10)]); +ctx.roundRect(0, 0, 100, 100, [new DOMPoint(NaN, 10)]); +ctx.roundRect(0, 0, 100, 100, [{x: 10, y: Infinity}]); +ctx.roundRect(0, 0, 100, 100, [{x: 10, y: -Infinity}]); +ctx.roundRect(0, 0, 100, 100, [{x: 10, y: NaN}]); +ctx.roundRect(0, 0, 100, 100, [{x: Infinity, y: 10}]); +ctx.roundRect(0, 0, 100, 100, [{x: -Infinity, y: 10}]); +ctx.roundRect(0, 0, 100, 100, [{x: NaN, y: 10}]); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 90,45, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.nonfinite.worker.js new file mode 100644 index 0000000000..68d0d8a09a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.nonfinite.worker.js @@ -0,0 +1,112 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.nonfinite +// Description:roundRect() with Infinity/NaN is ignored +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("roundRect() with Infinity/NaN 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50) +ctx.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.roundRect(Infinity, 50, 1, 1, [0]); +ctx.roundRect(-Infinity, 50, 1, 1, [0]); +ctx.roundRect(NaN, 50, 1, 1, [0]); +ctx.roundRect(0, Infinity, 1, 1, [0]); +ctx.roundRect(0, -Infinity, 1, 1, [0]); +ctx.roundRect(0, NaN, 1, 1, [0]); +ctx.roundRect(0, 50, Infinity, 1, [0]); +ctx.roundRect(0, 50, -Infinity, 1, [0]); +ctx.roundRect(0, 50, NaN, 1, [0]); +ctx.roundRect(0, 50, 1, Infinity, [0]); +ctx.roundRect(0, 50, 1, -Infinity, [0]); +ctx.roundRect(0, 50, 1, NaN, [0]); +ctx.roundRect(0, 50, 1, 1, [Infinity]); +ctx.roundRect(0, 50, 1, 1, [-Infinity]); +ctx.roundRect(0, 50, 1, 1, [NaN]); +ctx.roundRect(0, 50, 1, 1, [Infinity,0]); +ctx.roundRect(0, 50, 1, 1, [-Infinity,0]); +ctx.roundRect(0, 50, 1, 1, [NaN,0]); +ctx.roundRect(0, 50, 1, 1, [0,Infinity]); +ctx.roundRect(0, 50, 1, 1, [0,-Infinity]); +ctx.roundRect(0, 50, 1, 1, [0,NaN]); +ctx.roundRect(0, 50, 1, 1, [Infinity,0,0]); +ctx.roundRect(0, 50, 1, 1, [-Infinity,0,0]); +ctx.roundRect(0, 50, 1, 1, [NaN,0,0]); +ctx.roundRect(0, 50, 1, 1, [0,Infinity,0]); +ctx.roundRect(0, 50, 1, 1, [0,-Infinity,0]); +ctx.roundRect(0, 50, 1, 1, [0,NaN,0]); +ctx.roundRect(0, 50, 1, 1, [0,0,Infinity]); +ctx.roundRect(0, 50, 1, 1, [0,0,-Infinity]); +ctx.roundRect(0, 50, 1, 1, [0,0,NaN]); +ctx.roundRect(0, 50, 1, 1, [Infinity,0,0,0]); +ctx.roundRect(0, 50, 1, 1, [-Infinity,0,0,0]); +ctx.roundRect(0, 50, 1, 1, [NaN,0,0,0]); +ctx.roundRect(0, 50, 1, 1, [0,Infinity,0,0]); +ctx.roundRect(0, 50, 1, 1, [0,-Infinity,0,0]); +ctx.roundRect(0, 50, 1, 1, [0,NaN,0,0]); +ctx.roundRect(0, 50, 1, 1, [0,0,Infinity,0]); +ctx.roundRect(0, 50, 1, 1, [0,0,-Infinity,0]); +ctx.roundRect(0, 50, 1, 1, [0,0,NaN,0]); +ctx.roundRect(0, 50, 1, 1, [0,0,0,Infinity]); +ctx.roundRect(0, 50, 1, 1, [0,0,0,-Infinity]); +ctx.roundRect(0, 50, 1, 1, [0,0,0,NaN]); +ctx.roundRect(Infinity, Infinity, 1, 1, [0]); +ctx.roundRect(Infinity, Infinity, Infinity, 1, [0]); +ctx.roundRect(Infinity, Infinity, Infinity, Infinity, [0]); +ctx.roundRect(Infinity, Infinity, Infinity, Infinity, [Infinity]); +ctx.roundRect(Infinity, Infinity, Infinity, 1, [Infinity]); +ctx.roundRect(Infinity, Infinity, 1, Infinity, [0]); +ctx.roundRect(Infinity, Infinity, 1, Infinity, [Infinity]); +ctx.roundRect(Infinity, Infinity, 1, 1, [Infinity]); +ctx.roundRect(Infinity, 50, Infinity, 1, [0]); +ctx.roundRect(Infinity, 50, Infinity, Infinity, [0]); +ctx.roundRect(Infinity, 50, Infinity, Infinity, [Infinity]); +ctx.roundRect(Infinity, 50, Infinity, 1, [Infinity]); +ctx.roundRect(Infinity, 50, 1, Infinity, [0]); +ctx.roundRect(Infinity, 50, 1, Infinity, [Infinity]); +ctx.roundRect(Infinity, 50, 1, 1, [Infinity]); +ctx.roundRect(0, Infinity, Infinity, 1, [0]); +ctx.roundRect(0, Infinity, Infinity, Infinity, [0]); +ctx.roundRect(0, Infinity, Infinity, Infinity, [Infinity]); +ctx.roundRect(0, Infinity, Infinity, 1, [Infinity]); +ctx.roundRect(0, Infinity, 1, Infinity, [0]); +ctx.roundRect(0, Infinity, 1, Infinity, [Infinity]); +ctx.roundRect(0, Infinity, 1, 1, [Infinity]); +ctx.roundRect(0, 50, Infinity, Infinity, [0]); +ctx.roundRect(0, 50, Infinity, Infinity, [Infinity]); +ctx.roundRect(0, 50, Infinity, 1, [Infinity]); +ctx.roundRect(0, 50, 1, Infinity, [Infinity]); +ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, Infinity)]); +ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, -Infinity)]); +ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, NaN)]); +ctx.roundRect(0, 0, 100, 100, [new DOMPoint(Infinity, 10)]); +ctx.roundRect(0, 0, 100, 100, [new DOMPoint(-Infinity, 10)]); +ctx.roundRect(0, 0, 100, 100, [new DOMPoint(NaN, 10)]); +ctx.roundRect(0, 0, 100, 100, [{x: 10, y: Infinity}]); +ctx.roundRect(0, 0, 100, 100, [{x: 10, y: -Infinity}]); +ctx.roundRect(0, 0, 100, 100, [{x: 10, y: NaN}]); +ctx.roundRect(0, 0, 100, 100, [{x: Infinity, y: 10}]); +ctx.roundRect(0, 0, 100, 100, [{x: -Infinity, y: 10}]); +ctx.roundRect(0, 0, 100, 100, [{x: NaN, y: 10}]); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 90,45, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.1.html new file mode 100644 index 0000000000..c1916bf78f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.1.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.path.roundrect.radius.intersecting.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.radius.intersecting.1</h1> +<p class="desc">Check that roundRects with intersecting corner arcs are rendered correctly.</p> + + +<script> +var t = async_test("Check that roundRects with intersecting corner arcs are 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.roundRect(0, 0, 100, 50, [40, 40, 40, 40]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 2,25, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 97,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 255,0,0,255); +_assertPixel(canvas, 98,1, 255,0,0,255); +_assertPixel(canvas, 1,48, 255,0,0,255); +_assertPixel(canvas, 98,48, 255,0,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.1.worker.js new file mode 100644 index 0000000000..9da41478d9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.1.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.path.roundrect.radius.intersecting.1 +// Description:Check that roundRects with intersecting corner arcs are rendered correctly. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Check that roundRects with intersecting corner arcs are 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.roundRect(0, 0, 100, 50, [40, 40, 40, 40]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 2,25, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 97,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 255,0,0,255); +_assertPixel(canvas, 98,1, 255,0,0,255); +_assertPixel(canvas, 1,48, 255,0,0,255); +_assertPixel(canvas, 98,48, 255,0,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.2.html new file mode 100644 index 0000000000..f2a69c4ffc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.2.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.path.roundrect.radius.intersecting.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.radius.intersecting.2</h1> +<p class="desc">Check that roundRects with intersecting corner arcs are rendered correctly.</p> + + +<script> +var t = async_test("Check that roundRects with intersecting corner arcs are 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.roundRect(0, 0, 100, 50, [1000, 1000, 1000, 1000]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 2,25, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 97,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 255,0,0,255); +_assertPixel(canvas, 98,1, 255,0,0,255); +_assertPixel(canvas, 1,48, 255,0,0,255); +_assertPixel(canvas, 98,48, 255,0,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.2.worker.js new file mode 100644 index 0000000000..f0d3f57ca4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.2.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.path.roundrect.radius.intersecting.2 +// Description:Check that roundRects with intersecting corner arcs are rendered correctly. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Check that roundRects with intersecting corner arcs are 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.roundRect(0, 0, 100, 50, [1000, 1000, 1000, 1000]); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 2,25, 0,255,0,255); +_assertPixel(canvas, 50,1, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 50,48, 0,255,0,255); +_assertPixel(canvas, 97,25, 0,255,0,255); +_assertPixel(canvas, 1,1, 255,0,0,255); +_assertPixel(canvas, 98,1, 255,0,0,255); +_assertPixel(canvas, 1,48, 255,0,0,255); +_assertPixel(canvas, 98,48, 255,0,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.html new file mode 100644 index 0000000000..55e344d374 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.radius.negative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.radius.negative</h1> +<p class="desc">roundRect() with negative radius throws an exception</p> + + +<script> +var t = async_test("roundRect() with negative radius throws an exception"); +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'); + +assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [-1])}); +assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [1, -1])}); +assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [new DOMPoint(-1, 1), 1])}); +assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [new DOMPoint(1, -1)])}); +assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [{x: -1, y: 1}, 1])}); +assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [{x: 1, y: -1}])}); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.worker.js new file mode 100644 index 0000000000..050e5f7f00 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.radius.negative +// Description:roundRect() with negative radius throws an exception +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("roundRect() with negative radius throws an exception"); +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'); + +assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [-1])}); +assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [1, -1])}); +assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [new DOMPoint(-1, 1), 1])}); +assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [new DOMPoint(1, -1)])}); +assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [{x: -1, y: 1}, 1])}); +assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [{x: 1, y: -1}])}); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.none.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.none.html new file mode 100644 index 0000000000..530efe46b1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.none.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.radius.none</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.radius.none</h1> +<p class="desc">Check that roundRect throws an RangeError if radii is an empty array.</p> + + +<script> +var t = async_test("Check that roundRect throws an RangeError if radii is an empty array."); +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'); + +assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 100, 50, [])}); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.none.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.none.worker.js new file mode 100644 index 0000000000..3209e421de --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.none.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.radius.none +// Description:Check that roundRect throws an RangeError if radii is an empty array. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Check that roundRect throws an RangeError if radii is an empty array."); +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'); + +assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 100, 50, [])}); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.toomany.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.toomany.html new file mode 100644 index 0000000000..c667dc690a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.toomany.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.radius.toomany</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.radius.toomany</h1> +<p class="desc">Check that roundRect throws an IndeSizeError if radii has more than four items.</p> + + +<script> +var t = async_test("Check that roundRect throws an IndeSizeError if radii has more than four items."); +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'); + +assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 100, 50, [0, 0, 0, 0, 0])}); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.toomany.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.toomany.worker.js new file mode 100644 index 0000000000..3b05057eda --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.toomany.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.radius.toomany +// Description:Check that roundRect throws an IndeSizeError if radii has more than four items. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Check that roundRect throws an IndeSizeError if radii has more than four items."); +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'); + +assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 100, 50, [0, 0, 0, 0, 0])}); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.selfintersect.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.selfintersect.html new file mode 100644 index 0000000000..0ec2535490 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.selfintersect.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.path.roundrect.selfintersect</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.selfintersect</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.roundRect(0, 0, 100, 50, [0]); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 90; +ctx.beginPath(); +ctx.roundRect(45, 20, 10, 10, [0]); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.selfintersect.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.selfintersect.worker.js new file mode 100644 index 0000000000..8b6221414b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.selfintersect.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.selfintersect +// 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.roundRect(0, 0, 100, 50, [0]); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 90; +ctx.beginPath(); +ctx.roundRect(45, 20, 10, 10, [0]); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.winding.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.winding.html new file mode 100644 index 0000000000..e7f52fbf29 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.winding.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.winding</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.winding</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.beginPath(); +ctx.fillStyle = '#f00'; +ctx.roundRect(0, 0, 50, 50, [0]); +ctx.roundRect(100, 50, -50, -50, [0]); +ctx.roundRect(0, 25, 100, -25, [0]); +ctx.roundRect(100, 25, -100, 25, [0]); +ctx.fill(); +_assertPixel(canvas, 25,12, 0,255,0,255); +_assertPixel(canvas, 75,12, 0,255,0,255); +_assertPixel(canvas, 25,37, 0,255,0,255); +_assertPixel(canvas, 75,37, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.winding.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.winding.worker.js new file mode 100644 index 0000000000..82e6b5c313 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.winding.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.path.roundrect.winding +// 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.beginPath(); +ctx.fillStyle = '#f00'; +ctx.roundRect(0, 0, 50, 50, [0]); +ctx.roundRect(100, 50, -50, -50, [0]); +ctx.roundRect(0, 25, 100, -25, [0]); +ctx.roundRect(100, 25, -100, 25, [0]); +ctx.fill(); +_assertPixel(canvas, 25,12, 0,255,0,255); +_assertPixel(canvas, 75,12, 0,255,0,255); +_assertPixel(canvas, 25,37, 0,255,0,255); +_assertPixel(canvas, 75,37, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.1.html new file mode 100644 index 0000000000..252475194e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.1.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.path.roundrect.zero.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.zero.1</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.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.roundRect(0, 50, 100, 0, [0]); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.1.worker.js new file mode 100644 index 0000000000..17c9be78ec --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.1.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.zero.1 +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.roundRect(0, 50, 100, 0, [0]); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.2.html new file mode 100644 index 0000000000..2463e88f1e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.2.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.path.roundrect.zero.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.zero.2</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.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.roundRect(50, -100, 0, 250, [0]); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.2.worker.js new file mode 100644 index 0000000000..9ae058a847 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.2.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.zero.2 +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.roundRect(50, -100, 0, 250, [0]); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.3.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.3.html new file mode 100644 index 0000000000..39de433b08 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.3.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.path.roundrect.zero.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.zero.3</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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.roundRect(50, 25, 0, 0, [0]); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.3.worker.js new file mode 100644 index 0000000000..98d37e08e5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.3.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.zero.3 +// 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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.roundRect(50, 25, 0, 0, [0]); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.4.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.4.html new file mode 100644 index 0000000000..3c6c734b19 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.4.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.path.roundrect.zero.4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.zero.4</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.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.roundRect(100, 25, 0, 0, [0]); +ctx.lineTo(0, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.4.worker.js new file mode 100644 index 0000000000..462cde2a03 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.4.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.zero.4 +// 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.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.roundRect(100, 25, 0, 0, [0]); +ctx.lineTo(0, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.5.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.5.html new file mode 100644 index 0000000000..de66603a66 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.5.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.path.roundrect.zero.5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.zero.5</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.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.moveTo(0, 0); +ctx.roundRect(100, 25, 0, 0, [0]); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.5.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.5.worker.js new file mode 100644 index 0000000000..0f706ce246 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.5.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.zero.5 +// 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.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.moveTo(0, 0); +ctx.roundRect(100, 25, 0, 0, [0]); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.6.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.6.html new file mode 100644 index 0000000000..bd7ef0fa94 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.6.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.zero.6</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.zero.6</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.strokeStyle = '#f00'; +ctx.lineJoin = 'miter'; +ctx.miterLimit = 1.5; +ctx.lineWidth = 200; +ctx.beginPath(); +ctx.roundRect(100, 25, 1000, 0, [0]); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.6.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.6.worker.js new file mode 100644 index 0000000000..f2115cdd46 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.6.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.path.roundrect.zero.6 +// 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.strokeStyle = '#f00'; +ctx.lineJoin = 'miter'; +ctx.miterLimit = 1.5; +ctx.lineWidth = 200; +ctx.beginPath(); +ctx.roundRect(100, 25, 1000, 0, [0]); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.empty.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.empty.html new file mode 100644 index 0000000000..a873b260da --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.empty.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.path.stroke.empty</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.stroke.empty</h1> +<p class="desc">Empty subpaths are not stroked</p> + + +<script> +var t = async_test("Empty subpaths are not stroked"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.lineCap = 'round'; +ctx.lineJoin = 'round'; +ctx.beginPath(); +ctx.moveTo(40, 25); +ctx.moveTo(60, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.empty.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.empty.worker.js new file mode 100644 index 0000000000..1852c91876 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.empty.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.stroke.empty +// Description:Empty subpaths are not stroked +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Empty subpaths are not stroked"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.lineCap = 'round'; +ctx.lineJoin = 'round'; +ctx.beginPath(); +ctx.moveTo(40, 25); +ctx.moveTo(60, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.overlap.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.overlap.html new file mode 100644 index 0000000000..252a840ed7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.overlap.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.stroke.overlap</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.stroke.overlap</h1> +<p class="desc">Stroked subpaths are combined before being drawn</p> + + +<script> +var t = async_test("Stroked subpaths are combined before being drawn"); +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 = '#000'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = 'rgba(0, 255, 0, 0.5)'; +ctx.lineWidth = 50; +ctx.moveTo(0, 20); +ctx.lineTo(100, 20); +ctx.moveTo(0, 30); +ctx.lineTo(100, 30); +ctx.stroke(); +_assertPixelApprox(canvas, 50,25, 0,127,0,255, 1); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.overlap.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.overlap.worker.js new file mode 100644 index 0000000000..aa7cc51d77 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.overlap.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.path.stroke.overlap +// Description:Stroked subpaths are combined before being drawn +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Stroked subpaths are combined before being drawn"); +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 = '#000'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = 'rgba(0, 255, 0, 0.5)'; +ctx.lineWidth = 50; +ctx.moveTo(0, 20); +ctx.lineTo(100, 20); +ctx.moveTo(0, 30); +ctx.lineTo(100, 30); +ctx.stroke(); +_assertPixelApprox(canvas, 50,25, 0,127,0,255, 1); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.arc.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.arc.html new file mode 100644 index 0000000000..67f25440dc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.arc.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.path.stroke.prune.arc</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.stroke.prune.arc</h1> +<p class="desc">Zero-length line segments from arcTo and arc are removed before stroking</p> + + +<script> +var t = async_test("Zero-length line segments from arcTo and arc are removed before stroking"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.lineCap = 'round'; +ctx.lineJoin = 'round'; +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.arcTo(50, 25, 150, 25, 10); +ctx.stroke(); +ctx.beginPath(); +ctx.moveTo(60, 25); +ctx.arc(50, 25, 10, 0, 0, false); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.arc.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.arc.worker.js new file mode 100644 index 0000000000..ca5844ce2a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.arc.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.path.stroke.prune.arc +// Description:Zero-length line segments from arcTo and arc are removed before stroking +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Zero-length line segments from arcTo and arc are removed before stroking"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.lineCap = 'round'; +ctx.lineJoin = 'round'; +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.arcTo(50, 25, 150, 25, 10); +ctx.stroke(); +ctx.beginPath(); +ctx.moveTo(60, 25); +ctx.arc(50, 25, 10, 0, 0, false); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.closed.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.closed.html new file mode 100644 index 0000000000..1012975fcf --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.closed.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.stroke.prune.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.path.stroke.prune.closed</h1> +<p class="desc">Zero-length line segments from closed paths are removed before stroking</p> + + +<script> +var t = async_test("Zero-length line segments from closed paths are removed before stroking"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.lineCap = 'round'; +ctx.lineJoin = 'round'; +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.lineTo(50, 25); +ctx.closePath(); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.closed.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.closed.worker.js new file mode 100644 index 0000000000..9b3426f6d0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.closed.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.stroke.prune.closed +// Description:Zero-length line segments from closed paths are removed before stroking +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Zero-length line segments from closed paths are removed before stroking"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.lineCap = 'round'; +ctx.lineJoin = 'round'; +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.lineTo(50, 25); +ctx.closePath(); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.corner.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.corner.html new file mode 100644 index 0000000000..553fdb6165 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.corner.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.path.stroke.prune.corner</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.stroke.prune.corner</h1> +<p class="desc">Zero-length line segments are removed before stroking with miters</p> + + +<script> +var t = async_test("Zero-length line segments are removed before stroking with miters"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 400; +ctx.lineJoin = 'miter'; +ctx.miterLimit = 1.4; +ctx.beginPath(); +ctx.moveTo(-1000, 200); +ctx.lineTo(-100, 200); +ctx.lineTo(-100, 200); +ctx.lineTo(-100, 200); +ctx.lineTo(-100, 1000); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.corner.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.corner.worker.js new file mode 100644 index 0000000000..c2233bbc15 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.corner.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.path.stroke.prune.corner +// Description:Zero-length line segments are removed before stroking with miters +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Zero-length line segments are removed before stroking with miters"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 400; +ctx.lineJoin = 'miter'; +ctx.miterLimit = 1.4; +ctx.beginPath(); +ctx.moveTo(-1000, 200); +ctx.lineTo(-100, 200); +ctx.lineTo(-100, 200); +ctx.lineTo(-100, 200); +ctx.lineTo(-100, 1000); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.curve.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.curve.html new file mode 100644 index 0000000000..ae2f922a41 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.curve.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.path.stroke.prune.curve</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.stroke.prune.curve</h1> +<p class="desc">Zero-length line segments from quadraticCurveTo and bezierCurveTo are removed before stroking</p> + + +<script> +var t = async_test("Zero-length line segments from quadraticCurveTo and bezierCurveTo are removed before stroking"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.lineCap = 'round'; +ctx.lineJoin = 'round'; +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.quadraticCurveTo(50, 25, 50, 25); +ctx.stroke(); +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.bezierCurveTo(50, 25, 50, 25, 50, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.curve.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.curve.worker.js new file mode 100644 index 0000000000..7dc88a7213 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.curve.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.path.stroke.prune.curve +// Description:Zero-length line segments from quadraticCurveTo and bezierCurveTo are removed before stroking +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Zero-length line segments from quadraticCurveTo and bezierCurveTo are removed before stroking"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.lineCap = 'round'; +ctx.lineJoin = 'round'; +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.quadraticCurveTo(50, 25, 50, 25); +ctx.stroke(); +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.bezierCurveTo(50, 25, 50, 25, 50, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.line.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.line.html new file mode 100644 index 0000000000..e9163cab40 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.line.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.path.stroke.prune.line</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.stroke.prune.line</h1> +<p class="desc">Zero-length line segments from lineTo are removed before stroking</p> + + +<script> +var t = async_test("Zero-length line segments from lineTo are removed before stroking"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.lineCap = 'round'; +ctx.lineJoin = 'round'; +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.lineTo(50, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.line.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.line.worker.js new file mode 100644 index 0000000000..160bbe7eea --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.line.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.stroke.prune.line +// Description:Zero-length line segments from lineTo are removed before stroking +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Zero-length line segments from lineTo are removed before stroking"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.lineCap = 'round'; +ctx.lineJoin = 'round'; +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.lineTo(50, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.rect.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.rect.html new file mode 100644 index 0000000000..72d0d6b6e9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.rect.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.path.stroke.prune.rect</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.stroke.prune.rect</h1> +<p class="desc">Zero-length line segments from rect and strokeRect are removed before stroking</p> + + +<script> +var t = async_test("Zero-length line segments from rect and strokeRect are removed before stroking"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.lineCap = 'round'; +ctx.lineJoin = 'round'; +ctx.beginPath(); +ctx.rect(50, 25, 0, 0); +ctx.stroke(); +ctx.strokeRect(50, 25, 0, 0); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.rect.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.rect.worker.js new file mode 100644 index 0000000000..c6ed67ed9e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.rect.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.stroke.prune.rect +// Description:Zero-length line segments from rect and strokeRect are removed before stroking +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Zero-length line segments from rect and strokeRect are removed before stroking"); +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.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.lineCap = 'round'; +ctx.lineJoin = 'round'; +ctx.beginPath(); +ctx.rect(50, 25, 0, 0); +ctx.stroke(); +ctx.strokeRect(50, 25, 0, 0); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale1.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale1.html new file mode 100644 index 0000000000..e13fd9fe55 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale1.html @@ -0,0 +1,51 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.stroke.scale1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.stroke.scale1</h1> +<p class="desc">Stroke line widths are scaled by the current transformation matrix</p> + + +<script> +var t = async_test("Stroke line widths are scaled by the current transformation matrix"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.beginPath(); +ctx.rect(25, 12.5, 50, 25); +ctx.save(); +ctx.scale(50, 25); +ctx.strokeStyle = '#0f0'; +ctx.stroke(); +ctx.restore(); +ctx.beginPath(); +ctx.rect(-25, -12.5, 150, 75); +ctx.save(); +ctx.scale(50, 25); +ctx.strokeStyle = '#f00'; +ctx.stroke(); +ctx.restore(); +_assertPixel(canvas, 0,0, 0,255,0,255); +_assertPixel(canvas, 50,0, 0,255,0,255); +_assertPixel(canvas, 99,0, 0,255,0,255); +_assertPixel(canvas, 0,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 99,25, 0,255,0,255); +_assertPixel(canvas, 0,49, 0,255,0,255); +_assertPixel(canvas, 50,49, 0,255,0,255); +_assertPixel(canvas, 99,49, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale1.worker.js new file mode 100644 index 0000000000..ef7b2d4d04 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale1.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.path.stroke.scale1 +// Description:Stroke line widths are scaled by the current transformation matrix +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Stroke line widths are scaled by the current transformation matrix"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.beginPath(); +ctx.rect(25, 12.5, 50, 25); +ctx.save(); +ctx.scale(50, 25); +ctx.strokeStyle = '#0f0'; +ctx.stroke(); +ctx.restore(); +ctx.beginPath(); +ctx.rect(-25, -12.5, 150, 75); +ctx.save(); +ctx.scale(50, 25); +ctx.strokeStyle = '#f00'; +ctx.stroke(); +ctx.restore(); +_assertPixel(canvas, 0,0, 0,255,0,255); +_assertPixel(canvas, 50,0, 0,255,0,255); +_assertPixel(canvas, 99,0, 0,255,0,255); +_assertPixel(canvas, 0,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 99,25, 0,255,0,255); +_assertPixel(canvas, 0,49, 0,255,0,255); +_assertPixel(canvas, 50,49, 0,255,0,255); +_assertPixel(canvas, 99,49, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale2.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale2.html new file mode 100644 index 0000000000..2b80f16898 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale2.html @@ -0,0 +1,53 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.stroke.scale2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.stroke.scale2</h1> +<p class="desc">Stroke line widths are scaled by the current transformation matrix</p> + + +<script> +var t = async_test("Stroke line widths are scaled by the current transformation matrix"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.beginPath(); +ctx.rect(25, 12.5, 50, 25); +ctx.save(); +ctx.rotate(Math.PI/2); +ctx.scale(25, 50); +ctx.strokeStyle = '#0f0'; +ctx.stroke(); +ctx.restore(); +ctx.beginPath(); +ctx.rect(-25, -12.5, 150, 75); +ctx.save(); +ctx.rotate(Math.PI/2); +ctx.scale(25, 50); +ctx.strokeStyle = '#f00'; +ctx.stroke(); +ctx.restore(); +_assertPixel(canvas, 0,0, 0,255,0,255); +_assertPixel(canvas, 50,0, 0,255,0,255); +_assertPixel(canvas, 99,0, 0,255,0,255); +_assertPixel(canvas, 0,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 99,25, 0,255,0,255); +_assertPixel(canvas, 0,49, 0,255,0,255); +_assertPixel(canvas, 50,49, 0,255,0,255); +_assertPixel(canvas, 99,49, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale2.worker.js new file mode 100644 index 0000000000..9c6d4fbf54 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale2.worker.js @@ -0,0 +1,49 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.stroke.scale2 +// Description:Stroke line widths are scaled by the current transformation matrix +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Stroke line widths are scaled by the current transformation matrix"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.beginPath(); +ctx.rect(25, 12.5, 50, 25); +ctx.save(); +ctx.rotate(Math.PI/2); +ctx.scale(25, 50); +ctx.strokeStyle = '#0f0'; +ctx.stroke(); +ctx.restore(); +ctx.beginPath(); +ctx.rect(-25, -12.5, 150, 75); +ctx.save(); +ctx.rotate(Math.PI/2); +ctx.scale(25, 50); +ctx.strokeStyle = '#f00'; +ctx.stroke(); +ctx.restore(); +_assertPixel(canvas, 0,0, 0,255,0,255); +_assertPixel(canvas, 50,0, 0,255,0,255); +_assertPixel(canvas, 99,0, 0,255,0,255); +_assertPixel(canvas, 0,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 99,25, 0,255,0,255); +_assertPixel(canvas, 0,49, 0,255,0,255); +_assertPixel(canvas, 50,49, 0,255,0,255); +_assertPixel(canvas, 99,49, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.skew.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.skew.html new file mode 100644 index 0000000000..55e96e08e0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.skew.html @@ -0,0 +1,66 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.stroke.skew</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.stroke.skew</h1> +<p class="desc">Strokes lines are skewed by the current transformation matrix</p> + + +<script> +var t = async_test("Strokes lines are skewed by the current transformation matrix"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.save(); +ctx.beginPath(); +ctx.moveTo(49, -50); +ctx.lineTo(201, -50); +ctx.rotate(Math.PI/4); +ctx.scale(1, 283); +ctx.strokeStyle = '#0f0'; +ctx.stroke(); +ctx.restore(); +ctx.save(); +ctx.beginPath(); +ctx.translate(-150, 0); +ctx.moveTo(49, -50); +ctx.lineTo(199, -50); +ctx.rotate(Math.PI/4); +ctx.scale(1, 142); +ctx.strokeStyle = '#f00'; +ctx.stroke(); +ctx.restore(); +ctx.save(); +ctx.beginPath(); +ctx.translate(-150, 0); +ctx.moveTo(49, -50); +ctx.lineTo(199, -50); +ctx.rotate(Math.PI/4); +ctx.scale(1, 142); +ctx.strokeStyle = '#f00'; +ctx.stroke(); +ctx.restore(); +_assertPixel(canvas, 0,0, 0,255,0,255); +_assertPixel(canvas, 50,0, 0,255,0,255); +_assertPixel(canvas, 99,0, 0,255,0,255); +_assertPixel(canvas, 0,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 99,25, 0,255,0,255); +_assertPixel(canvas, 0,49, 0,255,0,255); +_assertPixel(canvas, 50,49, 0,255,0,255); +_assertPixel(canvas, 99,49, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.skew.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.skew.worker.js new file mode 100644 index 0000000000..745afe4ff5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.skew.worker.js @@ -0,0 +1,62 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.stroke.skew +// Description:Strokes lines are skewed by the current transformation matrix +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Strokes lines are skewed by the current transformation matrix"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.save(); +ctx.beginPath(); +ctx.moveTo(49, -50); +ctx.lineTo(201, -50); +ctx.rotate(Math.PI/4); +ctx.scale(1, 283); +ctx.strokeStyle = '#0f0'; +ctx.stroke(); +ctx.restore(); +ctx.save(); +ctx.beginPath(); +ctx.translate(-150, 0); +ctx.moveTo(49, -50); +ctx.lineTo(199, -50); +ctx.rotate(Math.PI/4); +ctx.scale(1, 142); +ctx.strokeStyle = '#f00'; +ctx.stroke(); +ctx.restore(); +ctx.save(); +ctx.beginPath(); +ctx.translate(-150, 0); +ctx.moveTo(49, -50); +ctx.lineTo(199, -50); +ctx.rotate(Math.PI/4); +ctx.scale(1, 142); +ctx.strokeStyle = '#f00'; +ctx.stroke(); +ctx.restore(); +_assertPixel(canvas, 0,0, 0,255,0,255); +_assertPixel(canvas, 50,0, 0,255,0,255); +_assertPixel(canvas, 99,0, 0,255,0,255); +_assertPixel(canvas, 0,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 99,25, 0,255,0,255); +_assertPixel(canvas, 0,49, 0,255,0,255); +_assertPixel(canvas, 50,49, 0,255,0,255); +_assertPixel(canvas, 99,49, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.unaffected.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.unaffected.html new file mode 100644 index 0000000000..58e7f75dc8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.unaffected.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.stroke.unaffected</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.stroke.unaffected</h1> +<p class="desc">Stroking does not start a new path or subpath</p> + + +<script> +var t = async_test("Stroking does not start a new path or subpath"); +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 = 50; +ctx.moveTo(-100, 25); +ctx.lineTo(-100, -100); +ctx.lineTo(200, -100); +ctx.lineTo(200, 25); +ctx.strokeStyle = '#f00'; +ctx.stroke(); +ctx.closePath(); +ctx.strokeStyle = '#0f0'; +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.unaffected.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.unaffected.worker.js new file mode 100644 index 0000000000..a47c32d009 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.unaffected.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.path.stroke.unaffected +// Description:Stroking does not start a new path or subpath +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Stroking does not start a new path or subpath"); +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 = 50; +ctx.moveTo(-100, 25); +ctx.lineTo(-100, -100); +ctx.lineTo(200, -100); +ctx.lineTo(200, 25); +ctx.strokeStyle = '#f00'; +ctx.stroke(); +ctx.closePath(); +ctx.strokeStyle = '#0f0'; +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.union.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.union.html new file mode 100644 index 0000000000..c3f063fe52 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.union.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.stroke.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.path.stroke.union</h1> +<p class="desc">Strokes in opposite directions are unioned, not subtracted</p> + + +<script> +var t = async_test("Strokes in opposite directions are unioned, not subtracted"); +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 = 40; +ctx.moveTo(0, 10); +ctx.lineTo(100, 10); +ctx.moveTo(100, 40); +ctx.lineTo(0, 40); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.union.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.union.worker.js new file mode 100644 index 0000000000..282cb10bf7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.stroke.union.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.path.stroke.union +// Description:Strokes in opposite directions are unioned, not subtracted +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Strokes in opposite directions are unioned, not subtracted"); +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 = 40; +ctx.moveTo(0, 10); +ctx.lineTo(100, 10); +ctx.moveTo(100, 40); +ctx.lineTo(0, 40); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.transformation.basic.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.transformation.basic.html new file mode 100644 index 0000000000..1837004138 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.transformation.basic.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.path.transformation.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.path.transformation.basic</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.translate(-100, 0); +ctx.rect(100, 0, 100, 50); +ctx.translate(0, -100); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.transformation.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.transformation.basic.worker.js new file mode 100644 index 0000000000..7bc112dd1d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.transformation.basic.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.transformation.basic +// 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.translate(-100, 0); +ctx.rect(100, 0, 100, 50); +ctx.translate(0, -100); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.transformation.changing.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.transformation.changing.html new file mode 100644 index 0000000000..b8a467387d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.transformation.changing.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.path.transformation.changing</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.transformation.changing</h1> +<p class="desc">Transformations are applied while building paths, not when drawing</p> + + +<script> +var t = async_test("Transformations are applied while building paths, not when drawing"); +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.fillStyle = '#0f0'; +ctx.moveTo(0, 0); +ctx.translate(100, 0); +ctx.lineTo(0, 0); +ctx.translate(0, 50); +ctx.lineTo(0, 0); +ctx.translate(-100, 0); +ctx.lineTo(0, 0); +ctx.translate(1000, 1000); +ctx.rotate(Math.PI/2); +ctx.scale(0.1, 0.1); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.transformation.changing.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.transformation.changing.worker.js new file mode 100644 index 0000000000..2460d24b19 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.transformation.changing.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.path.transformation.changing +// Description:Transformations are applied while building paths, not when drawing +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Transformations are applied while building paths, not when drawing"); +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.fillStyle = '#0f0'; +ctx.moveTo(0, 0); +ctx.translate(100, 0); +ctx.lineTo(0, 0); +ctx.translate(0, 50); +ctx.lineTo(0, 0); +ctx.translate(-100, 0); +ctx.lineTo(0, 0); +ctx.translate(1000, 1000); +ctx.rotate(Math.PI/2); +ctx.scale(0.1, 0.1); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.transformation.multiple.html b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.transformation.multiple.html new file mode 100644 index 0000000000..fcc2942435 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.transformation.multiple.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.path.transformation.multiple</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.transformation.multiple</h1> +<p class="desc">Transformations are applied while building paths, not when drawing</p> + + +<script> +var t = async_test("Transformations are applied while building paths, not when drawing"); +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.translate(-100, 0); +ctx.rect(0, 0, 100, 50); +ctx.fill(); +ctx.translate(100, 0); +ctx.fill(); +ctx.beginPath(); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.translate(0, -50); +ctx.moveTo(0, 25); +ctx.lineTo(100, 25); +ctx.stroke(); +ctx.translate(0, 50); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.transformation.multiple.worker.js b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.transformation.multiple.worker.js new file mode 100644 index 0000000000..a2a04ca777 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/path-objects/2d.path.transformation.multiple.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.path.transformation.multiple +// Description:Transformations are applied while building paths, not when drawing +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Transformations are applied while building paths, not when drawing"); +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.translate(-100, 0); +ctx.rect(0, 0, 100, 50); +ctx.fill(); +ctx.translate(100, 0); +ctx.fill(); +ctx.beginPath(); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.translate(0, -50); +ctx.moveTo(0, 25); +ctx.lineTo(100, 25); +ctx.stroke(); +ctx.translate(0, 50); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.basic.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.basic.html new file mode 100644 index 0000000000..24d9a77405 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.basic.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.create1.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.imageData.create1.basic</h1> +<p class="desc">createImageData(imgdata) exists and returns something</p> + + +<script> +var t = async_test("createImageData(imgdata) exists and returns something"); +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'); + +_assertDifferent(ctx.createImageData(ctx.createImageData(1, 1)), null, "ctx.createImageData(ctx.createImageData(1, 1))", "null"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.basic.worker.js new file mode 100644 index 0000000000..54d2cadb1c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.basic.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.create1.basic +// Description:createImageData(imgdata) exists and returns something +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("createImageData(imgdata) exists and returns something"); +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'); + +_assertDifferent(ctx.createImageData(ctx.createImageData(1, 1)), null, "ctx.createImageData(ctx.createImageData(1, 1))", "null"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.initial.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.initial.html new file mode 100644 index 0000000000..658ae83b56 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.initial.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.create1.initial</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.create1.initial</h1> +<p class="desc">createImageData(imgdata) returns transparent black data of the right size</p> + + +<script> +var t = async_test("createImageData(imgdata) returns transparent black data of the right size"); +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 imgdata1 = ctx.getImageData(0, 0, 10, 20); +var imgdata2 = ctx.createImageData(imgdata1); +_assertSame(imgdata2.data.length, imgdata1.data.length, "imgdata2.data.length", "imgdata1.data.length"); +_assertSame(imgdata2.width, imgdata1.width, "imgdata2.width", "imgdata1.width"); +_assertSame(imgdata2.height, imgdata1.height, "imgdata2.height", "imgdata1.height"); +var isTransparentBlack = true; +for (var i = 0; i < imgdata2.data.length; ++i) + if (imgdata2.data[i] !== 0) + isTransparentBlack = false; +_assert(isTransparentBlack, "isTransparentBlack"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.initial.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.initial.worker.js new file mode 100644 index 0000000000..bfff76b29f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.initial.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.create1.initial +// Description:createImageData(imgdata) returns transparent black data of the right size +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("createImageData(imgdata) returns transparent black data of the right size"); +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 imgdata1 = ctx.getImageData(0, 0, 10, 20); +var imgdata2 = ctx.createImageData(imgdata1); +_assertSame(imgdata2.data.length, imgdata1.data.length, "imgdata2.data.length", "imgdata1.data.length"); +_assertSame(imgdata2.width, imgdata1.width, "imgdata2.width", "imgdata1.width"); +_assertSame(imgdata2.height, imgdata1.height, "imgdata2.height", "imgdata1.height"); +var isTransparentBlack = true; +for (var i = 0; i < imgdata2.data.length; ++i) + if (imgdata2.data[i] !== 0) + isTransparentBlack = false; +_assert(isTransparentBlack, "isTransparentBlack"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.zero.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.zero.html new file mode 100644 index 0000000000..736725f0fd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.zero.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.create1.zero</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.create1.zero</h1> +<p class="desc">createImageData(null) throws TypeError</p> + + +<script> +var t = async_test("createImageData(null) throws TypeError"); +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'); + +assert_throws_js(TypeError, function() { ctx.createImageData(null); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.zero.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.zero.worker.js new file mode 100644 index 0000000000..c51067ed62 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.zero.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.create1.zero +// Description:createImageData(null) throws TypeError +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("createImageData(null) throws TypeError"); +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'); + +assert_throws_js(TypeError, function() { ctx.createImageData(null); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.basic.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.basic.html new file mode 100644 index 0000000000..7dca77e4ae --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.basic.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.create2.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.imageData.create2.basic</h1> +<p class="desc">createImageData(sw, sh) exists and returns something</p> + + +<script> +var t = async_test("createImageData(sw, sh) exists and returns something"); +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'); + +_assertDifferent(ctx.createImageData(1, 1), null, "ctx.createImageData(1, 1)", "null"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.basic.worker.js new file mode 100644 index 0000000000..e99cbe276b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.basic.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.create2.basic +// Description:createImageData(sw, sh) exists and returns something +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("createImageData(sw, sh) exists and returns something"); +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'); + +_assertDifferent(ctx.createImageData(1, 1), null, "ctx.createImageData(1, 1)", "null"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.initial.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.initial.html new file mode 100644 index 0000000000..76017f5c4f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.initial.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.create2.initial</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.create2.initial</h1> +<p class="desc">createImageData(sw, sh) returns transparent black data of the right size</p> + + +<script> +var t = async_test("createImageData(sw, sh) returns transparent black data of the right size"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.createImageData(10, 20); +_assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); +_assert(imgdata.width < imgdata.height, "imgdata.width < imgdata.height"); +_assert(imgdata.width > 0, "imgdata.width > 0"); +var isTransparentBlack = true; +for (var i = 0; i < imgdata.data.length; ++i) + if (imgdata.data[i] !== 0) + isTransparentBlack = false; +_assert(isTransparentBlack, "isTransparentBlack"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.initial.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.initial.worker.js new file mode 100644 index 0000000000..0e681dee07 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.initial.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.create2.initial +// Description:createImageData(sw, sh) returns transparent black data of the right size +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("createImageData(sw, sh) returns transparent black data of the right size"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.createImageData(10, 20); +_assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); +_assert(imgdata.width < imgdata.height, "imgdata.width < imgdata.height"); +_assert(imgdata.width > 0, "imgdata.width > 0"); +var isTransparentBlack = true; +for (var i = 0; i < imgdata.data.length; ++i) + if (imgdata.data[i] !== 0) + isTransparentBlack = false; +_assert(isTransparentBlack, "isTransparentBlack"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.large.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.large.html new file mode 100644 index 0000000000..f3d19d3f29 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.large.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.create2.large</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.create2.large</h1> +<p class="desc">createImageData(sw, sh) works for sizes much larger than the canvas</p> + + +<script> +var t = async_test("createImageData(sw, sh) works for sizes much larger than the canvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.createImageData(1000, 2000); +_assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); +_assert(imgdata.width < imgdata.height, "imgdata.width < imgdata.height"); +_assert(imgdata.width > 0, "imgdata.width > 0"); +var isTransparentBlack = true; +for (var i = 0; i < imgdata.data.length; i += 7813) // check ~1024 points (assuming normal scaling) + if (imgdata.data[i] !== 0) + isTransparentBlack = false; +_assert(isTransparentBlack, "isTransparentBlack"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.large.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.large.worker.js new file mode 100644 index 0000000000..57dda69d4d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.large.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.create2.large +// Description:createImageData(sw, sh) works for sizes much larger than the canvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("createImageData(sw, sh) works for sizes much larger than the canvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.createImageData(1000, 2000); +_assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); +_assert(imgdata.width < imgdata.height, "imgdata.width < imgdata.height"); +_assert(imgdata.width > 0, "imgdata.width > 0"); +var isTransparentBlack = true; +for (var i = 0; i < imgdata.data.length; i += 7813) // check ~1024 points (assuming normal scaling) + if (imgdata.data[i] !== 0) + isTransparentBlack = false; +_assert(isTransparentBlack, "isTransparentBlack"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.negative.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.negative.html new file mode 100644 index 0000000000..f4b4df99a8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.negative.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.create2.negative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.create2.negative</h1> +<p class="desc">createImageData(sw, sh) takes the absolute magnitude of the size arguments</p> + + +<script> +var t = async_test("createImageData(sw, sh) takes the absolute magnitude of the size arguments"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata1 = ctx.createImageData(10, 20); +var imgdata2 = ctx.createImageData(-10, 20); +var imgdata3 = ctx.createImageData(10, -20); +var imgdata4 = ctx.createImageData(-10, -20); +_assertSame(imgdata1.data.length, imgdata2.data.length, "imgdata1.data.length", "imgdata2.data.length"); +_assertSame(imgdata2.data.length, imgdata3.data.length, "imgdata2.data.length", "imgdata3.data.length"); +_assertSame(imgdata3.data.length, imgdata4.data.length, "imgdata3.data.length", "imgdata4.data.length"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.negative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.negative.worker.js new file mode 100644 index 0000000000..a5cb857295 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.negative.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.imageData.create2.negative +// Description:createImageData(sw, sh) takes the absolute magnitude of the size arguments +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("createImageData(sw, sh) takes the absolute magnitude of the size arguments"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata1 = ctx.createImageData(10, 20); +var imgdata2 = ctx.createImageData(-10, 20); +var imgdata3 = ctx.createImageData(10, -20); +var imgdata4 = ctx.createImageData(-10, -20); +_assertSame(imgdata1.data.length, imgdata2.data.length, "imgdata1.data.length", "imgdata2.data.length"); +_assertSame(imgdata2.data.length, imgdata3.data.length, "imgdata2.data.length", "imgdata3.data.length"); +_assertSame(imgdata3.data.length, imgdata4.data.length, "imgdata3.data.length", "imgdata4.data.length"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.nonfinite.html new file mode 100644 index 0000000000..d7d1e7f756 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.nonfinite.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.imageData.create2.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.create2.nonfinite</h1> +<p class="desc">createImageData() throws TypeError if arguments are not finite</p> + + +<script> +var t = async_test("createImageData() throws TypeError if arguments are not finite"); +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'); + +assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(-Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, NaN); }); +assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, Infinity); }); +var posinfobj = { valueOf: function() { return Infinity; } }, + neginfobj = { valueOf: function() { return -Infinity; } }, + nanobj = { valueOf: function() { return -Infinity; } }; +assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(neginfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(nanobj, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, neginfobj); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, nanobj); }); +assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, posinfobj); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.nonfinite.worker.js new file mode 100644 index 0000000000..f398e2a5d4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.nonfinite.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.imageData.create2.nonfinite +// Description:createImageData() throws TypeError if arguments are not finite +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("createImageData() throws TypeError if arguments are not finite"); +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'); + +assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(-Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, NaN); }); +assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, Infinity); }); +var posinfobj = { valueOf: function() { return Infinity; } }, + neginfobj = { valueOf: function() { return -Infinity; } }, + nanobj = { valueOf: function() { return -Infinity; } }; +assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(neginfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(nanobj, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, neginfobj); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, nanobj); }); +assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, posinfobj); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.round.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.round.html new file mode 100644 index 0000000000..f2f0aa89e2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.round.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.imageData.create2.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.imageData.create2.round</h1> +<p class="desc">createImageData(w, h) is rounded the same as getImageData(0, 0, w, h)</p> + + +<script> +var t = async_test("createImageData(w, h) is rounded the same as getImageData(0, 0, w, h)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata1 = ctx.createImageData(10.01, 10.99); +var imgdata2 = ctx.getImageData(0, 0, 10.01, 10.99); +_assertSame(imgdata1.width, imgdata2.width, "imgdata1.width", "imgdata2.width"); +_assertSame(imgdata1.height, imgdata2.height, "imgdata1.height", "imgdata2.height"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.round.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.round.worker.js new file mode 100644 index 0000000000..2387498418 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.round.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.create2.round +// Description:createImageData(w, h) is rounded the same as getImageData(0, 0, w, h) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("createImageData(w, h) is rounded the same as getImageData(0, 0, w, h)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata1 = ctx.createImageData(10.01, 10.99); +var imgdata2 = ctx.getImageData(0, 0, 10.01, 10.99); +_assertSame(imgdata1.width, imgdata2.width, "imgdata1.width", "imgdata2.width"); +_assertSame(imgdata1.height, imgdata2.height, "imgdata1.height", "imgdata2.height"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.zero.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.zero.html new file mode 100644 index 0000000000..7c3a2d9410 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.zero.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.create2.zero</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.create2.zero</h1> +<p class="desc">createImageData(sw, sh) throws INDEX_SIZE_ERR if size is zero</p> + + +<script> +var t = async_test("createImageData(sw, sh) throws INDEX_SIZE_ERR if size is zero"); +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'); + +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(10, 0); }); +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0, 10); }); +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0, 0); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.zero.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.zero.worker.js new file mode 100644 index 0000000000..615a989e68 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.zero.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.imageData.create2.zero +// Description:createImageData(sw, sh) throws INDEX_SIZE_ERR if size is zero +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("createImageData(sw, sh) throws INDEX_SIZE_ERR if size is zero"); +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'); + +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(10, 0); }); +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0, 10); }); +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0, 0); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.basic.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.basic.html new file mode 100644 index 0000000000..d4f4a63b3a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.basic.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.get.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.imageData.get.basic</h1> +<p class="desc">getImageData() exists and returns something</p> + + +<script> +var t = async_test("getImageData() exists and returns something"); +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'); + +_assertDifferent(ctx.getImageData(0, 0, 100, 50), null, "ctx.getImageData(0, 0, 100, 50)", "null"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.basic.worker.js new file mode 100644 index 0000000000..8accaccc75 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.basic.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.get.basic +// Description:getImageData() exists and returns something +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getImageData() exists and returns something"); +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'); + +_assertDifferent(ctx.getImageData(0, 0, 100, 50), null, "ctx.getImageData(0, 0, 100, 50)", "null"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.clamp.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.clamp.html new file mode 100644 index 0000000000..9cbc1b48dc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.clamp.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.get.clamp</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.get.clamp</h1> +<p class="desc">getImageData() clamps colors to the range [0, 255]</p> + + +<script> +var t = async_test("getImageData() clamps colors to the range [0, 255]"); +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 = 'rgb(-100, -200, -300)'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = 'rgb(256, 300, 400)'; +ctx.fillRect(20, 10, 60, 10); +var imgdata1 = ctx.getImageData(10, 5, 1, 1); +_assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata1.data[1], 0, "imgdata1.data[\""+(1)+"\"]", "0"); +_assertSame(imgdata1.data[2], 0, "imgdata1.data[\""+(2)+"\"]", "0"); +var imgdata2 = ctx.getImageData(30, 15, 1, 1); +_assertSame(imgdata2.data[0], 255, "imgdata2.data[\""+(0)+"\"]", "255"); +_assertSame(imgdata2.data[1], 255, "imgdata2.data[\""+(1)+"\"]", "255"); +_assertSame(imgdata2.data[2], 255, "imgdata2.data[\""+(2)+"\"]", "255"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.clamp.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.clamp.worker.js new file mode 100644 index 0000000000..ceeb8d5d86 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.clamp.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.get.clamp +// Description:getImageData() clamps colors to the range [0, 255] +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getImageData() clamps colors to the range [0, 255]"); +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 = 'rgb(-100, -200, -300)'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = 'rgb(256, 300, 400)'; +ctx.fillRect(20, 10, 60, 10); +var imgdata1 = ctx.getImageData(10, 5, 1, 1); +_assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata1.data[1], 0, "imgdata1.data[\""+(1)+"\"]", "0"); +_assertSame(imgdata1.data[2], 0, "imgdata1.data[\""+(2)+"\"]", "0"); +var imgdata2 = ctx.getImageData(30, 15, 1, 1); +_assertSame(imgdata2.data[0], 255, "imgdata2.data[\""+(0)+"\"]", "255"); +_assertSame(imgdata2.data[1], 255, "imgdata2.data[\""+(1)+"\"]", "255"); +_assertSame(imgdata2.data[2], 255, "imgdata2.data[\""+(2)+"\"]", "255"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.length.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.length.html new file mode 100644 index 0000000000..2f7247fafc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.length.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.get.length</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.get.length</h1> +<p class="desc">getImageData() returns a correctly-sized Uint8ClampedArray</p> + + +<script> +var t = async_test("getImageData() returns a correctly-sized Uint8ClampedArray"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +_assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.length.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.length.worker.js new file mode 100644 index 0000000000..dd2e3dd6c5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.length.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.get.length +// Description:getImageData() returns a correctly-sized Uint8ClampedArray +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getImageData() returns a correctly-sized Uint8ClampedArray"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +_assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonfinite.html new file mode 100644 index 0000000000..5efc73663d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonfinite.html @@ -0,0 +1,75 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.get.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.get.nonfinite</h1> +<p class="desc">getImageData() throws TypeError if arguments are not finite</p> + + +<script> +var t = async_test("getImageData() throws TypeError if arguments are not finite"); +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'); + +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(-Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(NaN, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, -Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, NaN, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, -Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, NaN); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, Infinity); }); +var posinfobj = { valueOf: function() { return Infinity; } }, + neginfobj = { valueOf: function() { return -Infinity; } }, + nanobj = { valueOf: function() { return -Infinity; } }; +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(neginfobj, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(nanobj, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, neginfobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, nanobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, neginfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, nanobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, neginfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, nanobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, posinfobj); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonfinite.worker.js new file mode 100644 index 0000000000..15b3950adc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonfinite.worker.js @@ -0,0 +1,71 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.get.nonfinite +// Description:getImageData() throws TypeError if arguments are not finite +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getImageData() throws TypeError if arguments are not finite"); +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'); + +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(-Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(NaN, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, -Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, NaN, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, -Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, NaN); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, Infinity); }); +var posinfobj = { valueOf: function() { return Infinity; } }, + neginfobj = { valueOf: function() { return -Infinity; } }, + nanobj = { valueOf: function() { return -Infinity; } }; +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(neginfobj, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(nanobj, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, neginfobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, nanobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, neginfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, nanobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, neginfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, nanobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, posinfobj); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonpremul.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonpremul.html new file mode 100644 index 0000000000..bed3294be4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonpremul.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.imageData.get.nonpremul</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.get.nonpremul</h1> +<p class="desc">getImageData() returns non-premultiplied colors</p> + + +<script> +var t = async_test("getImageData() returns non-premultiplied colors"); +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 = 'rgba(255, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +var imgdata = ctx.getImageData(10, 10, 10, 10); +_assert(imgdata.data[0] > 200, "imgdata.data[\""+(0)+"\"] > 200"); +_assert(imgdata.data[1] > 200, "imgdata.data[\""+(1)+"\"] > 200"); +_assert(imgdata.data[2] > 200, "imgdata.data[\""+(2)+"\"] > 200"); +_assert(imgdata.data[3] > 100, "imgdata.data[\""+(3)+"\"] > 100"); +_assert(imgdata.data[3] < 200, "imgdata.data[\""+(3)+"\"] < 200"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonpremul.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonpremul.worker.js new file mode 100644 index 0000000000..d568c31b38 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonpremul.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.get.nonpremul +// Description:getImageData() returns non-premultiplied colors +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getImageData() returns non-premultiplied colors"); +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 = 'rgba(255, 255, 255, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +var imgdata = ctx.getImageData(10, 10, 10, 10); +_assert(imgdata.data[0] > 200, "imgdata.data[\""+(0)+"\"] > 200"); +_assert(imgdata.data[1] > 200, "imgdata.data[\""+(1)+"\"] > 200"); +_assert(imgdata.data[2] > 200, "imgdata.data[\""+(2)+"\"] > 200"); +_assert(imgdata.data[3] > 100, "imgdata.data[\""+(3)+"\"] > 100"); +_assert(imgdata.data[3] < 200, "imgdata.data[\""+(3)+"\"] < 200"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.alpha.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.alpha.html new file mode 100644 index 0000000000..a169cb59e3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.alpha.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.get.order.alpha</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.get.order.alpha</h1> +<p class="desc">getImageData() returns A in the fourth component</p> + + +<script> +var t = async_test("getImageData() returns A in the fourth component"); +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 = 'rgba(0, 0, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +var imgdata = ctx.getImageData(0, 0, 10, 10); +_assert(imgdata.data[3] < 200, "imgdata.data[\""+(3)+"\"] < 200"); +_assert(imgdata.data[3] > 100, "imgdata.data[\""+(3)+"\"] > 100"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.alpha.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.alpha.worker.js new file mode 100644 index 0000000000..038844816f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.alpha.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.get.order.alpha +// Description:getImageData() returns A in the fourth component +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getImageData() returns A in the fourth component"); +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 = 'rgba(0, 0, 0, 0.5)'; +ctx.fillRect(0, 0, 100, 50); +var imgdata = ctx.getImageData(0, 0, 10, 10); +_assert(imgdata.data[3] < 200, "imgdata.data[\""+(3)+"\"] < 200"); +_assert(imgdata.data[3] > 100, "imgdata.data[\""+(3)+"\"] > 100"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.cols.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.cols.html new file mode 100644 index 0000000000..09eb58a7fd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.cols.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.imageData.get.order.cols</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.get.order.cols</h1> +<p class="desc">getImageData() returns leftmost columns first</p> + + +<script> +var t = async_test("getImageData() returns leftmost columns first"); +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 = '#fff'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#000'; +ctx.fillRect(0, 0, 2, 50); +var imgdata = ctx.getImageData(0, 0, 10, 10); +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata.data[Math.round(imgdata.width/2*4)], 255, "imgdata.data[Math.round(imgdata.width/2*4)]", "255"); +_assertSame(imgdata.data[Math.round((imgdata.height/2)*imgdata.width*4)], 0, "imgdata.data[Math.round((imgdata.height/2)*imgdata.width*4)]", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.cols.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.cols.worker.js new file mode 100644 index 0000000000..6a13c4dee6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.cols.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.get.order.cols +// Description:getImageData() returns leftmost columns first +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getImageData() returns leftmost columns first"); +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 = '#fff'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#000'; +ctx.fillRect(0, 0, 2, 50); +var imgdata = ctx.getImageData(0, 0, 10, 10); +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata.data[Math.round(imgdata.width/2*4)], 255, "imgdata.data[Math.round(imgdata.width/2*4)]", "255"); +_assertSame(imgdata.data[Math.round((imgdata.height/2)*imgdata.width*4)], 0, "imgdata.data[Math.round((imgdata.height/2)*imgdata.width*4)]", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rgb.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rgb.html new file mode 100644 index 0000000000..b56adf19fe --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rgb.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.imageData.get.order.rgb</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.get.order.rgb</h1> +<p class="desc">getImageData() returns R then G then B</p> + + +<script> +var t = async_test("getImageData() returns R then G then B"); +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 = '#48c'; +ctx.fillRect(0, 0, 100, 50); +var imgdata = ctx.getImageData(0, 0, 10, 10); +_assertSame(imgdata.data[0], 0x44, "imgdata.data[\""+(0)+"\"]", "0x44"); +_assertSame(imgdata.data[1], 0x88, "imgdata.data[\""+(1)+"\"]", "0x88"); +_assertSame(imgdata.data[2], 0xCC, "imgdata.data[\""+(2)+"\"]", "0xCC"); +_assertSame(imgdata.data[3], 255, "imgdata.data[\""+(3)+"\"]", "255"); +_assertSame(imgdata.data[4], 0x44, "imgdata.data[\""+(4)+"\"]", "0x44"); +_assertSame(imgdata.data[5], 0x88, "imgdata.data[\""+(5)+"\"]", "0x88"); +_assertSame(imgdata.data[6], 0xCC, "imgdata.data[\""+(6)+"\"]", "0xCC"); +_assertSame(imgdata.data[7], 255, "imgdata.data[\""+(7)+"\"]", "255"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rgb.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rgb.worker.js new file mode 100644 index 0000000000..771a777b9b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rgb.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.get.order.rgb +// Description:getImageData() returns R then G then B +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getImageData() returns R then G then B"); +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 = '#48c'; +ctx.fillRect(0, 0, 100, 50); +var imgdata = ctx.getImageData(0, 0, 10, 10); +_assertSame(imgdata.data[0], 0x44, "imgdata.data[\""+(0)+"\"]", "0x44"); +_assertSame(imgdata.data[1], 0x88, "imgdata.data[\""+(1)+"\"]", "0x88"); +_assertSame(imgdata.data[2], 0xCC, "imgdata.data[\""+(2)+"\"]", "0xCC"); +_assertSame(imgdata.data[3], 255, "imgdata.data[\""+(3)+"\"]", "255"); +_assertSame(imgdata.data[4], 0x44, "imgdata.data[\""+(4)+"\"]", "0x44"); +_assertSame(imgdata.data[5], 0x88, "imgdata.data[\""+(5)+"\"]", "0x88"); +_assertSame(imgdata.data[6], 0xCC, "imgdata.data[\""+(6)+"\"]", "0xCC"); +_assertSame(imgdata.data[7], 255, "imgdata.data[\""+(7)+"\"]", "255"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rows.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rows.html new file mode 100644 index 0000000000..3ad1ced7d2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rows.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.imageData.get.order.rows</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.get.order.rows</h1> +<p class="desc">getImageData() returns topmost rows first</p> + + +<script> +var t = async_test("getImageData() returns topmost rows first"); +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 = '#fff'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#000'; +ctx.fillRect(0, 0, 100, 2); +var imgdata = ctx.getImageData(0, 0, 10, 10); +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata.data[Math.floor(imgdata.width/2*4)], 0, "imgdata.data[Math.floor(imgdata.width/2*4)]", "0"); +_assertSame(imgdata.data[(imgdata.height/2)*imgdata.width*4], 255, "imgdata.data[(imgdata.height/2)*imgdata.width*4]", "255"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rows.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rows.worker.js new file mode 100644 index 0000000000..1f75f9301c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rows.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.get.order.rows +// Description:getImageData() returns topmost rows first +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getImageData() returns topmost rows first"); +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 = '#fff'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#000'; +ctx.fillRect(0, 0, 100, 2); +var imgdata = ctx.getImageData(0, 0, 10, 10); +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata.data[Math.floor(imgdata.width/2*4)], 0, "imgdata.data[Math.floor(imgdata.width/2*4)]", "0"); +_assertSame(imgdata.data[(imgdata.height/2)*imgdata.width*4], 255, "imgdata.data[(imgdata.height/2)*imgdata.width*4]", "255"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.range.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.range.html new file mode 100644 index 0000000000..283dd07b4c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.range.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.imageData.get.range</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.get.range</h1> +<p class="desc">getImageData() returns values in the range [0, 255]</p> + + +<script> +var t = async_test("getImageData() returns values in the range [0, 255]"); +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 = '#000'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#fff'; +ctx.fillRect(20, 10, 60, 10); +var imgdata1 = ctx.getImageData(10, 5, 1, 1); +_assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); +var imgdata2 = ctx.getImageData(30, 15, 1, 1); +_assertSame(imgdata2.data[0], 255, "imgdata2.data[\""+(0)+"\"]", "255"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.range.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.range.worker.js new file mode 100644 index 0000000000..9389c22bd3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.range.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.get.range +// Description:getImageData() returns values in the range [0, 255] +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getImageData() returns values in the range [0, 255]"); +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 = '#000'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#fff'; +ctx.fillRect(20, 10, 60, 10); +var imgdata1 = ctx.getImageData(10, 5, 1, 1); +_assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); +var imgdata2 = ctx.getImageData(30, 15, 1, 1); +_assertSame(imgdata2.data[0], 255, "imgdata2.data[\""+(0)+"\"]", "255"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.negative.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.negative.html new file mode 100644 index 0000000000..a7e3d8574f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.negative.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.imageData.get.source.negative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.get.source.negative</h1> +<p class="desc">getImageData() works with negative width and height, and returns top-to-bottom left-to-right</p> + + +<script> +var t = async_test("getImageData() works with negative width and height, and returns top-to-bottom left-to-right"); +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 = '#000'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#fff'; +ctx.fillRect(20, 10, 60, 10); +var imgdata1 = ctx.getImageData(85, 25, -10, -10); +_assertSame(imgdata1.data[0], 255, "imgdata1.data[\""+(0)+"\"]", "255"); +_assertSame(imgdata1.data[1], 255, "imgdata1.data[\""+(1)+"\"]", "255"); +_assertSame(imgdata1.data[2], 255, "imgdata1.data[\""+(2)+"\"]", "255"); +_assertSame(imgdata1.data[3], 255, "imgdata1.data[\""+(3)+"\"]", "255"); +_assertSame(imgdata1.data[imgdata1.data.length-4+0], 0, "imgdata1.data[imgdata1.data.length-4+0]", "0"); +_assertSame(imgdata1.data[imgdata1.data.length-4+1], 0, "imgdata1.data[imgdata1.data.length-4+1]", "0"); +_assertSame(imgdata1.data[imgdata1.data.length-4+2], 0, "imgdata1.data[imgdata1.data.length-4+2]", "0"); +_assertSame(imgdata1.data[imgdata1.data.length-4+3], 255, "imgdata1.data[imgdata1.data.length-4+3]", "255"); +var imgdata2 = ctx.getImageData(0, 0, -1, -1); +_assertSame(imgdata2.data[0], 0, "imgdata2.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata2.data[1], 0, "imgdata2.data[\""+(1)+"\"]", "0"); +_assertSame(imgdata2.data[2], 0, "imgdata2.data[\""+(2)+"\"]", "0"); +_assertSame(imgdata2.data[3], 0, "imgdata2.data[\""+(3)+"\"]", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.negative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.negative.worker.js new file mode 100644 index 0000000000..e057315d57 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.negative.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.imageData.get.source.negative +// Description:getImageData() works with negative width and height, and returns top-to-bottom left-to-right +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getImageData() works with negative width and height, and returns top-to-bottom left-to-right"); +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 = '#000'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#fff'; +ctx.fillRect(20, 10, 60, 10); +var imgdata1 = ctx.getImageData(85, 25, -10, -10); +_assertSame(imgdata1.data[0], 255, "imgdata1.data[\""+(0)+"\"]", "255"); +_assertSame(imgdata1.data[1], 255, "imgdata1.data[\""+(1)+"\"]", "255"); +_assertSame(imgdata1.data[2], 255, "imgdata1.data[\""+(2)+"\"]", "255"); +_assertSame(imgdata1.data[3], 255, "imgdata1.data[\""+(3)+"\"]", "255"); +_assertSame(imgdata1.data[imgdata1.data.length-4+0], 0, "imgdata1.data[imgdata1.data.length-4+0]", "0"); +_assertSame(imgdata1.data[imgdata1.data.length-4+1], 0, "imgdata1.data[imgdata1.data.length-4+1]", "0"); +_assertSame(imgdata1.data[imgdata1.data.length-4+2], 0, "imgdata1.data[imgdata1.data.length-4+2]", "0"); +_assertSame(imgdata1.data[imgdata1.data.length-4+3], 255, "imgdata1.data[imgdata1.data.length-4+3]", "255"); +var imgdata2 = ctx.getImageData(0, 0, -1, -1); +_assertSame(imgdata2.data[0], 0, "imgdata2.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata2.data[1], 0, "imgdata2.data[\""+(1)+"\"]", "0"); +_assertSame(imgdata2.data[2], 0, "imgdata2.data[\""+(2)+"\"]", "0"); +_assertSame(imgdata2.data[3], 0, "imgdata2.data[\""+(3)+"\"]", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.outside.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.outside.html new file mode 100644 index 0000000000..a071e44d55 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.outside.html @@ -0,0 +1,79 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.get.source.outside</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.get.source.outside</h1> +<p class="desc">getImageData() returns transparent black outside the canvas</p> + + +<script> +var t = async_test("getImageData() returns transparent black outside the canvas"); +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 = '#08f'; +ctx.fillRect(0, 0, 100, 50); +var imgdata1 = ctx.getImageData(-10, 5, 1, 1); +_assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata1.data[1], 0, "imgdata1.data[\""+(1)+"\"]", "0"); +_assertSame(imgdata1.data[2], 0, "imgdata1.data[\""+(2)+"\"]", "0"); +_assertSame(imgdata1.data[3], 0, "imgdata1.data[\""+(3)+"\"]", "0"); +var imgdata2 = ctx.getImageData(10, -5, 1, 1); +_assertSame(imgdata2.data[0], 0, "imgdata2.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata2.data[1], 0, "imgdata2.data[\""+(1)+"\"]", "0"); +_assertSame(imgdata2.data[2], 0, "imgdata2.data[\""+(2)+"\"]", "0"); +_assertSame(imgdata2.data[3], 0, "imgdata2.data[\""+(3)+"\"]", "0"); +var imgdata3 = ctx.getImageData(200, 5, 1, 1); +_assertSame(imgdata3.data[0], 0, "imgdata3.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata3.data[1], 0, "imgdata3.data[\""+(1)+"\"]", "0"); +_assertSame(imgdata3.data[2], 0, "imgdata3.data[\""+(2)+"\"]", "0"); +_assertSame(imgdata3.data[3], 0, "imgdata3.data[\""+(3)+"\"]", "0"); +var imgdata4 = ctx.getImageData(10, 60, 1, 1); +_assertSame(imgdata4.data[0], 0, "imgdata4.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata4.data[1], 0, "imgdata4.data[\""+(1)+"\"]", "0"); +_assertSame(imgdata4.data[2], 0, "imgdata4.data[\""+(2)+"\"]", "0"); +_assertSame(imgdata4.data[3], 0, "imgdata4.data[\""+(3)+"\"]", "0"); +var imgdata5 = ctx.getImageData(100, 10, 1, 1); +_assertSame(imgdata5.data[0], 0, "imgdata5.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata5.data[1], 0, "imgdata5.data[\""+(1)+"\"]", "0"); +_assertSame(imgdata5.data[2], 0, "imgdata5.data[\""+(2)+"\"]", "0"); +_assertSame(imgdata5.data[3], 0, "imgdata5.data[\""+(3)+"\"]", "0"); +var imgdata6 = ctx.getImageData(0, 10, 1, 1); +_assertSame(imgdata6.data[0], 0, "imgdata6.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata6.data[1], 136, "imgdata6.data[\""+(1)+"\"]", "136"); +_assertSame(imgdata6.data[2], 255, "imgdata6.data[\""+(2)+"\"]", "255"); +_assertSame(imgdata6.data[3], 255, "imgdata6.data[\""+(3)+"\"]", "255"); +var imgdata7 = ctx.getImageData(-10, 10, 20, 20); +_assertSame(imgdata7.data[ 0*4+0], 0, "imgdata7.data[ 0*4+0]", "0"); +_assertSame(imgdata7.data[ 0*4+1], 0, "imgdata7.data[ 0*4+1]", "0"); +_assertSame(imgdata7.data[ 0*4+2], 0, "imgdata7.data[ 0*4+2]", "0"); +_assertSame(imgdata7.data[ 0*4+3], 0, "imgdata7.data[ 0*4+3]", "0"); +_assertSame(imgdata7.data[ 9*4+0], 0, "imgdata7.data[ 9*4+0]", "0"); +_assertSame(imgdata7.data[ 9*4+1], 0, "imgdata7.data[ 9*4+1]", "0"); +_assertSame(imgdata7.data[ 9*4+2], 0, "imgdata7.data[ 9*4+2]", "0"); +_assertSame(imgdata7.data[ 9*4+3], 0, "imgdata7.data[ 9*4+3]", "0"); +_assertSame(imgdata7.data[10*4+0], 0, "imgdata7.data[10*4+0]", "0"); +_assertSame(imgdata7.data[10*4+1], 136, "imgdata7.data[10*4+1]", "136"); +_assertSame(imgdata7.data[10*4+2], 255, "imgdata7.data[10*4+2]", "255"); +_assertSame(imgdata7.data[10*4+3], 255, "imgdata7.data[10*4+3]", "255"); +_assertSame(imgdata7.data[19*4+0], 0, "imgdata7.data[19*4+0]", "0"); +_assertSame(imgdata7.data[19*4+1], 136, "imgdata7.data[19*4+1]", "136"); +_assertSame(imgdata7.data[19*4+2], 255, "imgdata7.data[19*4+2]", "255"); +_assertSame(imgdata7.data[19*4+3], 255, "imgdata7.data[19*4+3]", "255"); +_assertSame(imgdata7.data[20*4+0], 0, "imgdata7.data[20*4+0]", "0"); +_assertSame(imgdata7.data[20*4+1], 0, "imgdata7.data[20*4+1]", "0"); +_assertSame(imgdata7.data[20*4+2], 0, "imgdata7.data[20*4+2]", "0"); +_assertSame(imgdata7.data[20*4+3], 0, "imgdata7.data[20*4+3]", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.outside.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.outside.worker.js new file mode 100644 index 0000000000..4025ecd4be --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.outside.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.imageData.get.source.outside +// Description:getImageData() returns transparent black outside the canvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getImageData() returns transparent black outside the canvas"); +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 = '#08f'; +ctx.fillRect(0, 0, 100, 50); +var imgdata1 = ctx.getImageData(-10, 5, 1, 1); +_assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata1.data[1], 0, "imgdata1.data[\""+(1)+"\"]", "0"); +_assertSame(imgdata1.data[2], 0, "imgdata1.data[\""+(2)+"\"]", "0"); +_assertSame(imgdata1.data[3], 0, "imgdata1.data[\""+(3)+"\"]", "0"); +var imgdata2 = ctx.getImageData(10, -5, 1, 1); +_assertSame(imgdata2.data[0], 0, "imgdata2.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata2.data[1], 0, "imgdata2.data[\""+(1)+"\"]", "0"); +_assertSame(imgdata2.data[2], 0, "imgdata2.data[\""+(2)+"\"]", "0"); +_assertSame(imgdata2.data[3], 0, "imgdata2.data[\""+(3)+"\"]", "0"); +var imgdata3 = ctx.getImageData(200, 5, 1, 1); +_assertSame(imgdata3.data[0], 0, "imgdata3.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata3.data[1], 0, "imgdata3.data[\""+(1)+"\"]", "0"); +_assertSame(imgdata3.data[2], 0, "imgdata3.data[\""+(2)+"\"]", "0"); +_assertSame(imgdata3.data[3], 0, "imgdata3.data[\""+(3)+"\"]", "0"); +var imgdata4 = ctx.getImageData(10, 60, 1, 1); +_assertSame(imgdata4.data[0], 0, "imgdata4.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata4.data[1], 0, "imgdata4.data[\""+(1)+"\"]", "0"); +_assertSame(imgdata4.data[2], 0, "imgdata4.data[\""+(2)+"\"]", "0"); +_assertSame(imgdata4.data[3], 0, "imgdata4.data[\""+(3)+"\"]", "0"); +var imgdata5 = ctx.getImageData(100, 10, 1, 1); +_assertSame(imgdata5.data[0], 0, "imgdata5.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata5.data[1], 0, "imgdata5.data[\""+(1)+"\"]", "0"); +_assertSame(imgdata5.data[2], 0, "imgdata5.data[\""+(2)+"\"]", "0"); +_assertSame(imgdata5.data[3], 0, "imgdata5.data[\""+(3)+"\"]", "0"); +var imgdata6 = ctx.getImageData(0, 10, 1, 1); +_assertSame(imgdata6.data[0], 0, "imgdata6.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata6.data[1], 136, "imgdata6.data[\""+(1)+"\"]", "136"); +_assertSame(imgdata6.data[2], 255, "imgdata6.data[\""+(2)+"\"]", "255"); +_assertSame(imgdata6.data[3], 255, "imgdata6.data[\""+(3)+"\"]", "255"); +var imgdata7 = ctx.getImageData(-10, 10, 20, 20); +_assertSame(imgdata7.data[ 0*4+0], 0, "imgdata7.data[ 0*4+0]", "0"); +_assertSame(imgdata7.data[ 0*4+1], 0, "imgdata7.data[ 0*4+1]", "0"); +_assertSame(imgdata7.data[ 0*4+2], 0, "imgdata7.data[ 0*4+2]", "0"); +_assertSame(imgdata7.data[ 0*4+3], 0, "imgdata7.data[ 0*4+3]", "0"); +_assertSame(imgdata7.data[ 9*4+0], 0, "imgdata7.data[ 9*4+0]", "0"); +_assertSame(imgdata7.data[ 9*4+1], 0, "imgdata7.data[ 9*4+1]", "0"); +_assertSame(imgdata7.data[ 9*4+2], 0, "imgdata7.data[ 9*4+2]", "0"); +_assertSame(imgdata7.data[ 9*4+3], 0, "imgdata7.data[ 9*4+3]", "0"); +_assertSame(imgdata7.data[10*4+0], 0, "imgdata7.data[10*4+0]", "0"); +_assertSame(imgdata7.data[10*4+1], 136, "imgdata7.data[10*4+1]", "136"); +_assertSame(imgdata7.data[10*4+2], 255, "imgdata7.data[10*4+2]", "255"); +_assertSame(imgdata7.data[10*4+3], 255, "imgdata7.data[10*4+3]", "255"); +_assertSame(imgdata7.data[19*4+0], 0, "imgdata7.data[19*4+0]", "0"); +_assertSame(imgdata7.data[19*4+1], 136, "imgdata7.data[19*4+1]", "136"); +_assertSame(imgdata7.data[19*4+2], 255, "imgdata7.data[19*4+2]", "255"); +_assertSame(imgdata7.data[19*4+3], 255, "imgdata7.data[19*4+3]", "255"); +_assertSame(imgdata7.data[20*4+0], 0, "imgdata7.data[20*4+0]", "0"); +_assertSame(imgdata7.data[20*4+1], 0, "imgdata7.data[20*4+1]", "0"); +_assertSame(imgdata7.data[20*4+2], 0, "imgdata7.data[20*4+2]", "0"); +_assertSame(imgdata7.data[20*4+3], 0, "imgdata7.data[20*4+3]", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.size.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.size.html new file mode 100644 index 0000000000..4fd551db7d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.size.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.imageData.get.source.size</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.get.source.size</h1> +<p class="desc">getImageData() returns bigger ImageData for bigger source rectangle</p> + + +<script> +var t = async_test("getImageData() returns bigger ImageData for bigger source 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'); + +var imgdata1 = ctx.getImageData(0, 0, 10, 10); +var imgdata2 = ctx.getImageData(0, 0, 20, 20); +_assert(imgdata2.width > imgdata1.width, "imgdata2.width > imgdata1.width"); +_assert(imgdata2.height > imgdata1.height, "imgdata2.height > imgdata1.height"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.size.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.size.worker.js new file mode 100644 index 0000000000..111f4b5869 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.size.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.get.source.size +// Description:getImageData() returns bigger ImageData for bigger source rectangle +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getImageData() returns bigger ImageData for bigger source 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'); + +var imgdata1 = ctx.getImageData(0, 0, 10, 10); +var imgdata2 = ctx.getImageData(0, 0, 20, 20); +_assert(imgdata2.width > imgdata1.width, "imgdata2.width > imgdata1.width"); +_assert(imgdata2.height > imgdata1.height, "imgdata2.height > imgdata1.height"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.unaffected.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.unaffected.html new file mode 100644 index 0000000000..f65f015e8f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.unaffected.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.imageData.get.unaffected</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.get.unaffected</h1> +<p class="desc">getImageData() is not affected by context state</p> + + +<script> +var t = async_test("getImageData() is not affected by context state"); +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, 50, 50) +ctx.fillStyle = '#f00'; +ctx.fillRect(50, 0, 50, 50) +ctx.save(); +ctx.translate(50, 0); +ctx.globalAlpha = 0.1; +ctx.globalCompositeOperation = 'destination-atop'; +ctx.shadowColor = '#f00'; +ctx.rect(0, 0, 5, 5); +ctx.clip(); +var imgdata = ctx.getImageData(0, 0, 50, 50); +ctx.restore(); +ctx.putImageData(imgdata, 50, 0); +_assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.unaffected.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.unaffected.worker.js new file mode 100644 index 0000000000..a733c6ffdf --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.unaffected.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.imageData.get.unaffected +// Description:getImageData() is not affected by context state +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getImageData() is not affected by context state"); +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, 50, 50) +ctx.fillStyle = '#f00'; +ctx.fillRect(50, 0, 50, 50) +ctx.save(); +ctx.translate(50, 0); +ctx.globalAlpha = 0.1; +ctx.globalCompositeOperation = 'destination-atop'; +ctx.shadowColor = '#f00'; +ctx.rect(0, 0, 5, 5); +ctx.clip(); +var imgdata = ctx.getImageData(0, 0, 50, 50); +ctx.restore(); +ctx.putImageData(imgdata, 50, 0); +_assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.zero.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.zero.html new file mode 100644 index 0000000000..91cf5a25e2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.zero.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.get.zero</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.get.zero</h1> +<p class="desc">getImageData() throws INDEX_SIZE_ERR if size is zero</p> + + +<script> +var t = async_test("getImageData() throws INDEX_SIZE_ERR if size is zero"); +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'); + +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, 0); }); +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0, 10); }); +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0, 0); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.zero.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.zero.worker.js new file mode 100644 index 0000000000..07e8f3621b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.zero.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.imageData.get.zero +// Description:getImageData() throws INDEX_SIZE_ERR if size is zero +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getImageData() throws INDEX_SIZE_ERR if size is zero"); +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'); + +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, 0); }); +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0, 10); }); +assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0, 0); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.clamp.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.clamp.html new file mode 100644 index 0000000000..8b1515c678 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.clamp.html @@ -0,0 +1,51 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.object.clamp</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.object.clamp</h1> +<p class="desc">ImageData.data clamps numbers to [0, 255]</p> + + +<script> +var t = async_test("ImageData.data clamps numbers to [0, 255]"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +imgdata.data[0] = 100; +imgdata.data[0] = 300; +_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); +imgdata.data[0] = 100; +imgdata.data[0] = -100; +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +imgdata.data[0] = 100; +imgdata.data[0] = 200+Math.pow(2, 32); +_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); +imgdata.data[0] = 100; +imgdata.data[0] = -200-Math.pow(2, 32); +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +imgdata.data[0] = 100; +imgdata.data[0] = Math.pow(10, 39); +_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); +imgdata.data[0] = 100; +imgdata.data[0] = -Math.pow(10, 39); +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +imgdata.data[0] = 100; +imgdata.data[0] = -Infinity; +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +imgdata.data[0] = 100; +imgdata.data[0] = Infinity; +_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.clamp.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.clamp.worker.js new file mode 100644 index 0000000000..0e2a33c75e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.clamp.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.imageData.object.clamp +// Description:ImageData.data clamps numbers to [0, 255] +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("ImageData.data clamps numbers to [0, 255]"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +imgdata.data[0] = 100; +imgdata.data[0] = 300; +_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); +imgdata.data[0] = 100; +imgdata.data[0] = -100; +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +imgdata.data[0] = 100; +imgdata.data[0] = 200+Math.pow(2, 32); +_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); +imgdata.data[0] = 100; +imgdata.data[0] = -200-Math.pow(2, 32); +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +imgdata.data[0] = 100; +imgdata.data[0] = Math.pow(10, 39); +_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); +imgdata.data[0] = 100; +imgdata.data[0] = -Math.pow(10, 39); +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +imgdata.data[0] = 100; +imgdata.data[0] = -Infinity; +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +imgdata.data[0] = 100; +imgdata.data[0] = Infinity; +_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.nan.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.nan.html new file mode 100644 index 0000000000..9fce409778 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.nan.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.object.nan</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.object.nan</h1> +<p class="desc">ImageData.data converts NaN to 0</p> + + +<script> +var t = async_test("ImageData.data converts NaN to 0"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +imgdata.data[0] = 100; +imgdata.data[0] = NaN; +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +imgdata.data[0] = 100; +imgdata.data[0] = "cheese"; +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.nan.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.nan.worker.js new file mode 100644 index 0000000000..ef2eb21b37 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.nan.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.imageData.object.nan +// Description:ImageData.data converts NaN to 0 +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("ImageData.data converts NaN to 0"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +imgdata.data[0] = 100; +imgdata.data[0] = NaN; +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +imgdata.data[0] = 100; +imgdata.data[0] = "cheese"; +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.properties.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.properties.html new file mode 100644 index 0000000000..05a4106b6b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.properties.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.imageData.object.properties</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.object.properties</h1> +<p class="desc">ImageData objects have the right properties</p> + + +<script> +var t = async_test("ImageData objects have the right properties"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +_assertSame(typeof(imgdata.width), 'number', "typeof(imgdata.width)", "'number'"); +_assertSame(typeof(imgdata.height), 'number', "typeof(imgdata.height)", "'number'"); +_assertSame(typeof(imgdata.data), 'object', "typeof(imgdata.data)", "'object'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.properties.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.properties.worker.js new file mode 100644 index 0000000000..42c89ef117 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.properties.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.object.properties +// Description:ImageData objects have the right properties +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("ImageData objects have the right properties"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +_assertSame(typeof(imgdata.width), 'number', "typeof(imgdata.width)", "'number'"); +_assertSame(typeof(imgdata.height), 'number', "typeof(imgdata.height)", "'number'"); +_assertSame(typeof(imgdata.data), 'object', "typeof(imgdata.data)", "'object'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.readonly.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.readonly.html new file mode 100644 index 0000000000..5fbdfc5ce0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.readonly.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.imageData.object.readonly</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.object.readonly</h1> +<p class="desc">ImageData objects properties are read-only</p> + + +<script> +var t = async_test("ImageData objects properties are read-only"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +var w = imgdata.width; +var h = imgdata.height; +var d = imgdata.data; +imgdata.width = 123; +imgdata.height = 123; +imgdata.data = [100,100,100,100]; +_assertSame(imgdata.width, w, "imgdata.width", "w"); +_assertSame(imgdata.height, h, "imgdata.height", "h"); +_assertSame(imgdata.data, d, "imgdata.data", "d"); +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata.data[1], 0, "imgdata.data[\""+(1)+"\"]", "0"); +_assertSame(imgdata.data[2], 0, "imgdata.data[\""+(2)+"\"]", "0"); +_assertSame(imgdata.data[3], 0, "imgdata.data[\""+(3)+"\"]", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.readonly.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.readonly.worker.js new file mode 100644 index 0000000000..068761e2e6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.readonly.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.imageData.object.readonly +// Description:ImageData objects properties are read-only +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("ImageData objects properties are read-only"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +var w = imgdata.width; +var h = imgdata.height; +var d = imgdata.data; +imgdata.width = 123; +imgdata.height = 123; +imgdata.data = [100,100,100,100]; +_assertSame(imgdata.width, w, "imgdata.width", "w"); +_assertSame(imgdata.height, h, "imgdata.height", "h"); +_assertSame(imgdata.data, d, "imgdata.data", "d"); +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +_assertSame(imgdata.data[1], 0, "imgdata.data[\""+(1)+"\"]", "0"); +_assertSame(imgdata.data[2], 0, "imgdata.data[\""+(2)+"\"]", "0"); +_assertSame(imgdata.data[3], 0, "imgdata.data[\""+(3)+"\"]", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.round.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.round.html new file mode 100644 index 0000000000..8b362a01c6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.round.html @@ -0,0 +1,55 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.object.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.imageData.object.round</h1> +<p class="desc">ImageData.data rounds numbers with round-to-zero</p> + + +<script> +var t = async_test("ImageData.data rounds numbers with round-to-zero"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +imgdata.data[0] = 0.499; +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +imgdata.data[0] = 0.5; +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +imgdata.data[0] = 0.501; +_assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1"); +imgdata.data[0] = 1.499; +_assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1"); +imgdata.data[0] = 1.5; +_assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); +imgdata.data[0] = 1.501; +_assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); +imgdata.data[0] = 2.5; +_assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); +imgdata.data[0] = 3.5; +_assertSame(imgdata.data[0], 4, "imgdata.data[\""+(0)+"\"]", "4"); +imgdata.data[0] = 252.5; +_assertSame(imgdata.data[0], 252, "imgdata.data[\""+(0)+"\"]", "252"); +imgdata.data[0] = 253.5; +_assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254"); +imgdata.data[0] = 254.5; +_assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254"); +imgdata.data[0] = 256.5; +_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); +imgdata.data[0] = -0.5; +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +imgdata.data[0] = -1.5; +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.round.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.round.worker.js new file mode 100644 index 0000000000..4a88db9cdd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.round.worker.js @@ -0,0 +1,51 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.object.round +// Description:ImageData.data rounds numbers with round-to-zero +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("ImageData.data rounds numbers with round-to-zero"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +imgdata.data[0] = 0.499; +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +imgdata.data[0] = 0.5; +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +imgdata.data[0] = 0.501; +_assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1"); +imgdata.data[0] = 1.499; +_assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1"); +imgdata.data[0] = 1.5; +_assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); +imgdata.data[0] = 1.501; +_assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); +imgdata.data[0] = 2.5; +_assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); +imgdata.data[0] = 3.5; +_assertSame(imgdata.data[0], 4, "imgdata.data[\""+(0)+"\"]", "4"); +imgdata.data[0] = 252.5; +_assertSame(imgdata.data[0], 252, "imgdata.data[\""+(0)+"\"]", "252"); +imgdata.data[0] = 253.5; +_assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254"); +imgdata.data[0] = 254.5; +_assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254"); +imgdata.data[0] = 256.5; +_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); +imgdata.data[0] = -0.5; +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +imgdata.data[0] = -1.5; +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.set.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.set.html new file mode 100644 index 0000000000..95305c5bc4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.set.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.object.set</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.object.set</h1> +<p class="desc">ImageData.data can be modified</p> + + +<script> +var t = async_test("ImageData.data can be modified"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +imgdata.data[0] = 100; +_assertSame(imgdata.data[0], 100, "imgdata.data[\""+(0)+"\"]", "100"); +imgdata.data[0] = 200; +_assertSame(imgdata.data[0], 200, "imgdata.data[\""+(0)+"\"]", "200"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.set.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.set.worker.js new file mode 100644 index 0000000000..fcb16ab577 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.set.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.object.set +// Description:ImageData.data can be modified +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("ImageData.data can be modified"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +imgdata.data[0] = 100; +_assertSame(imgdata.data[0], 100, "imgdata.data[\""+(0)+"\"]", "100"); +imgdata.data[0] = 200; +_assertSame(imgdata.data[0], 200, "imgdata.data[\""+(0)+"\"]", "200"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.string.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.string.html new file mode 100644 index 0000000000..a7b5d578d2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.string.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.object.string</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.object.string</h1> +<p class="desc">ImageData.data converts strings to numbers with ToNumber</p> + + +<script> +var t = async_test("ImageData.data converts strings to numbers with ToNumber"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +imgdata.data[0] = 100; +imgdata.data[0] = "110"; +_assertSame(imgdata.data[0], 110, "imgdata.data[\""+(0)+"\"]", "110"); +imgdata.data[0] = 100; +imgdata.data[0] = "0x78"; +_assertSame(imgdata.data[0], 120, "imgdata.data[\""+(0)+"\"]", "120"); +imgdata.data[0] = 100; +imgdata.data[0] = " +130e0 "; +_assertSame(imgdata.data[0], 130, "imgdata.data[\""+(0)+"\"]", "130"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.string.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.string.worker.js new file mode 100644 index 0000000000..6c2dcc8b42 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.string.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.imageData.object.string +// Description:ImageData.data converts strings to numbers with ToNumber +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("ImageData.data converts strings to numbers with ToNumber"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +imgdata.data[0] = 100; +imgdata.data[0] = "110"; +_assertSame(imgdata.data[0], 110, "imgdata.data[\""+(0)+"\"]", "110"); +imgdata.data[0] = 100; +imgdata.data[0] = "0x78"; +_assertSame(imgdata.data[0], 120, "imgdata.data[\""+(0)+"\"]", "120"); +imgdata.data[0] = 100; +imgdata.data[0] = " +130e0 "; +_assertSame(imgdata.data[0], 130, "imgdata.data[\""+(0)+"\"]", "130"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.undefined.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.undefined.html new file mode 100644 index 0000000000..a2533a52e6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.undefined.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.imageData.object.undefined</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.object.undefined</h1> +<p class="desc">ImageData.data converts undefined to 0</p> + + +<script> +var t = async_test("ImageData.data converts undefined to 0"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +imgdata.data[0] = 100; +imgdata.data[0] = undefined; +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.undefined.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.undefined.worker.js new file mode 100644 index 0000000000..f6b62993f6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.undefined.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.object.undefined +// Description:ImageData.data converts undefined to 0 +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("ImageData.data converts undefined to 0"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +imgdata.data[0] = 100; +imgdata.data[0] = undefined; +_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.alpha.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.alpha.html new file mode 100644 index 0000000000..ecda85bd12 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.alpha.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.put.alpha</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.put.alpha</h1> +<p class="desc">putImageData() puts non-solid image data correctly</p> + + +<script> +var t = async_test("putImageData() puts non-solid image data 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 = 'rgba(0, 255, 0, 0.25)'; +ctx.fillRect(0, 0, 100, 50) +var imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50) +ctx.putImageData(imgdata, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,255,0,64, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.alpha.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.alpha.worker.js new file mode 100644 index 0000000000..3349c69286 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.alpha.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.imageData.put.alpha +// Description:putImageData() puts non-solid image data correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("putImageData() puts non-solid image data 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 = 'rgba(0, 255, 0, 0.25)'; +ctx.fillRect(0, 0, 100, 50) +var imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50) +ctx.putImageData(imgdata, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,255,0,64, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.basic.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.basic.html new file mode 100644 index 0000000000..d140cc39ab --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.basic.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.put.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.imageData.put.basic</h1> +<p class="desc">putImageData() puts image data from getImageData() onto the canvas</p> + + +<script> +var t = async_test("putImageData() puts image data from getImageData() onto the canvas"); +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 imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50) +ctx.putImageData(imgdata, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.basic.worker.js new file mode 100644 index 0000000000..276fea2d12 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.basic.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.imageData.put.basic +// Description:putImageData() puts image data from getImageData() onto the canvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("putImageData() puts image data from getImageData() onto the canvas"); +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 imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50) +ctx.putImageData(imgdata, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.clip.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.clip.html new file mode 100644 index 0000000000..121a45fae8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.clip.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.imageData.put.clip</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.put.clip</h1> +<p class="desc">putImageData() is not affected by clipping regions</p> + + +<script> +var t = async_test("putImageData() is not affected by clipping regions"); +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 imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50) +ctx.beginPath(); +ctx.rect(0, 0, 50, 50); +ctx.clip(); +ctx.putImageData(imgdata, 0, 0); +_assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.clip.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.clip.worker.js new file mode 100644 index 0000000000..9188b3cf88 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.clip.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.put.clip +// Description:putImageData() is not affected by clipping regions +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("putImageData() is not affected by clipping regions"); +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 imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50) +ctx.beginPath(); +ctx.rect(0, 0, 50, 50); +ctx.clip(); +ctx.putImageData(imgdata, 0, 0); +_assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.created.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.created.html new file mode 100644 index 0000000000..7ade3b1deb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.created.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.imageData.put.created</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.put.created</h1> +<p class="desc">putImageData() puts image data from createImageData() onto the canvas</p> + + +<script> +var t = async_test("putImageData() puts image data from createImageData() onto the canvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.createImageData(100, 50); +for (var i = 0; i < imgdata.data.length; i += 4) { + imgdata.data[i] = 0; + imgdata.data[i+1] = 255; + imgdata.data[i+2] = 0; + imgdata.data[i+3] = 255; +} +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50) +ctx.putImageData(imgdata, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.created.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.created.worker.js new file mode 100644 index 0000000000..fd6b5ec8e0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.created.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.put.created +// Description:putImageData() puts image data from createImageData() onto the canvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("putImageData() puts image data from createImageData() onto the canvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.createImageData(100, 50); +for (var i = 0; i < imgdata.data.length; i += 4) { + imgdata.data[i] = 0; + imgdata.data[i+1] = 255; + imgdata.data[i+2] = 0; + imgdata.data[i+3] = 255; +} +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50) +ctx.putImageData(imgdata, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.cross.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.cross.html new file mode 100644 index 0000000000..af90d71991 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.cross.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.put.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.imageData.put.cross</h1> +<p class="desc">putImageData() accepts image data got from a different canvas</p> + + +<script> +var t = async_test("putImageData() accepts image data got from a different canvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#0f0'; +ctx2.fillRect(0, 0, 100, 50) +var imgdata = ctx2.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50) +ctx.putImageData(imgdata, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.cross.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.cross.worker.js new file mode 100644 index 0000000000..bdeaa35245 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.cross.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.put.cross +// Description:putImageData() accepts image data got from a different canvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("putImageData() accepts image data got from a different canvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#0f0'; +ctx2.fillRect(0, 0, 100, 50) +var imgdata = ctx2.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50) +ctx.putImageData(imgdata, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.negative.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.negative.html new file mode 100644 index 0000000000..e2fbcb2702 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.negative.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.imageData.put.dirty.negative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.put.dirty.negative</h1> +<p class="desc">putImageData() handles negative-sized dirty rectangles correctly</p> + + +<script> +var t = async_test("putImageData() handles negative-sized dirty rectangles 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50) +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 20, 20) +var imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50) +ctx.fillStyle = '#f00'; +ctx.fillRect(40, 20, 20, 20) +ctx.putImageData(imgdata, 40, 20, 20, 20, -20, -20); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); +_assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.negative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.negative.worker.js new file mode 100644 index 0000000000..5eec264c75 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.negative.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.imageData.put.dirty.negative +// Description:putImageData() handles negative-sized dirty rectangles correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("putImageData() handles negative-sized dirty rectangles 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50) +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 20, 20) +var imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50) +ctx.fillStyle = '#f00'; +ctx.fillRect(40, 20, 20, 20) +ctx.putImageData(imgdata, 40, 20, 20, 20, -20, -20); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); +_assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.outside.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.outside.html new file mode 100644 index 0000000000..aaf48a762b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.outside.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.imageData.put.dirty.outside</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.put.dirty.outside</h1> +<p class="desc">putImageData() handles dirty rectangles outside the canvas correctly</p> + + +<script> +var t = async_test("putImageData() handles dirty rectangles outside the canvas 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50) +var imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50) +ctx.putImageData(imgdata, 100, 20, 20, 20, -20, -20); +ctx.putImageData(imgdata, 200, 200, 0, 0, 100, 50); +ctx.putImageData(imgdata, 40, 20, -30, -20, 30, 20); +ctx.putImageData(imgdata, -30, 20, 0, 0, 30, 20); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 98,15, 0,255,0,255, 2); +_assertPixelApprox(canvas, 98,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 98,45, 0,255,0,255, 2); +_assertPixelApprox(canvas, 1,5, 0,255,0,255, 2); +_assertPixelApprox(canvas, 1,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 1,45, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.outside.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.outside.worker.js new file mode 100644 index 0000000000..9f537135da --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.outside.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.imageData.put.dirty.outside +// Description:putImageData() handles dirty rectangles outside the canvas correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("putImageData() handles dirty rectangles outside the canvas 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50) +var imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50) +ctx.putImageData(imgdata, 100, 20, 20, 20, -20, -20); +ctx.putImageData(imgdata, 200, 200, 0, 0, 100, 50); +ctx.putImageData(imgdata, 40, 20, -30, -20, 30, 20); +ctx.putImageData(imgdata, -30, 20, 0, 0, 30, 20); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 98,15, 0,255,0,255, 2); +_assertPixelApprox(canvas, 98,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 98,45, 0,255,0,255, 2); +_assertPixelApprox(canvas, 1,5, 0,255,0,255, 2); +_assertPixelApprox(canvas, 1,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 1,45, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect1.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect1.html new file mode 100644 index 0000000000..e973eb6ca4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect1.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.imageData.put.dirty.rect1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.put.dirty.rect1</h1> +<p class="desc">putImageData() only modifies areas inside the dirty rectangle, using width and height</p> + + +<script> +var t = async_test("putImageData() only modifies areas inside the dirty rectangle, using width and height"); +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.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 20, 20) +var imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50) +ctx.fillStyle = '#f00'; +ctx.fillRect(40, 20, 20, 20) +ctx.putImageData(imgdata, 40, 20, 0, 0, 20, 20); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); +_assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect1.worker.js new file mode 100644 index 0000000000..fdbe6561ce --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect1.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.imageData.put.dirty.rect1 +// Description:putImageData() only modifies areas inside the dirty rectangle, using width and height +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("putImageData() only modifies areas inside the dirty rectangle, using width and height"); +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.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 20, 20) +var imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50) +ctx.fillStyle = '#f00'; +ctx.fillRect(40, 20, 20, 20) +ctx.putImageData(imgdata, 40, 20, 0, 0, 20, 20); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); +_assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect2.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect2.html new file mode 100644 index 0000000000..9b275429e6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect2.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.imageData.put.dirty.rect2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.put.dirty.rect2</h1> +<p class="desc">putImageData() only modifies areas inside the dirty rectangle, using x and y</p> + + +<script> +var t = async_test("putImageData() only modifies areas inside the dirty rectangle, using x and y"); +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.fillStyle = '#0f0'; +ctx.fillRect(60, 30, 20, 20) +var imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50) +ctx.fillStyle = '#f00'; +ctx.fillRect(40, 20, 20, 20) +ctx.putImageData(imgdata, -20, -10, 60, 30, 20, 20); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); +_assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect2.worker.js new file mode 100644 index 0000000000..3578ceec25 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect2.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.imageData.put.dirty.rect2 +// Description:putImageData() only modifies areas inside the dirty rectangle, using x and y +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("putImageData() only modifies areas inside the dirty rectangle, using x and y"); +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.fillStyle = '#0f0'; +ctx.fillRect(60, 30, 20, 20) +var imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50) +ctx.fillStyle = '#f00'; +ctx.fillRect(40, 20, 20, 20) +ctx.putImageData(imgdata, -20, -10, 60, 30, 20, 20); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); +_assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); +_assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.zero.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.zero.html new file mode 100644 index 0000000000..c1b6735d25 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.zero.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.put.dirty.zero</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.put.dirty.zero</h1> +<p class="desc">putImageData() with zero-sized dirty rectangle puts nothing</p> + + +<script> +var t = async_test("putImageData() with zero-sized dirty rectangle puts 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50) +var imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50) +ctx.putImageData(imgdata, 0, 0, 0, 0, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.zero.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.zero.worker.js new file mode 100644 index 0000000000..db09379c62 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.zero.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.imageData.put.dirty.zero +// Description:putImageData() with zero-sized dirty rectangle puts nothing +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("putImageData() with zero-sized dirty rectangle puts 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50) +var imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50) +ctx.putImageData(imgdata, 0, 0, 0, 0, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.modified.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.modified.html new file mode 100644 index 0000000000..543d9ff293 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.modified.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.put.modified</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.put.modified</h1> +<p class="desc">putImageData() puts modified image data correctly</p> + + +<script> +var t = async_test("putImageData() puts modified image data 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.fillStyle = '#f00'; +ctx.fillRect(45, 20, 10, 10) +var imgdata = ctx.getImageData(45, 20, 10, 10); +for (var i = 0, len = imgdata.width*imgdata.height*4; i < len; i += 4) +{ + imgdata.data[i] = 0; + imgdata.data[i+1] = 255; +} +ctx.putImageData(imgdata, 45, 20); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.modified.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.modified.worker.js new file mode 100644 index 0000000000..b238d56cf9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.modified.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.put.modified +// Description:putImageData() puts modified image data correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("putImageData() puts modified image data 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.fillStyle = '#f00'; +ctx.fillRect(45, 20, 10, 10) +var imgdata = ctx.getImageData(45, 20, 10, 10); +for (var i = 0, len = imgdata.width*imgdata.height*4; i < len; i += 4) +{ + imgdata.data[i] = 0; + imgdata.data[i+1] = 255; +} +ctx.putImageData(imgdata, 45, 20); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.nonfinite.html new file mode 100644 index 0000000000..6590f761ad --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.nonfinite.html @@ -0,0 +1,109 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.put.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.put.nonfinite</h1> +<p class="desc">putImageData() throws TypeError if arguments are not finite</p> + + +<script> +var t = async_test("putImageData() throws TypeError if arguments are not finite"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, -Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, NaN, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, -Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, NaN, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, -Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, NaN); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, Infinity); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.nonfinite.worker.js new file mode 100644 index 0000000000..04298fa99f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.nonfinite.worker.js @@ -0,0 +1,105 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.put.nonfinite +// Description:putImageData() throws TypeError if arguments are not finite +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("putImageData() throws TypeError if arguments are not finite"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = ctx.getImageData(0, 0, 10, 10); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, -Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, NaN, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, -Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, NaN, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, -Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, NaN); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, Infinity); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.null.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.null.html new file mode 100644 index 0000000000..3a51c9719c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.null.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.put.null</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.put.null</h1> +<p class="desc">putImageData() with null imagedata throws TypeError</p> + + +<script> +var t = async_test("putImageData() with null imagedata throws TypeError"); +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'); + +assert_throws_js(TypeError, function() { ctx.putImageData(null, 0, 0); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.null.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.null.worker.js new file mode 100644 index 0000000000..0b5b746ba0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.null.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.put.null +// Description:putImageData() with null imagedata throws TypeError +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("putImageData() with null imagedata throws TypeError"); +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'); + +assert_throws_js(TypeError, function() { ctx.putImageData(null, 0, 0); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.path.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.path.html new file mode 100644 index 0000000000..53e3ac4fce --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.path.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.put.path</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.put.path</h1> +<p class="desc">putImageData() does not affect the current path</p> + + +<script> +var t = async_test("putImageData() does not affect the current path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50) +ctx.rect(0, 0, 100, 50); +var imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.putImageData(imgdata, 0, 0); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.path.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.path.worker.js new file mode 100644 index 0000000000..81bd03eb4f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.path.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.put.path +// Description:putImageData() does not affect the current path +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("putImageData() does not affect the current path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50) +ctx.rect(0, 0, 100, 50); +var imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.putImageData(imgdata, 0, 0); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unaffected.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unaffected.html new file mode 100644 index 0000000000..8d94f9bbf6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unaffected.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.imageData.put.unaffected</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.put.unaffected</h1> +<p class="desc">putImageData() is not affected by context state</p> + + +<script> +var t = async_test("putImageData() is not affected by context state"); +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 imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50) +ctx.globalAlpha = 0.1; +ctx.globalCompositeOperation = 'destination-atop'; +ctx.shadowColor = '#f00'; +ctx.shadowBlur = 1; +ctx.translate(100, 50); +ctx.scale(0.1, 0.1); +ctx.putImageData(imgdata, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unaffected.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unaffected.worker.js new file mode 100644 index 0000000000..9b931717f0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unaffected.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.imageData.put.unaffected +// Description:putImageData() is not affected by context state +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("putImageData() is not affected by context state"); +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 imgdata = ctx.getImageData(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50) +ctx.globalAlpha = 0.1; +ctx.globalCompositeOperation = 'destination-atop'; +ctx.shadowColor = '#f00'; +ctx.shadowBlur = 1; +ctx.translate(100, 50); +ctx.scale(0.1, 0.1); +ctx.putImageData(imgdata, 0, 0); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unchanged.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unchanged.html new file mode 100644 index 0000000000..b3aff6f49c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unchanged.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.imageData.put.unchanged</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.put.unchanged</h1> +<p class="desc">putImageData(getImageData(...), ...) has no effect</p> + + +<script> +var t = async_test("putImageData(getImageData(...), ...) has no effect"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var i = 0; +for (var y = 0; y < 16; ++y) { + for (var x = 0; x < 16; ++x, ++i) { + ctx.fillStyle = 'rgba(' + i + ',' + (Math.floor(i*1.5) % 256) + ',' + (Math.floor(i*23.3) % 256) + ',' + (i/256) + ')'; + ctx.fillRect(x, y, 1, 1); + } +} +var imgdata1 = ctx.getImageData(0.1, 0.2, 15.8, 15.9); +var olddata = []; +for (var i = 0; i < imgdata1.data.length; ++i) + olddata[i] = imgdata1.data[i]; +ctx.putImageData(imgdata1, 0.1, 0.2); +var imgdata2 = ctx.getImageData(0.1, 0.2, 15.8, 15.9); +for (var i = 0; i < imgdata2.data.length; ++i) { + _assertSame(olddata[i], imgdata2.data[i], "olddata[\""+(i)+"\"]", "imgdata2.data[\""+(i)+"\"]"); +} +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unchanged.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unchanged.worker.js new file mode 100644 index 0000000000..231ba3860d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unchanged.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.imageData.put.unchanged +// Description:putImageData(getImageData(...), ...) has no effect +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("putImageData(getImageData(...), ...) has no effect"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var i = 0; +for (var y = 0; y < 16; ++y) { + for (var x = 0; x < 16; ++x, ++i) { + ctx.fillStyle = 'rgba(' + i + ',' + (Math.floor(i*1.5) % 256) + ',' + (Math.floor(i*23.3) % 256) + ',' + (i/256) + ')'; + ctx.fillRect(x, y, 1, 1); + } +} +var imgdata1 = ctx.getImageData(0.1, 0.2, 15.8, 15.9); +var olddata = []; +for (var i = 0; i < imgdata1.data.length; ++i) + olddata[i] = imgdata1.data[i]; +ctx.putImageData(imgdata1, 0.1, 0.2); +var imgdata2 = ctx.getImageData(0.1, 0.2, 15.8, 15.9); +for (var i = 0; i < imgdata2.data.length; ++i) { + _assertSame(olddata[i], imgdata2.data[i], "olddata[\""+(i)+"\"]", "imgdata2.data[\""+(i)+"\"]"); +} +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.wrongtype.html b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.wrongtype.html new file mode 100644 index 0000000000..8e8ca53a9a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.wrongtype.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.imageData.put.wrongtype</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.imageData.put.wrongtype</h1> +<p class="desc">putImageData() does not accept non-ImageData objects</p> + + +<script> +var t = async_test("putImageData() does not accept non-ImageData objects"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = { width: 1, height: 1, data: [255, 0, 0, 255] }; +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.putImageData("cheese", 0, 0); }); +assert_throws_js(TypeError, function() { ctx.putImageData(42, 0, 0); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.wrongtype.worker.js b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.wrongtype.worker.js new file mode 100644 index 0000000000..9c58133ac9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.wrongtype.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.imageData.put.wrongtype +// Description:putImageData() does not accept non-ImageData objects +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("putImageData() does not accept non-ImageData objects"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var imgdata = { width: 1, height: 1, data: [255, 0, 0, 255] }; +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.putImageData("cheese", 0, 0); }); +assert_throws_js(TypeError, function() { ctx.putImageData(42, 0, 0); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/set-proprietary-font-names-001-crash.html b/testing/web-platform/tests/html/canvas/offscreen/set-proprietary-font-names-001-crash.html new file mode 100644 index 0000000000..dfa661655e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/set-proprietary-font-names-001-crash.html @@ -0,0 +1,13 @@ +<!DOCTYPE> +<title>Setting font of offscreen</title> +<script src="/css/css-fonts/support/font-family-keywords.js"></script> +<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#font-family-prop"> +<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1056386"> +<script> + let ctx = (new OffscreenCanvas(1024, 50)).getContext('2d'); + function setFont(keyword) { ctx.font = `12px ${keyword}` }; + kNonGenericFontFamilyKeywords.forEach(setFont); + kGenericFontFamilyKeywords.forEach(keyword => { + setFont(`-webkit-${keyword}`); + }); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.1.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.1.html new file mode 100644 index 0000000000..cf887b62a2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.1.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.alpha.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.alpha.1</h1> +<p class="desc">Shadow color alpha components are used</p> + + +<script> +var t = async_test("Shadow color alpha components are used"); +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.shadowColor = 'rgba(255, 0, 0, 0.01)'; +ctx.shadowOffsetY = 50; +ctx.fillRect(0, -50, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 4); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.1.worker.js new file mode 100644 index 0000000000..7bcf74463c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.1.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.alpha.1 +// Description:Shadow color alpha components are used +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadow color alpha components are used"); +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.shadowColor = 'rgba(255, 0, 0, 0.01)'; +ctx.shadowOffsetY = 50; +ctx.fillRect(0, -50, 100, 50); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 4); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.2.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.2.html new file mode 100644 index 0000000000..cb03866bc3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.2.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.alpha.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.alpha.2</h1> +<p class="desc">Shadow color alpha components are used</p> + + +<script> +var t = async_test("Shadow color alpha components are used"); +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.shadowColor = 'rgba(0, 0, 255, 0.5)'; +ctx.shadowOffsetY = 50; +ctx.fillRect(0, -50, 100, 50); +_assertPixelApprox(canvas, 50,25, 127,0,127,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.2.worker.js new file mode 100644 index 0000000000..8f4b98143b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.2.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.alpha.2 +// Description:Shadow color alpha components are used +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadow color alpha components are used"); +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.shadowColor = 'rgba(0, 0, 255, 0.5)'; +ctx.shadowOffsetY = 50; +ctx.fillRect(0, -50, 100, 50); +_assertPixelApprox(canvas, 50,25, 127,0,127,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.3.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.3.html new file mode 100644 index 0000000000..efc9fca97e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.3.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.shadow.alpha.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.alpha.3</h1> +<p class="desc">Shadows are affected by globalAlpha</p> + + +<script> +var t = async_test("Shadows are affected by globalAlpha"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; // (work around broken Firefox globalAlpha caching) +ctx.shadowColor = '#00f'; +ctx.shadowOffsetY = 50; +ctx.globalAlpha = 0.5; +ctx.fillRect(0, -50, 100, 50); +_assertPixelApprox(canvas, 50,25, 127,0,127,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.3.worker.js new file mode 100644 index 0000000000..ddaae242d9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.3.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.alpha.3 +// Description:Shadows are affected by globalAlpha +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are affected by globalAlpha"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; // (work around broken Firefox globalAlpha caching) +ctx.shadowColor = '#00f'; +ctx.shadowOffsetY = 50; +ctx.globalAlpha = 0.5; +ctx.fillRect(0, -50, 100, 50); +_assertPixelApprox(canvas, 50,25, 127,0,127,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.4.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.4.html new file mode 100644 index 0000000000..295b61269c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.4.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.shadow.alpha.4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.alpha.4</h1> +<p class="desc">Shadows with alpha components are correctly affected by globalAlpha</p> + + +<script> +var t = async_test("Shadows with alpha components are correctly affected by globalAlpha"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; // (work around broken Firefox globalAlpha caching) +ctx.shadowColor = 'rgba(0, 0, 255, 0.707)'; +ctx.shadowOffsetY = 50; +ctx.globalAlpha = 0.707; +ctx.fillRect(0, -50, 100, 50); +_assertPixelApprox(canvas, 50,25, 127,0,127,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.4.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.4.worker.js new file mode 100644 index 0000000000..16defd9094 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.4.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.alpha.4 +// Description:Shadows with alpha components are correctly affected by globalAlpha +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows with alpha components are correctly affected by globalAlpha"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; // (work around broken Firefox globalAlpha caching) +ctx.shadowColor = 'rgba(0, 0, 255, 0.707)'; +ctx.shadowOffsetY = 50; +ctx.globalAlpha = 0.707; +ctx.fillRect(0, -50, 100, 50); +_assertPixelApprox(canvas, 50,25, 127,0,127,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.5.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.5.html new file mode 100644 index 0000000000..3b1089d7d7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.5.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.alpha.5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.alpha.5</h1> +<p class="desc">Shadows of shapes with alpha components are drawn correctly</p> + + +<script> +var t = async_test("Shadows of shapes with alpha components are drawn 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = 'rgba(64, 0, 0, 0.5)'; +ctx.shadowColor = '#00f'; +ctx.shadowOffsetY = 50; +ctx.fillRect(0, -50, 100, 50); +_assertPixelApprox(canvas, 50,25, 127,0,127,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.5.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.5.worker.js new file mode 100644 index 0000000000..5437c65ec1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.alpha.5.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.shadow.alpha.5 +// Description:Shadows of shapes with alpha components are drawn correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows of shapes with alpha components are drawn 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = 'rgba(64, 0, 0, 0.5)'; +ctx.shadowColor = '#00f'; +ctx.shadowOffsetY = 50; +ctx.fillRect(0, -50, 100, 50); +_assertPixelApprox(canvas, 50,25, 127,0,127,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowBlur.initial.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowBlur.initial.html new file mode 100644 index 0000000000..e6c4c2fda8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowBlur.initial.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.attributes.shadowBlur.initial</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.attributes.shadowBlur.initial</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.shadowBlur, 0, "ctx.shadowBlur", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowBlur.initial.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowBlur.initial.worker.js new file mode 100644 index 0000000000..9cf55e796b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowBlur.initial.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.attributes.shadowBlur.initial +// 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.shadowBlur, 0, "ctx.shadowBlur", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowBlur.invalid.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowBlur.invalid.html new file mode 100644 index 0000000000..a506da4b8b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowBlur.invalid.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.attributes.shadowBlur.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.shadow.attributes.shadowBlur.invalid</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.shadowBlur = 1; +ctx.shadowBlur = -2; +_assertSame(ctx.shadowBlur, 1, "ctx.shadowBlur", "1"); +ctx.shadowBlur = 1; +ctx.shadowBlur = Infinity; +_assertSame(ctx.shadowBlur, 1, "ctx.shadowBlur", "1"); +ctx.shadowBlur = 1; +ctx.shadowBlur = -Infinity; +_assertSame(ctx.shadowBlur, 1, "ctx.shadowBlur", "1"); +ctx.shadowBlur = 1; +ctx.shadowBlur = NaN; +_assertSame(ctx.shadowBlur, 1, "ctx.shadowBlur", "1"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowBlur.invalid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowBlur.invalid.worker.js new file mode 100644 index 0000000000..1f79c36d12 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowBlur.invalid.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.attributes.shadowBlur.invalid +// 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.shadowBlur = 1; +ctx.shadowBlur = -2; +_assertSame(ctx.shadowBlur, 1, "ctx.shadowBlur", "1"); +ctx.shadowBlur = 1; +ctx.shadowBlur = Infinity; +_assertSame(ctx.shadowBlur, 1, "ctx.shadowBlur", "1"); +ctx.shadowBlur = 1; +ctx.shadowBlur = -Infinity; +_assertSame(ctx.shadowBlur, 1, "ctx.shadowBlur", "1"); +ctx.shadowBlur = 1; +ctx.shadowBlur = NaN; +_assertSame(ctx.shadowBlur, 1, "ctx.shadowBlur", "1"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowBlur.valid.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowBlur.valid.html new file mode 100644 index 0000000000..b69b9c4717 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowBlur.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.shadow.attributes.shadowBlur.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.shadow.attributes.shadowBlur.valid</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.shadowBlur = 1; +_assertSame(ctx.shadowBlur, 1, "ctx.shadowBlur", "1"); +ctx.shadowBlur = 0.5; +_assertSame(ctx.shadowBlur, 0.5, "ctx.shadowBlur", "0.5"); +ctx.shadowBlur = 1e6; +_assertSame(ctx.shadowBlur, 1e6, "ctx.shadowBlur", "1e6"); +ctx.shadowBlur = 0; +_assertSame(ctx.shadowBlur, 0, "ctx.shadowBlur", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowBlur.valid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowBlur.valid.worker.js new file mode 100644 index 0000000000..b41fa24905 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowBlur.valid.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.attributes.shadowBlur.valid +// 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.shadowBlur = 1; +_assertSame(ctx.shadowBlur, 1, "ctx.shadowBlur", "1"); +ctx.shadowBlur = 0.5; +_assertSame(ctx.shadowBlur, 0.5, "ctx.shadowBlur", "0.5"); +ctx.shadowBlur = 1e6; +_assertSame(ctx.shadowBlur, 1e6, "ctx.shadowBlur", "1e6"); +ctx.shadowBlur = 0; +_assertSame(ctx.shadowBlur, 0, "ctx.shadowBlur", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowColor.initial.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowColor.initial.html new file mode 100644 index 0000000000..44a25308ac --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowColor.initial.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.attributes.shadowColor.initial</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.attributes.shadowColor.initial</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.shadowColor, 'rgba(0, 0, 0, 0)', "ctx.shadowColor", "'rgba(0, 0, 0, 0)'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowColor.initial.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowColor.initial.worker.js new file mode 100644 index 0000000000..f8132d5385 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowColor.initial.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.attributes.shadowColor.initial +// 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.shadowColor, 'rgba(0, 0, 0, 0)', "ctx.shadowColor", "'rgba(0, 0, 0, 0)'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowColor.invalid.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowColor.invalid.html new file mode 100644 index 0000000000..ed09bcbdcf --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowColor.invalid.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.attributes.shadowColor.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.shadow.attributes.shadowColor.invalid</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.shadowColor = '#00ff00'; +ctx.shadowColor = 'bogus'; +_assertSame(ctx.shadowColor, '#00ff00', "ctx.shadowColor", "'#00ff00'"); +ctx.shadowColor = '#00ff00'; +ctx.shadowColor = 'red bogus'; +_assertSame(ctx.shadowColor, '#00ff00', "ctx.shadowColor", "'#00ff00'"); +ctx.shadowColor = '#00ff00'; +ctx.shadowColor = ctx; +_assertSame(ctx.shadowColor, '#00ff00', "ctx.shadowColor", "'#00ff00'"); +ctx.shadowColor = '#00ff00'; +ctx.shadowColor = undefined; +_assertSame(ctx.shadowColor, '#00ff00', "ctx.shadowColor", "'#00ff00'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowColor.invalid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowColor.invalid.worker.js new file mode 100644 index 0000000000..b1003718c5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowColor.invalid.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.attributes.shadowColor.invalid +// 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.shadowColor = '#00ff00'; +ctx.shadowColor = 'bogus'; +_assertSame(ctx.shadowColor, '#00ff00', "ctx.shadowColor", "'#00ff00'"); +ctx.shadowColor = '#00ff00'; +ctx.shadowColor = 'red bogus'; +_assertSame(ctx.shadowColor, '#00ff00', "ctx.shadowColor", "'#00ff00'"); +ctx.shadowColor = '#00ff00'; +ctx.shadowColor = ctx; +_assertSame(ctx.shadowColor, '#00ff00', "ctx.shadowColor", "'#00ff00'"); +ctx.shadowColor = '#00ff00'; +ctx.shadowColor = undefined; +_assertSame(ctx.shadowColor, '#00ff00', "ctx.shadowColor", "'#00ff00'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowColor.valid.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowColor.valid.html new file mode 100644 index 0000000000..9511027b5a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowColor.valid.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.shadow.attributes.shadowColor.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.shadow.attributes.shadowColor.valid</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.shadowColor = 'lime'; +_assertSame(ctx.shadowColor, '#00ff00', "ctx.shadowColor", "'#00ff00'"); +ctx.shadowColor = 'RGBA(0,255, 0,0)'; +_assertSame(ctx.shadowColor, 'rgba(0, 255, 0, 0)', "ctx.shadowColor", "'rgba(0, 255, 0, 0)'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowColor.valid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowColor.valid.worker.js new file mode 100644 index 0000000000..f47e3660b5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowColor.valid.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.attributes.shadowColor.valid +// 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.shadowColor = 'lime'; +_assertSame(ctx.shadowColor, '#00ff00', "ctx.shadowColor", "'#00ff00'"); +ctx.shadowColor = 'RGBA(0,255, 0,0)'; +_assertSame(ctx.shadowColor, 'rgba(0, 255, 0, 0)', "ctx.shadowColor", "'rgba(0, 255, 0, 0)'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowOffset.initial.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowOffset.initial.html new file mode 100644 index 0000000000..e568569a58 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowOffset.initial.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.attributes.shadowOffset.initial</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.attributes.shadowOffset.initial</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.shadowOffsetX, 0, "ctx.shadowOffsetX", "0"); +_assertSame(ctx.shadowOffsetY, 0, "ctx.shadowOffsetY", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowOffset.initial.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowOffset.initial.worker.js new file mode 100644 index 0000000000..af2e77f464 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowOffset.initial.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.attributes.shadowOffset.initial +// 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.shadowOffsetX, 0, "ctx.shadowOffsetX", "0"); +_assertSame(ctx.shadowOffsetY, 0, "ctx.shadowOffsetY", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowOffset.invalid.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowOffset.invalid.html new file mode 100644 index 0000000000..58c8efec20 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowOffset.invalid.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.shadow.attributes.shadowOffset.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.shadow.attributes.shadowOffset.invalid</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.shadowOffsetX = 1; +ctx.shadowOffsetY = 2; +ctx.shadowOffsetX = Infinity; +ctx.shadowOffsetY = Infinity; +_assertSame(ctx.shadowOffsetX, 1, "ctx.shadowOffsetX", "1"); +_assertSame(ctx.shadowOffsetY, 2, "ctx.shadowOffsetY", "2"); +ctx.shadowOffsetX = 1; +ctx.shadowOffsetY = 2; +ctx.shadowOffsetX = -Infinity; +ctx.shadowOffsetY = -Infinity; +_assertSame(ctx.shadowOffsetX, 1, "ctx.shadowOffsetX", "1"); +_assertSame(ctx.shadowOffsetY, 2, "ctx.shadowOffsetY", "2"); +ctx.shadowOffsetX = 1; +ctx.shadowOffsetY = 2; +ctx.shadowOffsetX = NaN; +ctx.shadowOffsetY = NaN; +_assertSame(ctx.shadowOffsetX, 1, "ctx.shadowOffsetX", "1"); +_assertSame(ctx.shadowOffsetY, 2, "ctx.shadowOffsetY", "2"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowOffset.invalid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowOffset.invalid.worker.js new file mode 100644 index 0000000000..892614781a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowOffset.invalid.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.shadow.attributes.shadowOffset.invalid +// 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.shadowOffsetX = 1; +ctx.shadowOffsetY = 2; +ctx.shadowOffsetX = Infinity; +ctx.shadowOffsetY = Infinity; +_assertSame(ctx.shadowOffsetX, 1, "ctx.shadowOffsetX", "1"); +_assertSame(ctx.shadowOffsetY, 2, "ctx.shadowOffsetY", "2"); +ctx.shadowOffsetX = 1; +ctx.shadowOffsetY = 2; +ctx.shadowOffsetX = -Infinity; +ctx.shadowOffsetY = -Infinity; +_assertSame(ctx.shadowOffsetX, 1, "ctx.shadowOffsetX", "1"); +_assertSame(ctx.shadowOffsetY, 2, "ctx.shadowOffsetY", "2"); +ctx.shadowOffsetX = 1; +ctx.shadowOffsetY = 2; +ctx.shadowOffsetX = NaN; +ctx.shadowOffsetY = NaN; +_assertSame(ctx.shadowOffsetX, 1, "ctx.shadowOffsetX", "1"); +_assertSame(ctx.shadowOffsetY, 2, "ctx.shadowOffsetY", "2"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowOffset.valid.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowOffset.valid.html new file mode 100644 index 0000000000..1ad622c468 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowOffset.valid.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.shadow.attributes.shadowOffset.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.shadow.attributes.shadowOffset.valid</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.shadowOffsetX = 1; +ctx.shadowOffsetY = 2; +_assertSame(ctx.shadowOffsetX, 1, "ctx.shadowOffsetX", "1"); +_assertSame(ctx.shadowOffsetY, 2, "ctx.shadowOffsetY", "2"); +ctx.shadowOffsetX = 0.5; +ctx.shadowOffsetY = 0.25; +_assertSame(ctx.shadowOffsetX, 0.5, "ctx.shadowOffsetX", "0.5"); +_assertSame(ctx.shadowOffsetY, 0.25, "ctx.shadowOffsetY", "0.25"); +ctx.shadowOffsetX = -0.5; +ctx.shadowOffsetY = -0.25; +_assertSame(ctx.shadowOffsetX, -0.5, "ctx.shadowOffsetX", "-0.5"); +_assertSame(ctx.shadowOffsetY, -0.25, "ctx.shadowOffsetY", "-0.25"); +ctx.shadowOffsetX = 0; +ctx.shadowOffsetY = 0; +_assertSame(ctx.shadowOffsetX, 0, "ctx.shadowOffsetX", "0"); +_assertSame(ctx.shadowOffsetY, 0, "ctx.shadowOffsetY", "0"); +ctx.shadowOffsetX = 1e6; +ctx.shadowOffsetY = 1e6; +_assertSame(ctx.shadowOffsetX, 1e6, "ctx.shadowOffsetX", "1e6"); +_assertSame(ctx.shadowOffsetY, 1e6, "ctx.shadowOffsetY", "1e6"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowOffset.valid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowOffset.valid.worker.js new file mode 100644 index 0000000000..eed84b54e5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.attributes.shadowOffset.valid.worker.js @@ -0,0 +1,42 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.attributes.shadowOffset.valid +// 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.shadowOffsetX = 1; +ctx.shadowOffsetY = 2; +_assertSame(ctx.shadowOffsetX, 1, "ctx.shadowOffsetX", "1"); +_assertSame(ctx.shadowOffsetY, 2, "ctx.shadowOffsetY", "2"); +ctx.shadowOffsetX = 0.5; +ctx.shadowOffsetY = 0.25; +_assertSame(ctx.shadowOffsetX, 0.5, "ctx.shadowOffsetX", "0.5"); +_assertSame(ctx.shadowOffsetY, 0.25, "ctx.shadowOffsetY", "0.25"); +ctx.shadowOffsetX = -0.5; +ctx.shadowOffsetY = -0.25; +_assertSame(ctx.shadowOffsetX, -0.5, "ctx.shadowOffsetX", "-0.5"); +_assertSame(ctx.shadowOffsetY, -0.25, "ctx.shadowOffsetY", "-0.25"); +ctx.shadowOffsetX = 0; +ctx.shadowOffsetY = 0; +_assertSame(ctx.shadowOffsetX, 0, "ctx.shadowOffsetX", "0"); +_assertSame(ctx.shadowOffsetY, 0, "ctx.shadowOffsetY", "0"); +ctx.shadowOffsetX = 1e6; +ctx.shadowOffsetY = 1e6; +_assertSame(ctx.shadowOffsetX, 1e6, "ctx.shadowOffsetX", "1e6"); +_assertSame(ctx.shadowOffsetY, 1e6, "ctx.shadowOffsetY", "1e6"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.alpha.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.alpha.html new file mode 100644 index 0000000000..5fea8a7cf3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.alpha.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.canvas.alpha</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.canvas.alpha</h1> +<p class="desc">Shadows are drawn correctly for partially-transparent canvases</p> + + +<script> +var t = async_test("Shadows are drawn correctly for partially-transparent canvases"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = 'rgba(255, 0, 0, 0.5)'; +ctx2.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#00f'; +ctx.drawImage(offscreenCanvas2, 0, -50); +_assertPixelApprox(canvas, 50,25, 127,0,127,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.alpha.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.alpha.worker.js new file mode 100644 index 0000000000..663e89f284 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.alpha.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.shadow.canvas.alpha +// Description:Shadows are drawn correctly for partially-transparent canvases +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are drawn correctly for partially-transparent canvases"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = 'rgba(255, 0, 0, 0.5)'; +ctx2.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#00f'; +ctx.drawImage(offscreenCanvas2, 0, -50); +_assertPixelApprox(canvas, 50,25, 127,0,127,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.basic.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.basic.html new file mode 100644 index 0000000000..2fc6b547d5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.basic.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.canvas.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.shadow.canvas.basic</h1> +<p class="desc">Shadows are drawn for canvases</p> + + +<script> +var t = async_test("Shadows are drawn for canvases"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#f00'; +ctx2.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 50; +ctx.drawImage(offscreenCanvas2, 0, -50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.basic.worker.js new file mode 100644 index 0000000000..20c433b2f6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.basic.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.shadow.canvas.basic +// Description:Shadows are drawn for canvases +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are drawn for canvases"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#f00'; +ctx2.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 50; +ctx.drawImage(offscreenCanvas2, 0, -50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.transparent.1.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.transparent.1.html new file mode 100644 index 0000000000..1bfcb3bf3b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.transparent.1.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.shadow.canvas.transparent.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.canvas.transparent.1</h1> +<p class="desc">Shadows are not drawn for transparent canvases</p> + + +<script> +var t = async_test("Shadows are not drawn for transparent canvases"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = '#f00'; +ctx.shadowOffsetY = 50; +ctx.drawImage(offscreenCanvas2, 0, -50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.transparent.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.transparent.1.worker.js new file mode 100644 index 0000000000..413ba6b243 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.transparent.1.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.canvas.transparent.1 +// Description:Shadows are not drawn for transparent canvases +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are not drawn for transparent canvases"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = '#f00'; +ctx.shadowOffsetY = 50; +ctx.drawImage(offscreenCanvas2, 0, -50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.transparent.2.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.transparent.2.html new file mode 100644 index 0000000000..6d30dfcb85 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.transparent.2.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.shadow.canvas.transparent.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.canvas.transparent.2</h1> +<p class="desc">Shadows are not drawn for transparent parts of canvases</p> + + +<script> +var t = async_test("Shadows are not drawn for transparent parts of canvases"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#f00'; +ctx2.fillRect(0, 0, 50, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 50, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(50, 0, 50, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#0f0'; +ctx.drawImage(offscreenCanvas2, 50, -50); +ctx.shadowColor = '#f00'; +ctx.drawImage(offscreenCanvas2, -50, -50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.transparent.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.transparent.2.worker.js new file mode 100644 index 0000000000..d702ded746 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.canvas.transparent.2.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.shadow.canvas.transparent.2 +// Description:Shadows are not drawn for transparent parts of canvases +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are not drawn for transparent parts of canvases"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var ctx2 = offscreenCanvas2.getContext('2d'); +ctx2.fillStyle = '#f00'; +ctx2.fillRect(0, 0, 50, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 50, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(50, 0, 50, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#0f0'; +ctx.drawImage(offscreenCanvas2, 50, -50); +ctx.shadowColor = '#f00'; +ctx.drawImage(offscreenCanvas2, -50, -50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.clip.1.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.clip.1.html new file mode 100644 index 0000000000..4beb1214b2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.clip.1.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.shadow.clip.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.clip.1</h1> +<p class="desc">Shadows of clipped shapes are still drawn within the clipping region</p> + + +<script> +var t = async_test("Shadows of clipped shapes are still drawn within the clipping region"); +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, 50, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(50, 0, 50, 50); +ctx.save(); +ctx.beginPath(); +ctx.rect(50, 0, 50, 50); +ctx.clip(); +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetX = 50; +ctx.fillRect(0, 0, 50, 50); +ctx.restore(); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.clip.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.clip.1.worker.js new file mode 100644 index 0000000000..4fafad8330 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.clip.1.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.shadow.clip.1 +// Description:Shadows of clipped shapes are still drawn within the clipping region +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows of clipped shapes are still drawn within the clipping region"); +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, 50, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(50, 0, 50, 50); +ctx.save(); +ctx.beginPath(); +ctx.rect(50, 0, 50, 50); +ctx.clip(); +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetX = 50; +ctx.fillRect(0, 0, 50, 50); +ctx.restore(); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.clip.2.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.clip.2.html new file mode 100644 index 0000000000..bc3de09db7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.clip.2.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.shadow.clip.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.clip.2</h1> +<p class="desc">Shadows are not drawn outside the clipping region</p> + + +<script> +var t = async_test("Shadows are not drawn outside the clipping region"); +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, 50, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(50, 0, 50, 50); +ctx.save(); +ctx.beginPath(); +ctx.rect(0, 0, 50, 50); +ctx.clip(); +ctx.shadowColor = '#f00'; +ctx.shadowOffsetX = 50; +ctx.fillRect(0, 0, 50, 50); +ctx.restore(); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.clip.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.clip.2.worker.js new file mode 100644 index 0000000000..dd2712af40 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.clip.2.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.shadow.clip.2 +// Description:Shadows are not drawn outside the clipping region +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are not drawn outside the clipping region"); +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, 50, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(50, 0, 50, 50); +ctx.save(); +ctx.beginPath(); +ctx.rect(0, 0, 50, 50); +ctx.clip(); +ctx.shadowColor = '#f00'; +ctx.shadowOffsetX = 50; +ctx.fillRect(0, 0, 50, 50); +ctx.restore(); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.clip.3.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.clip.3.html new file mode 100644 index 0000000000..9656feb41f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.clip.3.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.shadow.clip.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.clip.3</h1> +<p class="desc">Shadows of clipped shapes are still drawn within the clipping region</p> + + +<script> +var t = async_test("Shadows of clipped shapes are still drawn within the clipping region"); +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, 50, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(50, 0, 50, 50); +ctx.save(); +ctx.beginPath(); +ctx.rect(0, 0, 50, 50); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetX = 50; +ctx.fillRect(-50, 0, 50, 50); +ctx.restore(); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.clip.3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.clip.3.worker.js new file mode 100644 index 0000000000..ed4983ac8c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.clip.3.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.shadow.clip.3 +// Description:Shadows of clipped shapes are still drawn within the clipping region +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows of clipped shapes are still drawn within the clipping region"); +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, 50, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(50, 0, 50, 50); +ctx.save(); +ctx.beginPath(); +ctx.rect(0, 0, 50, 50); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetX = 50; +ctx.fillRect(-50, 0, 50, 50); +ctx.restore(); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.composite.1.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.composite.1.html new file mode 100644 index 0000000000..13e0daf3aa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.composite.1.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.shadow.composite.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.composite.1</h1> +<p class="desc">Shadows are drawn using globalCompositeOperation</p> + + +<script> +var t = async_test("Shadows are drawn using globalCompositeOperation"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'xor'; +ctx.shadowColor = '#f00'; +ctx.shadowOffsetX = 100; +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, 0, 200, 50); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.composite.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.composite.1.worker.js new file mode 100644 index 0000000000..04d4801db9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.composite.1.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.composite.1 +// Description:Shadows are drawn using globalCompositeOperation +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are drawn using globalCompositeOperation"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'xor'; +ctx.shadowColor = '#f00'; +ctx.shadowOffsetX = 100; +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, 0, 200, 50); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.composite.2.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.composite.2.html new file mode 100644 index 0000000000..aea36997b6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.composite.2.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.shadow.composite.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.composite.2</h1> +<p class="desc">Shadows are drawn using globalCompositeOperation</p> + + +<script> +var t = async_test("Shadows are drawn using globalCompositeOperation"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'xor'; +ctx.shadowColor = '#f00'; +ctx.shadowBlur = 1; +ctx.fillStyle = '#0f0'; +ctx.fillRect(-10, -10, 120, 70); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.composite.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.composite.2.worker.js new file mode 100644 index 0000000000..505e3d535f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.composite.2.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.composite.2 +// Description:Shadows are drawn using globalCompositeOperation +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are drawn using globalCompositeOperation"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'xor'; +ctx.shadowColor = '#f00'; +ctx.shadowBlur = 1; +ctx.fillStyle = '#0f0'; +ctx.fillRect(-10, -10, 120, 70); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.composite.3.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.composite.3.html new file mode 100644 index 0000000000..2218602f38 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.composite.3.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.composite.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.composite.3</h1> +<p class="desc">Areas outside shadows are drawn correctly with destination-out</p> + + +<script> +var t = async_test("Areas outside shadows are drawn correctly with destination-out"); +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.globalCompositeOperation = 'destination-out'; +ctx.shadowColor = '#f00'; +ctx.shadowBlur = 10; +ctx.fillStyle = '#f00'; +ctx.fillRect(200, 0, 100, 50); +_assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.composite.3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.composite.3.worker.js new file mode 100644 index 0000000000..fd58d06192 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.composite.3.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.composite.3 +// Description:Areas outside shadows are drawn correctly with destination-out +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Areas outside shadows are drawn correctly with destination-out"); +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.globalCompositeOperation = 'destination-out'; +ctx.shadowColor = '#f00'; +ctx.shadowBlur = 10; +ctx.fillStyle = '#f00'; +ctx.fillRect(200, 0, 100, 50); +_assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.blur.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.blur.html new file mode 100644 index 0000000000..edc4c527b2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.blur.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.enable.blur</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.enable.blur</h1> +<p class="desc">Shadows are drawn if shadowBlur is set</p> + + +<script> +var t = async_test("Shadows are drawn if shadowBlur is set"); +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.globalCompositeOperation = 'destination-atop'; +ctx.shadowColor = '#0f0'; +ctx.shadowBlur = 0.1; +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.blur.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.blur.worker.js new file mode 100644 index 0000000000..85bf21a086 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.blur.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.enable.blur +// Description:Shadows are drawn if shadowBlur is set +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are drawn if shadowBlur is set"); +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.globalCompositeOperation = 'destination-atop'; +ctx.shadowColor = '#0f0'; +ctx.shadowBlur = 0.1; +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.off.1.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.off.1.html new file mode 100644 index 0000000000..f0c9282090 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.off.1.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.shadow.enable.off.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.enable.off.1</h1> +<p class="desc">Shadows are not drawn when only shadowColor is set</p> + + +<script> +var t = async_test("Shadows are not drawn when only shadowColor is set"); +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.shadowColor = '#f00'; +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.off.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.off.1.worker.js new file mode 100644 index 0000000000..dae0ea648d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.off.1.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.enable.off.1 +// Description:Shadows are not drawn when only shadowColor is set +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are not drawn when only shadowColor is set"); +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.shadowColor = '#f00'; +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.off.2.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.off.2.html new file mode 100644 index 0000000000..3c27b988c9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.off.2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.enable.off.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.enable.off.2</h1> +<p class="desc">Shadows are not drawn when only shadowColor is set</p> + + +<script> +var t = async_test("Shadows are not drawn when only shadowColor is set"); +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.globalCompositeOperation = 'destination-atop'; +ctx.shadowColor = '#f00'; +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.off.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.off.2.worker.js new file mode 100644 index 0000000000..2f1573ef3f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.off.2.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.enable.off.2 +// Description:Shadows are not drawn when only shadowColor is set +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are not drawn when only shadowColor is set"); +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.globalCompositeOperation = 'destination-atop'; +ctx.shadowColor = '#f00'; +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.x.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.x.html new file mode 100644 index 0000000000..9107ef25de --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.x.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.enable.x</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.enable.x</h1> +<p class="desc">Shadows are drawn if shadowOffsetX is set</p> + + +<script> +var t = async_test("Shadows are drawn if shadowOffsetX is set"); +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.globalCompositeOperation = 'destination-atop'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetX = 0.1; +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.x.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.x.worker.js new file mode 100644 index 0000000000..d8e7d5039b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.x.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.enable.x +// Description:Shadows are drawn if shadowOffsetX is set +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are drawn if shadowOffsetX is set"); +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.globalCompositeOperation = 'destination-atop'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetX = 0.1; +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.y.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.y.html new file mode 100644 index 0000000000..77a79d8457 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.y.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.enable.y</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.enable.y</h1> +<p class="desc">Shadows are drawn if shadowOffsetY is set</p> + + +<script> +var t = async_test("Shadows are drawn if shadowOffsetY is set"); +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.globalCompositeOperation = 'destination-atop'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 0.1; +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.y.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.y.worker.js new file mode 100644 index 0000000000..53140b13a9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.enable.y.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.enable.y +// Description:Shadows are drawn if shadowOffsetY is set +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are drawn if shadowOffsetY is set"); +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.globalCompositeOperation = 'destination-atop'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 0.1; +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.alpha.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.alpha.html new file mode 100644 index 0000000000..d92a248440 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.alpha.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.gradient.alpha</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.gradient.alpha</h1> +<p class="desc">Shadows are drawn correctly for partially-transparent gradient fills</p> + + +<script> +var t = async_test("Shadows are drawn correctly for partially-transparent gradient fills"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var gradient = ctx.createLinearGradient(0, 0, 100, 0); +gradient.addColorStop(0, 'rgba(255,0,0,0.5)'); +gradient.addColorStop(1, 'rgba(255,0,0,0.5)'); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#00f'; +ctx.fillStyle = gradient; +ctx.fillRect(0, -50, 100, 50); +_assertPixelApprox(canvas, 50,25, 127,0,127,255, 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.alpha.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.alpha.worker.js new file mode 100644 index 0000000000..b5b65a0056 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.alpha.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.shadow.gradient.alpha +// Description:Shadows are drawn correctly for partially-transparent gradient fills +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are drawn correctly for partially-transparent gradient fills"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var gradient = ctx.createLinearGradient(0, 0, 100, 0); +gradient.addColorStop(0, 'rgba(255,0,0,0.5)'); +gradient.addColorStop(1, 'rgba(255,0,0,0.5)'); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#00f'; +ctx.fillStyle = gradient; +ctx.fillRect(0, -50, 100, 50); +_assertPixelApprox(canvas, 50,25, 127,0,127,255, 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.basic.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.basic.html new file mode 100644 index 0000000000..b88281be9a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.basic.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.gradient.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.shadow.gradient.basic</h1> +<p class="desc">Shadows are drawn for gradient fills</p> + + +<script> +var t = async_test("Shadows are drawn for gradient fills"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var gradient = ctx.createLinearGradient(0, 0, 100, 0); +gradient.addColorStop(0, '#f00'); +gradient.addColorStop(1, '#f00'); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 50; +ctx.fillStyle = gradient; +ctx.fillRect(0, -50, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.basic.worker.js new file mode 100644 index 0000000000..ef9ce712f2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.basic.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.shadow.gradient.basic +// Description:Shadows are drawn for gradient fills +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are drawn for gradient fills"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var gradient = ctx.createLinearGradient(0, 0, 100, 0); +gradient.addColorStop(0, '#f00'); +gradient.addColorStop(1, '#f00'); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 50; +ctx.fillStyle = gradient; +ctx.fillRect(0, -50, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.transparent.1.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.transparent.1.html new file mode 100644 index 0000000000..f71a8b4222 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.transparent.1.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.gradient.transparent.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.gradient.transparent.1</h1> +<p class="desc">Shadows are not drawn for transparent gradient fills</p> + + +<script> +var t = async_test("Shadows are not drawn for transparent gradient fills"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var gradient = ctx.createLinearGradient(0, 0, 100, 0); +gradient.addColorStop(0, 'rgba(0,0,0,0)'); +gradient.addColorStop(1, 'rgba(0,0,0,0)'); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = '#f00'; +ctx.shadowOffsetY = 50; +ctx.fillStyle = gradient; +ctx.fillRect(0, -50, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.transparent.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.transparent.1.worker.js new file mode 100644 index 0000000000..b60d6f7f59 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.transparent.1.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.shadow.gradient.transparent.1 +// Description:Shadows are not drawn for transparent gradient fills +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are not drawn for transparent gradient fills"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var gradient = ctx.createLinearGradient(0, 0, 100, 0); +gradient.addColorStop(0, 'rgba(0,0,0,0)'); +gradient.addColorStop(1, 'rgba(0,0,0,0)'); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = '#f00'; +ctx.shadowOffsetY = 50; +ctx.fillStyle = gradient; +ctx.fillRect(0, -50, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.transparent.2.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.transparent.2.html new file mode 100644 index 0000000000..d7c560ec46 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.transparent.2.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.shadow.gradient.transparent.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.gradient.transparent.2</h1> +<p class="desc">Shadows are not drawn for transparent parts of gradient fills</p> + + +<script> +var t = async_test("Shadows are not drawn for transparent parts of gradient fills"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var gradient = ctx.createLinearGradient(0, 0, 100, 0); +gradient.addColorStop(0, '#f00'); +gradient.addColorStop(0.499, '#f00'); +gradient.addColorStop(0.5, 'rgba(0,0,0,0)'); +gradient.addColorStop(1, 'rgba(0,0,0,0)'); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(50, 0, 50, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#0f0'; +ctx.fillStyle = gradient; +ctx.fillRect(0, -50, 100, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.transparent.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.transparent.2.worker.js new file mode 100644 index 0000000000..7226b004b8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.gradient.transparent.2.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.shadow.gradient.transparent.2 +// Description:Shadows are not drawn for transparent parts of gradient fills +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are not drawn for transparent parts of gradient fills"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var gradient = ctx.createLinearGradient(0, 0, 100, 0); +gradient.addColorStop(0, '#f00'); +gradient.addColorStop(0.499, '#f00'); +gradient.addColorStop(0.5, 'rgba(0,0,0,0)'); +gradient.addColorStop(1, 'rgba(0,0,0,0)'); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(50, 0, 50, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#0f0'; +ctx.fillStyle = gradient; +ctx.fillRect(0, -50, 100, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.alpha.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.alpha.html new file mode 100644 index 0000000000..5add7eae5a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.alpha.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.shadow.image.alpha</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.image.alpha</h1> +<p class="desc">Shadows are drawn correctly for partially-transparent images</p> + + +<script> +var t = async_test("Shadows are drawn correctly for partially-transparent images"); +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.shadowOffsetY = 50; +ctx.shadowColor = '#00f'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/transparent50.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, -50); + _assertPixelApprox(canvas, 50,25, 127,0,127,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.alpha.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.alpha.worker.js new file mode 100644 index 0000000000..7a1d99218f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.alpha.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.shadow.image.alpha +// Description:Shadows are drawn correctly for partially-transparent images +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are drawn correctly for partially-transparent images"); +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.shadowOffsetY = 50; +ctx.shadowColor = '#00f'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/transparent50.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, -50); + _assertPixelApprox(canvas, 50,25, 127,0,127,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.basic.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.basic.html new file mode 100644 index 0000000000..101cfbab0c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.basic.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.shadow.image.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.shadow.image.basic</h1> +<p class="desc">Shadows are drawn for images</p> + + +<script> +var t = async_test("Shadows are drawn for images"); +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.shadowColor = '#0f0'; +ctx.shadowOffsetY = 50; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, -50); + _assertPixel(canvas, 50,25, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.basic.worker.js new file mode 100644 index 0000000000..f1d72def72 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.basic.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.shadow.image.basic +// Description:Shadows are drawn for images +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are drawn for images"); +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.shadowColor = '#0f0'; +ctx.shadowOffsetY = 50; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, -50); + _assertPixel(canvas, 50,25, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.scale.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.scale.html new file mode 100644 index 0000000000..c56a73f736 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.scale.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.shadow.image.scale</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.image.scale</h1> +<p class="desc">Shadows are drawn correctly for scaled images</p> + + +<script> +var t = async_test("Shadows are drawn correctly for scaled images"); +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.shadowOffsetY = 50; +ctx.shadowColor = '#0f0'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/redtransparent.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0, 100, 50, -10, -50, 240, 50); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.scale.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.scale.worker.js new file mode 100644 index 0000000000..a8c0ead903 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.scale.worker.js @@ -0,0 +1,42 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.image.scale +// Description:Shadows are drawn correctly for scaled images +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are drawn correctly for scaled images"); +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.shadowOffsetY = 50; +ctx.shadowColor = '#0f0'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/redtransparent.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0, 100, 50, -10, -50, 240, 50); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.section.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.section.html new file mode 100644 index 0000000000..cd09503499 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.section.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.shadow.image.section</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.image.section</h1> +<p class="desc">Shadows are not drawn for areas outside image source rectangles</p> + + +<script> +var t = async_test("Shadows are not drawn for areas outside image source rectangles"); +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.shadowOffsetY = 50; +ctx.shadowColor = '#f00'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/redtransparent.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 50, 0, 50, 50, 0, -50, 50, 50); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.section.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.section.worker.js new file mode 100644 index 0000000000..60e32b4883 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.section.worker.js @@ -0,0 +1,42 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.image.section +// Description:Shadows are not drawn for areas outside image source rectangles +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are not drawn for areas outside image source rectangles"); +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.shadowOffsetY = 50; +ctx.shadowColor = '#f00'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/redtransparent.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 50, 0, 50, 50, 0, -50, 50, 50); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.1.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.1.html new file mode 100644 index 0000000000..37844050a9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.1.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.shadow.image.transparent.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.image.transparent.1</h1> +<p class="desc">Shadows are not drawn for transparent images</p> + + +<script> +var t = async_test("Shadows are not drawn for transparent images"); +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.shadowColor = '#f00'; +ctx.shadowOffsetY = 50; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/transparent.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, -50); + _assertPixel(canvas, 50,25, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.1.worker.js new file mode 100644 index 0000000000..8e8ded8bd3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.1.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.shadow.image.transparent.1 +// Description:Shadows are not drawn for transparent images +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are not drawn for transparent images"); +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.shadowColor = '#f00'; +ctx.shadowOffsetY = 50; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/transparent.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, -50); + _assertPixel(canvas, 50,25, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.2.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.2.html new file mode 100644 index 0000000000..996bce718a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.2.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.image.transparent.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.image.transparent.2</h1> +<p class="desc">Shadows are not drawn for transparent parts of images</p> + + +<script> +var t = async_test("Shadows are not drawn for transparent parts of images"); +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, 50, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(50, 0, 50, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#0f0'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/redtransparent.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 50, -50); + ctx.shadowColor = '#f00'; + ctx.drawImage(bitmap, -50, -50); + _assertPixel(canvas, 25,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 75,25, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.2.worker.js new file mode 100644 index 0000000000..5075d6cfa7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.2.worker.js @@ -0,0 +1,46 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.image.transparent.2 +// Description:Shadows are not drawn for transparent parts of images +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are not drawn for transparent parts of images"); +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, 50, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(50, 0, 50, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#0f0'; +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/redtransparent.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 50, -50); + ctx.shadowColor = '#f00'; + ctx.drawImage(bitmap, -50, -50); + _assertPixel(canvas, 25,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 75,25, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.negativeX.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.negativeX.html new file mode 100644 index 0000000000..97c04018ac --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.negativeX.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.shadow.offset.negativeX</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.offset.negativeX</h1> +<p class="desc">Shadows can be offset with negative x</p> + + +<script> +var t = async_test("Shadows can be offset with negative x"); +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.fillStyle = '#0f0'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetX = -50; +ctx.fillRect(50, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.negativeX.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.negativeX.worker.js new file mode 100644 index 0000000000..93c226570f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.negativeX.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.offset.negativeX +// Description:Shadows can be offset with negative x +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows can be offset with negative x"); +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.fillStyle = '#0f0'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetX = -50; +ctx.fillRect(50, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.negativeY.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.negativeY.html new file mode 100644 index 0000000000..7f5d5ab9a8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.negativeY.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.shadow.offset.negativeY</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.offset.negativeY</h1> +<p class="desc">Shadows can be offset with negative y</p> + + +<script> +var t = async_test("Shadows can be offset with negative y"); +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.fillStyle = '#0f0'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = -25; +ctx.fillRect(0, 25, 100, 25); +_assertPixel(canvas, 50,12, 0,255,0,255); +_assertPixel(canvas, 50,37, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.negativeY.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.negativeY.worker.js new file mode 100644 index 0000000000..6ee0bcc7c5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.negativeY.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.offset.negativeY +// Description:Shadows can be offset with negative y +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows can be offset with negative y"); +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.fillStyle = '#0f0'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = -25; +ctx.fillRect(0, 25, 100, 25); +_assertPixel(canvas, 50,12, 0,255,0,255); +_assertPixel(canvas, 50,37, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.positiveX.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.positiveX.html new file mode 100644 index 0000000000..a745de88ab --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.positiveX.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.shadow.offset.positiveX</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.offset.positiveX</h1> +<p class="desc">Shadows can be offset with positive x</p> + + +<script> +var t = async_test("Shadows can be offset with positive x"); +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.fillStyle = '#0f0'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetX = 50; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.positiveX.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.positiveX.worker.js new file mode 100644 index 0000000000..241fbda8f3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.positiveX.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.offset.positiveX +// Description:Shadows can be offset with positive x +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows can be offset with positive x"); +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.fillStyle = '#0f0'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetX = 50; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.positiveY.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.positiveY.html new file mode 100644 index 0000000000..168b179688 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.positiveY.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.shadow.offset.positiveY</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.offset.positiveY</h1> +<p class="desc">Shadows can be offset with positive y</p> + + +<script> +var t = async_test("Shadows can be offset with positive y"); +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.fillStyle = '#0f0'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 25; +ctx.fillRect(0, 0, 100, 25); +_assertPixel(canvas, 50,12, 0,255,0,255); +_assertPixel(canvas, 50,37, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.positiveY.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.positiveY.worker.js new file mode 100644 index 0000000000..b3236d66a5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.offset.positiveY.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.offset.positiveY +// Description:Shadows can be offset with positive y +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows can be offset with positive y"); +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.fillStyle = '#0f0'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 25; +ctx.fillRect(0, 0, 100, 25); +_assertPixel(canvas, 50,12, 0,255,0,255); +_assertPixel(canvas, 50,37, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.outside.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.outside.html new file mode 100644 index 0000000000..207160d20f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.outside.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.shadow.outside</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.outside</h1> +<p class="desc">Shadows of shapes outside the visible area can be offset onto the visible area</p> + + +<script> +var t = async_test("Shadows of shapes outside the visible area can be offset onto the visible area"); +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.shadowColor = '#0f0'; +ctx.shadowOffsetX = 100; +ctx.fillRect(-100, 0, 25, 50); +ctx.shadowOffsetX = -100; +ctx.fillRect(175, 0, 25, 50); +ctx.shadowOffsetX = 0; +ctx.shadowOffsetY = 100; +ctx.fillRect(25, -100, 50, 25); +ctx.shadowOffsetY = -100; +ctx.fillRect(25, 125, 50, 25); +_assertPixel(canvas, 12,25, 0,255,0,255); +_assertPixel(canvas, 87,25, 0,255,0,255); +_assertPixel(canvas, 50,12, 0,255,0,255); +_assertPixel(canvas, 50,37, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.outside.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.outside.worker.js new file mode 100644 index 0000000000..d0787d67a4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.outside.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.shadow.outside +// Description:Shadows of shapes outside the visible area can be offset onto the visible area +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows of shapes outside the visible area can be offset onto the visible area"); +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.shadowColor = '#0f0'; +ctx.shadowOffsetX = 100; +ctx.fillRect(-100, 0, 25, 50); +ctx.shadowOffsetX = -100; +ctx.fillRect(175, 0, 25, 50); +ctx.shadowOffsetX = 0; +ctx.shadowOffsetY = 100; +ctx.fillRect(25, -100, 50, 25); +ctx.shadowOffsetY = -100; +ctx.fillRect(25, 125, 50, 25); +_assertPixel(canvas, 12,25, 0,255,0,255); +_assertPixel(canvas, 87,25, 0,255,0,255); +_assertPixel(canvas, 50,12, 0,255,0,255); +_assertPixel(canvas, 50,37, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.alpha.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.alpha.html new file mode 100644 index 0000000000..48615eadcf --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.alpha.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.shadow.pattern.alpha</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.pattern.alpha</h1> +<p class="desc">Shadows are drawn correctly for partially-transparent fill patterns</p> + + +<script> +var t = async_test("Shadows are drawn correctly for partially-transparent fill patterns"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/transparent50.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.shadowOffsetY = 50; + ctx.shadowColor = '#00f'; + ctx.fillStyle = pattern; + ctx.fillRect(0, -50, 100, 50); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.alpha.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.alpha.worker.js new file mode 100644 index 0000000000..6a533845ab --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.alpha.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.shadow.pattern.alpha +// Description:Shadows are drawn correctly for partially-transparent fill patterns +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are drawn correctly for partially-transparent fill patterns"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/transparent50.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.shadowOffsetY = 50; + ctx.shadowColor = '#00f'; + ctx.fillStyle = pattern; + ctx.fillRect(0, -50, 100, 50); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.basic.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.basic.html new file mode 100644 index 0000000000..586f7ef336 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.basic.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.shadow.pattern.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.shadow.pattern.basic</h1> +<p class="desc">Shadows are drawn for fill patterns</p> + + +<script> +var t = async_test("Shadows are drawn for fill patterns"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.shadowColor = '#0f0'; + ctx.shadowOffsetY = 50; + ctx.fillStyle = pattern; + ctx.fillRect(0, -50, 100, 50); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.basic.worker.js new file mode 100644 index 0000000000..6d2dce7c1b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.basic.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.shadow.pattern.basic +// Description:Shadows are drawn for fill patterns +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are drawn for fill patterns"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.shadowColor = '#0f0'; + ctx.shadowOffsetY = 50; + ctx.fillStyle = pattern; + ctx.fillRect(0, -50, 100, 50); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.1.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.1.html new file mode 100644 index 0000000000..6d97b590af --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.1.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.shadow.pattern.transparent.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.pattern.transparent.1</h1> +<p class="desc">Shadows are not drawn for transparent fill patterns</p> + + +<script> +var t = async_test("Shadows are not drawn for transparent fill patterns"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/transparent.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.shadowColor = '#f00'; + ctx.shadowOffsetY = 50; + ctx.fillStyle = pattern; + ctx.fillRect(0, -50, 100, 50); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.1.worker.js new file mode 100644 index 0000000000..cda0aa956d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.1.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.shadow.pattern.transparent.1 +// Description:Shadows are not drawn for transparent fill patterns +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are not drawn for transparent fill patterns"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/transparent.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.shadowColor = '#f00'; + ctx.shadowOffsetY = 50; + ctx.fillStyle = pattern; + ctx.fillRect(0, -50, 100, 50); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.2.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.2.html new file mode 100644 index 0000000000..600fbd03ff --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.2.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.pattern.transparent.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.pattern.transparent.2</h1> +<p class="desc">Shadows are not drawn for transparent parts of fill patterns</p> + + +<script> +var t = async_test("Shadows are not drawn for transparent parts of fill patterns"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/redtransparent.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 50, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(50, 0, 50, 50); + ctx.shadowOffsetY = 50; + ctx.shadowColor = '#0f0'; + ctx.fillStyle = pattern; + ctx.fillRect(0, -50, 100, 50); + _assertPixel(canvas, 25,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 75,25, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.2.worker.js new file mode 100644 index 0000000000..2aa3166146 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.2.worker.js @@ -0,0 +1,46 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.shadow.pattern.transparent.2 +// Description:Shadows are not drawn for transparent parts of fill patterns +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are not drawn for transparent parts of fill patterns"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/redtransparent.png'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; +}); +promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + var pattern = ctx.createPattern(bitmap, 'repeat'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 50, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(50, 0, 50, 50); + ctx.shadowOffsetY = 50; + ctx.shadowColor = '#0f0'; + ctx.fillStyle = pattern; + ctx.fillRect(0, -50, 100, 50); + _assertPixel(canvas, 25,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 75,25, 0,255,0,255); + }, t_fail); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.basic.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.basic.html new file mode 100644 index 0000000000..2711025134 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.basic.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.stroke.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.shadow.stroke.basic</h1> +<p class="desc">Shadows are drawn for strokes</p> + + +<script> +var t = async_test("Shadows are drawn for 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 50; +ctx.beginPath(); +ctx.lineWidth = 50; +ctx.moveTo(0, -25); +ctx.lineTo(100, -25); +ctx.stroke(); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.basic.worker.js new file mode 100644 index 0000000000..7ebbd8ec5b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.basic.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.shadow.stroke.basic +// Description:Shadows are drawn for strokes +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are drawn for 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 50; +ctx.beginPath(); +ctx.lineWidth = 50; +ctx.moveTo(0, -25); +ctx.lineTo(100, -25); +ctx.stroke(); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.cap.1.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.cap.1.html new file mode 100644 index 0000000000..3854669bf0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.cap.1.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.shadow.stroke.cap.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.stroke.cap.1</h1> +<p class="desc">Shadows are not drawn for areas outside stroke caps</p> + + +<script> +var t = async_test("Shadows are not drawn for areas outside stroke caps"); +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.strokeStyle = '#f00'; +ctx.shadowColor = '#f00'; +ctx.shadowOffsetY = 50; +ctx.beginPath(); +ctx.lineWidth = 50; +ctx.lineCap = 'butt'; +ctx.moveTo(-50, -25); +ctx.lineTo(0, -25); +ctx.moveTo(100, -25); +ctx.lineTo(150, -25); +ctx.stroke(); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.cap.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.cap.1.worker.js new file mode 100644 index 0000000000..7ecd07b1cd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.cap.1.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.shadow.stroke.cap.1 +// Description:Shadows are not drawn for areas outside stroke caps +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are not drawn for areas outside stroke caps"); +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.strokeStyle = '#f00'; +ctx.shadowColor = '#f00'; +ctx.shadowOffsetY = 50; +ctx.beginPath(); +ctx.lineWidth = 50; +ctx.lineCap = 'butt'; +ctx.moveTo(-50, -25); +ctx.lineTo(0, -25); +ctx.moveTo(100, -25); +ctx.lineTo(150, -25); +ctx.stroke(); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.cap.2.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.cap.2.html new file mode 100644 index 0000000000..bd18ec6f8c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.cap.2.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.shadow.stroke.cap.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.stroke.cap.2</h1> +<p class="desc">Shadows are drawn for stroke caps</p> + + +<script> +var t = async_test("Shadows are drawn for stroke caps"); +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 = '#f00'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 50; +ctx.beginPath(); +ctx.lineWidth = 50; +ctx.lineCap = 'square'; +ctx.moveTo(25, -25); +ctx.lineTo(75, -25); +ctx.stroke(); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.cap.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.cap.2.worker.js new file mode 100644 index 0000000000..7c7dc26dd9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.cap.2.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.shadow.stroke.cap.2 +// Description:Shadows are drawn for stroke caps +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are drawn for stroke caps"); +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 = '#f00'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 50; +ctx.beginPath(); +ctx.lineWidth = 50; +ctx.lineCap = 'square'; +ctx.moveTo(25, -25); +ctx.lineTo(75, -25); +ctx.stroke(); +_assertPixel(canvas, 1,25, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.join.1.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.join.1.html new file mode 100644 index 0000000000..8faa2fef08 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.join.1.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.shadow.stroke.join.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.stroke.join.1</h1> +<p class="desc">Shadows are not drawn for areas outside stroke joins</p> + + +<script> +var t = async_test("Shadows are not drawn for areas outside stroke 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 = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.shadowColor = '#f00'; +ctx.shadowOffsetX = 100; +ctx.lineWidth = 200; +ctx.lineJoin = 'bevel'; +ctx.beginPath(); +ctx.moveTo(-200, -50); +ctx.lineTo(-150, -50); +ctx.lineTo(-151, -100); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 48,48, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.join.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.join.1.worker.js new file mode 100644 index 0000000000..e81a9b212d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.join.1.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.shadow.stroke.join.1 +// Description:Shadows are not drawn for areas outside stroke joins +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are not drawn for areas outside stroke 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 = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.shadowColor = '#f00'; +ctx.shadowOffsetX = 100; +ctx.lineWidth = 200; +ctx.lineJoin = 'bevel'; +ctx.beginPath(); +ctx.moveTo(-200, -50); +ctx.lineTo(-150, -50); +ctx.lineTo(-151, -100); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 48,48, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.join.2.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.join.2.html new file mode 100644 index 0000000000..7b52a7c950 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.join.2.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.shadow.stroke.join.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.stroke.join.2</h1> +<p class="desc">Shadows are drawn for stroke joins</p> + + +<script> +var t = async_test("Shadows are drawn for stroke 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, 50, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(50, 0, 50, 50); +ctx.strokeStyle = '#f00'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetX = 100; +ctx.lineWidth = 200; +ctx.lineJoin = 'miter'; +ctx.beginPath(); +ctx.moveTo(-200, -50); +ctx.lineTo(-150, -50); +ctx.lineTo(-151, -100); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 48,48, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.join.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.join.2.worker.js new file mode 100644 index 0000000000..269a49d76c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.join.2.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.shadow.stroke.join.2 +// Description:Shadows are drawn for stroke joins +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are drawn for stroke 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, 50, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(50, 0, 50, 50); +ctx.strokeStyle = '#f00'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetX = 100; +ctx.lineWidth = 200; +ctx.lineJoin = 'miter'; +ctx.beginPath(); +ctx.moveTo(-200, -50); +ctx.lineTo(-150, -50); +ctx.lineTo(-151, -100); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 48,48, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.join.3.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.join.3.html new file mode 100644 index 0000000000..6110d3ae40 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.join.3.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.shadow.stroke.join.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.stroke.join.3</h1> +<p class="desc">Shadows are drawn for stroke joins respecting miter limit</p> + + +<script> +var t = async_test("Shadows are drawn for stroke joins respecting miter limit"); +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.strokeStyle = '#f00'; +ctx.shadowColor = '#f00'; +ctx.shadowOffsetX = 100; +ctx.lineWidth = 200; +ctx.lineJoin = 'miter'; +ctx.miterLimit = 0.1; +ctx.beginPath(); +ctx.moveTo(-200, -50); +ctx.lineTo(-150, -50); +ctx.lineTo(-151, -100); // (not an exact right angle, to avoid some other bug in Firefox 3) +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 48,48, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.join.3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.join.3.worker.js new file mode 100644 index 0000000000..43144b0fd9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.stroke.join.3.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.shadow.stroke.join.3 +// Description:Shadows are drawn for stroke joins respecting miter limit +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows are drawn for stroke joins respecting miter limit"); +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.strokeStyle = '#f00'; +ctx.shadowColor = '#f00'; +ctx.shadowOffsetX = 100; +ctx.lineWidth = 200; +ctx.lineJoin = 'miter'; +ctx.miterLimit = 0.1; +ctx.beginPath(); +ctx.moveTo(-200, -50); +ctx.lineTo(-150, -50); +ctx.lineTo(-151, -100); // (not an exact right angle, to avoid some other bug in Firefox 3) +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255); +_assertPixel(canvas, 48,48, 0,255,0,255); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,48, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.transform.1.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.transform.1.html new file mode 100644 index 0000000000..d6c4e483ba --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.transform.1.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.transform.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.transform.1</h1> +<p class="desc">Shadows take account of transformations</p> + + +<script> +var t = async_test("Shadows take account of 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.shadowOffsetY = 50; +ctx.shadowColor = '#0f0'; +ctx.translate(100, 100); +ctx.fillRect(-100, -150, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.transform.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.transform.1.worker.js new file mode 100644 index 0000000000..38cdf7eb7c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.transform.1.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.shadow.transform.1 +// Description:Shadows take account of transformations +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadows take account of 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.shadowOffsetY = 50; +ctx.shadowColor = '#0f0'; +ctx.translate(100, 100); +ctx.fillRect(-100, -150, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.transform.2.html b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.transform.2.html new file mode 100644 index 0000000000..f0b1607262 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.transform.2.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.shadow.transform.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.shadow.transform.2</h1> +<p class="desc">Shadow offsets are not affected by transformations</p> + + +<script> +var t = async_test("Shadow offsets are not affected by 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.shadowOffsetY = 50; +ctx.shadowColor = '#0f0'; +ctx.rotate(Math.PI) +ctx.fillRect(-100, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.transform.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.transform.2.worker.js new file mode 100644 index 0000000000..9f204d2439 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.transform.2.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.shadow.transform.2 +// Description:Shadow offsets are not affected by transformations +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Shadow offsets are not affected by 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.shadowOffsetY = 50; +ctx.shadowColor = '#0f0'; +ctx.rotate(Math.PI) +ctx.fillRect(-100, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.align.default.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.align.default.html new file mode 100644 index 0000000000..fda5ee496d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.align.default.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.align.default</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.align.default</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.textAlign, 'start', "ctx.textAlign", "'start'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.align.default.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.align.default.worker.js new file mode 100644 index 0000000000..b2c940fac6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.align.default.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.align.default +// 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.textAlign, 'start', "ctx.textAlign", "'start'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.align.invalid.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.align.invalid.html new file mode 100644 index 0000000000..8b6f409a3d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.align.invalid.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.text.align.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.text.align.invalid</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.textAlign = 'start'; +ctx.textAlign = 'bogus'; +_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'"); + +ctx.textAlign = 'start'; +ctx.textAlign = 'END'; +_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'"); + +ctx.textAlign = 'start'; +ctx.textAlign = 'end '; +_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'"); + +ctx.textAlign = 'start'; +ctx.textAlign = 'end\0'; +_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.align.invalid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.align.invalid.worker.js new file mode 100644 index 0000000000..60ad8faac9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.align.invalid.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.text.align.invalid +// 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.textAlign = 'start'; +ctx.textAlign = 'bogus'; +_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'"); + +ctx.textAlign = 'start'; +ctx.textAlign = 'END'; +_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'"); + +ctx.textAlign = 'start'; +ctx.textAlign = 'end '; +_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'"); + +ctx.textAlign = 'start'; +ctx.textAlign = 'end\0'; +_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.align.valid.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.align.valid.html new file mode 100644 index 0000000000..a78b58edaa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.align.valid.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.text.align.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.text.align.valid</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.textAlign = 'start'; +_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'"); + +ctx.textAlign = 'end'; +_assertSame(ctx.textAlign, 'end', "ctx.textAlign", "'end'"); + +ctx.textAlign = 'left'; +_assertSame(ctx.textAlign, 'left', "ctx.textAlign", "'left'"); + +ctx.textAlign = 'right'; +_assertSame(ctx.textAlign, 'right', "ctx.textAlign", "'right'"); + +ctx.textAlign = 'center'; +_assertSame(ctx.textAlign, 'center', "ctx.textAlign", "'center'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.align.valid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.align.valid.worker.js new file mode 100644 index 0000000000..fdf1907585 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.align.valid.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.text.align.valid +// 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.textAlign = 'start'; +_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'"); + +ctx.textAlign = 'end'; +_assertSame(ctx.textAlign, 'end', "ctx.textAlign", "'end'"); + +ctx.textAlign = 'left'; +_assertSame(ctx.textAlign, 'left', "ctx.textAlign", "'left'"); + +ctx.textAlign = 'right'; +_assertSame(ctx.textAlign, 'right', "ctx.textAlign", "'right'"); + +ctx.textAlign = 'center'; +_assertSame(ctx.textAlign, 'center', "ctx.textAlign", "'center'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.baseline.default.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.baseline.default.html new file mode 100644 index 0000000000..8bd20c6f84 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.baseline.default.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.baseline.default</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.baseline.default</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.textBaseline, 'alphabetic', "ctx.textBaseline", "'alphabetic'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.baseline.default.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.baseline.default.worker.js new file mode 100644 index 0000000000..ea8693f0a0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.baseline.default.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.baseline.default +// 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.textBaseline, 'alphabetic', "ctx.textBaseline", "'alphabetic'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.baseline.invalid.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.baseline.invalid.html new file mode 100644 index 0000000000..a850ac146f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.baseline.invalid.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.text.baseline.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.text.baseline.invalid</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.textBaseline = 'top'; +ctx.textBaseline = 'bogus'; +_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'"); + +ctx.textBaseline = 'top'; +ctx.textBaseline = 'MIDDLE'; +_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'"); + +ctx.textBaseline = 'top'; +ctx.textBaseline = 'middle '; +_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'"); + +ctx.textBaseline = 'top'; +ctx.textBaseline = 'middle\0'; +_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.baseline.invalid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.baseline.invalid.worker.js new file mode 100644 index 0000000000..d4cdc858b2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.baseline.invalid.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.text.baseline.invalid +// 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.textBaseline = 'top'; +ctx.textBaseline = 'bogus'; +_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'"); + +ctx.textBaseline = 'top'; +ctx.textBaseline = 'MIDDLE'; +_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'"); + +ctx.textBaseline = 'top'; +ctx.textBaseline = 'middle '; +_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'"); + +ctx.textBaseline = 'top'; +ctx.textBaseline = 'middle\0'; +_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.baseline.valid.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.baseline.valid.html new file mode 100644 index 0000000000..8fdc058844 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.baseline.valid.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.text.baseline.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.text.baseline.valid</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.textBaseline = 'top'; +_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'"); + +ctx.textBaseline = 'hanging'; +_assertSame(ctx.textBaseline, 'hanging', "ctx.textBaseline", "'hanging'"); + +ctx.textBaseline = 'middle'; +_assertSame(ctx.textBaseline, 'middle', "ctx.textBaseline", "'middle'"); + +ctx.textBaseline = 'alphabetic'; +_assertSame(ctx.textBaseline, 'alphabetic', "ctx.textBaseline", "'alphabetic'"); + +ctx.textBaseline = 'ideographic'; +_assertSame(ctx.textBaseline, 'ideographic', "ctx.textBaseline", "'ideographic'"); + +ctx.textBaseline = 'bottom'; +_assertSame(ctx.textBaseline, 'bottom', "ctx.textBaseline", "'bottom'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.baseline.valid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.baseline.valid.worker.js new file mode 100644 index 0000000000..62f6983ddb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.baseline.valid.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.text.baseline.valid +// 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.textBaseline = 'top'; +_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'"); + +ctx.textBaseline = 'hanging'; +_assertSame(ctx.textBaseline, 'hanging', "ctx.textBaseline", "'hanging'"); + +ctx.textBaseline = 'middle'; +_assertSame(ctx.textBaseline, 'middle', "ctx.textBaseline", "'middle'"); + +ctx.textBaseline = 'alphabetic'; +_assertSame(ctx.textBaseline, 'alphabetic', "ctx.textBaseline", "'alphabetic'"); + +ctx.textBaseline = 'ideographic'; +_assertSame(ctx.textBaseline, 'ideographic', "ctx.textBaseline", "'ideographic'"); + +ctx.textBaseline = 'bottom'; +_assertSame(ctx.textBaseline, 'bottom', "ctx.textBaseline", "'bottom'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.center.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.center.html new file mode 100644 index 0000000000..438e6756a0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.center.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.text.draw.align.center</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.align.center</h1> +<p class="desc">textAlign center is the center of the em squares (not the bounding box)</p> + + +<script> +var t = async_test("textAlign center is the center of the em squares (not the bounding box)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textAlign = 'center'; + ctx.fillText('DD', 50, 37.5); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.center.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.center.worker.js new file mode 100644 index 0000000000..9487e6ab8e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.center.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.text.draw.align.center +// Description:textAlign center is the center of the em squares (not the bounding box) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("textAlign center is the center of the em squares (not the bounding box)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textAlign = 'center'; + ctx.fillText('DD', 50, 37.5); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.ltr.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.ltr.html new file mode 100644 index 0000000000..6134042bdc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.ltr.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.text.draw.align.end.ltr</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.align.end.ltr</h1> +<p class="desc">textAlign end with ltr is the right edge</p> + + +<script> +var t = async_test("textAlign end with ltr is the right edge"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.direction = 'ltr'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textAlign = 'end'; + ctx.fillText('DD', 100, 37.5); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.ltr.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.ltr.worker.js new file mode 100644 index 0000000000..2a7b9e9418 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.ltr.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.text.draw.align.end.ltr +// Description:textAlign end with ltr is the right edge +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("textAlign end with ltr is the right edge"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.direction = 'ltr'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textAlign = 'end'; + ctx.fillText('DD', 100, 37.5); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.rtl.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.rtl.html new file mode 100644 index 0000000000..a4b502480a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.rtl.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.text.draw.align.end.rtl</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.align.end.rtl</h1> +<p class="desc">textAlign end with rtl is the left edge</p> + + +<script> +var t = async_test("textAlign end with rtl is the left edge"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.direction = 'rtl'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textAlign = 'end'; + ctx.fillText('DD', 0, 37.5); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.rtl.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.rtl.worker.js new file mode 100644 index 0000000000..deb8227ec4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.rtl.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.text.draw.align.end.rtl +// Description:textAlign end with rtl is the left edge +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("textAlign end with rtl is the left edge"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.direction = 'rtl'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textAlign = 'end'; + ctx.fillText('DD', 0, 37.5); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.left.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.left.html new file mode 100644 index 0000000000..6e69a830a4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.left.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.text.draw.align.left</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.align.left</h1> +<p class="desc">textAlign left is the left of the first em square (not the bounding box)</p> + + +<script> +var t = async_test("textAlign left is the left of the first em square (not the bounding box)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textAlign = 'left'; + ctx.fillText('DD', 0, 37.5); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.left.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.left.worker.js new file mode 100644 index 0000000000..9c55512653 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.left.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.text.draw.align.left +// Description:textAlign left is the left of the first em square (not the bounding box) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("textAlign left is the left of the first em square (not the bounding box)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textAlign = 'left'; + ctx.fillText('DD', 0, 37.5); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.right.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.right.html new file mode 100644 index 0000000000..a56c7cab1d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.right.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.text.draw.align.right</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.align.right</h1> +<p class="desc">textAlign right is the right of the last em square (not the bounding box)</p> + + +<script> +var t = async_test("textAlign right is the right of the last em square (not the bounding box)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textAlign = 'right'; + ctx.fillText('DD', 100, 37.5); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.right.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.right.worker.js new file mode 100644 index 0000000000..f246963f60 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.right.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.text.draw.align.right +// Description:textAlign right is the right of the last em square (not the bounding box) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("textAlign right is the right of the last em square (not the bounding box)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textAlign = 'right'; + ctx.fillText('DD', 100, 37.5); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.ltr.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.ltr.html new file mode 100644 index 0000000000..ba8c440c43 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.ltr.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.text.draw.align.start.ltr</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.align.start.ltr</h1> +<p class="desc">textAlign start with ltr is the left edge</p> + + +<script> +var t = async_test("textAlign start with ltr is the left edge"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.direction = 'ltr'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textAlign = 'start'; + ctx.fillText('DD', 0, 37.5); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.ltr.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.ltr.worker.js new file mode 100644 index 0000000000..2de9d50fab --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.ltr.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.text.draw.align.start.ltr +// Description:textAlign start with ltr is the left edge +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("textAlign start with ltr is the left edge"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.direction = 'ltr'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textAlign = 'start'; + ctx.fillText('DD', 0, 37.5); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.rtl.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.rtl.html new file mode 100644 index 0000000000..32f83430e0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.rtl.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.text.draw.align.start.rtl</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.align.start.rtl</h1> +<p class="desc">textAlign start with rtl is the right edge</p> + + +<script> +var t = async_test("textAlign start with rtl is the right edge"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.direction = 'rtl'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textAlign = 'start'; + ctx.fillText('DD', 100, 37.5); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.rtl.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.rtl.worker.js new file mode 100644 index 0000000000..41cb57b958 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.rtl.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.text.draw.align.start.rtl +// Description:textAlign start with rtl is the right edge +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("textAlign start with rtl is the right edge"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.direction = 'rtl'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textAlign = 'start'; + ctx.fillText('DD', 100, 37.5); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.alphabetic.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.alphabetic.html new file mode 100644 index 0000000000..bd6a1804a5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.alphabetic.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.text.draw.baseline.alphabetic</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.baseline.alphabetic</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'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textBaseline = 'alphabetic'; + ctx.fillText('CC', 0, 37.5); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.alphabetic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.alphabetic.worker.js new file mode 100644 index 0000000000..5b4fe08b13 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.alphabetic.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.text.draw.baseline.alphabetic +// 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'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textBaseline = 'alphabetic'; + ctx.fillText('CC', 0, 37.5); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.bottom.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.bottom.html new file mode 100644 index 0000000000..4e5fc8e346 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.bottom.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.text.draw.baseline.bottom</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.baseline.bottom</h1> +<p class="desc">textBaseline bottom is the bottom of the em square (not the bounding box)</p> + + +<script> +var t = async_test("textBaseline bottom is the bottom of the em square (not the bounding box)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textBaseline = 'bottom'; + ctx.fillText('CC', 0, 50); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.bottom.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.bottom.worker.js new file mode 100644 index 0000000000..1c7cab3ef9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.bottom.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.text.draw.baseline.bottom +// Description:textBaseline bottom is the bottom of the em square (not the bounding box) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("textBaseline bottom is the bottom of the em square (not the bounding box)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textBaseline = 'bottom'; + ctx.fillText('CC', 0, 50); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.hanging.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.hanging.html new file mode 100644 index 0000000000..d0d573790d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.hanging.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.text.draw.baseline.hanging</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.baseline.hanging</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'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textBaseline = 'hanging'; + ctx.fillText('CC', 0, 12.5); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.hanging.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.hanging.worker.js new file mode 100644 index 0000000000..79df7d8e48 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.hanging.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.text.draw.baseline.hanging +// 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'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textBaseline = 'hanging'; + ctx.fillText('CC', 0, 12.5); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.ideographic.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.ideographic.html new file mode 100644 index 0000000000..144d56f784 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.ideographic.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.text.draw.baseline.ideographic</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.baseline.ideographic</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'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textBaseline = 'ideographic'; + ctx.fillText('CC', 0, 31.25); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.ideographic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.ideographic.worker.js new file mode 100644 index 0000000000..ef7d0180cd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.ideographic.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.text.draw.baseline.ideographic +// 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'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textBaseline = 'ideographic'; + ctx.fillText('CC', 0, 31.25); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.middle.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.middle.html new file mode 100644 index 0000000000..3072264bb4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.middle.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.text.draw.baseline.middle</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.baseline.middle</h1> +<p class="desc">textBaseline middle is the middle of the em square (not the bounding box)</p> + + +<script> +var t = async_test("textBaseline middle is the middle of the em square (not the bounding box)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textBaseline = 'middle'; + ctx.fillText('CC', 0, 25); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.middle.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.middle.worker.js new file mode 100644 index 0000000000..a0509b6711 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.middle.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.text.draw.baseline.middle +// Description:textBaseline middle is the middle of the em square (not the bounding box) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("textBaseline middle is the middle of the em square (not the bounding box)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textBaseline = 'middle'; + ctx.fillText('CC', 0, 25); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.top.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.top.html new file mode 100644 index 0000000000..a077aff348 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.top.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.text.draw.baseline.top</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.baseline.top</h1> +<p class="desc">textBaseline top is the top of the em square (not the bounding box)</p> + + +<script> +var t = async_test("textBaseline top is the top of the em square (not the bounding box)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textBaseline = 'top'; + ctx.fillText('CC', 0, 0); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.top.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.top.worker.js new file mode 100644 index 0000000000..bbc7fc06a3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.top.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.text.draw.baseline.top +// Description:textBaseline top is the top of the em square (not the bounding box) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("textBaseline top is the top of the em square (not the bounding box)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textBaseline = 'top'; + ctx.fillText('CC', 0, 0); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.basic-manual.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.basic-manual.html new file mode 100644 index 0000000000..5c364f58a6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.basic-manual.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.draw.fill.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.text.draw.fill.basic</h1> +<p class="desc">fillText draws filled text</p> + + +<script> +var t = async_test("fillText draws filled text"); +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 = '#000'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.strokeStyle = '#f00'; +ctx.font = '35px Arial, sans-serif'; +ctx.fillText('PASS', 5, 35); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.basic-manual.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.basic-manual.worker.js new file mode 100644 index 0000000000..b75be08977 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.basic-manual.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.draw.fill.basic +// Description:fillText draws filled text +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fillText draws filled text"); +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 = '#000'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.strokeStyle = '#f00'; +ctx.font = '35px Arial, sans-serif'; +ctx.fillText('PASS', 5, 35); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.basic.png b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.basic.png Binary files differnew file mode 100644 index 0000000000..70d7b046cb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.basic.png diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.NaN.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.NaN.html new file mode 100644 index 0000000000..4bef0e3d70 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.NaN.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.draw.fill.maxWidth.NaN</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.fill.maxWidth.NaN</h1> +<p class="desc">fillText handles maxWidth correctly</p> + + +<script> +var t = async_test("fillText handles maxWidth 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.fillStyle = '#f00'; +ctx.font = '35px Arial, sans-serif'; +ctx.fillText('fail fail fail fail fail', 5, 35, NaN); +_assertGreen(ctx, 100, 50); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.NaN.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.NaN.worker.js new file mode 100644 index 0000000000..32a673f495 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.NaN.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.draw.fill.maxWidth.NaN +// Description:fillText handles maxWidth correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fillText handles maxWidth 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.fillStyle = '#f00'; +ctx.font = '35px Arial, sans-serif'; +ctx.fillText('fail fail fail fail fail', 5, 35, NaN); +_assertGreen(ctx, 100, 50); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.bound.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.bound.html new file mode 100644 index 0000000000..63b30966f4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.bound.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.text.draw.fill.maxWidth.bound</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.fill.maxWidth.bound</h1> +<p class="desc">fillText handles maxWidth based on line size, not bounding box size</p> + + +<script> +var t = async_test("fillText handles maxWidth based on line size, not bounding box size"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillText('DD', 0, 37.5, 100); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.bound.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.bound.worker.js new file mode 100644 index 0000000000..092289baf4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.bound.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.text.draw.fill.maxWidth.bound +// Description:fillText handles maxWidth based on line size, not bounding box size +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fillText handles maxWidth based on line size, not bounding box size"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillText('DD', 0, 37.5, 100); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.fontface.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.fontface.html new file mode 100644 index 0000000000..9294bf9973 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.fontface.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.text.draw.fill.maxWidth.fontface</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.fill.maxWidth.fontface</h1> +<p class="desc">fillText works on @font-face fonts</p> + + +<script> +var t = async_test("fillText works on @font-face fonts"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillText('EEEE', -50, 37.5, 40); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.fontface.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.fontface.worker.js new file mode 100644 index 0000000000..99cc25e7ae --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.fontface.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.text.draw.fill.maxWidth.fontface +// Description:fillText works on @font-face fonts +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fillText works on @font-face fonts"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillText('EEEE', -50, 37.5, 40); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.large-manual.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.large-manual.html new file mode 100644 index 0000000000..838b3f83ee --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.large-manual.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.draw.fill.maxWidth.large</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.fill.maxWidth.large</h1> +<p class="desc">fillText handles maxWidth correctly</p> + + +<script> +var t = async_test("fillText handles maxWidth 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 = '#000'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.font = '35px Arial, sans-serif'; +ctx.fillText('PASS', 5, 35, 200); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.large-manual.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.large-manual.worker.js new file mode 100644 index 0000000000..e124b08ebc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.large-manual.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.draw.fill.maxWidth.large +// Description:fillText handles maxWidth correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fillText handles maxWidth 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 = '#000'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.font = '35px Arial, sans-serif'; +ctx.fillText('PASS', 5, 35, 200); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.large.png b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.large.png Binary files differnew file mode 100644 index 0000000000..70d7b046cb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.large.png diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.negative.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.negative.html new file mode 100644 index 0000000000..9d06556736 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.negative.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.draw.fill.maxWidth.negative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.fill.maxWidth.negative</h1> +<p class="desc">fillText handles maxWidth correctly</p> + + +<script> +var t = async_test("fillText handles maxWidth 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.fillStyle = '#f00'; +ctx.font = '35px Arial, sans-serif'; +ctx.fillText('fail fail fail fail fail', 5, 35, -1); +_assertGreen(ctx, 100, 50); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.negative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.negative.worker.js new file mode 100644 index 0000000000..bf852bc54d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.negative.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.draw.fill.maxWidth.negative +// Description:fillText handles maxWidth correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fillText handles maxWidth 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.fillStyle = '#f00'; +ctx.font = '35px Arial, sans-serif'; +ctx.fillText('fail fail fail fail fail', 5, 35, -1); +_assertGreen(ctx, 100, 50); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.small.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.small.html new file mode 100644 index 0000000000..37c137eab5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.small.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.draw.fill.maxWidth.small</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.fill.maxWidth.small</h1> +<p class="desc">fillText handles maxWidth correctly</p> + + +<script> +var t = async_test("fillText handles maxWidth 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.fillStyle = '#f00'; +ctx.font = '35px Arial, sans-serif'; +ctx.fillText('fail fail fail fail fail', -100, 35, 90); +_assertGreen(ctx, 100, 50); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.small.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.small.worker.js new file mode 100644 index 0000000000..44cf210e1e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.small.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.draw.fill.maxWidth.small +// Description:fillText handles maxWidth correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fillText handles maxWidth 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.fillStyle = '#f00'; +ctx.font = '35px Arial, sans-serif'; +ctx.fillText('fail fail fail fail fail', -100, 35, 90); +_assertGreen(ctx, 100, 50); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.zero.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.zero.html new file mode 100644 index 0000000000..c5bec91f9d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.zero.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.draw.fill.maxWidth.zero</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.fill.maxWidth.zero</h1> +<p class="desc">fillText handles maxWidth correctly</p> + + +<script> +var t = async_test("fillText handles maxWidth 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.fillStyle = '#f00'; +ctx.font = '35px Arial, sans-serif'; +ctx.fillText('fail fail fail fail fail', 5, 35, 0); +_assertGreen(ctx, 100, 50); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.zero.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.zero.worker.js new file mode 100644 index 0000000000..6701f5b8dc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.zero.worker.js @@ -0,0 +1,29 @@ +// META: timeout=long +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.draw.fill.maxWidth.zero +// Description:fillText handles maxWidth correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fillText handles maxWidth 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.fillStyle = '#f00'; +ctx.font = '35px Arial, sans-serif'; +ctx.fillText('fail fail fail fail fail', 5, 35, 0); +_assertGreen(ctx, 100, 50); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.rtl-manual.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.rtl-manual.html new file mode 100644 index 0000000000..7363d734cc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.rtl-manual.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.draw.fill.rtl</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.fill.rtl</h1> +<p class="desc">fillText respects Right-To-Left Override characters</p> + + +<script> +var t = async_test("fillText respects Right-To-Left Override characters"); +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 = '#000'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.strokeStyle = '#f00'; +ctx.font = '35px Arial, sans-serif'; +ctx.fillText('\u202eFAIL \xa0 \xa0 SSAP', 5, 35); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.rtl-manual.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.rtl-manual.worker.js new file mode 100644 index 0000000000..f52a0cc617 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.rtl-manual.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.draw.fill.rtl +// Description:fillText respects Right-To-Left Override characters +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fillText respects Right-To-Left Override characters"); +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 = '#000'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.strokeStyle = '#f00'; +ctx.font = '35px Arial, sans-serif'; +ctx.fillText('\u202eFAIL \xa0 \xa0 SSAP', 5, 35); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.rtl.png b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.rtl.png Binary files differnew file mode 100644 index 0000000000..70d7b046cb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.rtl.png diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.unaffected.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.unaffected.html new file mode 100644 index 0000000000..e620ae1a18 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.unaffected.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.text.draw.fill.unaffected</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.fill.unaffected</h1> +<p class="desc">fillText does not start a new path or subpath</p> + + +<script> +var t = async_test("fillText does not start a new path or subpath"); +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.moveTo(0, 0); +ctx.lineTo(100, 0); + +ctx.font = '35px Arial, sans-serif'; +ctx.fillText('FAIL', 5, 35); + +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 5,45, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.unaffected.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.unaffected.worker.js new file mode 100644 index 0000000000..9640bad6c9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.unaffected.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.text.draw.fill.unaffected +// Description:fillText does not start a new path or subpath +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("fillText does not start a new path or subpath"); +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.moveTo(0, 0); +ctx.lineTo(100, 0); + +ctx.font = '35px Arial, sans-serif'; +ctx.fillText('FAIL', 5, 35); + +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 5,45, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.html new file mode 100644 index 0000000000..d2c65e8bb2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.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.text.draw.fontface</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.fontface</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'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '67px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillText('AA', 0, 50); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.notinpage.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.notinpage.html new file mode 100644 index 0000000000..f390700ea0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.notinpage.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.text.draw.fontface.notinpage</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.fontface.notinpage</h1> +<p class="desc">@font-face fonts should work even if they are not used in the page</p> + + +<script> +var t = async_test("@font-face fonts should work even if they are not used in the page"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '67px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillText('AA', 0, 50); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.notinpage.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.notinpage.worker.js new file mode 100644 index 0000000000..8efab418a8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.notinpage.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.text.draw.fontface.notinpage +// Description:@font-face fonts should work even if they are not used in the page +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("@font-face fonts should work even if they are not used in the page"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '67px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillText('AA', 0, 50); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.repeat.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.repeat.html new file mode 100644 index 0000000000..3766ab6989 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.repeat.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.text.draw.fontface.repeat</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.fontface.repeat</h1> +<p class="desc">Draw with the font immediately, then wait a bit until and draw again. (This crashes some version of WebKit.)</p> + + +<script> +var t = async_test("Draw with the font immediately, then wait a bit until and draw again. (This crashes some version of WebKit.)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.font = '67px CanvasTest'; + ctx.fillStyle = '#0f0'; + ctx.fillText('AA', 0, 50); + ctx.fillText('AA', 0, 50); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.repeat.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.repeat.worker.js new file mode 100644 index 0000000000..756e844709 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.repeat.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.text.draw.fontface.repeat +// Description:Draw with the font immediately, then wait a bit until and draw again. (This crashes some version of WebKit.) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Draw with the font immediately, then wait a bit until and draw again. (This crashes some version of WebKit.)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.font = '67px CanvasTest'; + ctx.fillStyle = '#0f0'; + ctx.fillText('AA', 0, 50); + ctx.fillText('AA', 0, 50); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.worker.js new file mode 100644 index 0000000000..45f18317b0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.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.text.draw.fontface +// 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'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '67px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillText('AA', 0, 50); + _assertPixelApprox(canvas, 5,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.kern.consistent-manual.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.kern.consistent-manual.html new file mode 100644 index 0000000000..e8ee39c655 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.kern.consistent-manual.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.draw.kern.consistent</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.kern.consistent</h1> +<p class="desc">Stroked and filled text should have exactly the same kerning so it overlaps</p> + + +<script> +var t = async_test("Stroked and filled text should have exactly the same kerning so it overlaps"); +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.strokeStyle = '#0f0'; +ctx.lineWidth = 3; +ctx.font = '20px Arial, sans-serif'; +ctx.fillText('VAVAVAVAVAVAVA', -50, 25); +ctx.fillText('ToToToToToToTo', -50, 45); +ctx.strokeText('VAVAVAVAVAVAVA', -50, 25); +ctx.strokeText('ToToToToToToTo', -50, 45); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.kern.consistent-manual.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.kern.consistent-manual.worker.js new file mode 100644 index 0000000000..464cab3ea5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.kern.consistent-manual.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.text.draw.kern.consistent +// Description:Stroked and filled text should have exactly the same kerning so it overlaps +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Stroked and filled text should have exactly the same kerning so it overlaps"); +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.strokeStyle = '#0f0'; +ctx.lineWidth = 3; +ctx.font = '20px Arial, sans-serif'; +ctx.fillText('VAVAVAVAVAVAVA', -50, 25); +ctx.fillText('ToToToToToToTo', -50, 45); +ctx.strokeText('VAVAVAVAVAVAVA', -50, 25); +ctx.strokeText('ToToToToToToTo', -50, 45); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.basic.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.basic.html new file mode 100644 index 0000000000..4bc03bb4ad --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.basic.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.draw.space.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.text.draw.space.basic</h1> +<p class="desc">U+0020 is rendered the correct size (1em wide)</p> + + +<script> +var t = async_test("U+0020 is rendered the correct size (1em wide)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillText('E EE', -100, 37.5); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.basic.worker.js new file mode 100644 index 0000000000..39c00846e9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.basic.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.draw.space.basic +// Description:U+0020 is rendered the correct size (1em wide) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("U+0020 is rendered the correct size (1em wide)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillText('E EE', -100, 37.5); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.end.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.end.html new file mode 100644 index 0000000000..58fb292e13 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.end.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.draw.space.collapse.end</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.space.collapse.end</h1> +<p class="desc">Space characters at the end of a line are collapsed (per CSS)</p> + + +<script> +var t = async_test("Space characters at the end of a line are collapsed (per CSS)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textAlign = 'right'; + ctx.fillText('EE ', 100, 37.5); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.end.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.end.worker.js new file mode 100644 index 0000000000..81f85baff0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.end.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.text.draw.space.collapse.end +// Description:Space characters at the end of a line are collapsed (per CSS) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Space characters at the end of a line are collapsed (per CSS)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.textAlign = 'right'; + ctx.fillText('EE ', 100, 37.5); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.nonspace.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.nonspace.html new file mode 100644 index 0000000000..f018dc1465 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.nonspace.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.draw.space.collapse.nonspace</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.space.collapse.nonspace</h1> +<p class="desc">Non-space characters are not converted to U+0020 and collapsed</p> + + +<script> +var t = async_test("Non-space characters are not converted to U+0020 and collapsed"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillText('E\x0b EE', -150, 37.5); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.nonspace.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.nonspace.worker.js new file mode 100644 index 0000000000..cbc9803487 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.nonspace.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.draw.space.collapse.nonspace +// Description:Non-space characters are not converted to U+0020 and collapsed +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Non-space characters are not converted to U+0020 and collapsed"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillText('E\x0b EE', -150, 37.5); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.other.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.other.html new file mode 100644 index 0000000000..0a6bb09c07 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.other.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.draw.space.collapse.other</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.space.collapse.other</h1> +<p class="desc">Space characters are converted to U+0020, and collapsed (per CSS)</p> + + +<script> +var t = async_test("Space characters are converted to U+0020, and collapsed (per CSS)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillText('E \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dEE', -100, 37.5); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.other.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.other.worker.js new file mode 100644 index 0000000000..e13b87a531 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.other.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.draw.space.collapse.other +// Description:Space characters are converted to U+0020, and collapsed (per CSS) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Space characters are converted to U+0020, and collapsed (per CSS)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillText('E \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dEE', -100, 37.5); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.space.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.space.html new file mode 100644 index 0000000000..3308cc7598 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.space.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.draw.space.collapse.space</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.space.collapse.space</h1> +<p class="desc">Space characters are converted to U+0020, and collapsed (per CSS)</p> + + +<script> +var t = async_test("Space characters are converted to U+0020, and collapsed (per CSS)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillText('E EE', -100, 37.5); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.space.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.space.worker.js new file mode 100644 index 0000000000..4ea78a2466 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.space.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.draw.space.collapse.space +// Description:Space characters are converted to U+0020, and collapsed (per CSS) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Space characters are converted to U+0020, and collapsed (per CSS)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillText('E EE', -100, 37.5); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.start.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.start.html new file mode 100644 index 0000000000..94b3f9ff0b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.start.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.draw.space.collapse.start</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.space.collapse.start</h1> +<p class="desc">Space characters at the start of a line are collapsed (per CSS)</p> + + +<script> +var t = async_test("Space characters at the start of a line are collapsed (per CSS)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillText(' EE', 0, 37.5); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.start.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.start.worker.js new file mode 100644 index 0000000000..20bd10ae57 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.start.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.draw.space.collapse.start +// Description:Space characters at the start of a line are collapsed (per CSS) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Space characters at the start of a line are collapsed (per CSS)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillText(' EE', 0, 37.5); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + }).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.stroke.basic-manual.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.stroke.basic-manual.html new file mode 100644 index 0000000000..5aee6afc0d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.stroke.basic-manual.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.draw.stroke.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.text.draw.stroke.basic</h1> +<p class="desc">strokeText draws stroked text</p> + + +<script> +var t = async_test("strokeText draws stroked text"); +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 = '#000'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.fillStyle = '#f00'; +ctx.lineWidth = 1; +ctx.font = '35px Arial, sans-serif'; +ctx.strokeText('PASS', 5, 35); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.stroke.basic-manual.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.stroke.basic-manual.worker.js new file mode 100644 index 0000000000..8806e011ea --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.stroke.basic-manual.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.text.draw.stroke.basic +// Description:strokeText draws stroked text +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("strokeText draws stroked text"); +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 = '#000'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.fillStyle = '#f00'; +ctx.lineWidth = 1; +ctx.font = '35px Arial, sans-serif'; +ctx.strokeText('PASS', 5, 35); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.stroke.basic.png b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.stroke.basic.png Binary files differnew file mode 100644 index 0000000000..fb3b5b830d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.stroke.basic.png diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.stroke.unaffected.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.stroke.unaffected.html new file mode 100644 index 0000000000..7cad996cc0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.stroke.unaffected.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.text.draw.stroke.unaffected</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.draw.stroke.unaffected</h1> +<p class="desc">strokeText does not start a new path or subpath</p> + + +<script> +var t = async_test("strokeText does not start a new path or subpath"); +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.moveTo(0, 0); +ctx.lineTo(100, 0); + +ctx.font = '35px Arial, sans-serif'; +ctx.strokeStyle = '#f00'; +ctx.strokeText('FAIL', 5, 35); + +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 5,45, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.stroke.unaffected.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.stroke.unaffected.worker.js new file mode 100644 index 0000000000..7ce3b1adc7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.stroke.unaffected.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.text.draw.stroke.unaffected +// Description:strokeText does not start a new path or subpath +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("strokeText does not start a new path or subpath"); +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.moveTo(0, 0); +ctx.lineTo(100, 0); + +ctx.font = '35px Arial, sans-serif'; +ctx.strokeStyle = '#f00'; +ctx.strokeText('FAIL', 5, 35); + +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 5,45, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.html new file mode 100644 index 0000000000..30e12f31bb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.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.text.drawing.style.fontKerning</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.drawing.style.fontKerning</h1> +<p class="desc">Testing basic functionalities of fontKerning for canvas</p> + + +<script> +var t = async_test("Testing basic functionalities of fontKerning for canvas"); +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.fontKerning, "auto", "ctx.fontKerning", "\"auto\""); +ctx.fontKerning = "normal"; +_assertSame(ctx.fontKerning, "normal", "ctx.fontKerning", "\"normal\""); +width_normal = ctx.measureText("TAWATAVA").width; +ctx.fontKerning = "none"; +_assertSame(ctx.fontKerning, "none", "ctx.fontKerning", "\"none\""); +width_none = ctx.measureText("TAWATAVA").width; +_assert(width_normal < width_none, "width_normal < width_none"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.with.uppercase.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.with.uppercase.html new file mode 100644 index 0000000000..a9a5ae23f5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.with.uppercase.html @@ -0,0 +1,56 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.drawing.style.fontKerning.with.uppercase</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.drawing.style.fontKerning.with.uppercase</h1> +<p class="desc">Testing basic functionalities of fontKerning for canvas</p> + + +<script> +var t = async_test("Testing basic functionalities of fontKerning for canvas"); +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.fontKerning, "auto", "ctx.fontKerning", "\"auto\""); +ctx.fontKerning = "Normal"; +_assertSame(ctx.fontKerning, "normal", "ctx.fontKerning", "\"normal\""); +ctx.fontKerning = "auto"; +ctx.fontKerning = "normal"; +_assertSame(ctx.fontKerning, "normal", "ctx.fontKerning", "\"normal\""); +ctx.fontKerning = "auto"; +ctx.fontKerning = "noRmal"; +_assertSame(ctx.fontKerning, "normal", "ctx.fontKerning", "\"normal\""); +ctx.fontKerning = "auto"; +ctx.fontKerning = "NoRMal"; +_assertSame(ctx.fontKerning, "normal", "ctx.fontKerning", "\"normal\""); +ctx.fontKerning = "auto"; +ctx.fontKerning = "NORMAL"; +_assertSame(ctx.fontKerning, "normal", "ctx.fontKerning", "\"normal\""); + +ctx.fontKerning = "None"; +_assertSame(ctx.fontKerning, "none", "ctx.fontKerning", "\"none\""); +ctx.fontKerning = "auto"; +ctx.fontKerning = "none"; +_assertSame(ctx.fontKerning, "none", "ctx.fontKerning", "\"none\""); +ctx.fontKerning = "auto"; +ctx.fontKerning = "nOne"; +_assertSame(ctx.fontKerning, "none", "ctx.fontKerning", "\"none\""); +ctx.fontKerning = "auto"; +ctx.fontKerning = "nonE"; +_assertSame(ctx.fontKerning, "none", "ctx.fontKerning", "\"none\""); +ctx.fontKerning = "auto"; +ctx.fontKerning = "NONE"; +_assertSame(ctx.fontKerning, "none", "ctx.fontKerning", "\"none\""); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.with.uppercase.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.with.uppercase.worker.js new file mode 100644 index 0000000000..a8837374e0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.with.uppercase.worker.js @@ -0,0 +1,52 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.drawing.style.fontKerning.with.uppercase +// Description:Testing basic functionalities of fontKerning for canvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Testing basic functionalities of fontKerning for canvas"); +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.fontKerning, "auto", "ctx.fontKerning", "\"auto\""); +ctx.fontKerning = "Normal"; +_assertSame(ctx.fontKerning, "normal", "ctx.fontKerning", "\"normal\""); +ctx.fontKerning = "auto"; +ctx.fontKerning = "normal"; +_assertSame(ctx.fontKerning, "normal", "ctx.fontKerning", "\"normal\""); +ctx.fontKerning = "auto"; +ctx.fontKerning = "noRmal"; +_assertSame(ctx.fontKerning, "normal", "ctx.fontKerning", "\"normal\""); +ctx.fontKerning = "auto"; +ctx.fontKerning = "NoRMal"; +_assertSame(ctx.fontKerning, "normal", "ctx.fontKerning", "\"normal\""); +ctx.fontKerning = "auto"; +ctx.fontKerning = "NORMAL"; +_assertSame(ctx.fontKerning, "normal", "ctx.fontKerning", "\"normal\""); + +ctx.fontKerning = "None"; +_assertSame(ctx.fontKerning, "none", "ctx.fontKerning", "\"none\""); +ctx.fontKerning = "auto"; +ctx.fontKerning = "none"; +_assertSame(ctx.fontKerning, "none", "ctx.fontKerning", "\"none\""); +ctx.fontKerning = "auto"; +ctx.fontKerning = "nOne"; +_assertSame(ctx.fontKerning, "none", "ctx.fontKerning", "\"none\""); +ctx.fontKerning = "auto"; +ctx.fontKerning = "nonE"; +_assertSame(ctx.fontKerning, "none", "ctx.fontKerning", "\"none\""); +ctx.fontKerning = "auto"; +ctx.fontKerning = "NONE"; +_assertSame(ctx.fontKerning, "none", "ctx.fontKerning", "\"none\""); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.worker.js new file mode 100644 index 0000000000..9478eece85 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.drawing.style.fontKerning +// Description:Testing basic functionalities of fontKerning for canvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Testing basic functionalities of fontKerning for canvas"); +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.fontKerning, "auto", "ctx.fontKerning", "\"auto\""); +ctx.fontKerning = "normal"; +_assertSame(ctx.fontKerning, "normal", "ctx.fontKerning", "\"normal\""); +width_normal = ctx.measureText("TAWATAVA").width; +ctx.fontKerning = "none"; +_assertSame(ctx.fontKerning, "none", "ctx.fontKerning", "\"none\""); +width_none = ctx.measureText("TAWATAVA").width; +_assert(width_normal < width_none, "width_normal < width_none"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.fontVariant.settings.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.fontVariant.settings.html new file mode 100644 index 0000000000..08c48f1bcd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.fontVariant.settings.html @@ -0,0 +1,75 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.drawing.style.fontVariant.settings</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.drawing.style.fontVariant.settings</h1> +<p class="desc">Testing basic functionalities of fontKerning for canvas</p> + + +<script> +var t = async_test("Testing basic functionalities of fontKerning for canvas"); +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'); + +// Setting fontVariantCaps with lower cases +_assertSame(ctx.fontVariantCaps, "normal", "ctx.fontVariantCaps", "\"normal\""); + +ctx.fontVariantCaps = "normal"; +_assertSame(ctx.fontVariantCaps, "normal", "ctx.fontVariantCaps", "\"normal\""); + +ctx.fontVariantCaps = "small-caps"; +_assertSame(ctx.fontVariantCaps, "small-caps", "ctx.fontVariantCaps", "\"small-caps\""); + +ctx.fontVariantCaps = "all-small-caps"; +_assertSame(ctx.fontVariantCaps, "all-small-caps", "ctx.fontVariantCaps", "\"all-small-caps\""); + +ctx.fontVariantCaps = "petite-caps"; +_assertSame(ctx.fontVariantCaps, "petite-caps", "ctx.fontVariantCaps", "\"petite-caps\""); + +ctx.fontVariantCaps = "all-petite-caps"; +_assertSame(ctx.fontVariantCaps, "all-petite-caps", "ctx.fontVariantCaps", "\"all-petite-caps\""); + +ctx.fontVariantCaps = "unicase"; +_assertSame(ctx.fontVariantCaps, "unicase", "ctx.fontVariantCaps", "\"unicase\""); + +ctx.fontVariantCaps = "titling-caps"; +_assertSame(ctx.fontVariantCaps, "titling-caps", "ctx.fontVariantCaps", "\"titling-caps\""); + +// Setting fontVariantCaps with lower cases and upper cases word. +ctx.fontVariantCaps = "nORmal"; +_assertSame(ctx.fontVariantCaps, "normal", "ctx.fontVariantCaps", "\"normal\""); + +ctx.fontVariantCaps = "smaLL-caps"; +_assertSame(ctx.fontVariantCaps, "small-caps", "ctx.fontVariantCaps", "\"small-caps\""); + +ctx.fontVariantCaps = "all-small-CAPS"; +_assertSame(ctx.fontVariantCaps, "all-small-caps", "ctx.fontVariantCaps", "\"all-small-caps\""); + +ctx.fontVariantCaps = "pEtitE-caps"; +_assertSame(ctx.fontVariantCaps, "petite-caps", "ctx.fontVariantCaps", "\"petite-caps\""); + +ctx.fontVariantCaps = "All-Petite-Caps"; +_assertSame(ctx.fontVariantCaps, "all-petite-caps", "ctx.fontVariantCaps", "\"all-petite-caps\""); + +ctx.fontVariantCaps = "uNIcase"; +_assertSame(ctx.fontVariantCaps, "unicase", "ctx.fontVariantCaps", "\"unicase\""); + +ctx.fontVariantCaps = "titling-CAPS"; +_assertSame(ctx.fontVariantCaps, "titling-caps", "ctx.fontVariantCaps", "\"titling-caps\""); + +// Setting fontVariantCaps with non-existing font variant. +ctx.fontVariantCaps = "abcd"; +_assertSame(ctx.fontVariantCaps, "titling-caps", "ctx.fontVariantCaps", "\"titling-caps\""); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.fontVariant.settings.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.fontVariant.settings.worker.js new file mode 100644 index 0000000000..d4e9307bef --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.fontVariant.settings.worker.js @@ -0,0 +1,71 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.drawing.style.fontVariant.settings +// Description:Testing basic functionalities of fontKerning for canvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Testing basic functionalities of fontKerning for canvas"); +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'); + +// Setting fontVariantCaps with lower cases +_assertSame(ctx.fontVariantCaps, "normal", "ctx.fontVariantCaps", "\"normal\""); + +ctx.fontVariantCaps = "normal"; +_assertSame(ctx.fontVariantCaps, "normal", "ctx.fontVariantCaps", "\"normal\""); + +ctx.fontVariantCaps = "small-caps"; +_assertSame(ctx.fontVariantCaps, "small-caps", "ctx.fontVariantCaps", "\"small-caps\""); + +ctx.fontVariantCaps = "all-small-caps"; +_assertSame(ctx.fontVariantCaps, "all-small-caps", "ctx.fontVariantCaps", "\"all-small-caps\""); + +ctx.fontVariantCaps = "petite-caps"; +_assertSame(ctx.fontVariantCaps, "petite-caps", "ctx.fontVariantCaps", "\"petite-caps\""); + +ctx.fontVariantCaps = "all-petite-caps"; +_assertSame(ctx.fontVariantCaps, "all-petite-caps", "ctx.fontVariantCaps", "\"all-petite-caps\""); + +ctx.fontVariantCaps = "unicase"; +_assertSame(ctx.fontVariantCaps, "unicase", "ctx.fontVariantCaps", "\"unicase\""); + +ctx.fontVariantCaps = "titling-caps"; +_assertSame(ctx.fontVariantCaps, "titling-caps", "ctx.fontVariantCaps", "\"titling-caps\""); + +// Setting fontVariantCaps with lower cases and upper cases word. +ctx.fontVariantCaps = "nORmal"; +_assertSame(ctx.fontVariantCaps, "normal", "ctx.fontVariantCaps", "\"normal\""); + +ctx.fontVariantCaps = "smaLL-caps"; +_assertSame(ctx.fontVariantCaps, "small-caps", "ctx.fontVariantCaps", "\"small-caps\""); + +ctx.fontVariantCaps = "all-small-CAPS"; +_assertSame(ctx.fontVariantCaps, "all-small-caps", "ctx.fontVariantCaps", "\"all-small-caps\""); + +ctx.fontVariantCaps = "pEtitE-caps"; +_assertSame(ctx.fontVariantCaps, "petite-caps", "ctx.fontVariantCaps", "\"petite-caps\""); + +ctx.fontVariantCaps = "All-Petite-Caps"; +_assertSame(ctx.fontVariantCaps, "all-petite-caps", "ctx.fontVariantCaps", "\"all-petite-caps\""); + +ctx.fontVariantCaps = "uNIcase"; +_assertSame(ctx.fontVariantCaps, "unicase", "ctx.fontVariantCaps", "\"unicase\""); + +ctx.fontVariantCaps = "titling-CAPS"; +_assertSame(ctx.fontVariantCaps, "titling-caps", "ctx.fontVariantCaps", "\"titling-caps\""); + +// Setting fontVariantCaps with non-existing font variant. +ctx.fontVariantCaps = "abcd"; +_assertSame(ctx.fontVariantCaps, "titling-caps", "ctx.fontVariantCaps", "\"titling-caps\""); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.invalid.spacing.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.invalid.spacing.html new file mode 100644 index 0000000000..a117be0365 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.invalid.spacing.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.text.drawing.style.invalid.spacing</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.drawing.style.invalid.spacing</h1> +<p class="desc">Testing letter spacing and word spacing with invalid units</p> + + +<script> +var t = async_test("Testing letter spacing and word spacing with invalid units"); +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.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); +_assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); + +function test_word_spacing(value) { + ctx.wordSpacing = value; + ctx.letterSpacing = value; + _assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); + _assertSame(ctx.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); +} +test_word_spacing('0s'); +test_word_spacing('1min'); +test_word_spacing('1deg'); +test_word_spacing('1pp'); + +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.invalid.spacing.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.invalid.spacing.worker.js new file mode 100644 index 0000000000..7f6baf28b6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.invalid.spacing.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.text.drawing.style.invalid.spacing +// Description:Testing letter spacing and word spacing with invalid units +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Testing letter spacing and word spacing with invalid units"); +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.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); +_assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); + +function test_word_spacing(value) { + ctx.wordSpacing = value; + ctx.letterSpacing = value; + _assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); + _assertSame(ctx.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); +} +test_word_spacing('0s'); +test_word_spacing('1min'); +test_word_spacing('1deg'); +test_word_spacing('1pp'); + +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.change.font.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.change.font.html new file mode 100644 index 0000000000..ff84f4541b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.change.font.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.text.drawing.style.letterSpacing.change.font</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.drawing.style.letterSpacing.change.font</h1> +<p class="desc">Set letter spacing and word spacing to font dependent value and verify it works after font change.</p> + + +<script> +var t = async_test("Set letter spacing and word spacing to font dependent value and verify it works after font change."); +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.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); +_assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); +// Get the width for 'Hello World' at default size, 10px. +var width_normal = ctx.measureText('Hello World').width; + +ctx.letterSpacing = '1em'; +_assertSame(ctx.letterSpacing, '1em', "ctx.letterSpacing", "'1em'"); +// 1em = 10px. Add 10px after each letter in "Hello World", +// makes it 110px longer. +var width_with_spacing = ctx.measureText('Hello World').width; +_assertSame(width_with_spacing, width_normal + 110, "width_with_spacing", "width_normal + 110"); + +// Changing font to 20px. Without resetting the spacing, 1em letterSpacing +// is now 20px, so it's suppose to be 220px longer without any letterSpacing set. +ctx.font = '20px serif'; +width_with_spacing = ctx.measureText('Hello World').width; +// Now calculate the reference spacing for "Hello World" with no spacing. +ctx.letterSpacing = '0em'; +width_normal = ctx.measureText('Hello World').width; +_assertSame(width_with_spacing, width_normal + 220, "width_with_spacing", "width_normal + 220"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.change.font.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.change.font.worker.js new file mode 100644 index 0000000000..5a6bf6614d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.change.font.worker.js @@ -0,0 +1,42 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.drawing.style.letterSpacing.change.font +// Description:Set letter spacing and word spacing to font dependent value and verify it works after font change. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Set letter spacing and word spacing to font dependent value and verify it works after font change."); +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.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); +_assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); +// Get the width for 'Hello World' at default size, 10px. +var width_normal = ctx.measureText('Hello World').width; + +ctx.letterSpacing = '1em'; +_assertSame(ctx.letterSpacing, '1em', "ctx.letterSpacing", "'1em'"); +// 1em = 10px. Add 10px after each letter in "Hello World", +// makes it 110px longer. +var width_with_spacing = ctx.measureText('Hello World').width; +_assertSame(width_with_spacing, width_normal + 110, "width_with_spacing", "width_normal + 110"); + +// Changing font to 20px. Without resetting the spacing, 1em letterSpacing +// is now 20px, so it's suppose to be 220px longer without any letterSpacing set. +ctx.font = '20px serif'; +width_with_spacing = ctx.measureText('Hello World').width; +// Now calculate the reference spacing for "Hello World" with no spacing. +ctx.letterSpacing = '0em'; +width_normal = ctx.measureText('Hello World').width; +_assertSame(width_with_spacing, width_normal + 220, "width_with_spacing", "width_normal + 220"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.measure.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.measure.html new file mode 100644 index 0000000000..b63c81b255 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.measure.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.drawing.style.letterSpacing.measure</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.drawing.style.letterSpacing.measure</h1> +<p class="desc">Testing letter spacing and word spacing</p> + + +<script> +var t = async_test("Testing letter spacing and word spacing"); +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.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); +_assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); +var width_normal = ctx.measureText('Hello World').width; + +function test_letter_spacing(value, difference_spacing, epsilon) { + ctx.letterSpacing = value; + _assertSame(ctx.letterSpacing, value, "ctx.letterSpacing", "value"); + _assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); + width_with_letter_spacing = ctx.measureText('Hello World').width; + assert_approx_equals(width_with_letter_spacing, width_normal + difference_spacing, epsilon, "letter spacing doesn't work."); +} + +// The first value is the letter Spacing to be set, the second value the +// change in length of string 'Hello World', note that there are 11 letters +// in 'hello world', so the length difference is always letterSpacing * 11. +// and the third value is the acceptable differencee for the length change, +// note that unit such as 1cm/1mm doesn't map to an exact pixel value. +test_cases = [['3px', 33, 0], + ['5px', 55, 0], + ['-2px', -22, 0], + ['1em', 110, 0], + ['1in', 1056, 0], + ['-0.1cm', -41.65, 0.2], + ['-0.6mm', -24,95, 0.2]] + +for (const test_case of test_cases) { + test_letter_spacing(test_case[0], test_case[1], test_case[2]); +} +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.measure.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.measure.worker.js new file mode 100644 index 0000000000..b9189cba30 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.measure.worker.js @@ -0,0 +1,50 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.drawing.style.letterSpacing.measure +// Description:Testing letter spacing and word spacing +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Testing letter spacing and word spacing"); +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.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); +_assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); +var width_normal = ctx.measureText('Hello World').width; + +function test_letter_spacing(value, difference_spacing, epsilon) { + ctx.letterSpacing = value; + _assertSame(ctx.letterSpacing, value, "ctx.letterSpacing", "value"); + _assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); + width_with_letter_spacing = ctx.measureText('Hello World').width; + assert_approx_equals(width_with_letter_spacing, width_normal + difference_spacing, epsilon, "letter spacing doesn't work."); +} + +// The first value is the letter Spacing to be set, the second value the +// change in length of string 'Hello World', note that there are 11 letters +// in 'hello world', so the length difference is always letterSpacing * 11. +// and the third value is the acceptable differencee for the length change, +// note that unit such as 1cm/1mm doesn't map to an exact pixel value. +test_cases = [['3px', 33, 0], + ['5px', 55, 0], + ['-2px', -22, 0], + ['1em', 110, 0], + ['1in', 1056, 0], + ['-0.1cm', -41.65, 0.2], + ['-0.6mm', -24,95, 0.2]] + +for (const test_case of test_cases) { + test_letter_spacing(test_case[0], test_case[1], test_case[2]); +} +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.measure.direction.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.measure.direction.html new file mode 100644 index 0000000000..04774a9d0f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.measure.direction.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.drawing.style.measure.direction</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.drawing.style.measure.direction</h1> +<p class="desc">Measurement should follow text direction</p> + + +<script> +var t = async_test("Measurement should follow text direction"); +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.direction = "ltr"; +metrics = ctx.measureText('hello'); +_assert(metrics.actualBoundingBoxLeft < metrics.actualBoundingBoxRight, "metrics.actualBoundingBoxLeft < metrics.actualBoundingBoxRight"); + +ctx.direction = "rtl"; +metrics = ctx.measureText('hello'); +_assert(metrics.actualBoundingBoxLeft > metrics.actualBoundingBoxRight, "metrics.actualBoundingBoxLeft > metrics.actualBoundingBoxRight"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.measure.direction.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.measure.direction.worker.js new file mode 100644 index 0000000000..8f5585682b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.measure.direction.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.text.drawing.style.measure.direction +// Description:Measurement should follow text direction +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Measurement should follow text direction"); +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.direction = "ltr"; +metrics = ctx.measureText('hello'); +_assert(metrics.actualBoundingBoxLeft < metrics.actualBoundingBoxRight, "metrics.actualBoundingBoxLeft < metrics.actualBoundingBoxRight"); + +ctx.direction = "rtl"; +metrics = ctx.measureText('hello'); +_assert(metrics.actualBoundingBoxLeft > metrics.actualBoundingBoxRight, "metrics.actualBoundingBoxLeft > metrics.actualBoundingBoxRight"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.measure.rtl.text.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.measure.rtl.text.html new file mode 100644 index 0000000000..7eba676652 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.measure.rtl.text.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.drawing.style.measure.rtl.text</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.drawing.style.measure.rtl.text</h1> +<p class="desc">Measurement should follow canvas direction instead text direction</p> + + +<script> +var t = async_test("Measurement should follow canvas direction instead text direction"); +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'); + +metrics = ctx.measureText('اَلْعَرَبِيَّةُ'); +_assert(metrics.actualBoundingBoxLeft < metrics.actualBoundingBoxRight, "metrics.actualBoundingBoxLeft < metrics.actualBoundingBoxRight"); + +metrics = ctx.measureText('hello'); +_assert(metrics.actualBoundingBoxLeft < metrics.actualBoundingBoxRight, "metrics.actualBoundingBoxLeft < metrics.actualBoundingBoxRight"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.measure.rtl.text.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.measure.rtl.text.worker.js new file mode 100644 index 0000000000..585e6c0c74 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.measure.rtl.text.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.drawing.style.measure.rtl.text +// Description:Measurement should follow canvas direction instead text direction +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Measurement should follow canvas direction instead text direction"); +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'); + +metrics = ctx.measureText('اَلْعَرَبِيَّةُ'); +_assert(metrics.actualBoundingBoxLeft < metrics.actualBoundingBoxRight, "metrics.actualBoundingBoxLeft < metrics.actualBoundingBoxRight"); + +metrics = ctx.measureText('hello'); +_assert(metrics.actualBoundingBoxLeft < metrics.actualBoundingBoxRight, "metrics.actualBoundingBoxLeft < metrics.actualBoundingBoxRight"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.measure.textAlign.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.measure.textAlign.html new file mode 100644 index 0000000000..f784f569b2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.measure.textAlign.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.drawing.style.measure.textAlign</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.drawing.style.measure.textAlign</h1> +<p class="desc">Measurement should be related to textAlignment</p> + + +<script> +var t = async_test("Measurement should be related to textAlignment"); +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.textAlign = "right"; +metrics = ctx.measureText('hello'); +_assert(metrics.actualBoundingBoxLeft > metrics.actualBoundingBoxRight, "metrics.actualBoundingBoxLeft > metrics.actualBoundingBoxRight"); + +ctx.textAlign = "left" +metrics = ctx.measureText('hello'); +_assert(metrics.actualBoundingBoxLeft < metrics.actualBoundingBoxRight, "metrics.actualBoundingBoxLeft < metrics.actualBoundingBoxRight"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.measure.textAlign.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.measure.textAlign.worker.js new file mode 100644 index 0000000000..3af2f47143 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.measure.textAlign.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.text.drawing.style.measure.textAlign +// Description:Measurement should be related to textAlignment +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Measurement should be related to textAlignment"); +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.textAlign = "right"; +metrics = ctx.measureText('hello'); +_assert(metrics.actualBoundingBoxLeft > metrics.actualBoundingBoxRight, "metrics.actualBoundingBoxLeft > metrics.actualBoundingBoxRight"); + +ctx.textAlign = "left" +metrics = ctx.measureText('hello'); +_assert(metrics.actualBoundingBoxLeft < metrics.actualBoundingBoxRight, "metrics.actualBoundingBoxLeft < metrics.actualBoundingBoxRight"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.nonfinite.spacing.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.nonfinite.spacing.html new file mode 100644 index 0000000000..8e80f9a3ab --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.nonfinite.spacing.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.drawing.style.nonfinite.spacing</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.drawing.style.nonfinite.spacing</h1> +<p class="desc">Testing letter spacing and word spacing with nonfinite inputs</p> + + +<script> +var t = async_test("Testing letter spacing and word spacing with nonfinite inputs"); +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.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); +_assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); + +function test_word_spacing(value) { + ctx.wordSpacing = value; + ctx.letterSpacing = value; + _assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); + _assertSame(ctx.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); +} +test_word_spacing(NaN); +test_word_spacing(Infinity); +test_word_spacing(-Infinity); + +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.nonfinite.spacing.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.nonfinite.spacing.worker.js new file mode 100644 index 0000000000..adba253282 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.nonfinite.spacing.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.text.drawing.style.nonfinite.spacing +// Description:Testing letter spacing and word spacing with nonfinite inputs +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Testing letter spacing and word spacing with nonfinite inputs"); +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.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); +_assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); + +function test_word_spacing(value) { + ctx.wordSpacing = value; + ctx.letterSpacing = value; + _assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); + _assertSame(ctx.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); +} +test_word_spacing(NaN); +test_word_spacing(Infinity); +test_word_spacing(-Infinity); + +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.spacing.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.spacing.html new file mode 100644 index 0000000000..ea480c4690 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.spacing.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.text.drawing.style.spacing</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.drawing.style.spacing</h1> +<p class="desc">Testing letter spacing and word spacing</p> + + +<script> +var t = async_test("Testing letter spacing and word spacing"); +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.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); +_assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); + +ctx.letterSpacing = '3px'; +_assertSame(ctx.letterSpacing, '3px', "ctx.letterSpacing", "'3px'"); +_assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); + +ctx.wordSpacing = '5px'; +_assertSame(ctx.letterSpacing, '3px', "ctx.letterSpacing", "'3px'"); +_assertSame(ctx.wordSpacing, '5px', "ctx.wordSpacing", "'5px'"); + +ctx.letterSpacing = '-1px'; +ctx.wordSpacing = '-1px'; +_assertSame(ctx.letterSpacing, '-1px', "ctx.letterSpacing", "'-1px'"); +_assertSame(ctx.wordSpacing, '-1px', "ctx.wordSpacing", "'-1px'"); + +ctx.letterSpacing = '1PX'; +ctx.wordSpacing = '1EM'; +_assertSame(ctx.letterSpacing, '1px', "ctx.letterSpacing", "'1px'"); +_assertSame(ctx.wordSpacing, '1em', "ctx.wordSpacing", "'1em'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.spacing.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.spacing.worker.js new file mode 100644 index 0000000000..a413f9270a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.spacing.worker.js @@ -0,0 +1,42 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.drawing.style.spacing +// Description:Testing letter spacing and word spacing +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Testing letter spacing and word spacing"); +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.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); +_assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); + +ctx.letterSpacing = '3px'; +_assertSame(ctx.letterSpacing, '3px', "ctx.letterSpacing", "'3px'"); +_assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); + +ctx.wordSpacing = '5px'; +_assertSame(ctx.letterSpacing, '3px', "ctx.letterSpacing", "'3px'"); +_assertSame(ctx.wordSpacing, '5px', "ctx.wordSpacing", "'5px'"); + +ctx.letterSpacing = '-1px'; +ctx.wordSpacing = '-1px'; +_assertSame(ctx.letterSpacing, '-1px', "ctx.letterSpacing", "'-1px'"); +_assertSame(ctx.wordSpacing, '-1px', "ctx.wordSpacing", "'-1px'"); + +ctx.letterSpacing = '1PX'; +ctx.wordSpacing = '1EM'; +_assertSame(ctx.letterSpacing, '1px', "ctx.letterSpacing", "'1px'"); +_assertSame(ctx.wordSpacing, '1em', "ctx.wordSpacing", "'1em'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.textRendering.settings.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.textRendering.settings.html new file mode 100644 index 0000000000..d0c7b88a0c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.textRendering.settings.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.drawing.style.textRendering.settings</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.drawing.style.textRendering.settings</h1> +<p class="desc">Testing basic functionalities of textRendering in Canvas</p> + + +<script> +var t = async_test("Testing basic functionalities of textRendering in Canvas"); +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'); + +// Setting textRendering with lower cases +_assertSame(ctx.textRendering, "auto", "ctx.textRendering", "\"auto\""); + +ctx.textRendering = "auto"; +_assertSame(ctx.textRendering, "auto", "ctx.textRendering", "\"auto\""); + +ctx.textRendering = "optimizespeed"; +_assertSame(ctx.textRendering, "optimizeSpeed", "ctx.textRendering", "\"optimizeSpeed\""); + +ctx.textRendering = "optimizelegibility"; +_assertSame(ctx.textRendering, "optimizeLegibility", "ctx.textRendering", "\"optimizeLegibility\""); + +ctx.textRendering = "geometricprecision"; +_assertSame(ctx.textRendering, "geometricPrecision", "ctx.textRendering", "\"geometricPrecision\""); + +// Setting textRendering with lower cases and upper cases word. +ctx.textRendering = "aUto"; +_assertSame(ctx.textRendering, "auto", "ctx.textRendering", "\"auto\""); + +ctx.textRendering = "OPtimizeSpeed"; +_assertSame(ctx.textRendering, "optimizeSpeed", "ctx.textRendering", "\"optimizeSpeed\""); + +ctx.textRendering = "OPtimizELEgibility"; +_assertSame(ctx.textRendering, "optimizeLegibility", "ctx.textRendering", "\"optimizeLegibility\""); + +ctx.textRendering = "GeometricPrecision"; +_assertSame(ctx.textRendering, "geometricPrecision", "ctx.textRendering", "\"geometricPrecision\""); + +// Setting textRendering with non-existing font variant. +ctx.textRendering = "abcd"; +_assertSame(ctx.textRendering, "geometricPrecision", "ctx.textRendering", "\"geometricPrecision\""); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.textRendering.settings.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.textRendering.settings.worker.js new file mode 100644 index 0000000000..e8402c2a08 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.textRendering.settings.worker.js @@ -0,0 +1,53 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.drawing.style.textRendering.settings +// Description:Testing basic functionalities of textRendering in Canvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Testing basic functionalities of textRendering in Canvas"); +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'); + +// Setting textRendering with lower cases +_assertSame(ctx.textRendering, "auto", "ctx.textRendering", "\"auto\""); + +ctx.textRendering = "auto"; +_assertSame(ctx.textRendering, "auto", "ctx.textRendering", "\"auto\""); + +ctx.textRendering = "optimizespeed"; +_assertSame(ctx.textRendering, "optimizeSpeed", "ctx.textRendering", "\"optimizeSpeed\""); + +ctx.textRendering = "optimizelegibility"; +_assertSame(ctx.textRendering, "optimizeLegibility", "ctx.textRendering", "\"optimizeLegibility\""); + +ctx.textRendering = "geometricprecision"; +_assertSame(ctx.textRendering, "geometricPrecision", "ctx.textRendering", "\"geometricPrecision\""); + +// Setting textRendering with lower cases and upper cases word. +ctx.textRendering = "aUto"; +_assertSame(ctx.textRendering, "auto", "ctx.textRendering", "\"auto\""); + +ctx.textRendering = "OPtimizeSpeed"; +_assertSame(ctx.textRendering, "optimizeSpeed", "ctx.textRendering", "\"optimizeSpeed\""); + +ctx.textRendering = "OPtimizELEgibility"; +_assertSame(ctx.textRendering, "optimizeLegibility", "ctx.textRendering", "\"optimizeLegibility\""); + +ctx.textRendering = "GeometricPrecision"; +_assertSame(ctx.textRendering, "geometricPrecision", "ctx.textRendering", "\"geometricPrecision\""); + +// Setting textRendering with non-existing font variant. +ctx.textRendering = "abcd"; +_assertSame(ctx.textRendering, "geometricPrecision", "ctx.textRendering", "\"geometricPrecision\""); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.change.font.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.change.font.html new file mode 100644 index 0000000000..f8b72fbfab --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.change.font.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.text.drawing.style.wordSpacing.change.font</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.drawing.style.wordSpacing.change.font</h1> +<p class="desc">Set word spacing and word spacing to font dependent value and verify it works after font change.</p> + + +<script> +var t = async_test("Set word spacing and word spacing to font dependent value and verify it works after font change."); +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.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); +_assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); +// Get the width for 'Hello World, again' at default size, 10px. +var width_normal = ctx.measureText('Hello World, again').width; + +ctx.wordSpacing = '1em'; +_assertSame(ctx.wordSpacing, '1em', "ctx.wordSpacing", "'1em'"); +// 1em = 10px. Add 10px after each word in "Hello World, again", +// makes it 20px longer. +var width_with_spacing = ctx.measureText('Hello World, again').width; +_assertSame(width_with_spacing, width_normal + 20, "width_with_spacing", "width_normal + 20"); + +// Changing font to 20px. Without resetting the spacing, 1em wordSpacing +// is now 20px, so it's suppose to be 40px longer without any wordSpacing set. +ctx.font = '20px serif'; +width_with_spacing = ctx.measureText('Hello World, again').width; +// Now calculate the reference spacing for "Hello World, again" with no spacing. +ctx.wordSpacing = '0em'; +width_normal = ctx.measureText('Hello World, again').width; +_assertSame(width_with_spacing, width_normal + 40, "width_with_spacing", "width_normal + 40"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.change.font.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.change.font.worker.js new file mode 100644 index 0000000000..993cd28501 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.change.font.worker.js @@ -0,0 +1,42 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.drawing.style.wordSpacing.change.font +// Description:Set word spacing and word spacing to font dependent value and verify it works after font change. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Set word spacing and word spacing to font dependent value and verify it works after font change."); +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.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); +_assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); +// Get the width for 'Hello World, again' at default size, 10px. +var width_normal = ctx.measureText('Hello World, again').width; + +ctx.wordSpacing = '1em'; +_assertSame(ctx.wordSpacing, '1em', "ctx.wordSpacing", "'1em'"); +// 1em = 10px. Add 10px after each word in "Hello World, again", +// makes it 20px longer. +var width_with_spacing = ctx.measureText('Hello World, again').width; +_assertSame(width_with_spacing, width_normal + 20, "width_with_spacing", "width_normal + 20"); + +// Changing font to 20px. Without resetting the spacing, 1em wordSpacing +// is now 20px, so it's suppose to be 40px longer without any wordSpacing set. +ctx.font = '20px serif'; +width_with_spacing = ctx.measureText('Hello World, again').width; +// Now calculate the reference spacing for "Hello World, again" with no spacing. +ctx.wordSpacing = '0em'; +width_normal = ctx.measureText('Hello World, again').width; +_assertSame(width_with_spacing, width_normal + 40, "width_with_spacing", "width_normal + 40"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.measure.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.measure.html new file mode 100644 index 0000000000..9ef479bba2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.measure.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.drawing.style.wordSpacing.measure</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.drawing.style.wordSpacing.measure</h1> +<p class="desc">Testing if word spacing is working properly</p> + + +<script> +var t = async_test("Testing if word spacing is working properly"); +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.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); +_assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); +var width_normal = ctx.measureText('Hello World, again').width; + +function test_word_spacing(value, difference_spacing, epsilon) { + ctx.wordSpacing = value; + _assertSame(ctx.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); + _assertSame(ctx.wordSpacing, value, "ctx.wordSpacing", "value"); + width_with_word_spacing = ctx.measureText('Hello World, again').width; + assert_approx_equals(width_with_word_spacing, width_normal + difference_spacing, epsilon, "word spacing doesn't work."); +} + +// The first value is the word Spacing to be set, the second value the +// change in length of string 'Hello World', note that there are 2 words +// in 'Hello World, again', so the length difference is always wordSpacing * 2. +// and the third value is the acceptable differencee for the length change, +// note that unit such as 1cm/1mm doesn't map to an exact pixel value. +test_cases = [['3px', 6, 0], + ['5px', 10, 0], + ['-2px', -4, 0], + ['1em', 20, 0], + ['1in', 192, 0], + ['-0.1cm', -7.57, 0.2], + ['-0.6mm', -4.54, 0.2]] + +for (const test_case of test_cases) { + test_word_spacing(test_case[0], test_case[1], test_case[2]); +} +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.measure.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.measure.worker.js new file mode 100644 index 0000000000..3e850fcf3d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.measure.worker.js @@ -0,0 +1,50 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.drawing.style.wordSpacing.measure +// Description:Testing if word spacing is working properly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Testing if word spacing is working properly"); +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.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); +_assertSame(ctx.wordSpacing, '0px', "ctx.wordSpacing", "'0px'"); +var width_normal = ctx.measureText('Hello World, again').width; + +function test_word_spacing(value, difference_spacing, epsilon) { + ctx.wordSpacing = value; + _assertSame(ctx.letterSpacing, '0px', "ctx.letterSpacing", "'0px'"); + _assertSame(ctx.wordSpacing, value, "ctx.wordSpacing", "value"); + width_with_word_spacing = ctx.measureText('Hello World, again').width; + assert_approx_equals(width_with_word_spacing, width_normal + difference_spacing, epsilon, "word spacing doesn't work."); +} + +// The first value is the word Spacing to be set, the second value the +// change in length of string 'Hello World', note that there are 2 words +// in 'Hello World, again', so the length difference is always wordSpacing * 2. +// and the third value is the acceptable differencee for the length change, +// note that unit such as 1cm/1mm doesn't map to an exact pixel value. +test_cases = [['3px', 6, 0], + ['5px', 10, 0], + ['-2px', -4, 0], + ['1em', 20, 0], + ['1in', 192, 0], + ['-0.1cm', -7.57, 0.2], + ['-0.6mm', -4.54, 0.2]] + +for (const test_case of test_cases) { + test_word_spacing(test_case[0], test_case[1], test_case[2]); +} +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.default.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.default.html new file mode 100644 index 0000000000..191c1a5c31 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.default.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.font.default</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.font.default</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.font, '10px sans-serif', "ctx.font", "'10px sans-serif'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.default.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.default.worker.js new file mode 100644 index 0000000000..dc620ed439 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.default.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.font.default +// 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.font, '10px sans-serif', "ctx.font", "'10px sans-serif'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.basic.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.basic.html new file mode 100644 index 0000000000..aee555656a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.basic.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.font.parse.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.text.font.parse.basic</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.font = '20px serif'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20PX SERIF'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.basic.worker.js new file mode 100644 index 0000000000..0d8a4aad32 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.basic.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.font.parse.basic +// 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.font = '20px serif'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20PX SERIF'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.complex.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.complex.html new file mode 100644 index 0000000000..361b44de1c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.complex.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.font.parse.complex</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.font.parse.complex</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.font = 'small-caps italic 400 12px/2 Unknown Font, sans-serif'; +_assertSame(ctx.font, 'italic small-caps 12px "Unknown Font", sans-serif', "ctx.font", "'italic small-caps 12px \"Unknown Font\", sans-serif'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.complex.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.complex.worker.js new file mode 100644 index 0000000000..3c05b6fb81 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.complex.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.font.parse.complex +// 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.font = 'small-caps italic 400 12px/2 Unknown Font, sans-serif'; +_assertSame(ctx.font, 'italic small-caps 12px "Unknown Font", sans-serif', "ctx.font", "'italic small-caps 12px \"Unknown Font\", sans-serif'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.family.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.family.html new file mode 100644 index 0000000000..70127ba67c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.family.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.font.parse.family</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.font.parse.family</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.font = '20px cursive,fantasy,monospace,sans-serif,serif,UnquotedFont,"QuotedFont\\\\\\","'; +_assertSame(ctx.font, '20px cursive, fantasy, monospace, sans-serif, serif, UnquotedFont, "QuotedFont\\\\\\","', "ctx.font", "'20px cursive, fantasy, monospace, sans-serif, serif, UnquotedFont, \"QuotedFont\\\\\\\\\\\\\",\"'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.family.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.family.worker.js new file mode 100644 index 0000000000..7640de2be0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.family.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.font.parse.family +// 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.font = '20px cursive,fantasy,monospace,sans-serif,serif,UnquotedFont,"QuotedFont\\\\\\","'; +_assertSame(ctx.font, '20px cursive, fantasy, monospace, sans-serif, serif, UnquotedFont, "QuotedFont\\\\\\","', "ctx.font", "'20px cursive, fantasy, monospace, sans-serif, serif, UnquotedFont, \"QuotedFont\\\\\\\\\\\\\",\"'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.invalid.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.invalid.html new file mode 100644 index 0000000000..483476bcfa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.invalid.html @@ -0,0 +1,72 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.font.parse.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.text.font.parse.invalid</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.font = '20px serif'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = ''; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = 'bogus'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = 'inherit'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = '10px {bogus}'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = '10px initial'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = '10px default'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = '10px inherit'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = '10px revert'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = 'var(--x)'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = 'var(--x, 10px serif)'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = '1em serif; background: green; margin: 10px'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.invalid.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.invalid.worker.js new file mode 100644 index 0000000000..a4e19a6887 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.invalid.worker.js @@ -0,0 +1,68 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.font.parse.invalid +// 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.font = '20px serif'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = ''; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = 'bogus'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = 'inherit'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = '10px {bogus}'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = '10px initial'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = '10px default'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = '10px inherit'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = '10px revert'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = 'var(--x)'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = 'var(--x, 10px serif)'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); + +ctx.font = '20px serif'; +ctx.font = '1em serif; background: green; margin: 10px'; +_assertSame(ctx.font, '20px serif', "ctx.font", "'20px serif'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.system.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.system.html new file mode 100644 index 0000000000..24cb730c22 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.system.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.font.parse.system</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.font.parse.system</h1> +<p class="desc">System fonts must be computed to explicit values</p> + + +<script> +var t = async_test("System fonts must be computed to explicit values"); +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.font = 'message-box'; +_assertDifferent(ctx.font, 'message-box', "ctx.font", "'message-box'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.system.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.system.worker.js new file mode 100644 index 0000000000..5c2a8b481a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.system.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.font.parse.system +// Description:System fonts must be computed to explicit values +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("System fonts must be computed to explicit values"); +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.font = 'message-box'; +_assertDifferent(ctx.font, 'message-box', "ctx.font", "'message-box'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.tiny.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.tiny.html new file mode 100644 index 0000000000..6c17ad47b6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.tiny.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.font.parse.tiny</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.font.parse.tiny</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.font = '1px sans-serif'; +_assertSame(ctx.font, '1px sans-serif', "ctx.font", "'1px sans-serif'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.tiny.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.tiny.worker.js new file mode 100644 index 0000000000..2171e2cdcc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.parse.tiny.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.font.parse.tiny +// 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.font = '1px sans-serif'; +_assertSame(ctx.font, '1px sans-serif', "ctx.font", "'1px sans-serif'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.relative_size.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.relative_size.html new file mode 100644 index 0000000000..eef3be79c7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.relative_size.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.font.relative_size</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.font.relative_size</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.font = '1em sans-serif'; +_assertSame(ctx.font, '10px sans-serif', "ctx.font", "'10px sans-serif'"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.relative_size.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.relative_size.worker.js new file mode 100644 index 0000000000..c4d78b8bcc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.font.relative_size.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.font.relative_size +// 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.font = '1em sans-serif'; +_assertSame(ctx.font, '10px sans-serif', "ctx.font", "'10px sans-serif'"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.html new file mode 100644 index 0000000000..b7ce281b41 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.html @@ -0,0 +1,55 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.measure.actualBoundingBox</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.measure.actualBoundingBox</h1> +<p class="desc">Testing actualBoundingBox for OffscreenCanvas</p> + + +<script> +var t = async_test("Testing actualBoundingBox for OffscreenCanvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.direction = 'ltr'; + ctx.align = 'left' + ctx.baseline = 'alphabetic' + // Some platforms may return '-0'. + _assertSame(Math.abs(ctx.measureText('A').actualBoundingBoxLeft), 0, "Math.abs(ctx.measureText('A').actualBoundingBoxLeft)", "0"); + // Different platforms may render text slightly different. + _assert(ctx.measureText('A').actualBoundingBoxRight >= 50, "ctx.measureText('A').actualBoundingBoxRight >= 50"); + _assert(ctx.measureText('A').actualBoundingBoxAscent >= 35, "ctx.measureText('A').actualBoundingBoxAscent >= 35"); + _assertSame(Math.abs(ctx.measureText('A').actualBoundingBoxDescent), 0, "Math.abs(ctx.measureText('A').actualBoundingBoxDescent)", "0"); + + _assert(ctx.measureText('D').actualBoundingBoxLeft >= 48, "ctx.measureText('D').actualBoundingBoxLeft >= 48"); + _assert(ctx.measureText('D').actualBoundingBoxLeft <= 52, "ctx.measureText('D').actualBoundingBoxLeft <= 52"); + _assert(ctx.measureText('D').actualBoundingBoxRight >= 75, "ctx.measureText('D').actualBoundingBoxRight >= 75"); + _assert(ctx.measureText('D').actualBoundingBoxRight <= 80, "ctx.measureText('D').actualBoundingBoxRight <= 80"); + _assert(ctx.measureText('D').actualBoundingBoxAscent >= 35, "ctx.measureText('D').actualBoundingBoxAscent >= 35"); + _assert(ctx.measureText('D').actualBoundingBoxAscent <= 40, "ctx.measureText('D').actualBoundingBoxAscent <= 40"); + _assert(ctx.measureText('D').actualBoundingBoxDescent >= 12, "ctx.measureText('D').actualBoundingBoxDescent >= 12"); + _assert(ctx.measureText('D').actualBoundingBoxDescent <= 15, "ctx.measureText('D').actualBoundingBoxDescent <= 15"); + + _assertSame(Math.abs(ctx.measureText('ABCD').actualBoundingBoxLeft), 0, "Math.abs(ctx.measureText('ABCD').actualBoundingBoxLeft)", "0"); + _assert(ctx.measureText('ABCD').actualBoundingBoxRight >= 200, "ctx.measureText('ABCD').actualBoundingBoxRight >= 200"); + _assert(ctx.measureText('ABCD').actualBoundingBoxAscent >= 85, "ctx.measureText('ABCD').actualBoundingBoxAscent >= 85"); + _assert(ctx.measureText('ABCD').actualBoundingBoxDescent >= 37, "ctx.measureText('ABCD').actualBoundingBoxDescent >= 37"); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.worker.js new file mode 100644 index 0000000000..4693bb6984 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.worker.js @@ -0,0 +1,51 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.measure.actualBoundingBox +// Description:Testing actualBoundingBox for OffscreenCanvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Testing actualBoundingBox for OffscreenCanvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.direction = 'ltr'; + ctx.align = 'left' + ctx.baseline = 'alphabetic' + // Some platforms may return '-0'. + _assertSame(Math.abs(ctx.measureText('A').actualBoundingBoxLeft), 0, "Math.abs(ctx.measureText('A').actualBoundingBoxLeft)", "0"); + // Different platforms may render text slightly different. + _assert(ctx.measureText('A').actualBoundingBoxRight >= 50, "ctx.measureText('A').actualBoundingBoxRight >= 50"); + _assert(ctx.measureText('A').actualBoundingBoxAscent >= 35, "ctx.measureText('A').actualBoundingBoxAscent >= 35"); + _assertSame(Math.abs(ctx.measureText('A').actualBoundingBoxDescent), 0, "Math.abs(ctx.measureText('A').actualBoundingBoxDescent)", "0"); + + _assert(ctx.measureText('D').actualBoundingBoxLeft >= 48, "ctx.measureText('D').actualBoundingBoxLeft >= 48"); + _assert(ctx.measureText('D').actualBoundingBoxLeft <= 52, "ctx.measureText('D').actualBoundingBoxLeft <= 52"); + _assert(ctx.measureText('D').actualBoundingBoxRight >= 75, "ctx.measureText('D').actualBoundingBoxRight >= 75"); + _assert(ctx.measureText('D').actualBoundingBoxRight <= 80, "ctx.measureText('D').actualBoundingBoxRight <= 80"); + _assert(ctx.measureText('D').actualBoundingBoxAscent >= 35, "ctx.measureText('D').actualBoundingBoxAscent >= 35"); + _assert(ctx.measureText('D').actualBoundingBoxAscent <= 40, "ctx.measureText('D').actualBoundingBoxAscent <= 40"); + _assert(ctx.measureText('D').actualBoundingBoxDescent >= 12, "ctx.measureText('D').actualBoundingBoxDescent >= 12"); + _assert(ctx.measureText('D').actualBoundingBoxDescent <= 15, "ctx.measureText('D').actualBoundingBoxDescent <= 15"); + + _assertSame(Math.abs(ctx.measureText('ABCD').actualBoundingBoxLeft), 0, "Math.abs(ctx.measureText('ABCD').actualBoundingBoxLeft)", "0"); + _assert(ctx.measureText('ABCD').actualBoundingBoxRight >= 200, "ctx.measureText('ABCD').actualBoundingBoxRight >= 200"); + _assert(ctx.measureText('ABCD').actualBoundingBoxAscent >= 85, "ctx.measureText('ABCD').actualBoundingBoxAscent >= 85"); + _assert(ctx.measureText('ABCD').actualBoundingBoxDescent >= 37, "ctx.measureText('ABCD').actualBoundingBoxDescent >= 37"); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.advances.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.advances.html new file mode 100644 index 0000000000..ed3affcda5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.advances.html @@ -0,0 +1,48 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.measure.advances</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.measure.advances</h1> +<p class="desc">Testing width advances for OffscreenCanvas</p> + + +<script> +var t = async_test("Testing width advances for OffscreenCanvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.direction = 'ltr'; + ctx.align = 'left' + // Some platforms may return '-0'. + _assertSame(Math.abs(ctx.measureText('Hello').advances[0]), 0, "Math.abs(ctx.measureText('Hello').advances[\""+(0)+"\"])", "0"); + // Different platforms may render text slightly different. + _assert(ctx.measureText('Hello').advances[1] >= 36, "ctx.measureText('Hello').advances[\""+(1)+"\"] >= 36"); + _assert(ctx.measureText('Hello').advances[2] >= 58, "ctx.measureText('Hello').advances[\""+(2)+"\"] >= 58"); + _assert(ctx.measureText('Hello').advances[3] >= 70, "ctx.measureText('Hello').advances[\""+(3)+"\"] >= 70"); + _assert(ctx.measureText('Hello').advances[4] >= 80, "ctx.measureText('Hello').advances[\""+(4)+"\"] >= 80"); + + var tm = ctx.measureText('Hello'); + _assertSame(ctx.measureText('Hello').advances[0], tm.advances[0], "ctx.measureText('Hello').advances[\""+(0)+"\"]", "tm.advances[\""+(0)+"\"]"); + _assertSame(ctx.measureText('Hello').advances[1], tm.advances[1], "ctx.measureText('Hello').advances[\""+(1)+"\"]", "tm.advances[\""+(1)+"\"]"); + _assertSame(ctx.measureText('Hello').advances[2], tm.advances[2], "ctx.measureText('Hello').advances[\""+(2)+"\"]", "tm.advances[\""+(2)+"\"]"); + _assertSame(ctx.measureText('Hello').advances[3], tm.advances[3], "ctx.measureText('Hello').advances[\""+(3)+"\"]", "tm.advances[\""+(3)+"\"]"); + _assertSame(ctx.measureText('Hello').advances[4], tm.advances[4], "ctx.measureText('Hello').advances[\""+(4)+"\"]", "tm.advances[\""+(4)+"\"]"); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.advances.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.advances.worker.js new file mode 100644 index 0000000000..f1d4bb98f9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.advances.worker.js @@ -0,0 +1,44 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.measure.advances +// Description:Testing width advances for OffscreenCanvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Testing width advances for OffscreenCanvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.direction = 'ltr'; + ctx.align = 'left' + // Some platforms may return '-0'. + _assertSame(Math.abs(ctx.measureText('Hello').advances[0]), 0, "Math.abs(ctx.measureText('Hello').advances[\""+(0)+"\"])", "0"); + // Different platforms may render text slightly different. + _assert(ctx.measureText('Hello').advances[1] >= 36, "ctx.measureText('Hello').advances[\""+(1)+"\"] >= 36"); + _assert(ctx.measureText('Hello').advances[2] >= 58, "ctx.measureText('Hello').advances[\""+(2)+"\"] >= 58"); + _assert(ctx.measureText('Hello').advances[3] >= 70, "ctx.measureText('Hello').advances[\""+(3)+"\"] >= 70"); + _assert(ctx.measureText('Hello').advances[4] >= 80, "ctx.measureText('Hello').advances[\""+(4)+"\"] >= 80"); + + var tm = ctx.measureText('Hello'); + _assertSame(ctx.measureText('Hello').advances[0], tm.advances[0], "ctx.measureText('Hello').advances[\""+(0)+"\"]", "tm.advances[\""+(0)+"\"]"); + _assertSame(ctx.measureText('Hello').advances[1], tm.advances[1], "ctx.measureText('Hello').advances[\""+(1)+"\"]", "tm.advances[\""+(1)+"\"]"); + _assertSame(ctx.measureText('Hello').advances[2], tm.advances[2], "ctx.measureText('Hello').advances[\""+(2)+"\"]", "tm.advances[\""+(2)+"\"]"); + _assertSame(ctx.measureText('Hello').advances[3], tm.advances[3], "ctx.measureText('Hello').advances[\""+(3)+"\"]", "tm.advances[\""+(3)+"\"]"); + _assertSame(ctx.measureText('Hello').advances[4], tm.advances[4], "ctx.measureText('Hello').advances[\""+(4)+"\"]", "tm.advances[\""+(4)+"\"]"); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.baselines.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.baselines.html new file mode 100644 index 0000000000..993fbb0822 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.baselines.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.text.measure.baselines</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.measure.baselines</h1> +<p class="desc">Testing baselines for OffscreenCanvas</p> + + +<script> +var t = async_test("Testing baselines for OffscreenCanvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.direction = 'ltr'; + ctx.align = 'left' + _assertSame(Math.abs(ctx.measureText('A').getBaselines().alphabetic), 0, "Math.abs(ctx.measureText('A').getBaselines().alphabetic)", "0"); + _assertSame(ctx.measureText('A').getBaselines().ideographic, -39, "ctx.measureText('A').getBaselines().ideographic", "-39"); + _assertSame(ctx.measureText('A').getBaselines().hanging, 68, "ctx.measureText('A').getBaselines().hanging", "68"); + + _assertSame(Math.abs(ctx.measureText('ABCD').getBaselines().alphabetic), 0, "Math.abs(ctx.measureText('ABCD').getBaselines().alphabetic)", "0"); + _assertSame(ctx.measureText('ABCD').getBaselines().ideographic, -39, "ctx.measureText('ABCD').getBaselines().ideographic", "-39"); + _assertSame(ctx.measureText('ABCD').getBaselines().hanging, 68, "ctx.measureText('ABCD').getBaselines().hanging", "68"); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker.js new file mode 100644 index 0000000000..0c060169d3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.baselines.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.text.measure.baselines +// Description:Testing baselines for OffscreenCanvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Testing baselines for OffscreenCanvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.direction = 'ltr'; + ctx.align = 'left' + _assertSame(Math.abs(ctx.measureText('A').getBaselines().alphabetic), 0, "Math.abs(ctx.measureText('A').getBaselines().alphabetic)", "0"); + _assertSame(ctx.measureText('A').getBaselines().ideographic, -39, "ctx.measureText('A').getBaselines().ideographic", "-39"); + _assertSame(ctx.measureText('A').getBaselines().hanging, 68, "ctx.measureText('A').getBaselines().hanging", "68"); + + _assertSame(Math.abs(ctx.measureText('ABCD').getBaselines().alphabetic), 0, "Math.abs(ctx.measureText('ABCD').getBaselines().alphabetic)", "0"); + _assertSame(ctx.measureText('ABCD').getBaselines().ideographic, -39, "ctx.measureText('ABCD').getBaselines().ideographic", "-39"); + _assertSame(ctx.measureText('ABCD').getBaselines().hanging, 68, "ctx.measureText('ABCD').getBaselines().hanging", "68"); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.emHeights.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.emHeights.html new file mode 100644 index 0000000000..cc91f4017c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.emHeights.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.text.measure.emHeights</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.measure.emHeights</h1> +<p class="desc">Testing emHeights for OffscreenCanvas</p> + + +<script> +var t = async_test("Testing emHeights for OffscreenCanvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.direction = 'ltr'; + ctx.align = 'left' + _assertSame(ctx.measureText('A').emHeightAscent, 37.5, "ctx.measureText('A').emHeightAscent", "37.5"); + _assertSame(ctx.measureText('A').emHeightDescent, 12.5, "ctx.measureText('A').emHeightDescent", "12.5"); + _assertSame(ctx.measureText('A').emHeightDescent + ctx.measureText('A').emHeightAscent, 50, "ctx.measureText('A').emHeightDescent + ctx.measureText('A').emHeightAscent", "50"); + + _assertSame(ctx.measureText('ABCD').emHeightAscent, 37.5, "ctx.measureText('ABCD').emHeightAscent", "37.5"); + _assertSame(ctx.measureText('ABCD').emHeightDescent, 12.5, "ctx.measureText('ABCD').emHeightDescent", "12.5"); + _assertSame(ctx.measureText('ABCD').emHeightDescent + ctx.measureText('ABCD').emHeightAscent, 50, "ctx.measureText('ABCD').emHeightDescent + ctx.measureText('ABCD').emHeightAscent", "50"); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.emHeights.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.emHeights.worker.js new file mode 100644 index 0000000000..88432343d1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.emHeights.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.text.measure.emHeights +// Description:Testing emHeights for OffscreenCanvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Testing emHeights for OffscreenCanvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.direction = 'ltr'; + ctx.align = 'left' + _assertSame(ctx.measureText('A').emHeightAscent, 37.5, "ctx.measureText('A').emHeightAscent", "37.5"); + _assertSame(ctx.measureText('A').emHeightDescent, 12.5, "ctx.measureText('A').emHeightDescent", "12.5"); + _assertSame(ctx.measureText('A').emHeightDescent + ctx.measureText('A').emHeightAscent, 50, "ctx.measureText('A').emHeightDescent + ctx.measureText('A').emHeightAscent", "50"); + + _assertSame(ctx.measureText('ABCD').emHeightAscent, 37.5, "ctx.measureText('ABCD').emHeightAscent", "37.5"); + _assertSame(ctx.measureText('ABCD').emHeightDescent, 12.5, "ctx.measureText('ABCD').emHeightDescent", "12.5"); + _assertSame(ctx.measureText('ABCD').emHeightDescent + ctx.measureText('ABCD').emHeightAscent, 50, "ctx.measureText('ABCD').emHeightDescent + ctx.measureText('ABCD').emHeightAscent", "50"); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.html new file mode 100644 index 0000000000..fca062b649 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.measure.fontBoundingBox</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.measure.fontBoundingBox</h1> +<p class="desc">Testing fontBoundingBox for OffscreenCanvas</p> + + +<script> +var t = async_test("Testing fontBoundingBox for OffscreenCanvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.direction = 'ltr'; + ctx.align = 'left' + _assertSame(ctx.measureText('A').fontBoundingBoxAscent, 85, "ctx.measureText('A').fontBoundingBoxAscent", "85"); + _assertSame(ctx.measureText('A').fontBoundingBoxDescent, 39, "ctx.measureText('A').fontBoundingBoxDescent", "39"); + + _assertSame(ctx.measureText('ABCD').fontBoundingBoxAscent, 85, "ctx.measureText('ABCD').fontBoundingBoxAscent", "85"); + _assertSame(ctx.measureText('ABCD').fontBoundingBoxDescent, 39, "ctx.measureText('ABCD').fontBoundingBoxDescent", "39"); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.worker.js new file mode 100644 index 0000000000..2f4b64d37a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.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.text.measure.fontBoundingBox +// Description:Testing fontBoundingBox for OffscreenCanvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Testing fontBoundingBox for OffscreenCanvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + ctx.direction = 'ltr'; + ctx.align = 'left' + _assertSame(ctx.measureText('A').fontBoundingBoxAscent, 85, "ctx.measureText('A').fontBoundingBoxAscent", "85"); + _assertSame(ctx.measureText('A').fontBoundingBoxDescent, 39, "ctx.measureText('A').fontBoundingBoxDescent", "39"); + + _assertSame(ctx.measureText('ABCD').fontBoundingBoxAscent, 85, "ctx.measureText('ABCD').fontBoundingBoxAscent", "85"); + _assertSame(ctx.measureText('ABCD').fontBoundingBoxDescent, 39, "ctx.measureText('ABCD').fontBoundingBoxDescent", "39"); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.basic.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.basic.html new file mode 100644 index 0000000000..074d62eec9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.basic.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.measure.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.text.measure.width.basic</h1> +<p class="desc">The width of character is same as font used for OffscreenCanvas</p> + + +<script> +var t = async_test("The width of character is same as font used for OffscreenCanvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + _assertSame(ctx.measureText('A').width, 50, "ctx.measureText('A').width", "50"); + _assertSame(ctx.measureText('AA').width, 100, "ctx.measureText('AA').width", "100"); + _assertSame(ctx.measureText('ABCD').width, 200, "ctx.measureText('ABCD').width", "200"); + + ctx.font = '100px CanvasTest'; + _assertSame(ctx.measureText('A').width, 100, "ctx.measureText('A').width", "100"); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.basic.worker.js new file mode 100644 index 0000000000..a1933c82c2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.basic.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.measure.width.basic +// Description:The width of character is same as font used for OffscreenCanvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("The width of character is same as font used for OffscreenCanvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + _assertSame(ctx.measureText('A').width, 50, "ctx.measureText('A').width", "50"); + _assertSame(ctx.measureText('AA').width, 100, "ctx.measureText('AA').width", "100"); + _assertSame(ctx.measureText('ABCD').width, 200, "ctx.measureText('ABCD').width", "200"); + + ctx.font = '100px CanvasTest'; + _assertSame(ctx.measureText('A').width, 100, "ctx.measureText('A').width", "100"); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.empty.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.empty.html new file mode 100644 index 0000000000..45792b41dd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.empty.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.measure.width.empty</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.measure.width.empty</h1> +<p class="desc">The empty string has zero width for OffscreenCanvas</p> + + +<script> +var t = async_test("The empty string has zero width for OffscreenCanvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + _assertSame(ctx.measureText("").width, 0, "ctx.measureText(\"\").width", "0"); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.empty.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.empty.worker.js new file mode 100644 index 0000000000..8d806c16cc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.empty.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.text.measure.width.empty +// Description:The empty string has zero width for OffscreenCanvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("The empty string has zero width for OffscreenCanvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + _assertSame(ctx.measureText("").width, 0, "ctx.measureText(\"\").width", "0"); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.space.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.space.html new file mode 100644 index 0000000000..971a41e293 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.space.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.measure.width.space</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.measure.width.space</h1> +<p class="desc">Space characters are converted to U+0020 and collapsed (per CSS) for OffscreenCanvas</p> + + +<script> +var t = async_test("Space characters are converted to U+0020 and collapsed (per CSS) for OffscreenCanvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + _assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150"); + _assertSame(ctx.measureText('A B').width, 200, "ctx.measureText('A B').width", "200"); + _assertSame(ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width, 150, "ctx.measureText('A \\x09\\x0a\\x0c\\x0d \\x09\\x0a\\x0c\\x0dB').width", "150"); + _assert(ctx.measureText('A \x0b B').width >= 200, "ctx.measureText('A \\x0b B').width >= 200"); + + _assertSame(ctx.measureText(' AB').width, 100, "ctx.measureText(' AB').width", "100"); + _assertSame(ctx.measureText('AB ').width, 100, "ctx.measureText('AB ').width", "100"); +}).then(t_pass, t_fail); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.space.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.space.worker.js new file mode 100644 index 0000000000..a52c1d8367 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.space.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.text.measure.width.space +// Description:Space characters are converted to U+0020 and collapsed (per CSS) for OffscreenCanvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Space characters are converted to U+0020 and collapsed (per CSS) for OffscreenCanvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var f = new FontFace("CanvasTest", "url('/fonts/CanvasTest.ttf')"); +let fonts = (self.fonts ? self.fonts : document.fonts); +f.load(); +fonts.add(f); +fonts.ready.then(function() { + ctx.font = '50px CanvasTest'; + _assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150"); + _assertSame(ctx.measureText('A B').width, 200, "ctx.measureText('A B').width", "200"); + _assertSame(ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width, 150, "ctx.measureText('A \\x09\\x0a\\x0c\\x0d \\x09\\x0a\\x0c\\x0dB').width", "150"); + _assert(ctx.measureText('A \x0b B').width >= 200, "ctx.measureText('A \\x0b B').width >= 200"); + + _assertSame(ctx.measureText(' AB').width, 100, "ctx.measureText(' AB').width", "100"); + _assertSame(ctx.measureText('AB ').width, 100, "ctx.measureText('AB ').width", "100"); +}).then(t_pass, t_fail); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.setFont.mathFont.html b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.setFont.mathFont.html new file mode 100644 index 0000000000..ed4752dfcb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.setFont.mathFont.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.text.setFont.mathFont</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.text.setFont.mathFont</h1> +<p class="desc">crbug.com/1212190, make sure offscreencanvas doesn't crash with Math Font</p> + + +<script> +var t = async_test("crbug.com/1212190, make sure offscreencanvas doesn't crash with Math Font"); +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.font = "math serif"; +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.setFont.mathFont.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.setFont.mathFont.worker.js new file mode 100644 index 0000000000..39e3031ecf --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.setFont.mathFont.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.text.setFont.mathFont +// Description:crbug.com/1212190, make sure offscreencanvas doesn't crash with Math Font +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("crbug.com/1212190, make sure offscreencanvas doesn't crash with Math Font"); +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.font = "math serif"; +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.bitmap.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.bitmap.html new file mode 100644 index 0000000000..3a6e67b77e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.bitmap.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.state.saverestore.bitmap</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.state.saverestore.bitmap</h1> +<p class="desc">save()/restore() does not affect the current bitmap</p> + + +<script> +var t = async_test("save()/restore() does not affect the current bitmap"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.save(); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.restore(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.bitmap.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.bitmap.worker.js new file mode 100644 index 0000000000..c602488d36 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.bitmap.worker.js @@ -0,0 +1,29 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.state.saverestore.bitmap +// Description:save()/restore() does not affect the current bitmap +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("save()/restore() does not affect the current bitmap"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.save(); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.restore(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.clip.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.clip.html new file mode 100644 index 0000000000..e96df9e2a4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.clip.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.state.saverestore.clip</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.state.saverestore.clip</h1> +<p class="desc">save()/restore() affects the clipping path</p> + + +<script> +var t = async_test("save()/restore() affects the clipping path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.save(); +ctx.rect(0, 0, 1, 1); +ctx.clip(); +ctx.restore(); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.clip.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.clip.worker.js new file mode 100644 index 0000000000..622d941677 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.clip.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.state.saverestore.clip +// Description:save()/restore() affects the clipping path +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("save()/restore() affects the clipping path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.save(); +ctx.rect(0, 0, 1, 1); +ctx.clip(); +ctx.restore(); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.fillStyle.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.fillStyle.html new file mode 100644 index 0000000000..91b23bd47a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.fillStyle.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.state.saverestore.fillStyle</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.state.saverestore.fillStyle</h1> +<p class="desc">save()/restore() works for fillStyle</p> + + +<script> +var t = async_test("save()/restore() works for fillStyle"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.fillStyle; +ctx.save(); +ctx.fillStyle = "#ff0000"; +ctx.restore(); +_assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old"); + +// Also test that save() doesn't modify the values +ctx.fillStyle = "#ff0000"; +old = ctx.fillStyle; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against "#ff0000" +ctx.save(); +_assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old"); +ctx.restore(); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.fillStyle.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.fillStyle.worker.js new file mode 100644 index 0000000000..fa4d77328a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.fillStyle.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.state.saverestore.fillStyle +// Description:save()/restore() works for fillStyle +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("save()/restore() works for fillStyle"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.fillStyle; +ctx.save(); +ctx.fillStyle = "#ff0000"; +ctx.restore(); +_assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old"); + +// Also test that save() doesn't modify the values +ctx.fillStyle = "#ff0000"; +old = ctx.fillStyle; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against "#ff0000" +ctx.save(); +_assertSame(ctx.fillStyle, old, "ctx.fillStyle", "old"); +ctx.restore(); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalAlpha.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalAlpha.html new file mode 100644 index 0000000000..01b9616bad --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalAlpha.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.state.saverestore.globalAlpha</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.state.saverestore.globalAlpha</h1> +<p class="desc">save()/restore() works for globalAlpha</p> + + +<script> +var t = async_test("save()/restore() works for globalAlpha"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.globalAlpha; +ctx.save(); +ctx.globalAlpha = 0.5; +ctx.restore(); +_assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old"); + +// Also test that save() doesn't modify the values +ctx.globalAlpha = 0.5; +old = ctx.globalAlpha; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against 0.5 +ctx.save(); +_assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old"); +ctx.restore(); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalAlpha.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalAlpha.worker.js new file mode 100644 index 0000000000..8b11054673 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalAlpha.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.state.saverestore.globalAlpha +// Description:save()/restore() works for globalAlpha +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("save()/restore() works for globalAlpha"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.globalAlpha; +ctx.save(); +ctx.globalAlpha = 0.5; +ctx.restore(); +_assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old"); + +// Also test that save() doesn't modify the values +ctx.globalAlpha = 0.5; +old = ctx.globalAlpha; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against 0.5 +ctx.save(); +_assertSame(ctx.globalAlpha, old, "ctx.globalAlpha", "old"); +ctx.restore(); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalCompositeOperation.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalCompositeOperation.html new file mode 100644 index 0000000000..557d3c074a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalCompositeOperation.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.state.saverestore.globalCompositeOperation</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.state.saverestore.globalCompositeOperation</h1> +<p class="desc">save()/restore() works for globalCompositeOperation</p> + + +<script> +var t = async_test("save()/restore() works for globalCompositeOperation"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.globalCompositeOperation; +ctx.save(); +ctx.globalCompositeOperation = "copy"; +ctx.restore(); +_assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old"); + +// Also test that save() doesn't modify the values +ctx.globalCompositeOperation = "copy"; +old = ctx.globalCompositeOperation; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against "copy" +ctx.save(); +_assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old"); +ctx.restore(); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalCompositeOperation.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalCompositeOperation.worker.js new file mode 100644 index 0000000000..3534147b92 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.globalCompositeOperation.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.state.saverestore.globalCompositeOperation +// Description:save()/restore() works for globalCompositeOperation +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("save()/restore() works for globalCompositeOperation"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.globalCompositeOperation; +ctx.save(); +ctx.globalCompositeOperation = "copy"; +ctx.restore(); +_assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old"); + +// Also test that save() doesn't modify the values +ctx.globalCompositeOperation = "copy"; +old = ctx.globalCompositeOperation; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against "copy" +ctx.save(); +_assertSame(ctx.globalCompositeOperation, old, "ctx.globalCompositeOperation", "old"); +ctx.restore(); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineCap.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineCap.html new file mode 100644 index 0000000000..e02cbd46dd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineCap.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.state.saverestore.lineCap</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.state.saverestore.lineCap</h1> +<p class="desc">save()/restore() works for lineCap</p> + + +<script> +var t = async_test("save()/restore() works for lineCap"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.lineCap; +ctx.save(); +ctx.lineCap = "round"; +ctx.restore(); +_assertSame(ctx.lineCap, old, "ctx.lineCap", "old"); + +// Also test that save() doesn't modify the values +ctx.lineCap = "round"; +old = ctx.lineCap; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against "round" +ctx.save(); +_assertSame(ctx.lineCap, old, "ctx.lineCap", "old"); +ctx.restore(); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineCap.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineCap.worker.js new file mode 100644 index 0000000000..70de46a604 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineCap.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.state.saverestore.lineCap +// Description:save()/restore() works for lineCap +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("save()/restore() works for lineCap"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.lineCap; +ctx.save(); +ctx.lineCap = "round"; +ctx.restore(); +_assertSame(ctx.lineCap, old, "ctx.lineCap", "old"); + +// Also test that save() doesn't modify the values +ctx.lineCap = "round"; +old = ctx.lineCap; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against "round" +ctx.save(); +_assertSame(ctx.lineCap, old, "ctx.lineCap", "old"); +ctx.restore(); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineJoin.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineJoin.html new file mode 100644 index 0000000000..92100e9d1f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineJoin.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.state.saverestore.lineJoin</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.state.saverestore.lineJoin</h1> +<p class="desc">save()/restore() works for lineJoin</p> + + +<script> +var t = async_test("save()/restore() works for lineJoin"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.lineJoin; +ctx.save(); +ctx.lineJoin = "round"; +ctx.restore(); +_assertSame(ctx.lineJoin, old, "ctx.lineJoin", "old"); + +// Also test that save() doesn't modify the values +ctx.lineJoin = "round"; +old = ctx.lineJoin; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against "round" +ctx.save(); +_assertSame(ctx.lineJoin, old, "ctx.lineJoin", "old"); +ctx.restore(); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineJoin.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineJoin.worker.js new file mode 100644 index 0000000000..1da6db86be --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineJoin.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.state.saverestore.lineJoin +// Description:save()/restore() works for lineJoin +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("save()/restore() works for lineJoin"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.lineJoin; +ctx.save(); +ctx.lineJoin = "round"; +ctx.restore(); +_assertSame(ctx.lineJoin, old, "ctx.lineJoin", "old"); + +// Also test that save() doesn't modify the values +ctx.lineJoin = "round"; +old = ctx.lineJoin; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against "round" +ctx.save(); +_assertSame(ctx.lineJoin, old, "ctx.lineJoin", "old"); +ctx.restore(); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineWidth.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineWidth.html new file mode 100644 index 0000000000..24f9550792 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineWidth.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.state.saverestore.lineWidth</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.state.saverestore.lineWidth</h1> +<p class="desc">save()/restore() works for lineWidth</p> + + +<script> +var t = async_test("save()/restore() works for lineWidth"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.lineWidth; +ctx.save(); +ctx.lineWidth = 0.5; +ctx.restore(); +_assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old"); + +// Also test that save() doesn't modify the values +ctx.lineWidth = 0.5; +old = ctx.lineWidth; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against 0.5 +ctx.save(); +_assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old"); +ctx.restore(); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineWidth.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineWidth.worker.js new file mode 100644 index 0000000000..657ded5b76 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.lineWidth.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.state.saverestore.lineWidth +// Description:save()/restore() works for lineWidth +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("save()/restore() works for lineWidth"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.lineWidth; +ctx.save(); +ctx.lineWidth = 0.5; +ctx.restore(); +_assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old"); + +// Also test that save() doesn't modify the values +ctx.lineWidth = 0.5; +old = ctx.lineWidth; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against 0.5 +ctx.save(); +_assertSame(ctx.lineWidth, old, "ctx.lineWidth", "old"); +ctx.restore(); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.miterLimit.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.miterLimit.html new file mode 100644 index 0000000000..b674467115 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.miterLimit.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.state.saverestore.miterLimit</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.state.saverestore.miterLimit</h1> +<p class="desc">save()/restore() works for miterLimit</p> + + +<script> +var t = async_test("save()/restore() works for miterLimit"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.miterLimit; +ctx.save(); +ctx.miterLimit = 0.5; +ctx.restore(); +_assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old"); + +// Also test that save() doesn't modify the values +ctx.miterLimit = 0.5; +old = ctx.miterLimit; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against 0.5 +ctx.save(); +_assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old"); +ctx.restore(); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.miterLimit.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.miterLimit.worker.js new file mode 100644 index 0000000000..745f2919a0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.miterLimit.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.state.saverestore.miterLimit +// Description:save()/restore() works for miterLimit +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("save()/restore() works for miterLimit"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.miterLimit; +ctx.save(); +ctx.miterLimit = 0.5; +ctx.restore(); +_assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old"); + +// Also test that save() doesn't modify the values +ctx.miterLimit = 0.5; +old = ctx.miterLimit; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against 0.5 +ctx.save(); +_assertSame(ctx.miterLimit, old, "ctx.miterLimit", "old"); +ctx.restore(); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.path.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.path.html new file mode 100644 index 0000000000..34c0b1e6d7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.path.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.state.saverestore.path</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.state.saverestore.path</h1> +<p class="desc">save()/restore() does not affect the current path</p> + + +<script> +var t = async_test("save()/restore() does not affect the current path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.save(); +ctx.rect(0, 0, 100, 50); +ctx.restore(); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.path.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.path.worker.js new file mode 100644 index 0000000000..24cec15972 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.path.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.state.saverestore.path +// Description:save()/restore() does not affect the current path +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("save()/restore() does not affect the current path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.save(); +ctx.rect(0, 0, 100, 50); +ctx.restore(); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowBlur.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowBlur.html new file mode 100644 index 0000000000..af2ee91307 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowBlur.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.state.saverestore.shadowBlur</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.state.saverestore.shadowBlur</h1> +<p class="desc">save()/restore() works for shadowBlur</p> + + +<script> +var t = async_test("save()/restore() works for shadowBlur"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.shadowBlur; +ctx.save(); +ctx.shadowBlur = 5; +ctx.restore(); +_assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); + +// Also test that save() doesn't modify the values +ctx.shadowBlur = 5; +old = ctx.shadowBlur; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against 5 +ctx.save(); +_assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); +ctx.restore(); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowBlur.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowBlur.worker.js new file mode 100644 index 0000000000..12acd3d294 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowBlur.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.state.saverestore.shadowBlur +// Description:save()/restore() works for shadowBlur +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("save()/restore() works for shadowBlur"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.shadowBlur; +ctx.save(); +ctx.shadowBlur = 5; +ctx.restore(); +_assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); + +// Also test that save() doesn't modify the values +ctx.shadowBlur = 5; +old = ctx.shadowBlur; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against 5 +ctx.save(); +_assertSame(ctx.shadowBlur, old, "ctx.shadowBlur", "old"); +ctx.restore(); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowColor.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowColor.html new file mode 100644 index 0000000000..5aa0194100 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowColor.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.state.saverestore.shadowColor</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.state.saverestore.shadowColor</h1> +<p class="desc">save()/restore() works for shadowColor</p> + + +<script> +var t = async_test("save()/restore() works for shadowColor"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.shadowColor; +ctx.save(); +ctx.shadowColor = "#ff0000"; +ctx.restore(); +_assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old"); + +// Also test that save() doesn't modify the values +ctx.shadowColor = "#ff0000"; +old = ctx.shadowColor; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against "#ff0000" +ctx.save(); +_assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old"); +ctx.restore(); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowColor.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowColor.worker.js new file mode 100644 index 0000000000..b2f9fb9265 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowColor.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.state.saverestore.shadowColor +// Description:save()/restore() works for shadowColor +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("save()/restore() works for shadowColor"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.shadowColor; +ctx.save(); +ctx.shadowColor = "#ff0000"; +ctx.restore(); +_assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old"); + +// Also test that save() doesn't modify the values +ctx.shadowColor = "#ff0000"; +old = ctx.shadowColor; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against "#ff0000" +ctx.save(); +_assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old"); +ctx.restore(); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetX.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetX.html new file mode 100644 index 0000000000..f281234801 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetX.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.state.saverestore.shadowOffsetX</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.state.saverestore.shadowOffsetX</h1> +<p class="desc">save()/restore() works for shadowOffsetX</p> + + +<script> +var t = async_test("save()/restore() works for shadowOffsetX"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.shadowOffsetX; +ctx.save(); +ctx.shadowOffsetX = 5; +ctx.restore(); +_assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old"); + +// Also test that save() doesn't modify the values +ctx.shadowOffsetX = 5; +old = ctx.shadowOffsetX; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against 5 +ctx.save(); +_assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old"); +ctx.restore(); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetX.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetX.worker.js new file mode 100644 index 0000000000..2711817755 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetX.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.state.saverestore.shadowOffsetX +// Description:save()/restore() works for shadowOffsetX +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("save()/restore() works for shadowOffsetX"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.shadowOffsetX; +ctx.save(); +ctx.shadowOffsetX = 5; +ctx.restore(); +_assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old"); + +// Also test that save() doesn't modify the values +ctx.shadowOffsetX = 5; +old = ctx.shadowOffsetX; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against 5 +ctx.save(); +_assertSame(ctx.shadowOffsetX, old, "ctx.shadowOffsetX", "old"); +ctx.restore(); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetY.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetY.html new file mode 100644 index 0000000000..643ce99a24 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetY.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.state.saverestore.shadowOffsetY</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.state.saverestore.shadowOffsetY</h1> +<p class="desc">save()/restore() works for shadowOffsetY</p> + + +<script> +var t = async_test("save()/restore() works for shadowOffsetY"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.shadowOffsetY; +ctx.save(); +ctx.shadowOffsetY = 5; +ctx.restore(); +_assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old"); + +// Also test that save() doesn't modify the values +ctx.shadowOffsetY = 5; +old = ctx.shadowOffsetY; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against 5 +ctx.save(); +_assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old"); +ctx.restore(); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetY.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetY.worker.js new file mode 100644 index 0000000000..aaa572a4d1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.shadowOffsetY.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.state.saverestore.shadowOffsetY +// Description:save()/restore() works for shadowOffsetY +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("save()/restore() works for shadowOffsetY"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.shadowOffsetY; +ctx.save(); +ctx.shadowOffsetY = 5; +ctx.restore(); +_assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old"); + +// Also test that save() doesn't modify the values +ctx.shadowOffsetY = 5; +old = ctx.shadowOffsetY; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against 5 +ctx.save(); +_assertSame(ctx.shadowOffsetY, old, "ctx.shadowOffsetY", "old"); +ctx.restore(); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stack.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stack.html new file mode 100644 index 0000000000..979176804b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stack.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.state.saverestore.stack</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.state.saverestore.stack</h1> +<p class="desc">save()/restore() can be nested as a stack</p> + + +<script> +var t = async_test("save()/restore() can be nested as a stack"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.lineWidth = 1; +ctx.save(); +ctx.lineWidth = 2; +ctx.save(); +ctx.lineWidth = 3; +_assertSame(ctx.lineWidth, 3, "ctx.lineWidth", "3"); +ctx.restore(); +_assertSame(ctx.lineWidth, 2, "ctx.lineWidth", "2"); +ctx.restore(); +_assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stack.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stack.worker.js new file mode 100644 index 0000000000..e1f078e90d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stack.worker.js @@ -0,0 +1,32 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.state.saverestore.stack +// Description:save()/restore() can be nested as a stack +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("save()/restore() can be nested as a stack"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.lineWidth = 1; +ctx.save(); +ctx.lineWidth = 2; +ctx.save(); +ctx.lineWidth = 3; +_assertSame(ctx.lineWidth, 3, "ctx.lineWidth", "3"); +ctx.restore(); +_assertSame(ctx.lineWidth, 2, "ctx.lineWidth", "2"); +ctx.restore(); +_assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stackdepth.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stackdepth.html new file mode 100644 index 0000000000..53dbc63c2b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stackdepth.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.state.saverestore.stackdepth</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.state.saverestore.stackdepth</h1> +<p class="desc">save()/restore() stack depth is not unreasonably limited</p> + + +<script> +var t = async_test("save()/restore() stack depth is not unreasonably limited"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var limit = 512; +for (var i = 1; i < limit; ++i) +{ + ctx.save(); + ctx.lineWidth = i; +} +for (var i = limit-1; i > 0; --i) +{ + _assertSame(ctx.lineWidth, i, "ctx.lineWidth", "i"); + ctx.restore(); +} +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stackdepth.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stackdepth.worker.js new file mode 100644 index 0000000000..a485c19471 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.stackdepth.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.state.saverestore.stackdepth +// Description:save()/restore() stack depth is not unreasonably limited +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("save()/restore() stack depth is not unreasonably limited"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var limit = 512; +for (var i = 1; i < limit; ++i) +{ + ctx.save(); + ctx.lineWidth = i; +} +for (var i = limit-1; i > 0; --i) +{ + _assertSame(ctx.lineWidth, i, "ctx.lineWidth", "i"); + ctx.restore(); +} +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.strokeStyle.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.strokeStyle.html new file mode 100644 index 0000000000..60963729f4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.strokeStyle.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.state.saverestore.strokeStyle</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.state.saverestore.strokeStyle</h1> +<p class="desc">save()/restore() works for strokeStyle</p> + + +<script> +var t = async_test("save()/restore() works for strokeStyle"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.strokeStyle; +ctx.save(); +ctx.strokeStyle = "#ff0000"; +ctx.restore(); +_assertSame(ctx.strokeStyle, old, "ctx.strokeStyle", "old"); + +// Also test that save() doesn't modify the values +ctx.strokeStyle = "#ff0000"; +old = ctx.strokeStyle; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against "#ff0000" +ctx.save(); +_assertSame(ctx.strokeStyle, old, "ctx.strokeStyle", "old"); +ctx.restore(); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.strokeStyle.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.strokeStyle.worker.js new file mode 100644 index 0000000000..275ba9e072 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.strokeStyle.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.state.saverestore.strokeStyle +// Description:save()/restore() works for strokeStyle +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("save()/restore() works for strokeStyle"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +// Test that restore() undoes any modifications +var old = ctx.strokeStyle; +ctx.save(); +ctx.strokeStyle = "#ff0000"; +ctx.restore(); +_assertSame(ctx.strokeStyle, old, "ctx.strokeStyle", "old"); + +// Also test that save() doesn't modify the values +ctx.strokeStyle = "#ff0000"; +old = ctx.strokeStyle; + // we're not interested in failures caused by get(set(x)) != x (e.g. + // from rounding), so compare against 'old' instead of against "#ff0000" +ctx.save(); +_assertSame(ctx.strokeStyle, old, "ctx.strokeStyle", "old"); +ctx.restore(); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.transformation.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.transformation.html new file mode 100644 index 0000000000..fff2ead703 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.transformation.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.state.saverestore.transformation</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.state.saverestore.transformation</h1> +<p class="desc">save()/restore() affects the current transformation matrix</p> + + +<script> +var t = async_test("save()/restore() affects the current transformation matrix"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.save(); +ctx.translate(200, 0); +ctx.restore(); +ctx.fillStyle = '#f00'; +ctx.fillRect(-200, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.transformation.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.transformation.worker.js new file mode 100644 index 0000000000..64fb4c4734 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.transformation.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.state.saverestore.transformation +// Description:save()/restore() affects the current transformation matrix +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("save()/restore() affects the current transformation matrix"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.save(); +ctx.translate(200, 0); +ctx.restore(); +ctx.fillStyle = '#f00'; +ctx.fillRect(-200, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.underflow.html b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.underflow.html new file mode 100644 index 0000000000..986d966885 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.underflow.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.state.saverestore.underflow</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.state.saverestore.underflow</h1> +<p class="desc">restore() with an empty stack has no effect</p> + + +<script> +var t = async_test("restore() with an empty stack has no effect"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +for (var i = 0; i < 16; ++i) + ctx.restore(); +ctx.lineWidth = 0.5; +ctx.restore(); +_assertSame(ctx.lineWidth, 0.5, "ctx.lineWidth", "0.5"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.underflow.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.underflow.worker.js new file mode 100644 index 0000000000..d38cf97417 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-canvas-state/2d.state.saverestore.underflow.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.state.saverestore.underflow +// Description:restore() with an empty stack has no effect +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("restore() with an empty stack has no effect"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +for (var i = 0; i < 16; ++i) + ctx.restore(); +ctx.lineWidth = 0.5; +ctx.restore(); +_assertSame(ctx.lineWidth, 0.5, "ctx.lineWidth", "0.5"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.js new file mode 100644 index 0000000000..8c4e7cfe96 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.js @@ -0,0 +1,41 @@ +test(() => { + const expected = [ + "alpha", + "colorSpace", + "colorSpace toString", + "desynchronized", + "willReadFrequently", + ]; + var actual = []; + const options = { + get alpha() { + actual.push("alpha"); + return true; + }, + get willReadFrequently() { + actual.push("willReadFrequently"); + return false; + }, + get desynchronized() { + actual.push("desynchronized"); + return false; + }, + get colorSpace() { + actual.push("colorSpace"); + return { + toString() { + actual.push("colorSpace toString"); + return "srgb"; + } + }; + }, + }; + + const canvas = new OffscreenCanvas(100, 50); + const context = canvas.getContext('2d', options); + assert_not_equals(context, null, "context"); + assert_array_equals(actual, expected, "order of operations (creation)"); + actual = []; + assert_equals(canvas.getContext('2d', options), context, "cached context"); + assert_array_equals(actual, expected, "order of operations (caching)"); +}); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.readonly.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.readonly.html new file mode 100644 index 0000000000..ec6ffe5292 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.readonly.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.canvas.readonly</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.canvas.readonly</h1> +<p class="desc">canvas is readonly</p> + + +<script> +var t = async_test("canvas is readonly"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var d = ctx.canvas; +_assertDifferent(offscreenCanvas2, d, "offscreenCanvas2", "d"); +ctx.canvas = offscreenCanvas2; +_assertSame(ctx.canvas, d, "ctx.canvas", "d"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.readonly.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.readonly.worker.js new file mode 100644 index 0000000000..8f88efd6dc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.readonly.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.canvas.readonly +// Description:canvas is readonly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("canvas is readonly"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var d = ctx.canvas; +_assertDifferent(offscreenCanvas2, d, "offscreenCanvas2", "d"); +ctx.canvas = offscreenCanvas2; +_assertSame(ctx.canvas, d, "ctx.canvas", "d"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.reference.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.reference.html new file mode 100644 index 0000000000..024b1fe7d5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.reference.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.canvas.reference</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.canvas.reference</h1> +<p class="desc">canvas refers back to its canvas</p> + + +<script> +var t = async_test("canvas refers back to its canvas"); +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.canvas, canvas, "ctx.canvas", "canvas"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.reference.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.reference.worker.js new file mode 100644 index 0000000000..a80e559053 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.reference.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.canvas.reference +// Description:canvas refers back to its canvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("canvas refers back to its canvas"); +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.canvas, canvas, "ctx.canvas", "canvas"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.exists.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.exists.html new file mode 100644 index 0000000000..55bdf1cc19 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.exists.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.getcontext.exists</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.getcontext.exists</h1> +<p class="desc">The 2D context is implemented</p> + + +<script> +var t = async_test("The 2D context is implemented"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +_assertDifferent(offscreenCanvas2.getContext('2d'), null, "offscreenCanvas2.getContext('2d')", "null"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.exists.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.exists.worker.js new file mode 100644 index 0000000000..97f8cc745b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.exists.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.getcontext.exists +// Description:The 2D context is implemented +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("The 2D context is implemented"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +_assertDifferent(offscreenCanvas2.getContext('2d'), null, "offscreenCanvas2.getContext('2d')", "null"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.html new file mode 100644 index 0000000000..a57dbcb655 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.getcontext.extraargs.cache</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.getcontext.extraargs.cache</h1> +<p class="desc">The 2D context doesn't throw with extra getContext arguments (cached)</p> + + +<script> +var t = async_test("The 2D context doesn't throw with extra getContext arguments (cached)"); +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'); + +_assertDifferent(canvas.getContext('2d', false, {}, [], 1, "2"), null, "canvas.getContext('2d', false, {}, [], 1, \"2\")", "null"); +_assertDifferent(canvas.getContext('2d', 123), null, "canvas.getContext('2d', 123)", "null"); +_assertDifferent(canvas.getContext('2d', "test"), null, "canvas.getContext('2d', \"test\")", "null"); +_assertDifferent(canvas.getContext('2d', undefined), null, "canvas.getContext('2d', undefined)", "null"); +_assertDifferent(canvas.getContext('2d', null), null, "canvas.getContext('2d', null)", "null"); +_assertDifferent(canvas.getContext('2d', Symbol.hasInstance), null, "canvas.getContext('2d', Symbol.hasInstance)", "null"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker.js new file mode 100644 index 0000000000..df330e301b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.getcontext.extraargs.cache +// Description:The 2D context doesn't throw with extra getContext arguments (cached) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("The 2D context doesn't throw with extra getContext arguments (cached)"); +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'); + +_assertDifferent(canvas.getContext('2d', false, {}, [], 1, "2"), null, "canvas.getContext('2d', false, {}, [], 1, \"2\")", "null"); +_assertDifferent(canvas.getContext('2d', 123), null, "canvas.getContext('2d', 123)", "null"); +_assertDifferent(canvas.getContext('2d', "test"), null, "canvas.getContext('2d', \"test\")", "null"); +_assertDifferent(canvas.getContext('2d', undefined), null, "canvas.getContext('2d', undefined)", "null"); +_assertDifferent(canvas.getContext('2d', null), null, "canvas.getContext('2d', null)", "null"); +_assertDifferent(canvas.getContext('2d', Symbol.hasInstance), null, "canvas.getContext('2d', Symbol.hasInstance)", "null"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.html new file mode 100644 index 0000000000..a626318791 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.getcontext.extraargs.create</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.getcontext.extraargs.create</h1> +<p class="desc">The 2D context doesn't throw with extra getContext arguments (new context)</p> + + +<script> +var t = async_test("The 2D context doesn't throw with extra getContext arguments (new context)"); +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'); + +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', false, {}, [], 1, "2"), null, "(new OffscreenCanvas(100, 50)).getContext('2d', false, {}, [], 1, \"2\")", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', 123), null, "(new OffscreenCanvas(100, 50)).getContext('2d', 123)", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', "test"), null, "(new OffscreenCanvas(100, 50)).getContext('2d', \"test\")", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', undefined), null, "(new OffscreenCanvas(100, 50)).getContext('2d', undefined)", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', null), null, "(new OffscreenCanvas(100, 50)).getContext('2d', null)", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', Symbol.hasInstance), null, "(new OffscreenCanvas(100, 50)).getContext('2d', Symbol.hasInstance)", "null"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker.js new file mode 100644 index 0000000000..f34c5a1d0e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.getcontext.extraargs.create +// Description:The 2D context doesn't throw with extra getContext arguments (new context) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("The 2D context doesn't throw with extra getContext arguments (new context)"); +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'); + +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', false, {}, [], 1, "2"), null, "(new OffscreenCanvas(100, 50)).getContext('2d', false, {}, [], 1, \"2\")", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', 123), null, "(new OffscreenCanvas(100, 50)).getContext('2d', 123)", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', "test"), null, "(new OffscreenCanvas(100, 50)).getContext('2d', \"test\")", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', undefined), null, "(new OffscreenCanvas(100, 50)).getContext('2d', undefined)", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', null), null, "(new OffscreenCanvas(100, 50)).getContext('2d', null)", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', Symbol.hasInstance), null, "(new OffscreenCanvas(100, 50)).getContext('2d', Symbol.hasInstance)", "null"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.shared.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.shared.html new file mode 100644 index 0000000000..6d6162528a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.shared.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.getcontext.shared</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.getcontext.shared</h1> +<p class="desc">getContext('2d') returns objects which share canvas state</p> + + +<script> +var t = async_test("getContext('2d') returns objects which share canvas state"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var ctx2 = canvas.getContext('2d'); +ctx.fillStyle = '#f00'; +ctx2.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.shared.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.shared.worker.js new file mode 100644 index 0000000000..4b8dd52e61 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.shared.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.getcontext.shared +// Description:getContext('2d') returns objects which share canvas state +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getContext('2d') returns objects which share canvas state"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var ctx2 = canvas.getContext('2d'); +ctx.fillStyle = '#f00'; +ctx2.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.unique.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.unique.html new file mode 100644 index 0000000000..c7e71da63a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.unique.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.getcontext.unique</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.getcontext.unique</h1> +<p class="desc">getContext('2d') returns the same object</p> + + +<script> +var t = async_test("getContext('2d') returns the same object"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +_assertSame(offscreenCanvas2.getContext('2d'), offscreenCanvas2.getContext('2d'), "offscreenCanvas2.getContext('2d')", "offscreenCanvas2.getContext('2d')"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.unique.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.unique.worker.js new file mode 100644 index 0000000000..a2a744df61 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.unique.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.getcontext.unique +// Description:getContext('2d') returns the same object +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getContext('2d') returns the same object"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +_assertSame(offscreenCanvas2.getContext('2d'), offscreenCanvas2.getContext('2d'), "offscreenCanvas2.getContext('2d')", "offscreenCanvas2.getContext('2d')"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.arguments.missing.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.arguments.missing.html new file mode 100644 index 0000000000..b69f63cdfb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.arguments.missing.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: context.arguments.missing</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>context.arguments.missing</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'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext(); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.arguments.missing.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.arguments.missing.worker.js new file mode 100644 index 0000000000..f03ca52328 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.arguments.missing.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:context.arguments.missing +// 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'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext(); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.casesensitive.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.casesensitive.html new file mode 100644 index 0000000000..e7ee0c63ba --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.casesensitive.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: context.casesensitive</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>context.casesensitive</h1> +<p class="desc">Context name "2D" is unrecognised; matching is case sensitive</p> + + +<script> +var t = async_test("Context name \"2D\" is unrecognised; matching is case sensitive"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext('2D'); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.casesensitive.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.casesensitive.worker.js new file mode 100644 index 0000000000..265fe959d2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.casesensitive.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:context.casesensitive +// Description:Context name "2D" is unrecognised; matching is case sensitive +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Context name \"2D\" is unrecognised; matching is case sensitive"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext('2D'); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.emptystring.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.emptystring.html new file mode 100644 index 0000000000..c8f8943d9e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.emptystring.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: context.emptystring</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>context.emptystring</h1> +<p class="desc">getContext with empty string returns null</p> + + +<script> +var t = async_test("getContext with empty string returns null"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext(""); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.emptystring.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.emptystring.worker.js new file mode 100644 index 0000000000..45612d386c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.emptystring.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:context.emptystring +// Description:getContext with empty string returns null +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getContext with empty string returns null"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext(""); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badname.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badname.html new file mode 100644 index 0000000000..d1b0f2fd17 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badname.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: context.unrecognised.badname</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>context.unrecognised.badname</h1> +<p class="desc">getContext with unrecognised context name returns null</p> + + +<script> +var t = async_test("getContext with unrecognised context name returns null"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext('This is not an implemented context in any real browser'); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badname.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badname.worker.js new file mode 100644 index 0000000000..cc50c2bdbd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badname.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:context.unrecognised.badname +// Description:getContext with unrecognised context name returns null +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getContext with unrecognised context name returns null"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext('This is not an implemented context in any real browser'); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badsuffix.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badsuffix.html new file mode 100644 index 0000000000..30178af927 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badsuffix.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: context.unrecognised.badsuffix</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>context.unrecognised.badsuffix</h1> +<p class="desc">Context name "2d" plus a suffix is unrecognised</p> + + +<script> +var t = async_test("Context name \"2d\" plus a suffix is unrecognised"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext("2d#"); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badsuffix.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badsuffix.worker.js new file mode 100644 index 0000000000..7b3d8a09c8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badsuffix.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:context.unrecognised.badsuffix +// Description:Context name "2d" plus a suffix is unrecognised +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Context name \"2d\" plus a suffix is unrecognised"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext("2d#"); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.nullsuffix.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.nullsuffix.html new file mode 100644 index 0000000000..2a22549baa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.nullsuffix.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: context.unrecognised.nullsuffix</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>context.unrecognised.nullsuffix</h1> +<p class="desc">Context name "2d" plus a "\0" suffix is unrecognised</p> + + +<script> +var t = async_test("Context name \"2d\" plus a \"\\0\" suffix is unrecognised"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext("2d\0"); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.nullsuffix.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.nullsuffix.worker.js new file mode 100644 index 0000000000..b6594100f6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.nullsuffix.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:context.unrecognised.nullsuffix +// Description:Context name "2d" plus a "\0" suffix is unrecognised +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Context name \"2d\" plus a \"\\0\" suffix is unrecognised"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext("2d\0"); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.unicode.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.unicode.html new file mode 100644 index 0000000000..0c826595fe --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.unicode.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: context.unrecognised.unicode</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>context.unrecognised.unicode</h1> +<p class="desc">Context name which kind of looks like "2d" is unrecognised</p> + + +<script> +var t = async_test("Context name which kind of looks like \"2d\" is unrecognised"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext("2\uFF44"); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.unicode.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.unicode.worker.js new file mode 100644 index 0000000000..cade5a20b5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.unicode.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:context.unrecognised.unicode +// Description:Context name which kind of looks like "2d" is unrecognised +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Context name which kind of looks like \"2d\" is unrecognised"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext("2\uFF44"); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.color.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.color.html new file mode 100644 index 0000000000..bfdcef7c4f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.color.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: initial.color</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>initial.color</h1> +<p class="desc">Initial state is transparent black</p> + + +<script> +var t = async_test("Initial state is transparent black"); +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'); + +_assertPixel(canvas, 20,20, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.color.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.color.worker.js new file mode 100644 index 0000000000..2a6e6e576c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.color.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:initial.color +// Description:Initial state is transparent black +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Initial state is transparent black"); +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'); + +_assertPixel(canvas, 20,20, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.2dstate.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.2dstate.html new file mode 100644 index 0000000000..76b76070d4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.2dstate.html @@ -0,0 +1,88 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: initial.reset.2dstate</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>initial.reset.2dstate</h1> +<p class="desc">Resetting the canvas state resets 2D state variables</p> + + +<script> +var t = async_test("Resetting the canvas state resets 2D state variables"); +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'); + +canvas.width = 100; +var default_val; + +default_val = ctx.strokeStyle; +ctx.strokeStyle = "#ff0000"; +canvas.width = 100; +_assertSame(ctx.strokeStyle, default_val, "ctx.strokeStyle", "default_val"); + +default_val = ctx.fillStyle; +ctx.fillStyle = "#ff0000"; +canvas.width = 100; +_assertSame(ctx.fillStyle, default_val, "ctx.fillStyle", "default_val"); + +default_val = ctx.globalAlpha; +ctx.globalAlpha = 0.5; +canvas.width = 100; +_assertSame(ctx.globalAlpha, default_val, "ctx.globalAlpha", "default_val"); + +default_val = ctx.lineWidth; +ctx.lineWidth = 0.5; +canvas.width = 100; +_assertSame(ctx.lineWidth, default_val, "ctx.lineWidth", "default_val"); + +default_val = ctx.lineCap; +ctx.lineCap = "round"; +canvas.width = 100; +_assertSame(ctx.lineCap, default_val, "ctx.lineCap", "default_val"); + +default_val = ctx.lineJoin; +ctx.lineJoin = "round"; +canvas.width = 100; +_assertSame(ctx.lineJoin, default_val, "ctx.lineJoin", "default_val"); + +default_val = ctx.miterLimit; +ctx.miterLimit = 0.5; +canvas.width = 100; +_assertSame(ctx.miterLimit, default_val, "ctx.miterLimit", "default_val"); + +default_val = ctx.shadowOffsetX; +ctx.shadowOffsetX = 5; +canvas.width = 100; +_assertSame(ctx.shadowOffsetX, default_val, "ctx.shadowOffsetX", "default_val"); + +default_val = ctx.shadowOffsetY; +ctx.shadowOffsetY = 5; +canvas.width = 100; +_assertSame(ctx.shadowOffsetY, default_val, "ctx.shadowOffsetY", "default_val"); + +default_val = ctx.shadowBlur; +ctx.shadowBlur = 5; +canvas.width = 100; +_assertSame(ctx.shadowBlur, default_val, "ctx.shadowBlur", "default_val"); + +default_val = ctx.shadowColor; +ctx.shadowColor = "#ff0000"; +canvas.width = 100; +_assertSame(ctx.shadowColor, default_val, "ctx.shadowColor", "default_val"); + +default_val = ctx.globalCompositeOperation; +ctx.globalCompositeOperation = "copy"; +canvas.width = 100; +_assertSame(ctx.globalCompositeOperation, default_val, "ctx.globalCompositeOperation", "default_val"); + +t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.2dstate.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.2dstate.worker.js new file mode 100644 index 0000000000..273c5f0bd6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.2dstate.worker.js @@ -0,0 +1,84 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:initial.reset.2dstate +// Description:Resetting the canvas state resets 2D state variables +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Resetting the canvas state resets 2D state variables"); +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'); + +canvas.width = 100; +var default_val; + +default_val = ctx.strokeStyle; +ctx.strokeStyle = "#ff0000"; +canvas.width = 100; +_assertSame(ctx.strokeStyle, default_val, "ctx.strokeStyle", "default_val"); + +default_val = ctx.fillStyle; +ctx.fillStyle = "#ff0000"; +canvas.width = 100; +_assertSame(ctx.fillStyle, default_val, "ctx.fillStyle", "default_val"); + +default_val = ctx.globalAlpha; +ctx.globalAlpha = 0.5; +canvas.width = 100; +_assertSame(ctx.globalAlpha, default_val, "ctx.globalAlpha", "default_val"); + +default_val = ctx.lineWidth; +ctx.lineWidth = 0.5; +canvas.width = 100; +_assertSame(ctx.lineWidth, default_val, "ctx.lineWidth", "default_val"); + +default_val = ctx.lineCap; +ctx.lineCap = "round"; +canvas.width = 100; +_assertSame(ctx.lineCap, default_val, "ctx.lineCap", "default_val"); + +default_val = ctx.lineJoin; +ctx.lineJoin = "round"; +canvas.width = 100; +_assertSame(ctx.lineJoin, default_val, "ctx.lineJoin", "default_val"); + +default_val = ctx.miterLimit; +ctx.miterLimit = 0.5; +canvas.width = 100; +_assertSame(ctx.miterLimit, default_val, "ctx.miterLimit", "default_val"); + +default_val = ctx.shadowOffsetX; +ctx.shadowOffsetX = 5; +canvas.width = 100; +_assertSame(ctx.shadowOffsetX, default_val, "ctx.shadowOffsetX", "default_val"); + +default_val = ctx.shadowOffsetY; +ctx.shadowOffsetY = 5; +canvas.width = 100; +_assertSame(ctx.shadowOffsetY, default_val, "ctx.shadowOffsetY", "default_val"); + +default_val = ctx.shadowBlur; +ctx.shadowBlur = 5; +canvas.width = 100; +_assertSame(ctx.shadowBlur, default_val, "ctx.shadowBlur", "default_val"); + +default_val = ctx.shadowColor; +ctx.shadowColor = "#ff0000"; +canvas.width = 100; +_assertSame(ctx.shadowColor, default_val, "ctx.shadowColor", "default_val"); + +default_val = ctx.globalCompositeOperation; +ctx.globalCompositeOperation = "copy"; +canvas.width = 100; +_assertSame(ctx.globalCompositeOperation, default_val, "ctx.globalCompositeOperation", "default_val"); + +t.done(); +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.clip.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.clip.html new file mode 100644 index 0000000000..87a3e43be4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.clip.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: initial.reset.clip</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>initial.reset.clip</h1> +<p class="desc">Resetting the canvas state resets the current clip region</p> + + +<script> +var t = async_test("Resetting the canvas state resets the current clip region"); +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'); + +canvas.width = 100; +ctx.rect(0, 0, 1, 1); +ctx.clip(); +canvas.width = 100; +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 20,20, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.clip.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.clip.worker.js new file mode 100644 index 0000000000..45ee30d080 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.clip.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:initial.reset.clip +// Description:Resetting the canvas state resets the current clip region +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Resetting the canvas state resets the current clip region"); +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'); + +canvas.width = 100; +ctx.rect(0, 0, 1, 1); +ctx.clip(); +canvas.width = 100; +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 20,20, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.different.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.different.html new file mode 100644 index 0000000000..632bc2fd69 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.different.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: initial.reset.different</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>initial.reset.different</h1> +<p class="desc">Changing size resets canvas to transparent black</p> + + +<script> +var t = async_test("Changing size resets canvas to transparent black"); +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, 50, 50); +_assertPixel(canvas, 20,20, 255,0,0,255); +canvas.width = 50; +_assertPixel(canvas, 20,20, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.different.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.different.worker.js new file mode 100644 index 0000000000..9d840a5963 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.different.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:initial.reset.different +// Description:Changing size resets canvas to transparent black +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Changing size resets canvas to transparent black"); +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, 50, 50); +_assertPixel(canvas, 20,20, 255,0,0,255); +canvas.width = 50; +_assertPixel(canvas, 20,20, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.gradient.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.gradient.html new file mode 100644 index 0000000000..96819a07d3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.gradient.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: initial.reset.gradient</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>initial.reset.gradient</h1> +<p class="desc">Resetting the canvas state does not invalidate any existing gradients</p> + + +<script> +var t = async_test("Resetting the canvas state does not invalidate any existing gradients"); +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'); + +canvas.width = 50; +var g = ctx.createLinearGradient(0, 0, 100, 0); +g.addColorStop(0, '#0f0'); +g.addColorStop(1, '#0f0'); +canvas.width = 100; +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.gradient.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.gradient.worker.js new file mode 100644 index 0000000000..a18d11e86a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.gradient.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:initial.reset.gradient +// Description:Resetting the canvas state does not invalidate any existing gradients +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Resetting the canvas state does not invalidate any existing gradients"); +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'); + +canvas.width = 50; +var g = ctx.createLinearGradient(0, 0, 100, 0); +g.addColorStop(0, '#0f0'); +g.addColorStop(1, '#0f0'); +canvas.width = 100; +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.path.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.path.html new file mode 100644 index 0000000000..3c9667ca5c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.path.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: initial.reset.path</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>initial.reset.path</h1> +<p class="desc">Resetting the canvas state resets the current path</p> + + +<script> +var t = async_test("Resetting the canvas state resets the current path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 100; +ctx.rect(0, 0, 100, 50); +canvas.width = 100; +ctx.fillStyle = '#f00'; +ctx.fill(); +_assertPixel(canvas, 20,20, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.path.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.path.worker.js new file mode 100644 index 0000000000..9f34734a58 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.path.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:initial.reset.path +// Description:Resetting the canvas state resets the current path +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Resetting the canvas state resets the current path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 100; +ctx.rect(0, 0, 100, 50); +canvas.width = 100; +ctx.fillStyle = '#f00'; +ctx.fill(); +_assertPixel(canvas, 20,20, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.pattern.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.pattern.html new file mode 100644 index 0000000000..3766795ba9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.pattern.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: initial.reset.pattern</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>initial.reset.pattern</h1> +<p class="desc">Resetting the canvas state does not invalidate any existing patterns</p> + + +<script> +var t = async_test("Resetting the canvas state does not invalidate any existing patterns"); +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'); + +canvas.width = 30; +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 30, 50); +var p = ctx.createPattern(canvas, 'repeat-x'); +canvas.width = 100; +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = p; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.pattern.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.pattern.worker.js new file mode 100644 index 0000000000..1fe6c01e2d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.pattern.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:initial.reset.pattern +// Description:Resetting the canvas state does not invalidate any existing patterns +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Resetting the canvas state does not invalidate any existing patterns"); +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'); + +canvas.width = 30; +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 30, 50); +var p = ctx.createPattern(canvas, 'repeat-x'); +canvas.width = 100; +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = p; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.same.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.same.html new file mode 100644 index 0000000000..bfcf05013e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.same.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: initial.reset.same</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>initial.reset.same</h1> +<p class="desc">Setting size (not changing the value) resets canvas to transparent black</p> + + +<script> +var t = async_test("Setting size (not changing the value) resets canvas to transparent black"); +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'); + +canvas.width = 100; +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 20,20, 255,0,0,255); +canvas.width = 100; +_assertPixel(canvas, 20,20, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.same.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.same.worker.js new file mode 100644 index 0000000000..00db682f70 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.same.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:initial.reset.same +// Description:Setting size (not changing the value) resets canvas to transparent black +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Setting size (not changing the value) resets canvas to transparent black"); +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'); + +canvas.width = 100; +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 20,20, 255,0,0,255); +canvas.width = 100; +_assertPixel(canvas, 20,20, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.transform.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.transform.html new file mode 100644 index 0000000000..402b34f9c5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.transform.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: initial.reset.transform</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>initial.reset.transform</h1> +<p class="desc">Resetting the canvas state resets the current transformation matrix</p> + + +<script> +var t = async_test("Resetting the canvas state resets the current transformation matrix"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 100; +ctx.scale(0.1, 0.1); +canvas.width = 100; +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 20,20, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.transform.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.transform.worker.js new file mode 100644 index 0000000000..3fb80d061f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.transform.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:initial.reset.transform +// Description:Resetting the canvas state resets the current transformation matrix +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Resetting the canvas state resets the current transformation matrix"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 100; +ctx.scale(0.1, 0.1); +canvas.width = 100; +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 20,20, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.default.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.default.html new file mode 100644 index 0000000000..6ebd35fbd0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.default.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.default</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.default</h1> +<p class="desc">Default width/height when attributes are missing</p> + + +<script> +var t = async_test("Default width/height when attributes are missing"); +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(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 50, "canvas.height", "50"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.default.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.default.worker.js new file mode 100644 index 0000000000..c77b8a4929 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.default.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.default +// Description:Default width/height when attributes are missing +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Default width/height when attributes are missing"); +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(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 50, "canvas.height", "50"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.html new file mode 100644 index 0000000000..fda4e92603 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.idl</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.idl</h1> +<p class="desc">Getting/setting width/height IDL attributes</p> + + +<script> +var t = async_test("Getting/setting width/height IDL attributes"); +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'); + +canvas.width = "100"; +canvas.height = "100"; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +canvas.width = "+1.5e2"; +canvas.height = "0x96"; +_assertSame(canvas.width, 150, "canvas.width", "150"); +_assertSame(canvas.height, 150, "canvas.height", "150"); +canvas.width = 301.999; +canvas.height = 301.001; +_assertSame(canvas.width, 301, "canvas.width", "301"); +_assertSame(canvas.height, 301, "canvas.height", "301"); +assert_throws_js(TypeError, function() { canvas.width = "400x"; }); +assert_throws_js(TypeError, function() { canvas.height = "foo"; }); +_assertSame(canvas.width, 301, "canvas.width", "301"); +_assertSame(canvas.height, 301, "canvas.height", "301"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.set.zero.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.set.zero.html new file mode 100644 index 0000000000..4bf7b9c41b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.set.zero.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.idl.set.zero</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.idl.set.zero</h1> +<p class="desc">Setting width/height IDL attributes to 0</p> + + +<script> +var t = async_test("Setting width/height IDL attributes to 0"); +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'); + +canvas.width = 0; +canvas.height = 0; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.set.zero.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.set.zero.worker.js new file mode 100644 index 0000000000..2ecf19974e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.set.zero.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.idl.set.zero +// Description:Setting width/height IDL attributes to 0 +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Setting width/height IDL attributes to 0"); +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'); + +canvas.width = 0; +canvas.height = 0; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.worker.js new file mode 100644 index 0000000000..16350aeacd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.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:size.attributes.idl +// Description:Getting/setting width/height IDL attributes +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Getting/setting width/height IDL attributes"); +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'); + +canvas.width = "100"; +canvas.height = "100"; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +canvas.width = "+1.5e2"; +canvas.height = "0x96"; +_assertSame(canvas.width, 150, "canvas.width", "150"); +_assertSame(canvas.height, 150, "canvas.height", "150"); +canvas.width = 301.999; +canvas.height = 301.001; +_assertSame(canvas.width, 301, "canvas.width", "301"); +_assertSame(canvas.height, 301, "canvas.height", "301"); +assert_throws_js(TypeError, function() { canvas.width = "400x"; }); +assert_throws_js(TypeError, function() { canvas.height = "foo"; }); +_assertSame(canvas.width, 301, "canvas.width", "301"); +_assertSame(canvas.height, 301, "canvas.height", "301"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.decimal.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.decimal.html new file mode 100644 index 0000000000..a74fe15899 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.decimal.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.decimal</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.decimal</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = '100.999'; +canvas.height = '100.999'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.decimal.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.decimal.worker.js new file mode 100644 index 0000000000..7b982e8d87 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.decimal.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.decimal +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = '100.999'; +canvas.height = '100.999'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.em.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.em.html new file mode 100644 index 0000000000..5a8eee2c8e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.em.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.em</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.em</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +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'); + +assert_throws_js(TypeError, function() { canvas.width = '100em'; }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.em.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.em.worker.js new file mode 100644 index 0000000000..a0248d4efc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.em.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.em +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +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'); + +assert_throws_js(TypeError, function() { canvas.width = '100em'; }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.empty.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.empty.html new file mode 100644 index 0000000000..eab54b013f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.empty.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.empty</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.empty</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = ''; +canvas.height = ''; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.empty.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.empty.worker.js new file mode 100644 index 0000000000..93b6cd6fc2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.empty.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.empty +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = ''; +canvas.height = ''; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.exp.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.exp.html new file mode 100644 index 0000000000..abfddf1858 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.exp.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.exp</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.exp</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = '100e1'; +canvas.height = '100e1'; +_assertSame(canvas.width, 1000.0, "canvas.width", "1000.0"); +_assertSame(canvas.height, 1000.0, "canvas.height", "1000.0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.exp.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.exp.worker.js new file mode 100644 index 0000000000..79fb413f37 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.exp.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.exp +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = '100e1'; +canvas.height = '100e1'; +_assertSame(canvas.width, 1000.0, "canvas.width", "1000.0"); +_assertSame(canvas.height, 1000.0, "canvas.height", "1000.0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.hex.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.hex.html new file mode 100644 index 0000000000..fba289087f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.hex.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.hex</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.hex</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = '0x100'; +canvas.height = '0x100'; +_assertSame(canvas.width, 256, "canvas.width", "256"); +_assertSame(canvas.height, 256, "canvas.height", "256"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.hex.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.hex.worker.js new file mode 100644 index 0000000000..b178c55646 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.hex.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.hex +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = '0x100'; +canvas.height = '0x100'; +_assertSame(canvas.width, 256, "canvas.width", "256"); +_assertSame(canvas.height, 256, "canvas.height", "256"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.junk.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.junk.html new file mode 100644 index 0000000000..3ffb674b9e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.junk.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.junk</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.junk</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +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'); + +assert_throws_js(TypeError, function() { canvas.width = '#!?'; }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.junk.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.junk.worker.js new file mode 100644 index 0000000000..6efd3ae5c2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.junk.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.junk +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +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'); + +assert_throws_js(TypeError, function() { canvas.width = '#!?'; }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.minus.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.minus.html new file mode 100644 index 0000000000..56435547ca --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.minus.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.minus</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.minus</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +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'); + +assert_throws_js(TypeError, function() { canvas.width = '-100'; }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.minus.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.minus.worker.js new file mode 100644 index 0000000000..a5837528ef --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.minus.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.minus +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +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'); + +assert_throws_js(TypeError, function() { canvas.width = '-100'; }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.octal.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.octal.html new file mode 100644 index 0000000000..d452217015 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.octal.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.octal</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.octal</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = '0100'; +canvas.height = '0100'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.octal.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.octal.worker.js new file mode 100644 index 0000000000..23f228e368 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.octal.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.octal +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = '0100'; +canvas.height = '0100'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.onlyspace.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.onlyspace.html new file mode 100644 index 0000000000..4164123fd1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.onlyspace.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.onlyspace</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.onlyspace</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = ' '; +canvas.height = ' '; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.onlyspace.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.onlyspace.worker.js new file mode 100644 index 0000000000..a4b86624f7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.onlyspace.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.onlyspace +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = ' '; +canvas.height = ' '; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.percent.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.percent.html new file mode 100644 index 0000000000..d6288e996e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.percent.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.percent</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.percent</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +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'); + +assert_throws_js(TypeError, function() { canvas.width = '100%'; }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.percent.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.percent.worker.js new file mode 100644 index 0000000000..e07fa60407 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.percent.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.percent +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +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'); + +assert_throws_js(TypeError, function() { canvas.width = '100%'; }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.plus.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.plus.html new file mode 100644 index 0000000000..79d531f06e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.plus.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.plus</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.plus</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = '+100'; +canvas.height = '+100'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.plus.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.plus.worker.js new file mode 100644 index 0000000000..240a6bd785 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.plus.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.plus +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = '+100'; +canvas.height = '+100'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.space.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.space.html new file mode 100644 index 0000000000..695afa5407 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.space.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.space</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.space</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = ' 100'; +canvas.height = ' 100'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.space.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.space.worker.js new file mode 100644 index 0000000000..29930209bf --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.space.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.space +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = ' 100'; +canvas.height = ' 100'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.trailingjunk.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.trailingjunk.html new file mode 100644 index 0000000000..fff231fda7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.trailingjunk.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.trailingjunk</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.trailingjunk</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +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'); + +assert_throws_js(TypeError, function() { canvas.width = '100#!?'; }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.trailingjunk.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.trailingjunk.worker.js new file mode 100644 index 0000000000..f8d916c853 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.trailingjunk.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.trailingjunk +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +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'); + +assert_throws_js(TypeError, function() { canvas.width = '100#!?'; }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.whitespace.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.whitespace.html new file mode 100644 index 0000000000..b7f0c4b931 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.whitespace.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.whitespace</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.whitespace</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = ' 100'; +canvas.height = ' 100'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.whitespace.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.whitespace.worker.js new file mode 100644 index 0000000000..ea38398145 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.whitespace.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.whitespace +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = ' 100'; +canvas.height = ' 100'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.zero.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.zero.html new file mode 100644 index 0000000000..9a84c95598 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.zero.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.zero</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.zero</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = '0'; +canvas.height = '0'; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.zero.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.zero.worker.js new file mode 100644 index 0000000000..4d97a96b42 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.zero.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.zero +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +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'); + +canvas.width = '0'; +canvas.height = '0'; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidl.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidl.html new file mode 100644 index 0000000000..968dad9dda --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidl.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.reflect.setidl</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.reflect.setidl</h1> +<p class="desc">Setting IDL attributes updates IDL and content attributes</p> + + +<script> +var t = async_test("Setting IDL attributes updates IDL and content attributes"); +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'); + +canvas.width = 120; +canvas.height = 60; +_assertSame(canvas.width, 120, "canvas.width", "120"); +_assertSame(canvas.height, 60, "canvas.height", "60"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidl.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidl.worker.js new file mode 100644 index 0000000000..3f8050d549 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidl.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.reflect.setidl +// Description:Setting IDL attributes updates IDL and content attributes +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Setting IDL attributes updates IDL and content attributes"); +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'); + +canvas.width = 120; +canvas.height = 60; +_assertSame(canvas.width, 120, "canvas.width", "120"); +_assertSame(canvas.height, 60, "canvas.height", "60"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidlzero.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidlzero.html new file mode 100644 index 0000000000..5f31f696cf --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidlzero.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.reflect.setidlzero</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.reflect.setidlzero</h1> +<p class="desc">Setting IDL attributes to 0 updates IDL and content attributes</p> + + +<script> +var t = async_test("Setting IDL attributes to 0 updates IDL and content attributes"); +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'); + +canvas.width = 0; +canvas.height = 0; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidlzero.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidlzero.worker.js new file mode 100644 index 0000000000..4ace1f5edb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidlzero.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.reflect.setidlzero +// Description:Setting IDL attributes to 0 updates IDL and content attributes +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Setting IDL attributes to 0 updates IDL and content attributes"); +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'); + +canvas.width = 0; +canvas.height = 0; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.large.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.large.html new file mode 100644 index 0000000000..9f41e2e23a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.large.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.large</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.large</h1> +<p class="desc"></p> + +<p class="notes">Not sure how reasonable this is, but the spec doesn't say there's an upper limit on the size. +<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'); + +var n = 2147483647; // 2^31 - 1, which should be supported by any sensible definition of "long" +canvas.width = n; +canvas.height = n; +_assertSame(canvas.width, n, "canvas.width", "n"); +_assertSame(canvas.height, n, "canvas.height", "n"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.large.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.large.worker.js new file mode 100644 index 0000000000..b20ff54969 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.large.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.large +// Description: +// Note:<p class="notes">Not sure how reasonable this is, but the spec doesn't say there's an upper limit on the size. + +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'); + +var n = 2147483647; // 2^31 - 1, which should be supported by any sensible definition of "long" +canvas.width = n; +canvas.height = n; +_assertSame(canvas.width, n, "canvas.width", "n"); +_assertSame(canvas.height, n, "canvas.height", "n"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.order.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.order.html new file mode 100644 index 0000000000..b130803593 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.order.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.transformation.order</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.order</h1> +<p class="desc">Transformations are applied in the right order</p> + + +<script> +var t = async_test("Transformations are applied in the right order"); +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(2, 1); +ctx.rotate(Math.PI / 2); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, -50, 50, 50); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.order.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.order.worker.js new file mode 100644 index 0000000000..7ac61067b4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.order.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.transformation.order +// Description:Transformations are applied in the right order +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Transformations are applied in the right order"); +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(2, 1); +ctx.rotate(Math.PI / 2); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, -50, 50, 50); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.direction.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.direction.html new file mode 100644 index 0000000000..0a98c7e65f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.direction.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.transformation.rotate.direction</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.rotate.direction</h1> +<p class="desc">rotate() is clockwise</p> + + +<script> +var t = async_test("rotate() is clockwise"); +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.rotate(Math.PI / 2); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, -100, 50, 100); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.direction.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.direction.worker.js new file mode 100644 index 0000000000..465d3b6790 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.direction.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.transformation.rotate.direction +// Description:rotate() is clockwise +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("rotate() is clockwise"); +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.rotate(Math.PI / 2); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, -100, 50, 100); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.nonfinite.html new file mode 100644 index 0000000000..0f2227a4e5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.nonfinite.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.transformation.rotate.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.rotate.nonfinite</h1> +<p class="desc">rotate() with Infinity/NaN is ignored</p> + + +<script> +var t = async_test("rotate() with Infinity/NaN 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.translate(100, 10); +ctx.rotate(Infinity); +ctx.rotate(-Infinity); +ctx.rotate(NaN); +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, -10, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.nonfinite.worker.js new file mode 100644 index 0000000000..56a04d874e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.nonfinite.worker.js @@ -0,0 +1,31 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.transformation.rotate.nonfinite +// Description:rotate() with Infinity/NaN is ignored +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("rotate() with Infinity/NaN 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.translate(100, 10); +ctx.rotate(Infinity); +ctx.rotate(-Infinity); +ctx.rotate(NaN); +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, -10, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.radians.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.radians.html new file mode 100644 index 0000000000..8a78dddd7f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.radians.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.transformation.rotate.radians</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.rotate.radians</h1> +<p class="desc">rotate() uses radians</p> + + +<script> +var t = async_test("rotate() uses radians"); +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.rotate(Math.PI); // should fail obviously if this is 3.1 degrees +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, -50, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.radians.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.radians.worker.js new file mode 100644 index 0000000000..9780e68a02 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.radians.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.transformation.rotate.radians +// Description:rotate() uses radians +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("rotate() uses radians"); +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.rotate(Math.PI); // should fail obviously if this is 3.1 degrees +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, -50, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrap.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrap.html new file mode 100644 index 0000000000..7711a8c140 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrap.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.transformation.rotate.wrap</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.rotate.wrap</h1> +<p class="desc">rotate() wraps large positive values correctly</p> + + +<script> +var t = async_test("rotate() wraps large positive values 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.rotate(Math.PI * (1 + 4096)); // == pi (mod 2*pi) +// We need about pi +/- 0.001 in order to get correct-looking results +// 32-bit floats can store pi*4097 with precision 2^-10, so that should +// be safe enough on reasonable implementations +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, -50, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,2, 0,255,0,255); +_assertPixel(canvas, 98,47, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrap.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrap.worker.js new file mode 100644 index 0000000000..db9fbd43bc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrap.worker.js @@ -0,0 +1,33 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.transformation.rotate.wrap +// Description:rotate() wraps large positive values correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("rotate() wraps large positive values 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.rotate(Math.PI * (1 + 4096)); // == pi (mod 2*pi) +// We need about pi +/- 0.001 in order to get correct-looking results +// 32-bit floats can store pi*4097 with precision 2^-10, so that should +// be safe enough on reasonable implementations +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, -50, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,2, 0,255,0,255); +_assertPixel(canvas, 98,47, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrapnegative.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrapnegative.html new file mode 100644 index 0000000000..49959dac02 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrapnegative.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.transformation.rotate.wrapnegative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.rotate.wrapnegative</h1> +<p class="desc">rotate() wraps large negative values correctly</p> + + +<script> +var t = async_test("rotate() wraps large negative values 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.rotate(-Math.PI * (1 + 4096)); +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, -50, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,2, 0,255,0,255); +_assertPixel(canvas, 98,47, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrapnegative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrapnegative.worker.js new file mode 100644 index 0000000000..7f93f65458 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrapnegative.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.transformation.rotate.wrapnegative +// Description:rotate() wraps large negative values correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("rotate() wraps large negative values 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.rotate(-Math.PI * (1 + 4096)); +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, -50, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +_assertPixel(canvas, 98,2, 0,255,0,255); +_assertPixel(canvas, 98,47, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.zero.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.zero.html new file mode 100644 index 0000000000..2255b9973d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.zero.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.transformation.rotate.zero</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.rotate.zero</h1> +<p class="desc">rotate() by 0 does nothing</p> + + +<script> +var t = async_test("rotate() by 0 does 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.rotate(0); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.zero.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.zero.worker.js new file mode 100644 index 0000000000..10e00c4656 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.rotate.zero.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.transformation.rotate.zero +// Description:rotate() by 0 does nothing +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("rotate() by 0 does 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.rotate(0); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.basic.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.basic.html new file mode 100644 index 0000000000..c78ac79f5a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.basic.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.transformation.scale.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.transformation.scale.basic</h1> +<p class="desc">scale() works</p> + + +<script> +var t = async_test("scale() 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.scale(2, 4); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 50, 12.5); +_assertPixel(canvas, 90,40, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.basic.worker.js new file mode 100644 index 0000000000..39b52d57b5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.basic.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.transformation.scale.basic +// Description:scale() works +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("scale() 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.scale(2, 4); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 50, 12.5); +_assertPixel(canvas, 90,40, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.large.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.large.html new file mode 100644 index 0000000000..a67d05eb2c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.large.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.transformation.scale.large</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.scale.large</h1> +<p class="desc">scale() with large scale factors works</p> + +<p class="notes">Not really that large at all, but it hits the limits in Firefox. +<script> +var t = async_test("scale() with large scale factors 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.scale(1e5, 1e5); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 1, 1); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.large.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.large.worker.js new file mode 100644 index 0000000000..1293cce196 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.large.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.transformation.scale.large +// Description:scale() with large scale factors works +// Note:<p class="notes">Not really that large at all, but it hits the limits in Firefox. + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("scale() with large scale factors 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.scale(1e5, 1e5); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 1, 1); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.multiple.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.multiple.html new file mode 100644 index 0000000000..717f3d305a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.multiple.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.transformation.scale.multiple</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.scale.multiple</h1> +<p class="desc">Multiple scale()s combine</p> + + +<script> +var t = async_test("Multiple scale()s combine"); +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(Math.sqrt(2), Math.sqrt(2)); +ctx.scale(Math.sqrt(2), Math.sqrt(2)); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 50, 25); +_assertPixel(canvas, 90,40, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.multiple.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.multiple.worker.js new file mode 100644 index 0000000000..c5a38207ea --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.multiple.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.transformation.scale.multiple +// Description:Multiple scale()s combine +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Multiple scale()s combine"); +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(Math.sqrt(2), Math.sqrt(2)); +ctx.scale(Math.sqrt(2), Math.sqrt(2)); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 50, 25); +_assertPixel(canvas, 90,40, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.negative.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.negative.html new file mode 100644 index 0000000000..fbcec5d763 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.negative.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.transformation.scale.negative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.scale.negative</h1> +<p class="desc">scale() with negative scale factors works</p> + + +<script> +var t = async_test("scale() with negative scale factors 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.save(); +ctx.scale(-1, 1); +ctx.fillStyle = '#0f0'; +ctx.fillRect(-50, 0, 50, 50); +ctx.restore(); +ctx.save(); +ctx.scale(1, -1); +ctx.fillStyle = '#0f0'; +ctx.fillRect(50, -50, 50, 50); +ctx.restore(); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.negative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.negative.worker.js new file mode 100644 index 0000000000..a5344a9a71 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.negative.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.transformation.scale.negative +// Description:scale() with negative scale factors works +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("scale() with negative scale factors 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.save(); +ctx.scale(-1, 1); +ctx.fillStyle = '#0f0'; +ctx.fillRect(-50, 0, 50, 50); +ctx.restore(); +ctx.save(); +ctx.scale(1, -1); +ctx.fillStyle = '#0f0'; +ctx.fillRect(50, -50, 50, 50); +ctx.restore(); +_assertPixel(canvas, 25,25, 0,255,0,255); +_assertPixel(canvas, 75,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.nonfinite.html new file mode 100644 index 0000000000..ac38bc1fa4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.nonfinite.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.transformation.scale.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.scale.nonfinite</h1> +<p class="desc">scale() with Infinity/NaN is ignored</p> + + +<script> +var t = async_test("scale() with Infinity/NaN 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.translate(100, 10); +ctx.scale(Infinity, 0.1); +ctx.scale(-Infinity, 0.1); +ctx.scale(NaN, 0.1); +ctx.scale(0.1, Infinity); +ctx.scale(0.1, -Infinity); +ctx.scale(0.1, NaN); +ctx.scale(Infinity, Infinity); +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, -10, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.nonfinite.worker.js new file mode 100644 index 0000000000..95e9922b69 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.nonfinite.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.transformation.scale.nonfinite +// Description:scale() with Infinity/NaN is ignored +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("scale() with Infinity/NaN 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.translate(100, 10); +ctx.scale(Infinity, 0.1); +ctx.scale(-Infinity, 0.1); +ctx.scale(NaN, 0.1); +ctx.scale(0.1, Infinity); +ctx.scale(0.1, -Infinity); +ctx.scale(0.1, NaN); +ctx.scale(Infinity, Infinity); +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, -10, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.zero.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.zero.html new file mode 100644 index 0000000000..9eae3b1db3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.zero.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.transformation.scale.zero</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.scale.zero</h1> +<p class="desc">scale() with a scale factor of zero works</p> + + +<script> +var t = async_test("scale() with a scale factor of zero 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.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.save(); +ctx.translate(50, 0); +ctx.scale(0, 1); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.restore(); +ctx.save(); +ctx.translate(0, 25); +ctx.scale(1, 0); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.restore(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.zero.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.zero.worker.js new file mode 100644 index 0000000000..0f8dad0442 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.scale.zero.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.transformation.scale.zero +// Description:scale() with a scale factor of zero works +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("scale() with a scale factor of zero 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.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.save(); +ctx.translate(50, 0); +ctx.scale(0, 1); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.restore(); +ctx.save(); +ctx.translate(0, 25); +ctx.scale(1, 0); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.restore(); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.multiple.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.multiple.html new file mode 100644 index 0000000000..f8dfb04881 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.multiple.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.transformation.setTransform.multiple</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.setTransform.multiple</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.setTransform(1/2,0, 0,1/2, 0,0); +ctx.setTransform(2,0, 0,2, 0,0); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 50, 25); +_assertPixel(canvas, 75,35, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.multiple.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.multiple.worker.js new file mode 100644 index 0000000000..9d01c1302e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.multiple.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.transformation.setTransform.multiple +// 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.setTransform(1/2,0, 0,1/2, 0,0); +ctx.setTransform(2,0, 0,2, 0,0); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 50, 25); +_assertPixel(canvas, 75,35, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.nonfinite.html new file mode 100644 index 0000000000..fbed341a04 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.nonfinite.html @@ -0,0 +1,107 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.transformation.setTransform.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.setTransform.nonfinite</h1> +<p class="desc">setTransform() with Infinity/NaN is ignored</p> + + +<script> +var t = async_test("setTransform() with Infinity/NaN 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.translate(100, 10); +ctx.setTransform(Infinity, 0, 0, 0, 0, 0); +ctx.setTransform(-Infinity, 0, 0, 0, 0, 0); +ctx.setTransform(NaN, 0, 0, 0, 0, 0); +ctx.setTransform(0, Infinity, 0, 0, 0, 0); +ctx.setTransform(0, -Infinity, 0, 0, 0, 0); +ctx.setTransform(0, NaN, 0, 0, 0, 0); +ctx.setTransform(0, 0, Infinity, 0, 0, 0); +ctx.setTransform(0, 0, -Infinity, 0, 0, 0); +ctx.setTransform(0, 0, NaN, 0, 0, 0); +ctx.setTransform(0, 0, 0, Infinity, 0, 0); +ctx.setTransform(0, 0, 0, -Infinity, 0, 0); +ctx.setTransform(0, 0, 0, NaN, 0, 0); +ctx.setTransform(0, 0, 0, 0, Infinity, 0); +ctx.setTransform(0, 0, 0, 0, -Infinity, 0); +ctx.setTransform(0, 0, 0, 0, NaN, 0); +ctx.setTransform(0, 0, 0, 0, 0, Infinity); +ctx.setTransform(0, 0, 0, 0, 0, -Infinity); +ctx.setTransform(0, 0, 0, 0, 0, NaN); +ctx.setTransform(Infinity, Infinity, 0, 0, 0, 0); +ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, 0); +ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, 0); +ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, 0); +ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, Infinity); +ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, 0); +ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, Infinity); +ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, Infinity); +ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, 0); +ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, 0); +ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, Infinity); +ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, Infinity); +ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, 0); +ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, Infinity); +ctx.setTransform(Infinity, Infinity, 0, 0, 0, Infinity); +ctx.setTransform(Infinity, 0, Infinity, 0, 0, 0); +ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, 0); +ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, 0); +ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, Infinity); +ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, Infinity); +ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, 0); +ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, Infinity); +ctx.setTransform(Infinity, 0, Infinity, 0, 0, Infinity); +ctx.setTransform(Infinity, 0, 0, Infinity, 0, 0); +ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, 0); +ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, Infinity); +ctx.setTransform(Infinity, 0, 0, Infinity, 0, Infinity); +ctx.setTransform(Infinity, 0, 0, 0, Infinity, 0); +ctx.setTransform(Infinity, 0, 0, 0, Infinity, Infinity); +ctx.setTransform(Infinity, 0, 0, 0, 0, Infinity); +ctx.setTransform(0, Infinity, Infinity, 0, 0, 0); +ctx.setTransform(0, Infinity, Infinity, Infinity, 0, 0); +ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, 0); +ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.setTransform(0, Infinity, Infinity, Infinity, 0, Infinity); +ctx.setTransform(0, Infinity, Infinity, 0, Infinity, 0); +ctx.setTransform(0, Infinity, Infinity, 0, Infinity, Infinity); +ctx.setTransform(0, Infinity, Infinity, 0, 0, Infinity); +ctx.setTransform(0, Infinity, 0, Infinity, 0, 0); +ctx.setTransform(0, Infinity, 0, Infinity, Infinity, 0); +ctx.setTransform(0, Infinity, 0, Infinity, Infinity, Infinity); +ctx.setTransform(0, Infinity, 0, Infinity, 0, Infinity); +ctx.setTransform(0, Infinity, 0, 0, Infinity, 0); +ctx.setTransform(0, Infinity, 0, 0, Infinity, Infinity); +ctx.setTransform(0, Infinity, 0, 0, 0, Infinity); +ctx.setTransform(0, 0, Infinity, Infinity, 0, 0); +ctx.setTransform(0, 0, Infinity, Infinity, Infinity, 0); +ctx.setTransform(0, 0, Infinity, Infinity, Infinity, Infinity); +ctx.setTransform(0, 0, Infinity, Infinity, 0, Infinity); +ctx.setTransform(0, 0, Infinity, 0, Infinity, 0); +ctx.setTransform(0, 0, Infinity, 0, Infinity, Infinity); +ctx.setTransform(0, 0, Infinity, 0, 0, Infinity); +ctx.setTransform(0, 0, 0, Infinity, Infinity, 0); +ctx.setTransform(0, 0, 0, Infinity, Infinity, Infinity); +ctx.setTransform(0, 0, 0, Infinity, 0, Infinity); +ctx.setTransform(0, 0, 0, 0, Infinity, Infinity); +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, -10, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.nonfinite.worker.js new file mode 100644 index 0000000000..be7e055a85 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.nonfinite.worker.js @@ -0,0 +1,103 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.transformation.setTransform.nonfinite +// Description:setTransform() with Infinity/NaN is ignored +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("setTransform() with Infinity/NaN 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.translate(100, 10); +ctx.setTransform(Infinity, 0, 0, 0, 0, 0); +ctx.setTransform(-Infinity, 0, 0, 0, 0, 0); +ctx.setTransform(NaN, 0, 0, 0, 0, 0); +ctx.setTransform(0, Infinity, 0, 0, 0, 0); +ctx.setTransform(0, -Infinity, 0, 0, 0, 0); +ctx.setTransform(0, NaN, 0, 0, 0, 0); +ctx.setTransform(0, 0, Infinity, 0, 0, 0); +ctx.setTransform(0, 0, -Infinity, 0, 0, 0); +ctx.setTransform(0, 0, NaN, 0, 0, 0); +ctx.setTransform(0, 0, 0, Infinity, 0, 0); +ctx.setTransform(0, 0, 0, -Infinity, 0, 0); +ctx.setTransform(0, 0, 0, NaN, 0, 0); +ctx.setTransform(0, 0, 0, 0, Infinity, 0); +ctx.setTransform(0, 0, 0, 0, -Infinity, 0); +ctx.setTransform(0, 0, 0, 0, NaN, 0); +ctx.setTransform(0, 0, 0, 0, 0, Infinity); +ctx.setTransform(0, 0, 0, 0, 0, -Infinity); +ctx.setTransform(0, 0, 0, 0, 0, NaN); +ctx.setTransform(Infinity, Infinity, 0, 0, 0, 0); +ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, 0); +ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, 0); +ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, 0); +ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, Infinity); +ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, 0); +ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, Infinity); +ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, Infinity); +ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, 0); +ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, 0); +ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, Infinity); +ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, Infinity); +ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, 0); +ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, Infinity); +ctx.setTransform(Infinity, Infinity, 0, 0, 0, Infinity); +ctx.setTransform(Infinity, 0, Infinity, 0, 0, 0); +ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, 0); +ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, 0); +ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, Infinity); +ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, Infinity); +ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, 0); +ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, Infinity); +ctx.setTransform(Infinity, 0, Infinity, 0, 0, Infinity); +ctx.setTransform(Infinity, 0, 0, Infinity, 0, 0); +ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, 0); +ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, Infinity); +ctx.setTransform(Infinity, 0, 0, Infinity, 0, Infinity); +ctx.setTransform(Infinity, 0, 0, 0, Infinity, 0); +ctx.setTransform(Infinity, 0, 0, 0, Infinity, Infinity); +ctx.setTransform(Infinity, 0, 0, 0, 0, Infinity); +ctx.setTransform(0, Infinity, Infinity, 0, 0, 0); +ctx.setTransform(0, Infinity, Infinity, Infinity, 0, 0); +ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, 0); +ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.setTransform(0, Infinity, Infinity, Infinity, 0, Infinity); +ctx.setTransform(0, Infinity, Infinity, 0, Infinity, 0); +ctx.setTransform(0, Infinity, Infinity, 0, Infinity, Infinity); +ctx.setTransform(0, Infinity, Infinity, 0, 0, Infinity); +ctx.setTransform(0, Infinity, 0, Infinity, 0, 0); +ctx.setTransform(0, Infinity, 0, Infinity, Infinity, 0); +ctx.setTransform(0, Infinity, 0, Infinity, Infinity, Infinity); +ctx.setTransform(0, Infinity, 0, Infinity, 0, Infinity); +ctx.setTransform(0, Infinity, 0, 0, Infinity, 0); +ctx.setTransform(0, Infinity, 0, 0, Infinity, Infinity); +ctx.setTransform(0, Infinity, 0, 0, 0, Infinity); +ctx.setTransform(0, 0, Infinity, Infinity, 0, 0); +ctx.setTransform(0, 0, Infinity, Infinity, Infinity, 0); +ctx.setTransform(0, 0, Infinity, Infinity, Infinity, Infinity); +ctx.setTransform(0, 0, Infinity, Infinity, 0, Infinity); +ctx.setTransform(0, 0, Infinity, 0, Infinity, 0); +ctx.setTransform(0, 0, Infinity, 0, Infinity, Infinity); +ctx.setTransform(0, 0, Infinity, 0, 0, Infinity); +ctx.setTransform(0, 0, 0, Infinity, Infinity, 0); +ctx.setTransform(0, 0, 0, Infinity, Infinity, Infinity); +ctx.setTransform(0, 0, 0, Infinity, 0, Infinity); +ctx.setTransform(0, 0, 0, 0, Infinity, Infinity); +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, -10, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.skewed.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.skewed.html new file mode 100644 index 0000000000..40fa8015d4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.skewed.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.transformation.setTransform.skewed</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.setTransform.skewed</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'); + +// Create green with a red square ring inside it +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(20, 10, 60, 30); +ctx.fillStyle = '#0f0'; +ctx.fillRect(40, 20, 20, 10); +// Draw a skewed shape to fill that gap, to make sure it is aligned correctly +ctx.setTransform(1,4, 2,3, 5,6); +// Post-transform coordinates: +// [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]]; +// Hence pre-transform coordinates: +var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2], + [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2], + [-7.4,11.2]]; +ctx.beginPath(); +ctx.moveTo(pts[0][0], pts[0][1]); +for (var i = 0; i < pts.length; ++i) + ctx.lineTo(pts[i][0], pts[i][1]); +ctx.fill(); +_assertPixel(canvas, 21,11, 0,255,0,255); +_assertPixel(canvas, 79,11, 0,255,0,255); +_assertPixel(canvas, 21,39, 0,255,0,255); +_assertPixel(canvas, 79,39, 0,255,0,255); +_assertPixel(canvas, 39,19, 0,255,0,255); +_assertPixel(canvas, 61,19, 0,255,0,255); +_assertPixel(canvas, 39,31, 0,255,0,255); +_assertPixel(canvas, 61,31, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.skewed.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.skewed.worker.js new file mode 100644 index 0000000000..6490f9b709 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.skewed.worker.js @@ -0,0 +1,50 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.transformation.setTransform.skewed +// 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'); + +// Create green with a red square ring inside it +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(20, 10, 60, 30); +ctx.fillStyle = '#0f0'; +ctx.fillRect(40, 20, 20, 10); +// Draw a skewed shape to fill that gap, to make sure it is aligned correctly +ctx.setTransform(1,4, 2,3, 5,6); +// Post-transform coordinates: +// [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]]; +// Hence pre-transform coordinates: +var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2], + [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2], + [-7.4,11.2]]; +ctx.beginPath(); +ctx.moveTo(pts[0][0], pts[0][1]); +for (var i = 0; i < pts.length; ++i) + ctx.lineTo(pts[i][0], pts[i][1]); +ctx.fill(); +_assertPixel(canvas, 21,11, 0,255,0,255); +_assertPixel(canvas, 79,11, 0,255,0,255); +_assertPixel(canvas, 21,39, 0,255,0,255); +_assertPixel(canvas, 79,39, 0,255,0,255); +_assertPixel(canvas, 39,19, 0,255,0,255); +_assertPixel(canvas, 61,19, 0,255,0,255); +_assertPixel(canvas, 39,31, 0,255,0,255); +_assertPixel(canvas, 61,31, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.identity.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.identity.html new file mode 100644 index 0000000000..92753bc9e3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.identity.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.transformation.transform.identity</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.transform.identity</h1> +<p class="desc">transform() with the identity matrix does nothing</p> + + +<script> +var t = async_test("transform() with the identity matrix does 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.transform(1,0, 0,1, 0,0); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.identity.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.identity.worker.js new file mode 100644 index 0000000000..99ac58d49d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.identity.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.transformation.transform.identity +// Description:transform() with the identity matrix does nothing +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("transform() with the identity matrix does 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 = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.transform(1,0, 0,1, 0,0); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.multiply.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.multiply.html new file mode 100644 index 0000000000..f69fa4330a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.multiply.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.transformation.transform.multiply</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.transform.multiply</h1> +<p class="desc">transform() multiplies the CTM</p> + + +<script> +var t = async_test("transform() multiplies the CTM"); +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.transform(1,2, 3,4, 5,6); +ctx.transform(-2,1, 3/2,-1/2, 1,-2); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.multiply.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.multiply.worker.js new file mode 100644 index 0000000000..1a0e702a05 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.multiply.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.transformation.transform.multiply +// Description:transform() multiplies the CTM +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("transform() multiplies the CTM"); +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.transform(1,2, 3,4, 5,6); +ctx.transform(-2,1, 3/2,-1/2, 1,-2); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.nonfinite.html new file mode 100644 index 0000000000..6e679341d5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.nonfinite.html @@ -0,0 +1,107 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.transformation.transform.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.transform.nonfinite</h1> +<p class="desc">transform() with Infinity/NaN is ignored</p> + + +<script> +var t = async_test("transform() with Infinity/NaN 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.translate(100, 10); +ctx.transform(Infinity, 0, 0, 0, 0, 0); +ctx.transform(-Infinity, 0, 0, 0, 0, 0); +ctx.transform(NaN, 0, 0, 0, 0, 0); +ctx.transform(0, Infinity, 0, 0, 0, 0); +ctx.transform(0, -Infinity, 0, 0, 0, 0); +ctx.transform(0, NaN, 0, 0, 0, 0); +ctx.transform(0, 0, Infinity, 0, 0, 0); +ctx.transform(0, 0, -Infinity, 0, 0, 0); +ctx.transform(0, 0, NaN, 0, 0, 0); +ctx.transform(0, 0, 0, Infinity, 0, 0); +ctx.transform(0, 0, 0, -Infinity, 0, 0); +ctx.transform(0, 0, 0, NaN, 0, 0); +ctx.transform(0, 0, 0, 0, Infinity, 0); +ctx.transform(0, 0, 0, 0, -Infinity, 0); +ctx.transform(0, 0, 0, 0, NaN, 0); +ctx.transform(0, 0, 0, 0, 0, Infinity); +ctx.transform(0, 0, 0, 0, 0, -Infinity); +ctx.transform(0, 0, 0, 0, 0, NaN); +ctx.transform(Infinity, Infinity, 0, 0, 0, 0); +ctx.transform(Infinity, Infinity, Infinity, 0, 0, 0); +ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, 0); +ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, 0); +ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, Infinity); +ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, 0); +ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, Infinity); +ctx.transform(Infinity, Infinity, Infinity, 0, 0, Infinity); +ctx.transform(Infinity, Infinity, 0, Infinity, 0, 0); +ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, 0); +ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, Infinity); +ctx.transform(Infinity, Infinity, 0, Infinity, 0, Infinity); +ctx.transform(Infinity, Infinity, 0, 0, Infinity, 0); +ctx.transform(Infinity, Infinity, 0, 0, Infinity, Infinity); +ctx.transform(Infinity, Infinity, 0, 0, 0, Infinity); +ctx.transform(Infinity, 0, Infinity, 0, 0, 0); +ctx.transform(Infinity, 0, Infinity, Infinity, 0, 0); +ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, 0); +ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, Infinity); +ctx.transform(Infinity, 0, Infinity, Infinity, 0, Infinity); +ctx.transform(Infinity, 0, Infinity, 0, Infinity, 0); +ctx.transform(Infinity, 0, Infinity, 0, Infinity, Infinity); +ctx.transform(Infinity, 0, Infinity, 0, 0, Infinity); +ctx.transform(Infinity, 0, 0, Infinity, 0, 0); +ctx.transform(Infinity, 0, 0, Infinity, Infinity, 0); +ctx.transform(Infinity, 0, 0, Infinity, Infinity, Infinity); +ctx.transform(Infinity, 0, 0, Infinity, 0, Infinity); +ctx.transform(Infinity, 0, 0, 0, Infinity, 0); +ctx.transform(Infinity, 0, 0, 0, Infinity, Infinity); +ctx.transform(Infinity, 0, 0, 0, 0, Infinity); +ctx.transform(0, Infinity, Infinity, 0, 0, 0); +ctx.transform(0, Infinity, Infinity, Infinity, 0, 0); +ctx.transform(0, Infinity, Infinity, Infinity, Infinity, 0); +ctx.transform(0, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.transform(0, Infinity, Infinity, Infinity, 0, Infinity); +ctx.transform(0, Infinity, Infinity, 0, Infinity, 0); +ctx.transform(0, Infinity, Infinity, 0, Infinity, Infinity); +ctx.transform(0, Infinity, Infinity, 0, 0, Infinity); +ctx.transform(0, Infinity, 0, Infinity, 0, 0); +ctx.transform(0, Infinity, 0, Infinity, Infinity, 0); +ctx.transform(0, Infinity, 0, Infinity, Infinity, Infinity); +ctx.transform(0, Infinity, 0, Infinity, 0, Infinity); +ctx.transform(0, Infinity, 0, 0, Infinity, 0); +ctx.transform(0, Infinity, 0, 0, Infinity, Infinity); +ctx.transform(0, Infinity, 0, 0, 0, Infinity); +ctx.transform(0, 0, Infinity, Infinity, 0, 0); +ctx.transform(0, 0, Infinity, Infinity, Infinity, 0); +ctx.transform(0, 0, Infinity, Infinity, Infinity, Infinity); +ctx.transform(0, 0, Infinity, Infinity, 0, Infinity); +ctx.transform(0, 0, Infinity, 0, Infinity, 0); +ctx.transform(0, 0, Infinity, 0, Infinity, Infinity); +ctx.transform(0, 0, Infinity, 0, 0, Infinity); +ctx.transform(0, 0, 0, Infinity, Infinity, 0); +ctx.transform(0, 0, 0, Infinity, Infinity, Infinity); +ctx.transform(0, 0, 0, Infinity, 0, Infinity); +ctx.transform(0, 0, 0, 0, Infinity, Infinity); +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, -10, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.nonfinite.worker.js new file mode 100644 index 0000000000..d596fc9744 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.nonfinite.worker.js @@ -0,0 +1,103 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.transformation.transform.nonfinite +// Description:transform() with Infinity/NaN is ignored +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("transform() with Infinity/NaN 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.translate(100, 10); +ctx.transform(Infinity, 0, 0, 0, 0, 0); +ctx.transform(-Infinity, 0, 0, 0, 0, 0); +ctx.transform(NaN, 0, 0, 0, 0, 0); +ctx.transform(0, Infinity, 0, 0, 0, 0); +ctx.transform(0, -Infinity, 0, 0, 0, 0); +ctx.transform(0, NaN, 0, 0, 0, 0); +ctx.transform(0, 0, Infinity, 0, 0, 0); +ctx.transform(0, 0, -Infinity, 0, 0, 0); +ctx.transform(0, 0, NaN, 0, 0, 0); +ctx.transform(0, 0, 0, Infinity, 0, 0); +ctx.transform(0, 0, 0, -Infinity, 0, 0); +ctx.transform(0, 0, 0, NaN, 0, 0); +ctx.transform(0, 0, 0, 0, Infinity, 0); +ctx.transform(0, 0, 0, 0, -Infinity, 0); +ctx.transform(0, 0, 0, 0, NaN, 0); +ctx.transform(0, 0, 0, 0, 0, Infinity); +ctx.transform(0, 0, 0, 0, 0, -Infinity); +ctx.transform(0, 0, 0, 0, 0, NaN); +ctx.transform(Infinity, Infinity, 0, 0, 0, 0); +ctx.transform(Infinity, Infinity, Infinity, 0, 0, 0); +ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, 0); +ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, 0); +ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, Infinity); +ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, 0); +ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, Infinity); +ctx.transform(Infinity, Infinity, Infinity, 0, 0, Infinity); +ctx.transform(Infinity, Infinity, 0, Infinity, 0, 0); +ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, 0); +ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, Infinity); +ctx.transform(Infinity, Infinity, 0, Infinity, 0, Infinity); +ctx.transform(Infinity, Infinity, 0, 0, Infinity, 0); +ctx.transform(Infinity, Infinity, 0, 0, Infinity, Infinity); +ctx.transform(Infinity, Infinity, 0, 0, 0, Infinity); +ctx.transform(Infinity, 0, Infinity, 0, 0, 0); +ctx.transform(Infinity, 0, Infinity, Infinity, 0, 0); +ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, 0); +ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, Infinity); +ctx.transform(Infinity, 0, Infinity, Infinity, 0, Infinity); +ctx.transform(Infinity, 0, Infinity, 0, Infinity, 0); +ctx.transform(Infinity, 0, Infinity, 0, Infinity, Infinity); +ctx.transform(Infinity, 0, Infinity, 0, 0, Infinity); +ctx.transform(Infinity, 0, 0, Infinity, 0, 0); +ctx.transform(Infinity, 0, 0, Infinity, Infinity, 0); +ctx.transform(Infinity, 0, 0, Infinity, Infinity, Infinity); +ctx.transform(Infinity, 0, 0, Infinity, 0, Infinity); +ctx.transform(Infinity, 0, 0, 0, Infinity, 0); +ctx.transform(Infinity, 0, 0, 0, Infinity, Infinity); +ctx.transform(Infinity, 0, 0, 0, 0, Infinity); +ctx.transform(0, Infinity, Infinity, 0, 0, 0); +ctx.transform(0, Infinity, Infinity, Infinity, 0, 0); +ctx.transform(0, Infinity, Infinity, Infinity, Infinity, 0); +ctx.transform(0, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.transform(0, Infinity, Infinity, Infinity, 0, Infinity); +ctx.transform(0, Infinity, Infinity, 0, Infinity, 0); +ctx.transform(0, Infinity, Infinity, 0, Infinity, Infinity); +ctx.transform(0, Infinity, Infinity, 0, 0, Infinity); +ctx.transform(0, Infinity, 0, Infinity, 0, 0); +ctx.transform(0, Infinity, 0, Infinity, Infinity, 0); +ctx.transform(0, Infinity, 0, Infinity, Infinity, Infinity); +ctx.transform(0, Infinity, 0, Infinity, 0, Infinity); +ctx.transform(0, Infinity, 0, 0, Infinity, 0); +ctx.transform(0, Infinity, 0, 0, Infinity, Infinity); +ctx.transform(0, Infinity, 0, 0, 0, Infinity); +ctx.transform(0, 0, Infinity, Infinity, 0, 0); +ctx.transform(0, 0, Infinity, Infinity, Infinity, 0); +ctx.transform(0, 0, Infinity, Infinity, Infinity, Infinity); +ctx.transform(0, 0, Infinity, Infinity, 0, Infinity); +ctx.transform(0, 0, Infinity, 0, Infinity, 0); +ctx.transform(0, 0, Infinity, 0, Infinity, Infinity); +ctx.transform(0, 0, Infinity, 0, 0, Infinity); +ctx.transform(0, 0, 0, Infinity, Infinity, 0); +ctx.transform(0, 0, 0, Infinity, Infinity, Infinity); +ctx.transform(0, 0, 0, Infinity, 0, Infinity); +ctx.transform(0, 0, 0, 0, Infinity, Infinity); +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, -10, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.skewed.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.skewed.html new file mode 100644 index 0000000000..78e1252c67 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.skewed.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.transformation.transform.skewed</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.transform.skewed</h1> +<p class="desc">transform() with skewy matrix transforms correctly</p> + + +<script> +var t = async_test("transform() with skewy matrix transforms 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'); + +// Create green with a red square ring inside it +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(20, 10, 60, 30); +ctx.fillStyle = '#0f0'; +ctx.fillRect(40, 20, 20, 10); +// Draw a skewed shape to fill that gap, to make sure it is aligned correctly +ctx.transform(1,4, 2,3, 5,6); +// Post-transform coordinates: +// [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]]; +// Hence pre-transform coordinates: +var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2], + [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2], + [-7.4,11.2]]; +ctx.beginPath(); +ctx.moveTo(pts[0][0], pts[0][1]); +for (var i = 0; i < pts.length; ++i) + ctx.lineTo(pts[i][0], pts[i][1]); +ctx.fill(); +_assertPixel(canvas, 21,11, 0,255,0,255); +_assertPixel(canvas, 79,11, 0,255,0,255); +_assertPixel(canvas, 21,39, 0,255,0,255); +_assertPixel(canvas, 79,39, 0,255,0,255); +_assertPixel(canvas, 39,19, 0,255,0,255); +_assertPixel(canvas, 61,19, 0,255,0,255); +_assertPixel(canvas, 39,31, 0,255,0,255); +_assertPixel(canvas, 61,31, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.skewed.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.skewed.worker.js new file mode 100644 index 0000000000..46416bb957 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.transform.skewed.worker.js @@ -0,0 +1,50 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.transformation.transform.skewed +// Description:transform() with skewy matrix transforms correctly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("transform() with skewy matrix transforms 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'); + +// Create green with a red square ring inside it +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(20, 10, 60, 30); +ctx.fillStyle = '#0f0'; +ctx.fillRect(40, 20, 20, 10); +// Draw a skewed shape to fill that gap, to make sure it is aligned correctly +ctx.transform(1,4, 2,3, 5,6); +// Post-transform coordinates: +// [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]]; +// Hence pre-transform coordinates: +var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2], + [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2], + [-7.4,11.2]]; +ctx.beginPath(); +ctx.moveTo(pts[0][0], pts[0][1]); +for (var i = 0; i < pts.length; ++i) + ctx.lineTo(pts[i][0], pts[i][1]); +ctx.fill(); +_assertPixel(canvas, 21,11, 0,255,0,255); +_assertPixel(canvas, 79,11, 0,255,0,255); +_assertPixel(canvas, 21,39, 0,255,0,255); +_assertPixel(canvas, 79,39, 0,255,0,255); +_assertPixel(canvas, 39,19, 0,255,0,255); +_assertPixel(canvas, 61,19, 0,255,0,255); +_assertPixel(canvas, 39,31, 0,255,0,255); +_assertPixel(canvas, 61,31, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.translate.basic.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.translate.basic.html new file mode 100644 index 0000000000..8144ab0cc1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.translate.basic.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.transformation.translate.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.transformation.translate.basic</h1> +<p class="desc">translate() works</p> + + +<script> +var t = async_test("translate() 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.translate(100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, -50, 100, 50); +_assertPixel(canvas, 90,40, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.translate.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.translate.basic.worker.js new file mode 100644 index 0000000000..695aff37da --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.translate.basic.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.transformation.translate.basic +// Description:translate() works +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("translate() 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.translate(100, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, -50, 100, 50); +_assertPixel(canvas, 90,40, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.translate.nonfinite.html b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.translate.nonfinite.html new file mode 100644 index 0000000000..4127a7a157 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.translate.nonfinite.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.transformation.translate.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.transformation.translate.nonfinite</h1> +<p class="desc">translate() with Infinity/NaN is ignored</p> + + +<script> +var t = async_test("translate() with Infinity/NaN 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.translate(100, 10); +ctx.translate(Infinity, 0.1); +ctx.translate(-Infinity, 0.1); +ctx.translate(NaN, 0.1); +ctx.translate(0.1, Infinity); +ctx.translate(0.1, -Infinity); +ctx.translate(0.1, NaN); +ctx.translate(Infinity, Infinity); +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, -10, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.translate.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.translate.nonfinite.worker.js new file mode 100644 index 0000000000..84b52a203b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/transformations/2d.transformation.translate.nonfinite.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.transformation.translate.nonfinite +// Description:translate() with Infinity/NaN is ignored +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("translate() with Infinity/NaN 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.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.translate(100, 10); +ctx.translate(Infinity, 0.1); +ctx.translate(-Infinity, 0.1); +ctx.translate(NaN, 0.1); +ctx.translate(0.1, Infinity); +ctx.translate(0.1, -Infinity); +ctx.translate(0.1, NaN); +ctx.translate(Infinity, Infinity); +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, -10, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.p3.html b/testing/web-platform/tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.p3.html new file mode 100644 index 0000000000..fd8385bbf7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.p3.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.color.space.p3.to.p3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.color.space.p3.to.p3</h1> +<p class="desc">test getImageData with display-p3 and uint8 from display p3 uint8 canvas</p> + + +<script> +var t = async_test("test getImageData with display-p3 and uint8 from display p3 uint8 canvas"); +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', {colorSpace: "display-p3"}); + +var color_style = 'rgb(50, 100, 150)'; +// [0.24304, 0.38818, 0.57227, 1.0] * 255 = [62, 99, 146, 255] +var pixel_expected = [62, 99, 146, 255]; +var epsilon = 2; +ctx.fillStyle = color_style; +ctx.fillRect(0, 0, 10, 10); + +var pixel = ctx.getImageData(5, 5, 1, 1, {colorSpace: "display-p3", storageFormat: "uint8"}).data; +_assertSame(pixel.length, pixel_expected.length, "pixel.length", "pixel_expected.length"); +assert_approx_equals(pixel[0], pixel_expected[0], 2); +assert_approx_equals(pixel[1], pixel_expected[1], 2); +assert_approx_equals(pixel[2], pixel_expected[2], 2); +assert_approx_equals(pixel[3], pixel_expected[3], 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.p3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.p3.worker.js new file mode 100644 index 0000000000..c5242daab6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.p3.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.color.space.p3.to.p3 +// Description:test getImageData with display-p3 and uint8 from display p3 uint8 canvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("test getImageData with display-p3 and uint8 from display p3 uint8 canvas"); +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', {colorSpace: "display-p3"}); + +var color_style = 'rgb(50, 100, 150)'; +// [0.24304, 0.38818, 0.57227, 1.0] * 255 = [62, 99, 146, 255] +var pixel_expected = [62, 99, 146, 255]; +var epsilon = 2; +ctx.fillStyle = color_style; +ctx.fillRect(0, 0, 10, 10); + +var pixel = ctx.getImageData(5, 5, 1, 1, {colorSpace: "display-p3", storageFormat: "uint8"}).data; +_assertSame(pixel.length, pixel_expected.length, "pixel.length", "pixel_expected.length"); +assert_approx_equals(pixel[0], pixel_expected[0], 2); +assert_approx_equals(pixel[1], pixel_expected[1], 2); +assert_approx_equals(pixel[2], pixel_expected[2], 2); +assert_approx_equals(pixel[3], pixel_expected[3], 2); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.srgb.html b/testing/web-platform/tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.srgb.html new file mode 100644 index 0000000000..56d771b666 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.srgb.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.color.space.p3.to.srgb</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.color.space.p3.to.srgb</h1> +<p class="desc">test getImageData with srsb and uint8 from display p3 uint8 canvas</p> + + +<script> +var t = async_test("test getImageData with srsb and uint8 from display p3 uint8 canvas"); +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', {colorSpace: "display-p3"}); + +var color_style = 'rgb(50, 100, 150)'; +var pixel_expected = [50, 100, 150, 255]; +var epsilon = 2; +ctx.fillStyle = color_style; +ctx.fillRect(0, 0, 10, 10); + +var pixel = ctx.getImageData(5, 5, 1, 1, {colorSpace: "srgb", storageFormat: "uint8"}).data; +_assertSame(pixel.length, pixel_expected.length, "pixel.length", "pixel_expected.length"); +assert_approx_equals(pixel[0], pixel_expected[0], 2); +assert_approx_equals(pixel[1], pixel_expected[1], 2); +assert_approx_equals(pixel[2], pixel_expected[2], 2); +assert_approx_equals(pixel[3], pixel_expected[3], 2); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.srgb.worker.js b/testing/web-platform/tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.srgb.worker.js new file mode 100644 index 0000000000..3f8fb4b289 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.srgb.worker.js @@ -0,0 +1,34 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.color.space.p3.to.srgb +// Description:test getImageData with srsb and uint8 from display p3 uint8 canvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("test getImageData with srsb and uint8 from display p3 uint8 canvas"); +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', {colorSpace: "display-p3"}); + +var color_style = 'rgb(50, 100, 150)'; +var pixel_expected = [50, 100, 150, 255]; +var epsilon = 2; +ctx.fillStyle = color_style; +ctx.fillRect(0, 0, 10, 10); + +var pixel = ctx.getImageData(5, 5, 1, 1, {colorSpace: "srgb", storageFormat: "uint8"}).data; +_assertSame(pixel.length, pixel_expected.length, "pixel.length", "pixel_expected.length"); +assert_approx_equals(pixel[0], pixel_expected[0], 2); +assert_approx_equals(pixel[1], pixel_expected[1], 2); +assert_approx_equals(pixel[2], pixel_expected[2], 2); +assert_approx_equals(pixel[3], pixel_expected[3], 2); +t.done(); + +}); +done(); |