diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas')
58 files changed, 2370 insertions, 0 deletions
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..7f1f66654d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.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.3arg</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.3arg</h1> +<p class="desc"></p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.drawImage(bitmap_green, 0, 0); + ctx.drawImage(bitmap_red, -100, 0); + ctx.drawImage(bitmap_red, 100, 0); + ctx.drawImage(bitmap_red, 0, -50); + ctx.drawImage(bitmap_red, 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); + +}, ""); +</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..b2f860bc60 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.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.drawImage.3arg +// Description: +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.drawImage(bitmap_green, 0, 0); + ctx.drawImage(bitmap_red, -100, 0); + ctx.drawImage(bitmap_red, 100, 0); + ctx.drawImage(bitmap_red, 0, -50); + ctx.drawImage(bitmap_red, 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.done(); +}, ""); +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..f7bf0568c4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.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.5arg</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.5arg</h1> +<p class="desc"></p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.drawImage(bitmap_green, 50, 0, 50, 50); + ctx.drawImage(bitmap_red, 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); + +}, ""); +</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..f725acf011 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.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.5arg +// Description: +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.drawImage(bitmap_green, 50, 0, 50, 50); + ctx.drawImage(bitmap_red, 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.done(); +}, ""); +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..47e442e23e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.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.drawImage.9arg.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.drawImage.9arg.basic</h1> +<p class="desc"></p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/green.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + 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); + +}, ""); +</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..b2d6f7d860 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.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.drawImage.9arg.basic +// Description: +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/green.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + 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.done(); +}, ""); +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..5e0f3f1088 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.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.9arg.destpos</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.9arg.destpos</h1> +<p class="desc"></p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.drawImage(bitmap_green, 0, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap_green, 0, 0, 100, 50, -100, 0, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 100, 0, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, -50, 100, 50); + ctx.drawImage(bitmap_red, 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); + +}, ""); +</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..380d526f9b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.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.drawImage.9arg.destpos +// Description: +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.drawImage(bitmap_green, 0, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap_green, 0, 0, 100, 50, -100, 0, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 100, 0, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, -50, 100, 50); + ctx.drawImage(bitmap_red, 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.done(); +}, ""); +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..93b587a44f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.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.drawImage.9arg.destsize</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.9arg.destsize</h1> +<p class="desc"></p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.drawImage(bitmap_green, 1, 1, 1, 1, 0, 0, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, -50, 0, 50, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 100, 0, 50, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, -25, 100, 25); + ctx.drawImage(bitmap_red, 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); + +}, ""); +</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..76e3e8baaf --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.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.drawImage.9arg.destsize +// Description: +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.drawImage(bitmap_green, 1, 1, 1, 1, 0, 0, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, -50, 0, 50, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 100, 0, 50, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, -25, 100, 25); + ctx.drawImage(bitmap_red, 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.done(); +}, ""); +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..e822ab43fa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.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.drawImage.9arg.sourcepos</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.9arg.sourcepos</h1> +<p class="desc"></p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/rgrg-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + 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); + +}, ""); +</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..d3525435fa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.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.drawImage.9arg.sourcepos +// Description: +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/rgrg-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + 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.done(); +}, ""); +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..b99ca58768 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.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.9arg.sourcesize</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.9arg.sourcesize</h1> +<p class="desc"></p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/rgrg-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + 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); + +}, ""); +</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..aa15efb705 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.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.drawImage.9arg.sourcesize +// Description: +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/rgrg-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + 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.done(); +}, ""); +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..a95f3ece7a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.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.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.drawImage.alpha</h1> +<p class="desc"></p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalAlpha = 0; + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + +}, ""); +</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..958a2431b6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.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.alpha +// Description: +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalAlpha = 0; + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 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.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..eccf14bfd0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.animated.poster.html @@ -0,0 +1,26 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.drawImage.animated.poster</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.animated.poster</h1> +<p class="desc">drawImage() of an APNG draws the poster frame</p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + const response = await fetch('/images/anim-poster-gr.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + +}, "drawImage() of an APNG draws the poster frame"); +</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..542c9382f6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.animated.poster.worker.js @@ -0,0 +1,22 @@ +// 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"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + const response = await fetch('/images/anim-poster-gr.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); +}, "drawImage() of an APNG draws the poster frame"); +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..a2afa05f01 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.html @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.drawImage.broken</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.broken</h1> +<p class="desc"></p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + const response = await fetch('/images/broken.png'); + const blob = await response.blob(); + + await promise_rejects_dom(t, 'InvalidStateError', createImageBitmap(blob), 'The source image could not be decoded.'); + +}, ""); +</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..dc695b5459 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.worker.js @@ -0,0 +1,20 @@ +// 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"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + const response = await fetch('/images/broken.png'); + const blob = await response.blob(); + + await promise_rejects_dom(t, 'InvalidStateError', createImageBitmap(blob), 'The source image could not be decoded.'); + t.done(); +}, ""); +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..e5eeedea6e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.canvas.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.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.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..1f18cd7723 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.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.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..a828039b7b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.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.drawImage.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.drawImage.clip</h1> +<p class="desc"></p> + + +<script> +promise_test(async t => { + + 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(); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.rect(-10, -10, 1, 1); + ctx.clip(); + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + +}, ""); +</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..fea2a7bac7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.drawImage.clip +// Description: +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +promise_test(async t => { + + 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(); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.rect(-10, -10, 1, 1); + ctx.clip(); + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 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.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..b32b5a12ed --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.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.composite</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.composite</h1> +<p class="desc"></p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'destination-over'; + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + +}, ""); +</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..0b17673b68 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.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.composite +// Description: +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'destination-over'; + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 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.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..e201082e35 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.drawImage.floatsource</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.floatsource</h1> +<p class="desc"></p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + const response = await fetch('/images/green.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 10.1, 10.1, 0.1, 0.1, 0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + +}, ""); +</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..1efc17d04d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.worker.js @@ -0,0 +1,21 @@ +// 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"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + const response = await fetch('/images/green.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + 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.done(); +}, ""); +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..3e43a772c6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.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.negativedest</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.negativedest</h1> +<p class="desc">Negative destination width/height represents the correct rectangle</p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/ggrr-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + 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); + +}, "Negative destination width/height represents the correct rectangle"); +</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..ce5cf5efad --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.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.drawImage.negativedest +// Description:Negative destination width/height represents the correct rectangle +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/ggrr-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + 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.done(); +}, "Negative destination width/height represents the correct rectangle"); +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..347b634cfd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.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.negativedir</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.negativedir</h1> +<p class="desc">Negative dimensions do not affect the direction of the image</p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/ggrr-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + 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); + +}, "Negative dimensions do not affect the direction of the image"); +</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..c82b9ba1be --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.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.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"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/ggrr-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + 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.done(); +}, "Negative dimensions do not affect the direction of the image"); +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..3e18725720 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.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.negativesource</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.negativesource</h1> +<p class="desc">Negative source width/height represents the correct rectangle</p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/ggrr-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + 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); + +}, "Negative source width/height represents the correct rectangle"); +</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..f92d15774d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.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.drawImage.negativesource +// Description:Negative source width/height represents the correct rectangle +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/ggrr-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + 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.done(); +}, "Negative source width/height represents the correct rectangle"); +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..93dccd3d4e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.html @@ -0,0 +1,328 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.drawImage.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.drawImage.nonfinite</h1> +<p class="desc">drawImage() with Infinity/NaN is ignored</p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/redtransparent.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + 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); + +}, "drawImage() with Infinity/NaN is ignored"); +</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..a56f09e0b2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.worker.js @@ -0,0 +1,324 @@ +// 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"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/redtransparent.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + 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.done(); +}, "drawImage() with Infinity/NaN is ignored"); +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..1182baec3b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.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.drawImage.nowrap</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.nowrap</h1> +<p class="desc">Stretched images do not get pixels wrapping around the edges</p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/redtransparent.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + 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); + +}, "Stretched images do not get pixels wrapping around the edges"); +</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..47a77834c0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.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.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"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/redtransparent.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + 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.done(); +}, "Stretched images do not get pixels wrapping around the edges"); +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..7a8338b353 --- /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..329abd2221 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.null.worker.js @@ -0,0 +1,22 @@ +// 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..063353c11f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.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.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.drawImage.path</h1> +<p class="desc"></p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.rect(0, 0, 100, 50); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + ctx.fill(); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + +}, ""); +</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..3259ff0258 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.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.path +// Description: +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.rect(0, 0, 100, 50); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + ctx.fill(); + _assertPixelApprox(canvas, 50,25, 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.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..c5e51c2772 --- /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..a9af88d13a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.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.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..ac67476966 --- /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..802d2d8c52 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.2.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.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..50aeabd286 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.svg.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.drawImage.svg</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.svg</h1> +<p class="desc">drawImage() of an SVG image</p> + + +<script> +promise_test(async t => { + + 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); + }); + }); + +}, "drawImage() of an SVG image"); +</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..a15371db39 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.svg.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.drawImage.svg +// Description:drawImage() of an SVG image +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +promise_test(async t => { + + 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.done(); +}, "drawImage() of an SVG image"); +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..ca148c1a68 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.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.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.drawImage.transform</h1> +<p class="desc"></p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.translate(100, 0); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + +}, ""); +</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..4a4cd07be9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.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.transform +// Description: +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.translate(100, 0); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 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.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..96906e8fc3 --- /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..176e418d64 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.wrongtype.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.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..a30c300730 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.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.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.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..41346ad328 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.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.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..0239c5356d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.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.zerosource</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.zerosource</h1> +<p class="desc">drawImage with zero-sized source rectangle draws nothing without exception</p> + + +<script> +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + 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); + +}, "drawImage with zero-sized source rectangle draws nothing without exception"); +</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..4941d37347 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.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.zerosource.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.drawImage.zerosource.image</h1> +<p class="desc">drawImage with zero-sized source rectangle from image draws nothing without exception</p> + + +<script> +promise_test(async t => { + + 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); + _assertPixel(canvas, 50,25, 0,255,0,255); + }); + }); + +}, "drawImage with zero-sized source rectangle from image draws nothing without exception"); +</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..a3182c9b73 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.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.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"); + +promise_test(async t => { + + 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); + _assertPixel(canvas, 50,25, 0,255,0,255); + }); + }); + t.done(); +}, "drawImage with zero-sized source rectangle from image draws nothing without exception"); +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..a80bfff562 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.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.zerosource +// Description:drawImage with zero-sized source rectangle draws nothing without exception +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + 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.done(); +}, "drawImage with zero-sized source rectangle draws nothing without exception"); +done(); |