diff options
Diffstat (limited to 'testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas')
89 files changed, 2621 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.js new file mode 100644 index 0000000000..8c4e7cfe96 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d-getcontext-options.any.js @@ -0,0 +1,41 @@ +test(() => { + const expected = [ + "alpha", + "colorSpace", + "colorSpace toString", + "desynchronized", + "willReadFrequently", + ]; + var actual = []; + const options = { + get alpha() { + actual.push("alpha"); + return true; + }, + get willReadFrequently() { + actual.push("willReadFrequently"); + return false; + }, + get desynchronized() { + actual.push("desynchronized"); + return false; + }, + get colorSpace() { + actual.push("colorSpace"); + return { + toString() { + actual.push("colorSpace toString"); + return "srgb"; + } + }; + }, + }; + + const canvas = new OffscreenCanvas(100, 50); + const context = canvas.getContext('2d', options); + assert_not_equals(context, null, "context"); + assert_array_equals(actual, expected, "order of operations (creation)"); + actual = []; + assert_equals(canvas.getContext('2d', options), context, "cached context"); + assert_array_equals(actual, expected, "order of operations (caching)"); +}); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.readonly.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.readonly.html new file mode 100644 index 0000000000..ec6ffe5292 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.readonly.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.canvas.readonly</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.canvas.readonly</h1> +<p class="desc">canvas is readonly</p> + + +<script> +var t = async_test("canvas is readonly"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var d = ctx.canvas; +_assertDifferent(offscreenCanvas2, d, "offscreenCanvas2", "d"); +ctx.canvas = offscreenCanvas2; +_assertSame(ctx.canvas, d, "ctx.canvas", "d"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.readonly.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.readonly.worker.js new file mode 100644 index 0000000000..8f88efd6dc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.readonly.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.canvas.readonly +// Description:canvas is readonly +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("canvas is readonly"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +var d = ctx.canvas; +_assertDifferent(offscreenCanvas2, d, "offscreenCanvas2", "d"); +ctx.canvas = offscreenCanvas2; +_assertSame(ctx.canvas, d, "ctx.canvas", "d"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.reference.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.reference.html new file mode 100644 index 0000000000..024b1fe7d5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.reference.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.canvas.reference</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.canvas.reference</h1> +<p class="desc">canvas refers back to its canvas</p> + + +<script> +var t = async_test("canvas refers back to its canvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +_assertSame(ctx.canvas, canvas, "ctx.canvas", "canvas"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.reference.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.reference.worker.js new file mode 100644 index 0000000000..a80e559053 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.canvas.reference.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.canvas.reference +// Description:canvas refers back to its canvas +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("canvas refers back to its canvas"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +_assertSame(ctx.canvas, canvas, "ctx.canvas", "canvas"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.exists.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.exists.html new file mode 100644 index 0000000000..55bdf1cc19 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.exists.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.getcontext.exists</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.getcontext.exists</h1> +<p class="desc">The 2D context is implemented</p> + + +<script> +var t = async_test("The 2D context is implemented"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +_assertDifferent(offscreenCanvas2.getContext('2d'), null, "offscreenCanvas2.getContext('2d')", "null"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.exists.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.exists.worker.js new file mode 100644 index 0000000000..97f8cc745b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.exists.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.getcontext.exists +// Description:The 2D context is implemented +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("The 2D context is implemented"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +_assertDifferent(offscreenCanvas2.getContext('2d'), null, "offscreenCanvas2.getContext('2d')", "null"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.html new file mode 100644 index 0000000000..a57dbcb655 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.getcontext.extraargs.cache</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.getcontext.extraargs.cache</h1> +<p class="desc">The 2D context doesn't throw with extra getContext arguments (cached)</p> + + +<script> +var t = async_test("The 2D context doesn't throw with extra getContext arguments (cached)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +_assertDifferent(canvas.getContext('2d', false, {}, [], 1, "2"), null, "canvas.getContext('2d', false, {}, [], 1, \"2\")", "null"); +_assertDifferent(canvas.getContext('2d', 123), null, "canvas.getContext('2d', 123)", "null"); +_assertDifferent(canvas.getContext('2d', "test"), null, "canvas.getContext('2d', \"test\")", "null"); +_assertDifferent(canvas.getContext('2d', undefined), null, "canvas.getContext('2d', undefined)", "null"); +_assertDifferent(canvas.getContext('2d', null), null, "canvas.getContext('2d', null)", "null"); +_assertDifferent(canvas.getContext('2d', Symbol.hasInstance), null, "canvas.getContext('2d', Symbol.hasInstance)", "null"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker.js new file mode 100644 index 0000000000..df330e301b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.cache.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.getcontext.extraargs.cache +// Description:The 2D context doesn't throw with extra getContext arguments (cached) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("The 2D context doesn't throw with extra getContext arguments (cached)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +_assertDifferent(canvas.getContext('2d', false, {}, [], 1, "2"), null, "canvas.getContext('2d', false, {}, [], 1, \"2\")", "null"); +_assertDifferent(canvas.getContext('2d', 123), null, "canvas.getContext('2d', 123)", "null"); +_assertDifferent(canvas.getContext('2d', "test"), null, "canvas.getContext('2d', \"test\")", "null"); +_assertDifferent(canvas.getContext('2d', undefined), null, "canvas.getContext('2d', undefined)", "null"); +_assertDifferent(canvas.getContext('2d', null), null, "canvas.getContext('2d', null)", "null"); +_assertDifferent(canvas.getContext('2d', Symbol.hasInstance), null, "canvas.getContext('2d', Symbol.hasInstance)", "null"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.html new file mode 100644 index 0000000000..a626318791 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.getcontext.extraargs.create</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.getcontext.extraargs.create</h1> +<p class="desc">The 2D context doesn't throw with extra getContext arguments (new context)</p> + + +<script> +var t = async_test("The 2D context doesn't throw with extra getContext arguments (new context)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', false, {}, [], 1, "2"), null, "(new OffscreenCanvas(100, 50)).getContext('2d', false, {}, [], 1, \"2\")", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', 123), null, "(new OffscreenCanvas(100, 50)).getContext('2d', 123)", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', "test"), null, "(new OffscreenCanvas(100, 50)).getContext('2d', \"test\")", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', undefined), null, "(new OffscreenCanvas(100, 50)).getContext('2d', undefined)", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', null), null, "(new OffscreenCanvas(100, 50)).getContext('2d', null)", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', Symbol.hasInstance), null, "(new OffscreenCanvas(100, 50)).getContext('2d', Symbol.hasInstance)", "null"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker.js new file mode 100644 index 0000000000..f34c5a1d0e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.extraargs.create.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.getcontext.extraargs.create +// Description:The 2D context doesn't throw with extra getContext arguments (new context) +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("The 2D context doesn't throw with extra getContext arguments (new context)"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', false, {}, [], 1, "2"), null, "(new OffscreenCanvas(100, 50)).getContext('2d', false, {}, [], 1, \"2\")", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', 123), null, "(new OffscreenCanvas(100, 50)).getContext('2d', 123)", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', "test"), null, "(new OffscreenCanvas(100, 50)).getContext('2d', \"test\")", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', undefined), null, "(new OffscreenCanvas(100, 50)).getContext('2d', undefined)", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', null), null, "(new OffscreenCanvas(100, 50)).getContext('2d', null)", "null"); +_assertDifferent((new OffscreenCanvas(100, 50)).getContext('2d', Symbol.hasInstance), null, "(new OffscreenCanvas(100, 50)).getContext('2d', Symbol.hasInstance)", "null"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.shared.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.shared.html new file mode 100644 index 0000000000..6d6162528a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.shared.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.getcontext.shared</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.getcontext.shared</h1> +<p class="desc">getContext('2d') returns objects which share canvas state</p> + + +<script> +var t = async_test("getContext('2d') returns objects which share canvas state"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var ctx2 = canvas.getContext('2d'); +ctx.fillStyle = '#f00'; +ctx2.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.shared.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.shared.worker.js new file mode 100644 index 0000000000..4b8dd52e61 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.shared.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.getcontext.shared +// Description:getContext('2d') returns objects which share canvas state +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getContext('2d') returns objects which share canvas state"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var ctx2 = canvas.getContext('2d'); +ctx.fillStyle = '#f00'; +ctx2.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.unique.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.unique.html new file mode 100644 index 0000000000..c7e71da63a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.unique.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.getcontext.unique</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.getcontext.unique</h1> +<p class="desc">getContext('2d') returns the same object</p> + + +<script> +var t = async_test("getContext('2d') returns the same object"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +_assertSame(offscreenCanvas2.getContext('2d'), offscreenCanvas2.getContext('2d'), "offscreenCanvas2.getContext('2d')", "offscreenCanvas2.getContext('2d')"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.unique.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.unique.worker.js new file mode 100644 index 0000000000..a2a744df61 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/2d.getcontext.unique.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.getcontext.unique +// Description:getContext('2d') returns the same object +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getContext('2d') returns the same object"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +_assertSame(offscreenCanvas2.getContext('2d'), offscreenCanvas2.getContext('2d'), "offscreenCanvas2.getContext('2d')", "offscreenCanvas2.getContext('2d')"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.arguments.missing.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.arguments.missing.html new file mode 100644 index 0000000000..b69f63cdfb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.arguments.missing.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: context.arguments.missing</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>context.arguments.missing</h1> +<p class="desc"></p> + + +<script> +var t = async_test(""); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext(); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.arguments.missing.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.arguments.missing.worker.js new file mode 100644 index 0000000000..f03ca52328 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.arguments.missing.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:context.arguments.missing +// Description: +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test(""); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext(); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.casesensitive.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.casesensitive.html new file mode 100644 index 0000000000..e7ee0c63ba --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.casesensitive.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: context.casesensitive</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>context.casesensitive</h1> +<p class="desc">Context name "2D" is unrecognised; matching is case sensitive</p> + + +<script> +var t = async_test("Context name \"2D\" is unrecognised; matching is case sensitive"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext('2D'); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.casesensitive.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.casesensitive.worker.js new file mode 100644 index 0000000000..265fe959d2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.casesensitive.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:context.casesensitive +// Description:Context name "2D" is unrecognised; matching is case sensitive +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Context name \"2D\" is unrecognised; matching is case sensitive"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext('2D'); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.emptystring.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.emptystring.html new file mode 100644 index 0000000000..c8f8943d9e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.emptystring.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: context.emptystring</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>context.emptystring</h1> +<p class="desc">getContext with empty string returns null</p> + + +<script> +var t = async_test("getContext with empty string returns null"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext(""); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.emptystring.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.emptystring.worker.js new file mode 100644 index 0000000000..45612d386c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.emptystring.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:context.emptystring +// Description:getContext with empty string returns null +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getContext with empty string returns null"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext(""); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badname.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badname.html new file mode 100644 index 0000000000..d1b0f2fd17 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badname.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: context.unrecognised.badname</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>context.unrecognised.badname</h1> +<p class="desc">getContext with unrecognised context name returns null</p> + + +<script> +var t = async_test("getContext with unrecognised context name returns null"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext('This is not an implemented context in any real browser'); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badname.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badname.worker.js new file mode 100644 index 0000000000..cc50c2bdbd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badname.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:context.unrecognised.badname +// Description:getContext with unrecognised context name returns null +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("getContext with unrecognised context name returns null"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext('This is not an implemented context in any real browser'); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badsuffix.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badsuffix.html new file mode 100644 index 0000000000..30178af927 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badsuffix.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: context.unrecognised.badsuffix</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>context.unrecognised.badsuffix</h1> +<p class="desc">Context name "2d" plus a suffix is unrecognised</p> + + +<script> +var t = async_test("Context name \"2d\" plus a suffix is unrecognised"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext("2d#"); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badsuffix.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badsuffix.worker.js new file mode 100644 index 0000000000..7b3d8a09c8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.badsuffix.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:context.unrecognised.badsuffix +// Description:Context name "2d" plus a suffix is unrecognised +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Context name \"2d\" plus a suffix is unrecognised"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext("2d#"); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.nullsuffix.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.nullsuffix.html new file mode 100644 index 0000000000..2a22549baa --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.nullsuffix.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: context.unrecognised.nullsuffix</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>context.unrecognised.nullsuffix</h1> +<p class="desc">Context name "2d" plus a "\0" suffix is unrecognised</p> + + +<script> +var t = async_test("Context name \"2d\" plus a \"\\0\" suffix is unrecognised"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext("2d\0"); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.nullsuffix.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.nullsuffix.worker.js new file mode 100644 index 0000000000..b6594100f6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.nullsuffix.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:context.unrecognised.nullsuffix +// Description:Context name "2d" plus a "\0" suffix is unrecognised +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Context name \"2d\" plus a \"\\0\" suffix is unrecognised"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext("2d\0"); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.unicode.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.unicode.html new file mode 100644 index 0000000000..0c826595fe --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.unicode.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: context.unrecognised.unicode</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>context.unrecognised.unicode</h1> +<p class="desc">Context name which kind of looks like "2d" is unrecognised</p> + + +<script> +var t = async_test("Context name which kind of looks like \"2d\" is unrecognised"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext("2\uFF44"); }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.unicode.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.unicode.worker.js new file mode 100644 index 0000000000..cade5a20b5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/context.unrecognised.unicode.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:context.unrecognised.unicode +// Description:Context name which kind of looks like "2d" is unrecognised +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Context name which kind of looks like \"2d\" is unrecognised"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var offscreenCanvas2 = new OffscreenCanvas(100, 50); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext("2\uFF44"); }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.color.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.color.html new file mode 100644 index 0000000000..bfdcef7c4f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.color.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: initial.color</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>initial.color</h1> +<p class="desc">Initial state is transparent black</p> + + +<script> +var t = async_test("Initial state is transparent black"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +_assertPixel(canvas, 20,20, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.color.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.color.worker.js new file mode 100644 index 0000000000..2a6e6e576c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.color.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:initial.color +// Description:Initial state is transparent black +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Initial state is transparent black"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +_assertPixel(canvas, 20,20, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.2dstate.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.2dstate.html new file mode 100644 index 0000000000..76b76070d4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.2dstate.html @@ -0,0 +1,88 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: initial.reset.2dstate</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>initial.reset.2dstate</h1> +<p class="desc">Resetting the canvas state resets 2D state variables</p> + + +<script> +var t = async_test("Resetting the canvas state resets 2D state variables"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 100; +var default_val; + +default_val = ctx.strokeStyle; +ctx.strokeStyle = "#ff0000"; +canvas.width = 100; +_assertSame(ctx.strokeStyle, default_val, "ctx.strokeStyle", "default_val"); + +default_val = ctx.fillStyle; +ctx.fillStyle = "#ff0000"; +canvas.width = 100; +_assertSame(ctx.fillStyle, default_val, "ctx.fillStyle", "default_val"); + +default_val = ctx.globalAlpha; +ctx.globalAlpha = 0.5; +canvas.width = 100; +_assertSame(ctx.globalAlpha, default_val, "ctx.globalAlpha", "default_val"); + +default_val = ctx.lineWidth; +ctx.lineWidth = 0.5; +canvas.width = 100; +_assertSame(ctx.lineWidth, default_val, "ctx.lineWidth", "default_val"); + +default_val = ctx.lineCap; +ctx.lineCap = "round"; +canvas.width = 100; +_assertSame(ctx.lineCap, default_val, "ctx.lineCap", "default_val"); + +default_val = ctx.lineJoin; +ctx.lineJoin = "round"; +canvas.width = 100; +_assertSame(ctx.lineJoin, default_val, "ctx.lineJoin", "default_val"); + +default_val = ctx.miterLimit; +ctx.miterLimit = 0.5; +canvas.width = 100; +_assertSame(ctx.miterLimit, default_val, "ctx.miterLimit", "default_val"); + +default_val = ctx.shadowOffsetX; +ctx.shadowOffsetX = 5; +canvas.width = 100; +_assertSame(ctx.shadowOffsetX, default_val, "ctx.shadowOffsetX", "default_val"); + +default_val = ctx.shadowOffsetY; +ctx.shadowOffsetY = 5; +canvas.width = 100; +_assertSame(ctx.shadowOffsetY, default_val, "ctx.shadowOffsetY", "default_val"); + +default_val = ctx.shadowBlur; +ctx.shadowBlur = 5; +canvas.width = 100; +_assertSame(ctx.shadowBlur, default_val, "ctx.shadowBlur", "default_val"); + +default_val = ctx.shadowColor; +ctx.shadowColor = "#ff0000"; +canvas.width = 100; +_assertSame(ctx.shadowColor, default_val, "ctx.shadowColor", "default_val"); + +default_val = ctx.globalCompositeOperation; +ctx.globalCompositeOperation = "copy"; +canvas.width = 100; +_assertSame(ctx.globalCompositeOperation, default_val, "ctx.globalCompositeOperation", "default_val"); + +t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.2dstate.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.2dstate.worker.js new file mode 100644 index 0000000000..273c5f0bd6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.2dstate.worker.js @@ -0,0 +1,84 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:initial.reset.2dstate +// Description:Resetting the canvas state resets 2D state variables +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Resetting the canvas state resets 2D state variables"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 100; +var default_val; + +default_val = ctx.strokeStyle; +ctx.strokeStyle = "#ff0000"; +canvas.width = 100; +_assertSame(ctx.strokeStyle, default_val, "ctx.strokeStyle", "default_val"); + +default_val = ctx.fillStyle; +ctx.fillStyle = "#ff0000"; +canvas.width = 100; +_assertSame(ctx.fillStyle, default_val, "ctx.fillStyle", "default_val"); + +default_val = ctx.globalAlpha; +ctx.globalAlpha = 0.5; +canvas.width = 100; +_assertSame(ctx.globalAlpha, default_val, "ctx.globalAlpha", "default_val"); + +default_val = ctx.lineWidth; +ctx.lineWidth = 0.5; +canvas.width = 100; +_assertSame(ctx.lineWidth, default_val, "ctx.lineWidth", "default_val"); + +default_val = ctx.lineCap; +ctx.lineCap = "round"; +canvas.width = 100; +_assertSame(ctx.lineCap, default_val, "ctx.lineCap", "default_val"); + +default_val = ctx.lineJoin; +ctx.lineJoin = "round"; +canvas.width = 100; +_assertSame(ctx.lineJoin, default_val, "ctx.lineJoin", "default_val"); + +default_val = ctx.miterLimit; +ctx.miterLimit = 0.5; +canvas.width = 100; +_assertSame(ctx.miterLimit, default_val, "ctx.miterLimit", "default_val"); + +default_val = ctx.shadowOffsetX; +ctx.shadowOffsetX = 5; +canvas.width = 100; +_assertSame(ctx.shadowOffsetX, default_val, "ctx.shadowOffsetX", "default_val"); + +default_val = ctx.shadowOffsetY; +ctx.shadowOffsetY = 5; +canvas.width = 100; +_assertSame(ctx.shadowOffsetY, default_val, "ctx.shadowOffsetY", "default_val"); + +default_val = ctx.shadowBlur; +ctx.shadowBlur = 5; +canvas.width = 100; +_assertSame(ctx.shadowBlur, default_val, "ctx.shadowBlur", "default_val"); + +default_val = ctx.shadowColor; +ctx.shadowColor = "#ff0000"; +canvas.width = 100; +_assertSame(ctx.shadowColor, default_val, "ctx.shadowColor", "default_val"); + +default_val = ctx.globalCompositeOperation; +ctx.globalCompositeOperation = "copy"; +canvas.width = 100; +_assertSame(ctx.globalCompositeOperation, default_val, "ctx.globalCompositeOperation", "default_val"); + +t.done(); +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.clip.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.clip.html new file mode 100644 index 0000000000..87a3e43be4 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.clip.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: initial.reset.clip</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>initial.reset.clip</h1> +<p class="desc">Resetting the canvas state resets the current clip region</p> + + +<script> +var t = async_test("Resetting the canvas state resets the current clip region"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 100; +ctx.rect(0, 0, 1, 1); +ctx.clip(); +canvas.width = 100; +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 20,20, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.clip.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.clip.worker.js new file mode 100644 index 0000000000..45ee30d080 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.clip.worker.js @@ -0,0 +1,29 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:initial.reset.clip +// Description:Resetting the canvas state resets the current clip region +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Resetting the canvas state resets the current clip region"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 100; +ctx.rect(0, 0, 1, 1); +ctx.clip(); +canvas.width = 100; +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 20,20, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.different.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.different.html new file mode 100644 index 0000000000..632bc2fd69 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.different.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: initial.reset.different</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>initial.reset.different</h1> +<p class="desc">Changing size resets canvas to transparent black</p> + + +<script> +var t = async_test("Changing size resets canvas to transparent black"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 20,20, 255,0,0,255); +canvas.width = 50; +_assertPixel(canvas, 20,20, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.different.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.different.worker.js new file mode 100644 index 0000000000..9d840a5963 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.different.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:initial.reset.different +// Description:Changing size resets canvas to transparent black +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Changing size resets canvas to transparent black"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 20,20, 255,0,0,255); +canvas.width = 50; +_assertPixel(canvas, 20,20, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.gradient.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.gradient.html new file mode 100644 index 0000000000..96819a07d3 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.gradient.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: initial.reset.gradient</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>initial.reset.gradient</h1> +<p class="desc">Resetting the canvas state does not invalidate any existing gradients</p> + + +<script> +var t = async_test("Resetting the canvas state does not invalidate any existing gradients"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 50; +var g = ctx.createLinearGradient(0, 0, 100, 0); +g.addColorStop(0, '#0f0'); +g.addColorStop(1, '#0f0'); +canvas.width = 100; +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.gradient.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.gradient.worker.js new file mode 100644 index 0000000000..a18d11e86a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.gradient.worker.js @@ -0,0 +1,32 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:initial.reset.gradient +// Description:Resetting the canvas state does not invalidate any existing gradients +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Resetting the canvas state does not invalidate any existing gradients"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 50; +var g = ctx.createLinearGradient(0, 0, 100, 0); +g.addColorStop(0, '#0f0'); +g.addColorStop(1, '#0f0'); +canvas.width = 100; +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.path.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.path.html new file mode 100644 index 0000000000..3c9667ca5c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.path.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: initial.reset.path</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>initial.reset.path</h1> +<p class="desc">Resetting the canvas state resets the current path</p> + + +<script> +var t = async_test("Resetting the canvas state resets the current path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 100; +ctx.rect(0, 0, 100, 50); +canvas.width = 100; +ctx.fillStyle = '#f00'; +ctx.fill(); +_assertPixel(canvas, 20,20, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.path.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.path.worker.js new file mode 100644 index 0000000000..9f34734a58 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.path.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:initial.reset.path +// Description:Resetting the canvas state resets the current path +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Resetting the canvas state resets the current path"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 100; +ctx.rect(0, 0, 100, 50); +canvas.width = 100; +ctx.fillStyle = '#f00'; +ctx.fill(); +_assertPixel(canvas, 20,20, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.pattern.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.pattern.html new file mode 100644 index 0000000000..3766795ba9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.pattern.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: initial.reset.pattern</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>initial.reset.pattern</h1> +<p class="desc">Resetting the canvas state does not invalidate any existing patterns</p> + + +<script> +var t = async_test("Resetting the canvas state does not invalidate any existing patterns"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 30; +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 30, 50); +var p = ctx.createPattern(canvas, 'repeat-x'); +canvas.width = 100; +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = p; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.pattern.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.pattern.worker.js new file mode 100644 index 0000000000..1fe6c01e2d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.pattern.worker.js @@ -0,0 +1,32 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:initial.reset.pattern +// Description:Resetting the canvas state does not invalidate any existing patterns +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Resetting the canvas state does not invalidate any existing patterns"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 30; +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 30, 50); +var p = ctx.createPattern(canvas, 'repeat-x'); +canvas.width = 100; +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = p; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.same.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.same.html new file mode 100644 index 0000000000..bfcf05013e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.same.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: initial.reset.same</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>initial.reset.same</h1> +<p class="desc">Setting size (not changing the value) resets canvas to transparent black</p> + + +<script> +var t = async_test("Setting size (not changing the value) resets canvas to transparent black"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 100; +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 20,20, 255,0,0,255); +canvas.width = 100; +_assertPixel(canvas, 20,20, 0,0,0,0); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.same.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.same.worker.js new file mode 100644 index 0000000000..00db682f70 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.same.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:initial.reset.same +// Description:Setting size (not changing the value) resets canvas to transparent black +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Setting size (not changing the value) resets canvas to transparent black"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 100; +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 20,20, 255,0,0,255); +canvas.width = 100; +_assertPixel(canvas, 20,20, 0,0,0,0); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.transform.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.transform.html new file mode 100644 index 0000000000..402b34f9c5 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.transform.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: initial.reset.transform</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>initial.reset.transform</h1> +<p class="desc">Resetting the canvas state resets the current transformation matrix</p> + + +<script> +var t = async_test("Resetting the canvas state resets the current transformation matrix"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 100; +ctx.scale(0.1, 0.1); +canvas.width = 100; +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 20,20, 0,255,0,255); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.transform.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.transform.worker.js new file mode 100644 index 0000000000..3fb80d061f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/initial.reset.transform.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:initial.reset.transform +// Description:Resetting the canvas state resets the current transformation matrix +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Resetting the canvas state resets the current transformation matrix"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 100; +ctx.scale(0.1, 0.1); +canvas.width = 100; +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(canvas, 20,20, 0,255,0,255); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.default.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.default.html new file mode 100644 index 0000000000..6ebd35fbd0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.default.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.default</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.default</h1> +<p class="desc">Default width/height when attributes are missing</p> + + +<script> +var t = async_test("Default width/height when attributes are missing"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 50, "canvas.height", "50"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.default.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.default.worker.js new file mode 100644 index 0000000000..c77b8a4929 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.default.worker.js @@ -0,0 +1,24 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.default +// Description:Default width/height when attributes are missing +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Default width/height when attributes are missing"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 50, "canvas.height", "50"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.html new file mode 100644 index 0000000000..fda4e92603 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.idl</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.idl</h1> +<p class="desc">Getting/setting width/height IDL attributes</p> + + +<script> +var t = async_test("Getting/setting width/height IDL attributes"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = "100"; +canvas.height = "100"; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +canvas.width = "+1.5e2"; +canvas.height = "0x96"; +_assertSame(canvas.width, 150, "canvas.width", "150"); +_assertSame(canvas.height, 150, "canvas.height", "150"); +canvas.width = 301.999; +canvas.height = 301.001; +_assertSame(canvas.width, 301, "canvas.width", "301"); +_assertSame(canvas.height, 301, "canvas.height", "301"); +assert_throws_js(TypeError, function() { canvas.width = "400x"; }); +assert_throws_js(TypeError, function() { canvas.height = "foo"; }); +_assertSame(canvas.width, 301, "canvas.width", "301"); +_assertSame(canvas.height, 301, "canvas.height", "301"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.set.zero.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.set.zero.html new file mode 100644 index 0000000000..4bf7b9c41b --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.set.zero.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.idl.set.zero</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.idl.set.zero</h1> +<p class="desc">Setting width/height IDL attributes to 0</p> + + +<script> +var t = async_test("Setting width/height IDL attributes to 0"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 0; +canvas.height = 0; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.set.zero.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.set.zero.worker.js new file mode 100644 index 0000000000..2ecf19974e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.set.zero.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.idl.set.zero +// Description:Setting width/height IDL attributes to 0 +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Setting width/height IDL attributes to 0"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 0; +canvas.height = 0; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.worker.js new file mode 100644 index 0000000000..16350aeacd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.idl.worker.js @@ -0,0 +1,38 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.idl +// Description:Getting/setting width/height IDL attributes +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Getting/setting width/height IDL attributes"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = "100"; +canvas.height = "100"; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +canvas.width = "+1.5e2"; +canvas.height = "0x96"; +_assertSame(canvas.width, 150, "canvas.width", "150"); +_assertSame(canvas.height, 150, "canvas.height", "150"); +canvas.width = 301.999; +canvas.height = 301.001; +_assertSame(canvas.width, 301, "canvas.width", "301"); +_assertSame(canvas.height, 301, "canvas.height", "301"); +assert_throws_js(TypeError, function() { canvas.width = "400x"; }); +assert_throws_js(TypeError, function() { canvas.height = "foo"; }); +_assertSame(canvas.width, 301, "canvas.width", "301"); +_assertSame(canvas.height, 301, "canvas.height", "301"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.decimal.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.decimal.html new file mode 100644 index 0000000000..a74fe15899 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.decimal.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.decimal</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.decimal</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = '100.999'; +canvas.height = '100.999'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.decimal.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.decimal.worker.js new file mode 100644 index 0000000000..7b982e8d87 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.decimal.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.decimal +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = '100.999'; +canvas.height = '100.999'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.em.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.em.html new file mode 100644 index 0000000000..5a8eee2c8e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.em.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.em</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.em</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +assert_throws_js(TypeError, function() { canvas.width = '100em'; }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.em.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.em.worker.js new file mode 100644 index 0000000000..a0248d4efc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.em.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.em +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +assert_throws_js(TypeError, function() { canvas.width = '100em'; }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.empty.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.empty.html new file mode 100644 index 0000000000..eab54b013f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.empty.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.empty</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.empty</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = ''; +canvas.height = ''; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.empty.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.empty.worker.js new file mode 100644 index 0000000000..93b6cd6fc2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.empty.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.empty +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = ''; +canvas.height = ''; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.exp.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.exp.html new file mode 100644 index 0000000000..abfddf1858 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.exp.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.exp</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.exp</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = '100e1'; +canvas.height = '100e1'; +_assertSame(canvas.width, 1000.0, "canvas.width", "1000.0"); +_assertSame(canvas.height, 1000.0, "canvas.height", "1000.0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.exp.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.exp.worker.js new file mode 100644 index 0000000000..79fb413f37 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.exp.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.exp +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = '100e1'; +canvas.height = '100e1'; +_assertSame(canvas.width, 1000.0, "canvas.width", "1000.0"); +_assertSame(canvas.height, 1000.0, "canvas.height", "1000.0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.hex.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.hex.html new file mode 100644 index 0000000000..fba289087f --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.hex.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.hex</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.hex</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = '0x100'; +canvas.height = '0x100'; +_assertSame(canvas.width, 256, "canvas.width", "256"); +_assertSame(canvas.height, 256, "canvas.height", "256"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.hex.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.hex.worker.js new file mode 100644 index 0000000000..b178c55646 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.hex.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.hex +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = '0x100'; +canvas.height = '0x100'; +_assertSame(canvas.width, 256, "canvas.width", "256"); +_assertSame(canvas.height, 256, "canvas.height", "256"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.junk.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.junk.html new file mode 100644 index 0000000000..3ffb674b9e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.junk.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.junk</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.junk</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +assert_throws_js(TypeError, function() { canvas.width = '#!?'; }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.junk.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.junk.worker.js new file mode 100644 index 0000000000..6efd3ae5c2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.junk.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.junk +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +assert_throws_js(TypeError, function() { canvas.width = '#!?'; }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.minus.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.minus.html new file mode 100644 index 0000000000..56435547ca --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.minus.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.minus</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.minus</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +assert_throws_js(TypeError, function() { canvas.width = '-100'; }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.minus.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.minus.worker.js new file mode 100644 index 0000000000..a5837528ef --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.minus.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.minus +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +assert_throws_js(TypeError, function() { canvas.width = '-100'; }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.octal.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.octal.html new file mode 100644 index 0000000000..d452217015 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.octal.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.octal</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.octal</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = '0100'; +canvas.height = '0100'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.octal.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.octal.worker.js new file mode 100644 index 0000000000..23f228e368 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.octal.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.octal +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = '0100'; +canvas.height = '0100'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.onlyspace.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.onlyspace.html new file mode 100644 index 0000000000..4164123fd1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.onlyspace.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.onlyspace</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.onlyspace</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = ' '; +canvas.height = ' '; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.onlyspace.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.onlyspace.worker.js new file mode 100644 index 0000000000..a4b86624f7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.onlyspace.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.onlyspace +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = ' '; +canvas.height = ' '; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.percent.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.percent.html new file mode 100644 index 0000000000..d6288e996e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.percent.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.percent</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.percent</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +assert_throws_js(TypeError, function() { canvas.width = '100%'; }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.percent.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.percent.worker.js new file mode 100644 index 0000000000..e07fa60407 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.percent.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.percent +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +assert_throws_js(TypeError, function() { canvas.width = '100%'; }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.plus.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.plus.html new file mode 100644 index 0000000000..79d531f06e --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.plus.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.plus</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.plus</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = '+100'; +canvas.height = '+100'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.plus.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.plus.worker.js new file mode 100644 index 0000000000..240a6bd785 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.plus.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.plus +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = '+100'; +canvas.height = '+100'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.space.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.space.html new file mode 100644 index 0000000000..695afa5407 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.space.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.space</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.space</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = ' 100'; +canvas.height = ' 100'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.space.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.space.worker.js new file mode 100644 index 0000000000..29930209bf --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.space.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.space +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = ' 100'; +canvas.height = ' 100'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.trailingjunk.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.trailingjunk.html new file mode 100644 index 0000000000..fff231fda7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.trailingjunk.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.trailingjunk</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.trailingjunk</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +assert_throws_js(TypeError, function() { canvas.width = '100#!?'; }); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.trailingjunk.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.trailingjunk.worker.js new file mode 100644 index 0000000000..f8d916c853 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.trailingjunk.worker.js @@ -0,0 +1,23 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.trailingjunk +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +assert_throws_js(TypeError, function() { canvas.width = '100#!?'; }); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.whitespace.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.whitespace.html new file mode 100644 index 0000000000..b7f0c4b931 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.whitespace.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.whitespace</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.whitespace</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = ' 100'; +canvas.height = ' 100'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.whitespace.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.whitespace.worker.js new file mode 100644 index 0000000000..ea38398145 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.whitespace.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.whitespace +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = ' 100'; +canvas.height = ' 100'; +_assertSame(canvas.width, 100, "canvas.width", "100"); +_assertSame(canvas.height, 100, "canvas.height", "100"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.zero.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.zero.html new file mode 100644 index 0000000000..9a84c95598 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.zero.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.parse.zero</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.parse.zero</h1> +<p class="desc">Parsing of non-negative integers</p> + + +<script> +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = '0'; +canvas.height = '0'; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.zero.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.zero.worker.js new file mode 100644 index 0000000000..4d97a96b42 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.parse.zero.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.parse.zero +// Description:Parsing of non-negative integers +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Parsing of non-negative integers"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = '0'; +canvas.height = '0'; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidl.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidl.html new file mode 100644 index 0000000000..968dad9dda --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidl.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.reflect.setidl</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.reflect.setidl</h1> +<p class="desc">Setting IDL attributes updates IDL and content attributes</p> + + +<script> +var t = async_test("Setting IDL attributes updates IDL and content attributes"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 120; +canvas.height = 60; +_assertSame(canvas.width, 120, "canvas.width", "120"); +_assertSame(canvas.height, 60, "canvas.height", "60"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidl.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidl.worker.js new file mode 100644 index 0000000000..3f8050d549 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidl.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.reflect.setidl +// Description:Setting IDL attributes updates IDL and content attributes +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Setting IDL attributes updates IDL and content attributes"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 120; +canvas.height = 60; +_assertSame(canvas.width, 120, "canvas.width", "120"); +_assertSame(canvas.height, 60, "canvas.height", "60"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidlzero.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidlzero.html new file mode 100644 index 0000000000..5f31f696cf --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidlzero.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.attributes.reflect.setidlzero</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.attributes.reflect.setidlzero</h1> +<p class="desc">Setting IDL attributes to 0 updates IDL and content attributes</p> + + +<script> +var t = async_test("Setting IDL attributes to 0 updates IDL and content attributes"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 0; +canvas.height = 0; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidlzero.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidlzero.worker.js new file mode 100644 index 0000000000..4ace1f5edb --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.attributes.reflect.setidlzero.worker.js @@ -0,0 +1,26 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.attributes.reflect.setidlzero +// Description:Setting IDL attributes to 0 updates IDL and content attributes +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Setting IDL attributes to 0 updates IDL and content attributes"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +canvas.width = 0; +canvas.height = 0; +_assertSame(canvas.width, 0, "canvas.width", "0"); +_assertSame(canvas.height, 0, "canvas.height", "0"); +t.done(); + +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.large.html b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.large.html new file mode 100644 index 0000000000..9f41e2e23a --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.large.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: size.large</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>size.large</h1> +<p class="desc"></p> + +<p class="notes">Not sure how reasonable this is, but the spec doesn't say there's an upper limit on the size. +<script> +var t = async_test(""); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var n = 2147483647; // 2^31 - 1, which should be supported by any sensible definition of "long" +canvas.width = n; +canvas.height = n; +_assertSame(canvas.width, n, "canvas.width", "n"); +_assertSame(canvas.height, n, "canvas.height", "n"); +t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.large.worker.js b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.large.worker.js new file mode 100644 index 0000000000..b20ff54969 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/the-offscreen-canvas/size.large.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:size.large +// Description: +// Note:<p class="notes">Not sure how reasonable this is, but the spec doesn't say there's an upper limit on the size. + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test(""); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var canvas = new OffscreenCanvas(100, 50); +var ctx = canvas.getContext('2d'); + +var n = 2147483647; // 2^31 - 1, which should be supported by any sensible definition of "long" +canvas.width = n; +canvas.height = n; +_assertSame(canvas.width, n, "canvas.width", "n"); +_assertSame(canvas.height, n, "canvas.height", "n"); +t.done(); + +}); +done(); |