diff options
Diffstat (limited to 'tests/wpt/web-platform-tests/html')
1399 files changed, 27335 insertions, 27264 deletions
diff --git a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.canvas.html b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.canvas.html index 2ae3d662f08..525a56ebc9d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.canvas.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.canvas.html @@ -19,19 +19,19 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -var canvas2 = document.createElement('canvas'); -canvas2.width = 100; -canvas2.height = 50; -var ctx2 = canvas2.getContext('2d'); -ctx2.fillStyle = '#f00'; -ctx2.fillRect(0, 0, 100, 50); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations -ctx.drawImage(canvas2, 0, 0); -_assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); - + var canvas2 = document.createElement('canvas'); + canvas2.width = 100; + canvas2.height = 50; + var ctx2 = canvas2.getContext('2d'); + ctx2.fillStyle = '#f00'; + ctx2.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; + ctx.drawImage(canvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.canvascopy.html b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.canvascopy.html index 1f3e6299ba0..17a46cfca22 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.canvascopy.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.canvascopy.html @@ -19,21 +19,20 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -var canvas2 = document.createElement('canvas'); -canvas2.width = 100; -canvas2.height = 50; -var ctx2 = canvas2.getContext('2d'); -ctx2.fillStyle = '#0f0'; -ctx2.fillRect(0, 0, 100, 50); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.globalCompositeOperation = 'copy' -ctx.globalAlpha = 0.51; -ctx.drawImage(canvas2, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,130, 2); - + var canvas2 = document.createElement('canvas'); + canvas2.width = 100; + canvas2.height = 50; + var ctx2 = canvas2.getContext('2d'); + ctx2.fillStyle = '#0f0'; + ctx2.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.globalCompositeOperation = 'copy' + ctx.globalAlpha = 0.51; + ctx.drawImage(canvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,130, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.canvaspattern.html b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.canvaspattern.html index e861cddf302..eea076c974d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.canvaspattern.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.canvaspattern.html @@ -19,20 +19,20 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -var canvas2 = document.createElement('canvas'); -canvas2.width = 100; -canvas2.height = 50; -var ctx2 = canvas2.getContext('2d'); -ctx2.fillStyle = '#f00'; -ctx2.fillRect(0, 0, 100, 50); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = ctx.createPattern(canvas2, 'no-repeat'); -ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); - + var canvas2 = document.createElement('canvas'); + canvas2.width = 100; + canvas2.height = 50; + var ctx2 = canvas2.getContext('2d'); + ctx2.fillStyle = '#f00'; + ctx2.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = ctx.createPattern(canvas2, 'no-repeat'); + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.default.html b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.default.html index a8aa19162af..97cdf267c7c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.default.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.default.html @@ -19,8 +19,7 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -_assertSame(ctx.globalAlpha, 1.0, "ctx.globalAlpha", "1.0"); - + _assertSame(ctx.globalAlpha, 1.0, "ctx.globalAlpha", "1.0"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.fill.html b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.fill.html index fce9b7fbfc3..5766fdbe77c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.fill.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.fill.html @@ -19,13 +19,13 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.image.html b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.image.html index deb13f34160..5de1d5ff3ee 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.image.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.image.html @@ -16,17 +16,22 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test(""); -_addTest(function(canvas, ctx) { +promise_test(async t => { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations -ctx.drawImage(document.getElementById('red.png'), 0, 0); -_assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); + +}, ""); </script> -<img src="/images/red.png" id="red.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.imagepattern.html b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.imagepattern.html index 06aea4c0295..87e884524e8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.imagepattern.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.imagepattern.html @@ -16,18 +16,23 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test(""); -_addTest(function(canvas, ctx) { +promise_test(async t => { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = ctx.createPattern(document.getElementById('red.png'), 'no-repeat'); -ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); + +}, ""); </script> -<img src="/images/red.png" id="red.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.invalid.html b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.invalid.html index e5a3dd66960..db67f882f66 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.invalid.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.invalid.html @@ -19,15 +19,16 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.globalAlpha = 0.5; -var a = ctx.globalAlpha; // might not be exactly 0.5, if it is rounded/quantised, so remember for future comparisons -ctx.globalAlpha = Infinity; -_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); -ctx.globalAlpha = -Infinity; -_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); -ctx.globalAlpha = NaN; -_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); - + ctx.globalAlpha = 0.5; + // This may not set it to exactly 0.5 if it is rounded/quantised, so + // remember for future comparisons. + var a = ctx.globalAlpha; + ctx.globalAlpha = Infinity; + _assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); + ctx.globalAlpha = -Infinity; + _assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); + ctx.globalAlpha = NaN; + _assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.range.html b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.range.html index ab041864010..883b0cac69a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.range.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.globalAlpha.range.html @@ -19,17 +19,19 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.globalAlpha = 0.5; -var a = ctx.globalAlpha; // might not be exactly 0.5, if it is rounded/quantised, so remember for future comparisons -ctx.globalAlpha = 1.1; -_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); -ctx.globalAlpha = -0.1; -_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); -ctx.globalAlpha = 0; -_assertSame(ctx.globalAlpha, 0, "ctx.globalAlpha", "0"); -ctx.globalAlpha = 1; -_assertSame(ctx.globalAlpha, 1, "ctx.globalAlpha", "1"); - + ctx.globalAlpha = 0.5; + // This may not set it to exactly 0.5 if it is rounded/quantised, so + // remember for future comparisons. + var a = ctx.globalAlpha; + _assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); + ctx.globalAlpha = 1.1; + _assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); + ctx.globalAlpha = -0.1; + _assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); + ctx.globalAlpha = 0; + _assertSame(ctx.globalAlpha, 0, "ctx.globalAlpha", "0"); + ctx.globalAlpha = 1; + _assertSame(ctx.globalAlpha, 1, "ctx.globalAlpha", "1"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.casesensitive.html b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.casesensitive.html index 96e7d597a76..13ae99b35f9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.casesensitive.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.casesensitive.html @@ -19,10 +19,9 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'Source-over'; -_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); - + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'Source-over'; + _assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.clear.html b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.clear.html index 99d8e1d92f8..c1e88b4894e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.clear.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.clear.html @@ -19,10 +19,9 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'clear'; -_assertSame(ctx.globalCompositeOperation, 'clear', "ctx.globalCompositeOperation", "'clear'"); - + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'clear'; + _assertSame(ctx.globalCompositeOperation, 'clear', "ctx.globalCompositeOperation", "'clear'"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.darker.html b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.darker.html index 4bf5878d9bb..4fb6998f71d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.darker.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.darker.html @@ -19,10 +19,9 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'darker'; -_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); - + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'darker'; + _assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.default.html b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.default.html index ff0ab69cc41..5ccd488b3c7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.default.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.default.html @@ -19,8 +19,7 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -_assertSame(ctx.globalCompositeOperation, 'source-over', "ctx.globalCompositeOperation", "'source-over'"); - + _assertSame(ctx.globalCompositeOperation, 'source-over', "ctx.globalCompositeOperation", "'source-over'"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.get.html b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.get.html index 4831ae77304..27b89c9fedf 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.get.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.get.html @@ -19,15 +19,14 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -var modes = ['source-atop', 'source-in', 'source-out', 'source-over', - 'destination-atop', 'destination-in', 'destination-out', 'destination-over', - 'lighter', 'copy', 'xor']; -for (var i = 0; i < modes.length; ++i) -{ - ctx.globalCompositeOperation = modes[i]; - _assertSame(ctx.globalCompositeOperation, modes[i], "ctx.globalCompositeOperation", "modes[\""+(i)+"\"]"); -} - + var modes = ['source-atop', 'source-in', 'source-out', 'source-over', + 'destination-atop', 'destination-in', 'destination-out', 'destination-over', + 'lighter', 'copy', 'xor']; + for (var i = 0; i < modes.length; ++i) + { + ctx.globalCompositeOperation = modes[i]; + _assertSame(ctx.globalCompositeOperation, modes[i], "ctx.globalCompositeOperation", "modes[\""+(i)+"\"]"); + } }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.highlight.html b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.highlight.html index 88fe7ff37a6..45c5dd15ebb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.highlight.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.highlight.html @@ -19,10 +19,9 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'highlight'; -_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); - + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'highlight'; + _assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.nullsuffix.html b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.nullsuffix.html index 7998d725332..8a2443ff41d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.nullsuffix.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.nullsuffix.html @@ -19,10 +19,9 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'source-over\0'; -_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); - + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'source-over\0'; + _assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.over.html b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.over.html index bc286190fb1..1d742ef3cc4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.over.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.over.html @@ -19,10 +19,9 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'over'; -_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); - + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'over'; + _assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.unrecognised.html b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.unrecognised.html index 90f098a6853..e4aa877d96f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.unrecognised.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/compositing/2d.composite.operation.unrecognised.html @@ -19,10 +19,9 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'nonexistent'; -_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); - + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'nonexistent'; + _assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/conformance-requirements/2d.conformance.requirements.basics.html b/tests/wpt/web-platform-tests/html/canvas/element/conformance-requirements/2d.conformance.requirements.basics.html index fed4aa61ba9..cea531f9dbb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/conformance-requirements/2d.conformance.requirements.basics.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/conformance-requirements/2d.conformance.requirements.basics.html @@ -19,43 +19,42 @@ var t = async_test("void methods return undefined"); _addTest(function(canvas, ctx) { -_assertSame(ctx.save(), undefined, "ctx.save()", "undefined"); -_assertSame(ctx.restore(), undefined, "ctx.restore()", "undefined"); -_assertSame(ctx.scale(1, 1), undefined, "ctx.scale(1, 1)", "undefined"); -_assertSame(ctx.rotate(0), undefined, "ctx.rotate(0)", "undefined"); -_assertSame(ctx.translate(0, 0), undefined, "ctx.translate(0, 0)", "undefined"); -if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) - _assertSame(ctx.transform(1, 0, 0, 1, 0, 0), undefined, "ctx.transform(1, 0, 0, 1, 0, 0)", "undefined"); -} -if (ctx.setTransform) { - _assertSame(ctx.setTransform(1, 0, 0, 1, 0, 0), undefined, "ctx.setTransform(1, 0, 0, 1, 0, 0)", "undefined"); - _assertSame(ctx.setTransform(), undefined, "ctx.setTransform()", "undefined"); -} -_assertSame(ctx.clearRect(0, 0, 0, 0), undefined, "ctx.clearRect(0, 0, 0, 0)", "undefined"); -_assertSame(ctx.fillRect(0, 0, 0, 0), undefined, "ctx.fillRect(0, 0, 0, 0)", "undefined"); -_assertSame(ctx.strokeRect(0, 0, 0, 0), undefined, "ctx.strokeRect(0, 0, 0, 0)", "undefined"); -_assertSame(ctx.beginPath(), undefined, "ctx.beginPath()", "undefined"); -_assertSame(ctx.closePath(), undefined, "ctx.closePath()", "undefined"); -_assertSame(ctx.moveTo(0, 0), undefined, "ctx.moveTo(0, 0)", "undefined"); -_assertSame(ctx.lineTo(0, 0), undefined, "ctx.lineTo(0, 0)", "undefined"); -_assertSame(ctx.quadraticCurveTo(0, 0, 0, 0), undefined, "ctx.quadraticCurveTo(0, 0, 0, 0)", "undefined"); -_assertSame(ctx.bezierCurveTo(0, 0, 0, 0, 0, 0), undefined, "ctx.bezierCurveTo(0, 0, 0, 0, 0, 0)", "undefined"); -_assertSame(ctx.arcTo(0, 0, 0, 0, 1), undefined, "ctx.arcTo(0, 0, 0, 0, 1)", "undefined"); -_assertSame(ctx.rect(0, 0, 0, 0), undefined, "ctx.rect(0, 0, 0, 0)", "undefined"); -_assertSame(ctx.arc(0, 0, 1, 0, 0, true), undefined, "ctx.arc(0, 0, 1, 0, 0, true)", "undefined"); -_assertSame(ctx.fill(), undefined, "ctx.fill()", "undefined"); -_assertSame(ctx.stroke(), undefined, "ctx.stroke()", "undefined"); -_assertSame(ctx.clip(), undefined, "ctx.clip()", "undefined"); -if (ctx.fillText) { - _assertSame(ctx.fillText('test', 0, 0), undefined, "ctx.fillText('test', 0, 0)", "undefined"); - _assertSame(ctx.strokeText('test', 0, 0), undefined, "ctx.strokeText('test', 0, 0)", "undefined"); -} -if (ctx.putImageData) { - _assertSame(ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0), undefined, "ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0)", "undefined"); -} -_assertSame(ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0), undefined, "ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0)", "undefined"); -_assertSame(ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white'), undefined, "ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white')", "undefined"); - + _assertSame(ctx.save(), undefined, "ctx.save()", "undefined"); + _assertSame(ctx.restore(), undefined, "ctx.restore()", "undefined"); + _assertSame(ctx.scale(1, 1), undefined, "ctx.scale(1, 1)", "undefined"); + _assertSame(ctx.rotate(0), undefined, "ctx.rotate(0)", "undefined"); + _assertSame(ctx.translate(0, 0), undefined, "ctx.translate(0, 0)", "undefined"); + if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) + _assertSame(ctx.transform(1, 0, 0, 1, 0, 0), undefined, "ctx.transform(1, 0, 0, 1, 0, 0)", "undefined"); + } + if (ctx.setTransform) { + _assertSame(ctx.setTransform(1, 0, 0, 1, 0, 0), undefined, "ctx.setTransform(1, 0, 0, 1, 0, 0)", "undefined"); + _assertSame(ctx.setTransform(), undefined, "ctx.setTransform()", "undefined"); + } + _assertSame(ctx.clearRect(0, 0, 0, 0), undefined, "ctx.clearRect(0, 0, 0, 0)", "undefined"); + _assertSame(ctx.fillRect(0, 0, 0, 0), undefined, "ctx.fillRect(0, 0, 0, 0)", "undefined"); + _assertSame(ctx.strokeRect(0, 0, 0, 0), undefined, "ctx.strokeRect(0, 0, 0, 0)", "undefined"); + _assertSame(ctx.beginPath(), undefined, "ctx.beginPath()", "undefined"); + _assertSame(ctx.closePath(), undefined, "ctx.closePath()", "undefined"); + _assertSame(ctx.moveTo(0, 0), undefined, "ctx.moveTo(0, 0)", "undefined"); + _assertSame(ctx.lineTo(0, 0), undefined, "ctx.lineTo(0, 0)", "undefined"); + _assertSame(ctx.quadraticCurveTo(0, 0, 0, 0), undefined, "ctx.quadraticCurveTo(0, 0, 0, 0)", "undefined"); + _assertSame(ctx.bezierCurveTo(0, 0, 0, 0, 0, 0), undefined, "ctx.bezierCurveTo(0, 0, 0, 0, 0, 0)", "undefined"); + _assertSame(ctx.arcTo(0, 0, 0, 0, 1), undefined, "ctx.arcTo(0, 0, 0, 0, 1)", "undefined"); + _assertSame(ctx.rect(0, 0, 0, 0), undefined, "ctx.rect(0, 0, 0, 0)", "undefined"); + _assertSame(ctx.arc(0, 0, 1, 0, 0, true), undefined, "ctx.arc(0, 0, 1, 0, 0, true)", "undefined"); + _assertSame(ctx.fill(), undefined, "ctx.fill()", "undefined"); + _assertSame(ctx.stroke(), undefined, "ctx.stroke()", "undefined"); + _assertSame(ctx.clip(), undefined, "ctx.clip()", "undefined"); + if (ctx.fillText) { + _assertSame(ctx.fillText('test', 0, 0), undefined, "ctx.fillText('test', 0, 0)", "undefined"); + _assertSame(ctx.strokeText('test', 0, 0), undefined, "ctx.strokeText('test', 0, 0)", "undefined"); + } + if (ctx.putImageData) { + _assertSame(ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0), undefined, "ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0)", "undefined"); + } + _assertSame(ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0), undefined, "ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0)", "undefined"); + _assertSame(ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white'), undefined, "ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white')", "undefined"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/conformance-requirements/2d.conformance.requirements.delete.html b/tests/wpt/web-platform-tests/html/canvas/element/conformance-requirements/2d.conformance.requirements.delete.html index bfdf94319b4..a33cc869d62 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/conformance-requirements/2d.conformance.requirements.delete.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/conformance-requirements/2d.conformance.requirements.delete.html @@ -19,10 +19,9 @@ var t = async_test("window.CanvasRenderingContext2D is Configurable"); _addTest(function(canvas, ctx) { -_assertDifferent(window.CanvasRenderingContext2D, undefined, "window.CanvasRenderingContext2D", "undefined"); -_assertSame(delete window.CanvasRenderingContext2D, true, "delete window.CanvasRenderingContext2D", "true"); -_assertSame(window.CanvasRenderingContext2D, undefined, "window.CanvasRenderingContext2D", "undefined"); - + _assertDifferent(window.CanvasRenderingContext2D, undefined, "window.CanvasRenderingContext2D", "undefined"); + _assertSame(delete window.CanvasRenderingContext2D, true, "delete window.CanvasRenderingContext2D", "true"); + _assertSame(window.CanvasRenderingContext2D, undefined, "window.CanvasRenderingContext2D", "undefined"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/conformance-requirements/2d.conformance.requirements.drawings.html b/tests/wpt/web-platform-tests/html/canvas/element/conformance-requirements/2d.conformance.requirements.drawings.html index 40038b21910..efdad2eab9c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/conformance-requirements/2d.conformance.requirements.drawings.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/conformance-requirements/2d.conformance.requirements.drawings.html @@ -19,8 +19,7 @@ var t = async_test("void methods return undefined"); _addTest(function(canvas, ctx) { -_assertSame(ctx.drawImage(document.getElementById('yellow.png'), 0, 0, 1, 1, 0, 0, 0, 0), undefined, "ctx.drawImage(document.getElementById('yellow.png'), 0, 0, 1, 1, 0, 0, 0, 0)", "undefined"); - + _assertSame(ctx.drawImage(document.getElementById('yellow.png'), 0, 0, 1, 1, 0, 0, 0, 0), undefined, "ctx.drawImage(document.getElementById('yellow.png'), 0, 0, 1, 1, 0, 0, 0, 0)", "undefined"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/conformance-requirements/2d.conformance.requirements.missingargs.html b/tests/wpt/web-platform-tests/html/canvas/element/conformance-requirements/2d.conformance.requirements.missingargs.html index 2ac3d58f4e3..6744c6c3814 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/conformance-requirements/2d.conformance.requirements.missingargs.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/conformance-requirements/2d.conformance.requirements.missingargs.html @@ -19,122 +19,121 @@ var t = async_test("Missing arguments cause TypeError"); _addTest(function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.scale(); }); -assert_throws_js(TypeError, function() { ctx.scale(1); }); -assert_throws_js(TypeError, function() { ctx.rotate(); }); -assert_throws_js(TypeError, function() { ctx.translate(); }); -assert_throws_js(TypeError, function() { ctx.translate(0); }); -if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) - assert_throws_js(TypeError, function() { ctx.transform(); }); - assert_throws_js(TypeError, function() { ctx.transform(1); }); - assert_throws_js(TypeError, function() { ctx.transform(1, 0); }); - assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0); }); - assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1); }); - assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1, 0); }); -} -if (ctx.setTransform) { - assert_throws_js(TypeError, function() { ctx.setTransform(1); }); - assert_throws_js(TypeError, function() { ctx.setTransform(1, 0); }); - assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0); }); - assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1); }); - assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1, 0); }); -} -assert_throws_js(TypeError, function() { ctx.createLinearGradient(); }); -assert_throws_js(TypeError, function() { ctx.createLinearGradient(0); }); -assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0); }); -assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1); }); -assert_throws_js(TypeError, function() { ctx.createRadialGradient(); }); -assert_throws_js(TypeError, function() { ctx.createRadialGradient(0); }); -assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0); }); -assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1); }); -assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0); }); -assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.createPattern(canvas); }); -assert_throws_js(TypeError, function() { ctx.clearRect(); }); -assert_throws_js(TypeError, function() { ctx.clearRect(0); }); -assert_throws_js(TypeError, function() { ctx.clearRect(0, 0); }); -assert_throws_js(TypeError, function() { ctx.clearRect(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.fillRect(); }); -assert_throws_js(TypeError, function() { ctx.fillRect(0); }); -assert_throws_js(TypeError, function() { ctx.fillRect(0, 0); }); -assert_throws_js(TypeError, function() { ctx.fillRect(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.strokeRect(); }); -assert_throws_js(TypeError, function() { ctx.strokeRect(0); }); -assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0); }); -assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.moveTo(); }); -assert_throws_js(TypeError, function() { ctx.moveTo(0); }); -assert_throws_js(TypeError, function() { ctx.lineTo(); }); -assert_throws_js(TypeError, function() { ctx.lineTo(0); }); -assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(); }); -assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0); }); -assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0); }); -assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.bezierCurveTo(); }); -assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0); }); -assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0); }); -assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.arcTo(); }); -assert_throws_js(TypeError, function() { ctx.arcTo(0); }); -assert_throws_js(TypeError, function() { ctx.arcTo(0, 0); }); -assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.rect(); }); -assert_throws_js(TypeError, function() { ctx.rect(0); }); -assert_throws_js(TypeError, function() { ctx.rect(0, 0); }); -assert_throws_js(TypeError, function() { ctx.rect(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.arc(); }); -assert_throws_js(TypeError, function() { ctx.arc(0); }); -assert_throws_js(TypeError, function() { ctx.arc(0, 0); }); -assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1); }); -assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1, 0); }); -// (6th argument to arc is optional) -if (ctx.isPointInPath) { - assert_throws_js(TypeError, function() { ctx.isPointInPath(); }); - assert_throws_js(TypeError, function() { ctx.isPointInPath(0); }); -} -if (ctx.drawFocusRing) { - assert_throws_js(TypeError, function() { ctx.drawFocusRing(); }); - assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas); }); - assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas, 0); }); -} -if (ctx.fillText) { - assert_throws_js(TypeError, function() { ctx.fillText(); }); - assert_throws_js(TypeError, function() { ctx.fillText('test'); }); - assert_throws_js(TypeError, function() { ctx.fillText('test', 0); }); - assert_throws_js(TypeError, function() { ctx.strokeText(); }); - assert_throws_js(TypeError, function() { ctx.strokeText('test'); }); - assert_throws_js(TypeError, function() { ctx.strokeText('test', 0); }); - assert_throws_js(TypeError, function() { ctx.measureText(); }); -} -assert_throws_js(TypeError, function() { ctx.drawImage(); }); -assert_throws_js(TypeError, function() { ctx.drawImage(canvas); }); -assert_throws_js(TypeError, function() { ctx.drawImage(canvas, 0); }); -// TODO: n >= 3 args on drawImage could be either a valid overload, -// or too few for another overload, or too many for another -// overload - what should happen? -if (ctx.createImageData) { - assert_throws_js(TypeError, function() { ctx.createImageData(); }); - assert_throws_js(TypeError, function() { ctx.createImageData(1); }); -} -if (ctx.getImageData) { - assert_throws_js(TypeError, function() { ctx.getImageData(); }); - assert_throws_js(TypeError, function() { ctx.getImageData(0); }); - assert_throws_js(TypeError, function() { ctx.getImageData(0, 0); }); - assert_throws_js(TypeError, function() { ctx.getImageData(0, 0, 1); }); -} -if (ctx.putImageData) { - var imgdata = ctx.getImageData(0, 0, 1, 1); - assert_throws_js(TypeError, function() { ctx.putImageData(); }); - assert_throws_js(TypeError, function() { ctx.putImageData(imgdata); }); - assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0); }); -} -var g = ctx.createLinearGradient(0, 0, 0, 0); -assert_throws_js(TypeError, function() { g.addColorStop(); }); -assert_throws_js(TypeError, function() { g.addColorStop(0); }); - + assert_throws_js(TypeError, function() { ctx.scale(); }); + assert_throws_js(TypeError, function() { ctx.scale(1); }); + assert_throws_js(TypeError, function() { ctx.rotate(); }); + assert_throws_js(TypeError, function() { ctx.translate(); }); + assert_throws_js(TypeError, function() { ctx.translate(0); }); + if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) + assert_throws_js(TypeError, function() { ctx.transform(); }); + assert_throws_js(TypeError, function() { ctx.transform(1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1, 0); }); + } + if (ctx.setTransform) { + assert_throws_js(TypeError, function() { ctx.setTransform(1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1, 0); }); + } + assert_throws_js(TypeError, function() { ctx.createLinearGradient(); }); + assert_throws_js(TypeError, function() { ctx.createLinearGradient(0); }); + assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0); }); + assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.createRadialGradient(); }); + assert_throws_js(TypeError, function() { ctx.createRadialGradient(0); }); + assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0); }); + assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0); }); + assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.createPattern(canvas); }); + assert_throws_js(TypeError, function() { ctx.clearRect(); }); + assert_throws_js(TypeError, function() { ctx.clearRect(0); }); + assert_throws_js(TypeError, function() { ctx.clearRect(0, 0); }); + assert_throws_js(TypeError, function() { ctx.clearRect(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.fillRect(); }); + assert_throws_js(TypeError, function() { ctx.fillRect(0); }); + assert_throws_js(TypeError, function() { ctx.fillRect(0, 0); }); + assert_throws_js(TypeError, function() { ctx.fillRect(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.strokeRect(); }); + assert_throws_js(TypeError, function() { ctx.strokeRect(0); }); + assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0); }); + assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.moveTo(); }); + assert_throws_js(TypeError, function() { ctx.moveTo(0); }); + assert_throws_js(TypeError, function() { ctx.lineTo(); }); + assert_throws_js(TypeError, function() { ctx.lineTo(0); }); + assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(); }); + assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0); }); + assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0); }); + assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.bezierCurveTo(); }); + assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0); }); + assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0); }); + assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.arcTo(); }); + assert_throws_js(TypeError, function() { ctx.arcTo(0); }); + assert_throws_js(TypeError, function() { ctx.arcTo(0, 0); }); + assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.rect(); }); + assert_throws_js(TypeError, function() { ctx.rect(0); }); + assert_throws_js(TypeError, function() { ctx.rect(0, 0); }); + assert_throws_js(TypeError, function() { ctx.rect(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.arc(); }); + assert_throws_js(TypeError, function() { ctx.arc(0); }); + assert_throws_js(TypeError, function() { ctx.arc(0, 0); }); + assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1, 0); }); + // (6th argument to arc is optional) + if (ctx.isPointInPath) { + assert_throws_js(TypeError, function() { ctx.isPointInPath(); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(0); }); + } + if (ctx.drawFocusRing) { + assert_throws_js(TypeError, function() { ctx.drawFocusRing(); }); + assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas); }); + assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas, 0); }); + } + if (ctx.fillText) { + assert_throws_js(TypeError, function() { ctx.fillText(); }); + assert_throws_js(TypeError, function() { ctx.fillText('test'); }); + assert_throws_js(TypeError, function() { ctx.fillText('test', 0); }); + assert_throws_js(TypeError, function() { ctx.strokeText(); }); + assert_throws_js(TypeError, function() { ctx.strokeText('test'); }); + assert_throws_js(TypeError, function() { ctx.strokeText('test', 0); }); + assert_throws_js(TypeError, function() { ctx.measureText(); }); + } + assert_throws_js(TypeError, function() { ctx.drawImage(); }); + assert_throws_js(TypeError, function() { ctx.drawImage(canvas); }); + assert_throws_js(TypeError, function() { ctx.drawImage(canvas, 0); }); + // TODO: n >= 3 args on drawImage could be either a valid overload, + // or too few for another overload, or too many for another + // overload - what should happen? + if (ctx.createImageData) { + assert_throws_js(TypeError, function() { ctx.createImageData(); }); + assert_throws_js(TypeError, function() { ctx.createImageData(1); }); + } + if (ctx.getImageData) { + assert_throws_js(TypeError, function() { ctx.getImageData(); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0, 1); }); + } + if (ctx.putImageData) { + var imgdata = ctx.getImageData(0, 0, 1, 1); + assert_throws_js(TypeError, function() { ctx.putImageData(); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0); }); + } + var g = ctx.createLinearGradient(0, 0, 0, 0); + assert_throws_js(TypeError, function() { g.addColorStop(); }); + assert_throws_js(TypeError, function() { g.addColorStop(0); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.3arg.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.3arg.html index 7669c280491..d9e2de563bf 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.3arg.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.3arg.html @@ -13,26 +13,32 @@ <p class="output">Actual output:</p> <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas> -<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> + <ul id="d"></ul> <script> -var t = async_test(""); -_addTest(function(canvas, ctx) { - -ctx.drawImage(document.getElementById('green.png'), 0, 0); -ctx.drawImage(document.getElementById('red.png'), -100, 0); -ctx.drawImage(document.getElementById('red.png'), 100, 0); -ctx.drawImage(document.getElementById('red.png'), 0, -50); -ctx.drawImage(document.getElementById('red.png'), 0, 50); - -_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - - -}); +promise_test(async t => { + + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.drawImage(bitmap_green, 0, 0); + ctx.drawImage(bitmap_red, -100, 0); + ctx.drawImage(bitmap_red, 100, 0); + ctx.drawImage(bitmap_red, 0, -50); + ctx.drawImage(bitmap_red, 0, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + +}, ""); </script> -<img src="/images/red.png" id="red.png" class="resource"> -<img src="/images/green.png" id="green.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.5arg.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.5arg.html index 3a2f2050946..befa7108f88 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.5arg.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.5arg.html @@ -13,27 +13,33 @@ <p class="output">Actual output:</p> <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas> -<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> + <ul id="d"></ul> <script> -var t = async_test(""); -_addTest(function(canvas, ctx) { - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.drawImage(document.getElementById('green.png'), 50, 0, 50, 50); -ctx.drawImage(document.getElementById('red.png'), 0, 0, 50, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 50, 50); - -_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - - -}); +promise_test(async t => { + + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.drawImage(bitmap_green, 50, 0, 50, 50); + ctx.drawImage(bitmap_red, 0, 0, 50, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + +}, ""); </script> -<img src="/images/red.png" id="red.png" class="resource"> -<img src="/images/green.png" id="green.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.html index 80cda234bb8..f71eebc2e06 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.html @@ -16,26 +16,23 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test(""); -_addTest(function(canvas, ctx) { - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/green.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, 50); - _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - }); -}); - - -}); +promise_test(async t => { + + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/green.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + +}, ""); </script> -<img src="/images/green.png" id="green.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.html index d85ae780656..98da8eccbdf 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.html @@ -13,27 +13,32 @@ <p class="output">Actual output:</p> <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas> -<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> + <ul id="d"></ul> <script> -var t = async_test(""); -_addTest(function(canvas, ctx) { - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.drawImage(document.getElementById('green.png'), 0, 0, 100, 50, 0, 0, 100, 50); -ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, -100, 0, 100, 50); -ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, 100, 0, 100, 50); -ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, 0, -50, 100, 50); -ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, 0, 50, 100, 50); -_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - - -}); +promise_test(async t => { + + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.drawImage(bitmap_green, 0, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap_green, 0, 0, 100, 50, -100, 0, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 100, 0, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, -50, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, 50, 100, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + +}, ""); </script> -<img src="/images/red.png" id="red.png" class="resource"> -<img src="/images/green.png" id="green.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.html index 703c6788948..f21096cd960 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.html @@ -13,27 +13,34 @@ <p class="output">Actual output:</p> <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas> -<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> + <ul id="d"></ul> <script> -var t = async_test(""); -_addTest(function(canvas, ctx) { - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.drawImage(document.getElementById('green.png'), 1, 1, 1, 1, 0, 0, 100, 50); -ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, -50, 0, 50, 50); -ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, 100, 0, 50, 50); -ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, 0, -25, 100, 25); -ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, 0, 50, 100, 25); -_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - - -}); +promise_test(async t => { + + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.drawImage(bitmap_green, 1, 1, 1, 1, 0, 0, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, -50, 0, 50, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 100, 0, 50, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, -25, 100, 25); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, 50, 100, 25); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + +}, ""); </script> -<img src="/images/red.png" id="red.png" class="resource"> -<img src="/images/green.png" id="green.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.html index b7487e09991..ca4cc189487 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.html @@ -16,26 +16,22 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test(""); -_addTest(function(canvas, ctx) { +promise_test(async t => { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/rgrg-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 140, 20, 100, 50, 0, 0, 100, 50); - _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - }); -}); + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/rgrg-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 140, 20, 100, 50, 0, 0, 100, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); -}); +}, ""); </script> -<img src="/images/rgrg-256x256.png" id="rgrg-256x256.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.html index 567b4abfcff..fb38943cfa7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.html @@ -16,33 +16,29 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test(""); -_addTest(function(canvas, ctx) { +promise_test(async t => { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/rgrg-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0, 256, 256, 0, 0, 100, 50); - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 51, 26); - ctx.fillRect(49, 24, 51, 26); - _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 20,20, 0,255,0,255, 2); - _assertPixelApprox(canvas, 80,20, 0,255,0,255, 2); - _assertPixelApprox(canvas, 20,30, 0,255,0,255, 2); - _assertPixelApprox(canvas, 80,30, 0,255,0,255, 2); - }); -}); + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/rgrg-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 0, 0, 256, 256, 0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 51, 26); + ctx.fillRect(49, 24, 51, 26); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 20,20, 0,255,0,255, 2); + _assertPixelApprox(canvas, 80,20, 0,255,0,255, 2); + _assertPixelApprox(canvas, 20,30, 0,255,0,255, 2); + _assertPixelApprox(canvas, 80,30, 0,255,0,255, 2); -}); +}, ""); </script> -<img src="/images/rgrg-256x256.png" id="rgrg-256x256.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.alpha.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.alpha.html index 8926a72c9da..52acd11803f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.alpha.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.alpha.html @@ -16,24 +16,21 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test(""); -_addTest(function(canvas, ctx) { - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalAlpha = 0; -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); - - -}); +promise_test(async t => { + + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalAlpha = 0; + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + +}, ""); </script> -<img src="/images/red.png" id="red.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.animated.apng.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.animated.apng.html index b16473e3685..ffe19ce9bc4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.animated.apng.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.animated.apng.html @@ -19,12 +19,11 @@ var t = async_test("drawImage() of an APNG with no poster frame draws the first frame"); _addTest(function(canvas, ctx) { -deferTest(); -step_timeout(t.step_func_done(function () { - ctx.drawImage(document.getElementById('anim-gr.png'), 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -}), 500); - + deferTest(); + step_timeout(t.step_func_done(function () { + ctx.drawImage(document.getElementById('anim-gr.png'), 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }), 500); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.animated.gif.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.animated.gif.html index 30cad0c7aea..6330d06ade3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.animated.gif.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.animated.gif.html @@ -19,12 +19,11 @@ var t = async_test("drawImage() of an animated GIF draws the first frame"); _addTest(function(canvas, ctx) { -deferTest(); -step_timeout(t.step_func_done(function () { - ctx.drawImage(document.getElementById('anim-gr.gif'), 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -}), 500); - + deferTest(); + step_timeout(t.step_func_done(function () { + ctx.drawImage(document.getElementById('anim-gr.gif'), 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }), 500); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.animated.poster.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.animated.poster.html index 779397f6b9b..2d28bc12837 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.animated.poster.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.animated.poster.html @@ -16,21 +16,18 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test("drawImage() of an APNG draws the poster frame"); -_addTest(function(canvas, ctx) { +promise_test(async t => { -fetch('anim-poster-gr.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + const response = await fetch('/images/anim-poster-gr.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + +}, "drawImage() of an APNG draws the poster frame"); </script> -<img src="/images/anim-poster-gr.png" id="anim-poster-gr.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.broken.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.broken.html index 7e9f1451963..f6516a8eccc 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.broken.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.broken.html @@ -16,22 +16,16 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test(""); -_addTest(function(canvas, ctx) { - -fetch('/images/broken.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); - - -}); +promise_test(async t => { + + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + + const response = await fetch('/images/broken.png'); + const blob = await response.blob(); + + await promise_rejects_dom(t, 'InvalidStateError', createImageBitmap(blob), 'The source image could not be decoded.'); + +}, ""); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.canvas.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.canvas.html index 3041d737913..d1f9aeb326f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.canvas.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.canvas.html @@ -19,28 +19,27 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -var canvas2 = document.createElement('canvas'); -canvas2.width = 100; -canvas2.height = 50; -var ctx2 = canvas2.getContext('2d'); -ctx2.fillStyle = '#0f0'; -ctx2.fillRect(0, 0, 100, 50); - -ctx.fillStyle = '#f00'; -ctx.drawImage(canvas2, 0, 0); - -_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - -ctx.drawImage(document.createElement('canvas'), 0, 0); - -_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - + var canvas2 = document.createElement('canvas'); + canvas2.width = 100; + canvas2.height = 50; + var ctx2 = canvas2.getContext('2d'); + ctx2.fillStyle = '#0f0'; + ctx2.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#f00'; + ctx.drawImage(canvas2, 0, 0); + + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + + ctx.drawImage(document.createElement('canvas'), 0, 0); + + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.clip.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.clip.html index 380620faf34..70ec029d8e7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.clip.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.clip.html @@ -16,29 +16,26 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test(""); -_addTest(function(canvas, ctx) { - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.rect(-10, -10, 1, 1); -ctx.clip(); -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.rect(-10, -10, 1, 1); - ctx.clip(); - ctx.drawImage(document.getElementById('red.png'), 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); - - -}); +promise_test(async t => { + + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.rect(-10, -10, 1, 1); + ctx.clip(); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.rect(-10, -10, 1, 1); + ctx.clip(); + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + +}, ""); </script> -<img src="/images/red.png" id="red.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.composite.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.composite.html index 7b7deb0f91e..4ff2026aad5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.composite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.composite.html @@ -16,24 +16,21 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test(""); -_addTest(function(canvas, ctx) { - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalCompositeOperation = 'destination-over'; -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); - - -}); +promise_test(async t => { + + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'destination-over'; + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + +}, ""); </script> -<img src="/images/red.png" id="red.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.floatsource.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.floatsource.html index 02e4626133d..3e100c257fe 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.floatsource.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.floatsource.html @@ -16,20 +16,17 @@ <ul id="d"></ul> <script> -var t = async_test(""); -_addTest(function(canvas, ctx) { +promise_test(async t => { -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 10.1, 10.1, 0.1, 0.1, 0, 0, 100, 50); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + const response = await fetch('/images/green.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 10.1, 10.1, 0.1, 0.1, 0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -}); +}, ""); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.emptysrc.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.emptysrc.html index c684589de06..849f41aaf66 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.emptysrc.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.emptysrc.html @@ -19,13 +19,12 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -var img = document.getElementById('red.png'); -img.src = ""; -ctx.drawImage(img, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + var img = document.getElementById('red.png'); + img.src = ""; + ctx.drawImage(img, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.immediate.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.immediate.html index 347e750eef9..d2e8108d90d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.immediate.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.immediate.html @@ -19,17 +19,16 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -var img = new Image(); -img.src = '../images/red.png'; -// This triggers the "update the image data" algorithm. -// The image will not go to the "completely available" state -// until a fetch task in the networking task source is processed, -// so the image must not be fully decodable yet: -ctx.drawImage(img, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + var img = new Image(); + img.src = '../images/red.png'; + // This triggers the "update the image data" algorithm. + // The image will not go to the "completely available" state + // until a fetch task in the networking task source is processed, + // so the image must not be fully decodable yet: + ctx.drawImage(img, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.nosrc.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.nosrc.html index 677a7b856fa..dccf75c6d80 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.nosrc.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.nosrc.html @@ -19,12 +19,11 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -var img = new Image(); -ctx.drawImage(img, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + var img = new Image(); + ctx.drawImage(img, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.reload.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.reload.html index 5f90f819efe..b4a8440e460 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.reload.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.reload.html @@ -19,18 +19,17 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -var img = document.getElementById('yellow.png'); -img.src = '../images/red.png'; -// This triggers the "update the image data" algorithm, -// and resets the image to the "unavailable" state. -// The image will not go to the "completely available" state -// until a fetch task in the networking task source is processed, -// so the image must not be fully decodable yet: -ctx.drawImage(img, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + var img = document.getElementById('yellow.png'); + img.src = '../images/red.png'; + // This triggers the "update the image data" algorithm, + // and resets the image to the "unavailable" state. + // The image will not go to the "completely available" state + // until a fetch task in the networking task source is processed, + // so the image must not be fully decodable yet: + ctx.drawImage(img, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.removedsrc.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.removedsrc.html index c887fd64533..91e11eb15ce 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.removedsrc.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.incomplete.removedsrc.html @@ -19,13 +19,12 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -var img = document.getElementById('red.png'); -img.removeAttribute('src'); -ctx.drawImage(img, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + var img = document.getElementById('red.png'); + img.removeAttribute('src'); + ctx.drawImage(img, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedest.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedest.html index 1020754fa8f..94d4f71a7e9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedest.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedest.html @@ -16,33 +16,29 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test("Negative destination width/height represents the correct rectangle"); -_addTest(function(canvas, ctx) { +promise_test(async t => { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/ggrr-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 100, 78, 50, 50, 0, 50, 50, -50); - ctx.drawImage(bitmap, 100, 128, 50, -50, 100, 50, -50, -50); - _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); - _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - }); -}); + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/ggrr-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 100, 78, 50, 50, 0, 50, 50, -50); + ctx.drawImage(bitmap, 100, 128, 50, -50, 100, 50, -50, -50); + _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); -}); +}, "Negative destination width/height represents the correct rectangle"); </script> -<img src="/images/ggrr-256x256.png" id="ggrr-256x256.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedir.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedir.html index e02d0ff439d..281da9a5734 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedir.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedir.html @@ -16,33 +16,29 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test("Negative dimensions do not affect the direction of the image"); -_addTest(function(canvas, ctx) { +promise_test(async t => { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/ggrr-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 178, 50, -100, 0, 0, 50, 100); - ctx.drawImage(bitmap, 0, 78, 50, 100, 50, 100, 50, -100); - _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); - _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - }); -}); + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/ggrr-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 0, 178, 50, -100, 0, 0, 50, 100); + ctx.drawImage(bitmap, 0, 78, 50, 100, 50, 100, 50, -100); + _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); -}); +}, "Negative dimensions do not affect the direction of the image"); </script> -<img src="/images/ggrr-256x256.png" id="ggrr-256x256.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativesource.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativesource.html index f15fc3adcb0..5a504973d11 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativesource.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativesource.html @@ -16,33 +16,29 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test("Negative source width/height represents the correct rectangle"); -_addTest(function(canvas, ctx) { +promise_test(async t => { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/ggrr-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 100, 78, -100, 50, 0, 0, 50, 50); - ctx.drawImage(bitmap, 100, 128, -100, -50, 50, 0, 50, 50); - _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); - _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - }); -}); + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/ggrr-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 100, 78, -100, 50, 0, 0, 50, 50); + ctx.drawImage(bitmap, 100, 128, -100, -50, 50, 0, 50, 50); + _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); -}); +}, "Negative source width/height represents the correct rectangle"); </script> -<img src="/images/ggrr-256x256.png" id="ggrr-256x256.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.nonexistent.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.nonexistent.html index a1d8badb069..0cebf6cf681 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.nonexistent.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.nonexistent.html @@ -19,9 +19,8 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -var img = document.getElementById('not-found-at-all.png'); -assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(img, 0, 0); }); - + var img = document.getElementById('not-found-at-all.png'); + assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(img, 0, 0); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.nonfinite.html index f1ad616355d..8225d15fddc 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.nonfinite.html @@ -16,323 +16,320 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test("drawImage() with Infinity/NaN is ignored"); -_addTest(function(canvas, ctx) { +promise_test(async t => { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/redtransparent.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, Infinity, 0); -ctx.drawImage(bitmap, -Infinity, 0); -ctx.drawImage(bitmap, NaN, 0); -ctx.drawImage(bitmap, 0, Infinity); -ctx.drawImage(bitmap, 0, -Infinity); -ctx.drawImage(bitmap, 0, NaN); -ctx.drawImage(bitmap, Infinity, Infinity); - ctx.drawImage(bitmap, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, -Infinity, 0, 100, 50); -ctx.drawImage(bitmap, NaN, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, -Infinity, 100, 50); -ctx.drawImage(bitmap, 0, NaN, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, -Infinity, 50); -ctx.drawImage(bitmap, 0, 0, NaN, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, -Infinity); -ctx.drawImage(bitmap, 0, 0, 100, NaN); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity); - ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, -Infinity, 0, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, NaN, 0, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, -Infinity, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, NaN, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, -Infinity, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, NaN, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, -Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, NaN, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, -Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, NaN, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, -Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, NaN, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, -Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, NaN, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, -Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, NaN); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, Infinity, Infinity); - _assertPixel(canvas, 50,25, 0,255,0,255); - }); -}); + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/redtransparent.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.drawImage(bitmap, Infinity, 0); + ctx.drawImage(bitmap, -Infinity, 0); + ctx.drawImage(bitmap, NaN, 0); + ctx.drawImage(bitmap, 0, Infinity); + ctx.drawImage(bitmap, 0, -Infinity); + ctx.drawImage(bitmap, 0, NaN); + ctx.drawImage(bitmap, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, -Infinity, 0, 100, 50); + ctx.drawImage(bitmap, NaN, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, -Infinity, 100, 50); + ctx.drawImage(bitmap, 0, NaN, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, -Infinity, 50); + ctx.drawImage(bitmap, 0, 0, NaN, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, -Infinity); + ctx.drawImage(bitmap, 0, 0, 100, NaN); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, -Infinity, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, NaN, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, -Infinity, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, NaN, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, -Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, NaN, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, -Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, NaN, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, -Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, NaN, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, -Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, NaN, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, -Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, NaN, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, -Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, NaN); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, Infinity, Infinity); + _assertPixel(canvas, 50,25, 0,255,0,255); + +}, "drawImage() with Infinity/NaN is ignored"); </script> -<img src="/images/red.png" id="red.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.nowrap.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.nowrap.html index 3fde82454a8..8c32461b3ab 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.nowrap.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.nowrap.html @@ -16,25 +16,22 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test("Stretched images do not get pixels wrapping around the edges"); -_addTest(function(canvas, ctx) { - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/redtransparent.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, -1950, 0, 2000, 50); - _assertPixelApprox(canvas, 45,25, 0,255,0,255, 2); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - _assertPixelApprox(canvas, 55,25, 0,255,0,255, 2); - }); -}); - - -}); +promise_test(async t => { + + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/redtransparent.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, -1950, 0, 2000, 50); + _assertPixelApprox(canvas, 45,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 55,25, 0,255,0,255, 2); + +}, "Stretched images do not get pixels wrapping around the edges"); </script> -<img src="/images/redtransparent.png" id="redtransparent.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.null.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.null.html index 73034f8ef0d..0f46c97dcea 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.null.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.null.html @@ -19,8 +19,7 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.drawImage(null, 0, 0); }); - + assert_throws_js(TypeError, function() { ctx.drawImage(null, 0, 0); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.path.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.path.html index ebc7040fa4b..52852ec32e9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.path.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.path.html @@ -16,23 +16,21 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test(""); -_addTest(function(canvas, ctx) { - -ctx.fillStyle = '#0f0'; -ctx.rect(0, 0, 100, 50); -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - ctx.fill(); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); - - -}); +promise_test(async t => { + + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.rect(0, 0, 100, 50); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + ctx.fill(); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + +}, ""); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.self.1.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.self.1.html index 7c5524b95fd..90eaaea5d96 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.self.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.self.1.html @@ -19,17 +19,16 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 50, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(50, 0, 50, 50); -ctx.drawImage(canvas, 50, 0); - -_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(50, 0, 50, 50); + ctx.drawImage(canvas, 50, 0); + + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.self.2.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.self.2.html index dbc96dbb3c1..39e619ddc5b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.self.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.self.2.html @@ -19,19 +19,18 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 1, 100, 49); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 1); -ctx.drawImage(canvas, 0, 1); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 2); - -_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 1, 100, 49); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 1); + ctx.drawImage(canvas, 0, 1); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 2); + + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.svg.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.svg.html index 5464e63e230..bcfcdadb28d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.svg.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.svg.html @@ -16,20 +16,22 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test("drawImage() of an SVG image"); -_addTest(function(canvas, ctx) { +promise_test(async t => { -fetch('/images/green.svg') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + const img = new Image(); + const imageLoadPromise = new Promise((resolve, reject) => { + img.onload = () => resolve(); + img.onerror = (err) => reject(err); + }); + img.src = '/images/green.svg'; + await imageLoadPromise; -}); + ctx.drawImage(img, 0, 0); + _assertPixelApprox(canvas, 50, 25, 0, 255, 0, 255, 2); + +}, "drawImage() of an SVG image"); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.transform.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.transform.html index 2c8f930262b..42a277e2008 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.transform.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.transform.html @@ -16,24 +16,21 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test(""); -_addTest(function(canvas, ctx) { - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.translate(100, 0); -fetch('red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); - - -}); +promise_test(async t => { + + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.translate(100, 0); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + +}, ""); </script> -<img src="/images/red.png" id="red.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.wrongtype.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.wrongtype.html index 90b3eac6974..73e8f45090c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.wrongtype.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.wrongtype.html @@ -19,10 +19,9 @@ var t = async_test("Incorrect image types in drawImage do not match any defined overloads, so WebIDL throws a TypeError"); _addTest(function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.drawImage(undefined, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.drawImage(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.drawImage("", 0, 0); }); - + assert_throws_js(TypeError, function() { ctx.drawImage(undefined, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.drawImage(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.drawImage("", 0, 0); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.wrongtype.paragraph.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.wrongtype.paragraph.html index 1acfa22d599..ef0be39ca74 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.wrongtype.paragraph.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.wrongtype.paragraph.html @@ -19,8 +19,7 @@ var t = async_test("Incorrect image types in drawImage do not match any defined overloads, so WebIDL throws a TypeError"); _addTest(function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.drawImage(document.createElement('p'), 0, 0); }); - + assert_throws_js(TypeError, function() { ctx.drawImage(document.createElement('p'), 0, 0); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.html index 5906d61c3c1..d3c644cf88b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.html @@ -19,19 +19,18 @@ var t = async_test("drawImage with zero-sized canvas as the source shoud throw exception"); _addTest(function(canvas, ctx) { -var canvas2 = document.createElement('canvas'); -canvas2.width = 0; -canvas2.height = 50; -assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(canvas2, 0, 0); }); - -canvas2.width = 50; -canvas2.height = 0; -assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(canvas2, 0, 0); }); - -canvas2.width = 0; -canvas2.height = 0; -assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(canvas2, 0, 0); }); - + var canvas2 = document.createElement('canvas'); + canvas2.width = 0; + canvas2.height = 50; + assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(canvas2, 0, 0); }); + + canvas2.width = 50; + canvas2.height = 0; + assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(canvas2, 0, 0); }); + + canvas2.width = 0; + canvas2.height = 0; + assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(canvas2, 0, 0); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.zerosource.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.zerosource.html index c3ce69d9e0b..2b7b4ebea6d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.zerosource.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.zerosource.html @@ -16,26 +16,21 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test("drawImage with zero-sized source rectangle draws nothing without exception"); -_addTest(function(canvas, ctx) { +promise_test(async t => { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -const red = async () => await createImageBitmap(await (await fetch("/images/red.png")).blob()); -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 10, 10, 0, 1, 0, 0, 100, 50); - ctx.drawImage(bitmap, 10, 10, 1, 0, 0, 0, 100, 50); - ctx.drawImage(bitmap, 10, 10, 0, 0, 0, 0, 100, 50); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); - }); + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 10, 10, 0, 1, 0, 0, 100, 50); + ctx.drawImage(bitmap, 10, 10, 1, 0, 0, 0, 100, 50); + ctx.drawImage(bitmap, 10, 10, 0, 0, 0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -}); +}, "drawImage with zero-sized source rectangle draws nothing without exception"); </script> -<img src="/images/red.png" id="red.png" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.html index 403df3db463..ea00f1f9a14 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.html @@ -16,27 +16,31 @@ <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> <ul id="d"></ul> <script> -var t = async_test("drawImage with zero-sized source rectangle from image draws nothing without exception"); -_addTest(function(canvas, ctx) { - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/red-zerowidth.svg') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0, 100, 50); - ctx.drawImage(bitmap, 0, 0, 100, 50); - ctx.drawImage(bitmap, 0, 0, 100, 50); - _assertPixel(canvas, 50,25, 0,255,0,255); - }); -}); - - -}); +promise_test(async t => { + + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + function loadImage(src) { + return new Promise((resolve, reject) => { + const img = new Image(); + img.onload = () => resolve(img); + img.onerror = (err) => reject(err); + img.src = src; + }); + } + const img1 = await loadImage('/images/red-zerowidth.svg'); + const img2 = await loadImage('/images/red-zeroheight.svg'); + const img3 = await loadImage('/images/red-zerosize.svg'); + + ctx.drawImage(img1, 0, 0, 100, 50); + ctx.drawImage(img2, 0, 0, 100, 50); + ctx.drawImage(img3, 0, 0, 100, 50); + _assertPixel(canvas, 50, 25, 0, 255, 0, 255); + +}, "drawImage with zero-sized source rectangle from image draws nothing without exception"); </script> -<img src="/images/red-zerowidth.svg" id="red-zerowidth.svg" class="resource"> -<img src="/images/red-zeroheight.svg" id="red-zeroheight.svg" class="resource"> -<img src="/images/red-zerosize.svg" id="red-zerosize.svg" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.basic.html index 3821fff21c0..78a8c3ac064 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.basic.html @@ -19,11 +19,10 @@ var t = async_test("clearRect clears to transparent black"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.clearRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,0,0,0); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.clearRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,0,0,0); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.clip.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.clip.html index da264239441..eb43a401e78 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.clip.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.clip.html @@ -19,16 +19,15 @@ var t = async_test("clearRect is affected by clipping regions"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(0, 0, 16, 16); -ctx.clip(); -ctx.clearRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 16, 16); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.rect(0, 0, 16, 16); + ctx.clip(); + ctx.clearRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 16, 16); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.globalalpha.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.globalalpha.html index 3a228ae7ab3..73b87ecc81d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.globalalpha.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.globalalpha.html @@ -19,12 +19,11 @@ var t = async_test("clearRect is not affected by globalAlpha"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalAlpha = 0.1; -ctx.clearRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,0,0,0); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalAlpha = 0.1; + ctx.clearRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,0,0,0); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.globalcomposite.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.globalcomposite.html index 2f49b808600..9eb3d338348 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.globalcomposite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.globalcomposite.html @@ -19,12 +19,11 @@ var t = async_test("clearRect is not affected by globalCompositeOperation"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalCompositeOperation = 'destination-atop'; -ctx.clearRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,0,0,0); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'destination-atop'; + ctx.clearRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,0,0,0); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.negative.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.negative.html index 13ad1fb8120..baa48e2ba36 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.negative.html @@ -19,17 +19,16 @@ var t = async_test("clearRect of negative sizes works"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.clearRect(0, 0, 50, 25); -ctx.clearRect(100, 0, -50, 25); -ctx.clearRect(0, 50, 50, -25); -ctx.clearRect(100, 50, -50, -25); -_assertPixel(canvas, 25,12, 0,0,0,0); -_assertPixel(canvas, 75,12, 0,0,0,0); -_assertPixel(canvas, 25,37, 0,0,0,0); -_assertPixel(canvas, 75,37, 0,0,0,0); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.clearRect(0, 0, 50, 25); + ctx.clearRect(100, 0, -50, 25); + ctx.clearRect(0, 50, 50, -25); + ctx.clearRect(100, 50, -50, -25); + _assertPixel(canvas, 25,12, 0,0,0,0); + _assertPixel(canvas, 75,12, 0,0,0,0); + _assertPixel(canvas, 25,37, 0,0,0,0); + _assertPixel(canvas, 75,37, 0,0,0,0); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.nonfinite.html index 56232594e10..726ed057727 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.nonfinite.html @@ -19,33 +19,32 @@ var t = async_test("clearRect() with Infinity/NaN is ignored"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.clearRect(Infinity, 0, 100, 50); -ctx.clearRect(-Infinity, 0, 100, 50); -ctx.clearRect(NaN, 0, 100, 50); -ctx.clearRect(0, Infinity, 100, 50); -ctx.clearRect(0, -Infinity, 100, 50); -ctx.clearRect(0, NaN, 100, 50); -ctx.clearRect(0, 0, Infinity, 50); -ctx.clearRect(0, 0, -Infinity, 50); -ctx.clearRect(0, 0, NaN, 50); -ctx.clearRect(0, 0, 100, Infinity); -ctx.clearRect(0, 0, 100, -Infinity); -ctx.clearRect(0, 0, 100, NaN); -ctx.clearRect(Infinity, Infinity, 100, 50); -ctx.clearRect(Infinity, Infinity, Infinity, 50); -ctx.clearRect(Infinity, Infinity, Infinity, Infinity); -ctx.clearRect(Infinity, Infinity, 100, Infinity); -ctx.clearRect(Infinity, 0, Infinity, 50); -ctx.clearRect(Infinity, 0, Infinity, Infinity); -ctx.clearRect(Infinity, 0, 100, Infinity); -ctx.clearRect(0, Infinity, Infinity, 50); -ctx.clearRect(0, Infinity, Infinity, Infinity); -ctx.clearRect(0, Infinity, 100, Infinity); -ctx.clearRect(0, 0, Infinity, Infinity); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.clearRect(Infinity, 0, 100, 50); + ctx.clearRect(-Infinity, 0, 100, 50); + ctx.clearRect(NaN, 0, 100, 50); + ctx.clearRect(0, Infinity, 100, 50); + ctx.clearRect(0, -Infinity, 100, 50); + ctx.clearRect(0, NaN, 100, 50); + ctx.clearRect(0, 0, Infinity, 50); + ctx.clearRect(0, 0, -Infinity, 50); + ctx.clearRect(0, 0, NaN, 50); + ctx.clearRect(0, 0, 100, Infinity); + ctx.clearRect(0, 0, 100, -Infinity); + ctx.clearRect(0, 0, 100, NaN); + ctx.clearRect(Infinity, Infinity, 100, 50); + ctx.clearRect(Infinity, Infinity, Infinity, 50); + ctx.clearRect(Infinity, Infinity, Infinity, Infinity); + ctx.clearRect(Infinity, Infinity, 100, Infinity); + ctx.clearRect(Infinity, 0, Infinity, 50); + ctx.clearRect(Infinity, 0, Infinity, Infinity); + ctx.clearRect(Infinity, 0, 100, Infinity); + ctx.clearRect(0, Infinity, Infinity, 50); + ctx.clearRect(0, Infinity, Infinity, Infinity); + ctx.clearRect(0, Infinity, 100, Infinity); + ctx.clearRect(0, 0, Infinity, Infinity); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.path.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.path.html index 8d837adc3a3..77c9c037b73 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.path.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.path.html @@ -19,13 +19,12 @@ var t = async_test("clearRect does not affect the current path"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.rect(0, 0, 100, 50); -ctx.clearRect(0, 0, 16, 16); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.rect(0, 0, 100, 50); + ctx.clearRect(0, 0, 16, 16); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.shadow.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.shadow.html index e65b46b23cd..8240073a281 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.shadow.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.shadow.html @@ -19,15 +19,14 @@ var t = async_test("clearRect does not draw shadows"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.shadowColor = '#f00'; -ctx.shadowBlur = 0; -ctx.shadowOffsetX = 0; -ctx.shadowOffsetY = 50; -ctx.clearRect(0, -50, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.shadowColor = '#f00'; + ctx.shadowBlur = 0; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 50; + ctx.clearRect(0, -50, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.transform.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.transform.html index 9e524c36f21..347bedb8355 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.transform.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.transform.html @@ -19,13 +19,12 @@ var t = async_test("clearRect is affected by transforms"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.scale(10, 10); -ctx.translate(0, 5); -ctx.clearRect(0, -5, 10, 5); -_assertPixel(canvas, 50,25, 0,0,0,0); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(10, 10); + ctx.translate(0, 5); + ctx.clearRect(0, -5, 10, 5); + _assertPixel(canvas, 50,25, 0,0,0,0); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.zero.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.zero.html index ea1fff31cb8..2c192a7102b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.zero.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.zero.html @@ -19,13 +19,12 @@ var t = async_test("clearRect of zero pixels has no effect"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.clearRect(0, 0, 100, 0); -ctx.clearRect(0, 0, 0, 50); -ctx.clearRect(0, 0, 0, 0); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.clearRect(0, 0, 100, 0); + ctx.clearRect(0, 0, 0, 50); + ctx.clearRect(0, 0, 0, 0); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.basic.html index 14c04829a75..f29daf426a2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.basic.html @@ -19,10 +19,9 @@ var t = async_test("fillRect works"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.clip.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.clip.html index bdd269e1ad0..cc46b765d4f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.clip.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.clip.html @@ -19,17 +19,16 @@ var t = async_test("fillRect is affected by clipping regions"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(0, 0, 16, 16); -ctx.clip(); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 16, 16); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.rect(0, 0, 16, 16); + ctx.clip(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 16, 16); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.negative.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.negative.html index 6f754581b22..7c64952e8bf 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.negative.html @@ -19,18 +19,17 @@ var t = async_test("fillRect of negative sizes works"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 50, 25); -ctx.fillRect(100, 0, -50, 25); -ctx.fillRect(0, 50, 50, -25); -ctx.fillRect(100, 50, -50, -25); -_assertPixel(canvas, 25,12, 0,255,0,255); -_assertPixel(canvas, 75,12, 0,255,0,255); -_assertPixel(canvas, 25,37, 0,255,0,255); -_assertPixel(canvas, 75,37, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 25); + ctx.fillRect(100, 0, -50, 25); + ctx.fillRect(0, 50, 50, -25); + ctx.fillRect(100, 50, -50, -25); + _assertPixel(canvas, 25,12, 0,255,0,255); + _assertPixel(canvas, 75,12, 0,255,0,255); + _assertPixel(canvas, 25,37, 0,255,0,255); + _assertPixel(canvas, 75,37, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.nonfinite.html index bf0ea501a07..090607766d9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.nonfinite.html @@ -19,34 +19,33 @@ var t = async_test("fillRect() with Infinity/NaN is ignored"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(Infinity, 0, 100, 50); -ctx.fillRect(-Infinity, 0, 100, 50); -ctx.fillRect(NaN, 0, 100, 50); -ctx.fillRect(0, Infinity, 100, 50); -ctx.fillRect(0, -Infinity, 100, 50); -ctx.fillRect(0, NaN, 100, 50); -ctx.fillRect(0, 0, Infinity, 50); -ctx.fillRect(0, 0, -Infinity, 50); -ctx.fillRect(0, 0, NaN, 50); -ctx.fillRect(0, 0, 100, Infinity); -ctx.fillRect(0, 0, 100, -Infinity); -ctx.fillRect(0, 0, 100, NaN); -ctx.fillRect(Infinity, Infinity, 100, 50); -ctx.fillRect(Infinity, Infinity, Infinity, 50); -ctx.fillRect(Infinity, Infinity, Infinity, Infinity); -ctx.fillRect(Infinity, Infinity, 100, Infinity); -ctx.fillRect(Infinity, 0, Infinity, 50); -ctx.fillRect(Infinity, 0, Infinity, Infinity); -ctx.fillRect(Infinity, 0, 100, Infinity); -ctx.fillRect(0, Infinity, Infinity, 50); -ctx.fillRect(0, Infinity, Infinity, Infinity); -ctx.fillRect(0, Infinity, 100, Infinity); -ctx.fillRect(0, 0, Infinity, Infinity); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(Infinity, 0, 100, 50); + ctx.fillRect(-Infinity, 0, 100, 50); + ctx.fillRect(NaN, 0, 100, 50); + ctx.fillRect(0, Infinity, 100, 50); + ctx.fillRect(0, -Infinity, 100, 50); + ctx.fillRect(0, NaN, 100, 50); + ctx.fillRect(0, 0, Infinity, 50); + ctx.fillRect(0, 0, -Infinity, 50); + ctx.fillRect(0, 0, NaN, 50); + ctx.fillRect(0, 0, 100, Infinity); + ctx.fillRect(0, 0, 100, -Infinity); + ctx.fillRect(0, 0, 100, NaN); + ctx.fillRect(Infinity, Infinity, 100, 50); + ctx.fillRect(Infinity, Infinity, Infinity, 50); + ctx.fillRect(Infinity, Infinity, Infinity, Infinity); + ctx.fillRect(Infinity, Infinity, 100, Infinity); + ctx.fillRect(Infinity, 0, Infinity, 50); + ctx.fillRect(Infinity, 0, Infinity, Infinity); + ctx.fillRect(Infinity, 0, 100, Infinity); + ctx.fillRect(0, Infinity, Infinity, 50); + ctx.fillRect(0, Infinity, Infinity, Infinity); + ctx.fillRect(0, Infinity, 100, Infinity); + ctx.fillRect(0, 0, Infinity, Infinity); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.path.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.path.html index 3d073c41f60..39a6e181033 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.path.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.path.html @@ -19,14 +19,13 @@ var t = async_test("fillRect does not affect the current path"); _addTest(function(canvas, ctx) { -ctx.beginPath(); -ctx.rect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 16, 16); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.beginPath(); + ctx.rect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 16, 16); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.shadow.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.shadow.html index 78f3f4d3677..48aa8538f1d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.shadow.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.shadow.html @@ -19,15 +19,14 @@ var t = async_test("fillRect draws shadows"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.shadowColor = '#0f0'; -ctx.shadowBlur = 0; -ctx.shadowOffsetX = 0; -ctx.shadowOffsetY = 50; -ctx.fillRect(0, -50, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.shadowColor = '#0f0'; + ctx.shadowBlur = 0; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 50; + ctx.fillRect(0, -50, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.transform.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.transform.html index 6892747651e..de6f790bc77 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.transform.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.transform.html @@ -19,12 +19,11 @@ var t = async_test("fillRect is affected by transforms"); _addTest(function(canvas, ctx) { -ctx.scale(10, 10); -ctx.translate(0, 5); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, -5, 10, 5); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.scale(10, 10); + ctx.translate(0, 5); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, -5, 10, 5); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.zero.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.zero.html index 915347713fa..095eb19a667 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.zero.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.zero.html @@ -19,14 +19,13 @@ var t = async_test("fillRect of zero pixels has no effect"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 0); -ctx.fillRect(0, 0, 0, 50); -ctx.fillRect(0, 0, 0, 0); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 0); + ctx.fillRect(0, 0, 0, 50); + ctx.fillRect(0, 0, 0, 0); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.basic.html index 299bb8a39ee..d2ea8131789 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.basic.html @@ -19,11 +19,10 @@ var t = async_test("strokeRect works"); _addTest(function(canvas, ctx) { -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.strokeRect(25, 24, 50, 2); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.strokeRect(25, 24, 50, 2); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.clip.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.clip.html index 5f35cd07be3..31db69b6cdc 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.clip.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.clip.html @@ -19,18 +19,17 @@ var t = async_test("strokeRect is affected by clipping regions"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(0, 0, 16, 16); -ctx.clip(); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.strokeRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 16, 16); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.rect(0, 0, 16, 16); + ctx.clip(); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.strokeRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 16, 16); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.globalalpha.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.globalalpha.html index 3e80a77f744..323b663145e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.globalalpha.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.globalalpha.html @@ -19,12 +19,11 @@ var t = async_test("strokeRect is affected by globalAlpha"); _addTest(function(canvas, ctx) { -ctx.globalAlpha = 0; -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.strokeRect(25, 24, 50, 2); -_assertPixel(canvas, 50,25, 0,0,0,0); - + ctx.globalAlpha = 0; + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.strokeRect(25, 24, 50, 2); + _assertPixel(canvas, 50,25, 0,0,0,0); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.globalcomposite.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.globalcomposite.html index ce52dffd8c2..671db7f07a8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.globalcomposite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.globalcomposite.html @@ -19,12 +19,11 @@ var t = async_test("strokeRect is not affected by globalCompositeOperation"); _addTest(function(canvas, ctx) { -ctx.globalCompositeOperation = 'source-in'; -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.strokeRect(25, 24, 50, 2); -_assertPixel(canvas, 50,25, 0,0,0,0); - + ctx.globalCompositeOperation = 'source-in'; + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.strokeRect(25, 24, 50, 2); + _assertPixel(canvas, 50,25, 0,0,0,0); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.negative.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.negative.html index 617d56f125c..20bbc5bafea 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.negative.html @@ -19,19 +19,18 @@ var t = async_test("strokeRect of negative sizes works"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 25; -ctx.strokeRect(12, 12, 26, 1); -ctx.strokeRect(88, 12, -26, 1); -ctx.strokeRect(12, 38, 26, -1); -ctx.strokeRect(88, 38, -26, -1); -_assertPixel(canvas, 25,12, 0,255,0,255); -_assertPixel(canvas, 75,12, 0,255,0,255); -_assertPixel(canvas, 25,37, 0,255,0,255); -_assertPixel(canvas, 75,37, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 25; + ctx.strokeRect(12, 12, 26, 1); + ctx.strokeRect(88, 12, -26, 1); + ctx.strokeRect(12, 38, 26, -1); + ctx.strokeRect(88, 38, -26, -1); + _assertPixel(canvas, 25,12, 0,255,0,255); + _assertPixel(canvas, 75,12, 0,255,0,255); + _assertPixel(canvas, 25,37, 0,255,0,255); + _assertPixel(canvas, 75,37, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.nonfinite.html index 3f98e5e2feb..af7a393c8fc 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.nonfinite.html @@ -19,35 +19,34 @@ var t = async_test("strokeRect() with Infinity/NaN is ignored"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 150; -ctx.strokeRect(Infinity, 0, 100, 50); -ctx.strokeRect(-Infinity, 0, 100, 50); -ctx.strokeRect(NaN, 0, 100, 50); -ctx.strokeRect(0, Infinity, 100, 50); -ctx.strokeRect(0, -Infinity, 100, 50); -ctx.strokeRect(0, NaN, 100, 50); -ctx.strokeRect(0, 0, Infinity, 50); -ctx.strokeRect(0, 0, -Infinity, 50); -ctx.strokeRect(0, 0, NaN, 50); -ctx.strokeRect(0, 0, 100, Infinity); -ctx.strokeRect(0, 0, 100, -Infinity); -ctx.strokeRect(0, 0, 100, NaN); -ctx.strokeRect(Infinity, Infinity, 100, 50); -ctx.strokeRect(Infinity, Infinity, Infinity, 50); -ctx.strokeRect(Infinity, Infinity, Infinity, Infinity); -ctx.strokeRect(Infinity, Infinity, 100, Infinity); -ctx.strokeRect(Infinity, 0, Infinity, 50); -ctx.strokeRect(Infinity, 0, Infinity, Infinity); -ctx.strokeRect(Infinity, 0, 100, Infinity); -ctx.strokeRect(0, Infinity, Infinity, 50); -ctx.strokeRect(0, Infinity, Infinity, Infinity); -ctx.strokeRect(0, Infinity, 100, Infinity); -ctx.strokeRect(0, 0, Infinity, Infinity); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 150; + ctx.strokeRect(Infinity, 0, 100, 50); + ctx.strokeRect(-Infinity, 0, 100, 50); + ctx.strokeRect(NaN, 0, 100, 50); + ctx.strokeRect(0, Infinity, 100, 50); + ctx.strokeRect(0, -Infinity, 100, 50); + ctx.strokeRect(0, NaN, 100, 50); + ctx.strokeRect(0, 0, Infinity, 50); + ctx.strokeRect(0, 0, -Infinity, 50); + ctx.strokeRect(0, 0, NaN, 50); + ctx.strokeRect(0, 0, 100, Infinity); + ctx.strokeRect(0, 0, 100, -Infinity); + ctx.strokeRect(0, 0, 100, NaN); + ctx.strokeRect(Infinity, Infinity, 100, 50); + ctx.strokeRect(Infinity, Infinity, Infinity, 50); + ctx.strokeRect(Infinity, Infinity, Infinity, Infinity); + ctx.strokeRect(Infinity, Infinity, 100, Infinity); + ctx.strokeRect(Infinity, 0, Infinity, 50); + ctx.strokeRect(Infinity, 0, Infinity, Infinity); + ctx.strokeRect(Infinity, 0, 100, Infinity); + ctx.strokeRect(0, Infinity, Infinity, 50); + ctx.strokeRect(0, Infinity, Infinity, Infinity); + ctx.strokeRect(0, Infinity, 100, Infinity); + ctx.strokeRect(0, 0, Infinity, Infinity); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.path.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.path.html index 5d88373525a..121789d8642 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.path.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.path.html @@ -19,15 +19,14 @@ var t = async_test("strokeRect does not affect the current path"); _addTest(function(canvas, ctx) { -ctx.beginPath(); -ctx.rect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 5; -ctx.strokeRect(0, 0, 16, 16); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.beginPath(); + ctx.rect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 5; + ctx.strokeRect(0, 0, 16, 16); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.shadow.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.shadow.html index a8c7ba314a3..8e7a50a7458 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.shadow.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.shadow.html @@ -19,18 +19,17 @@ var t = async_test("strokeRect draws shadows"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.shadowColor = '#0f0'; -ctx.shadowBlur = 0; -ctx.shadowOffsetX = 0; -ctx.shadowOffsetY = 50; -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.strokeRect(0, -75, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.shadowColor = '#0f0'; + ctx.shadowBlur = 0; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 50; + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.strokeRect(0, -75, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.transform.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.transform.html index 9fe89042abf..312b9d20038 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.transform.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.transform.html @@ -19,13 +19,12 @@ var t = async_test("fillRect is affected by transforms"); _addTest(function(canvas, ctx) { -ctx.scale(10, 10); -ctx.translate(0, 5); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 5; -ctx.strokeRect(2.5, -2.6, 5, 0.2); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.scale(10, 10); + ctx.translate(0, 5); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 5; + ctx.strokeRect(2.5, -2.6, 5, 0.2); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.1.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.1.html index 188699d6a8d..c140a2668b0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.1.html @@ -19,11 +19,10 @@ var t = async_test("strokeRect of 0x0 pixels draws nothing"); _addTest(function(canvas, ctx) { -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 250; -ctx.strokeRect(50, 25, 0, 0); -_assertPixel(canvas, 50,25, 0,0,0,0); - + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 250; + ctx.strokeRect(50, 25, 0, 0); + _assertPixel(canvas, 50,25, 0,0,0,0); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.2.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.2.html index 2e28b90dd2a..f17620a3024 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.2.html @@ -19,13 +19,12 @@ var t = async_test("strokeRect of 0x0 pixels draws nothing, including caps and joins"); _addTest(function(canvas, ctx) { -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 250; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; -ctx.strokeRect(50, 25, 0, 0); -_assertPixel(canvas, 50,25, 0,0,0,0); - + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 250; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; + ctx.strokeRect(50, 25, 0, 0); + _assertPixel(canvas, 50,25, 0,0,0,0); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.3.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.3.html index 5831c228fff..e671ae4116b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.3.html @@ -19,11 +19,10 @@ var t = async_test("strokeRect of Nx0 pixels draws a straight line"); _addTest(function(canvas, ctx) { -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.strokeRect(0, 25, 100, 0); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.strokeRect(0, 25, 100, 0); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.4.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.4.html index 6a09e8eaf95..ff3c4040b3f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.4.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.4.html @@ -19,12 +19,11 @@ var t = async_test("strokeRect of Nx0 pixels draws a closed line with no caps"); _addTest(function(canvas, ctx) { -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 250; -ctx.lineCap = 'round'; -ctx.strokeRect(100, 25, 100, 0); -_assertPixel(canvas, 50,25, 0,0,0,0); - + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 250; + ctx.lineCap = 'round'; + ctx.strokeRect(100, 25, 100, 0); + _assertPixel(canvas, 50,25, 0,0,0,0); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.5.html b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.5.html index c6cc50ca9b5..809781ab438 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.5.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.5.html @@ -19,12 +19,11 @@ var t = async_test("strokeRect of Nx0 pixels draws a closed line with joins"); _addTest(function(canvas, ctx) { -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 250; -ctx.lineJoin = 'round'; -ctx.strokeRect(100, 25, 100, 0); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 250; + ctx.lineJoin = 'round'; + ctx.strokeRect(100, 25, 100, 0); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/fill-and-stroke-styles/2d.fillStyle.colorObject.html b/tests/wpt/web-platform-tests/html/canvas/element/fill-and-stroke-styles/2d.fillStyle.colorObject.html index 02408138c24..ae6507350cd 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/fill-and-stroke-styles/2d.fillStyle.colorObject.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/fill-and-stroke-styles/2d.fillStyle.colorObject.html @@ -19,25 +19,24 @@ var t = async_test("ctx.fillStyle works with color objects"); _addTest(function(canvas, ctx) { -ctx.fillStyle = {r: 1, g: 0, b: 0}; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 255,0,0,255); -ctx.fillStyle = {r: 0, g: 0, b: 1}; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,0,255,255); -ctx.fillStyle = {r: 0.2, g: 0.4, b: 0.6}; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 51,102,153,255); -ctx.fillStyle = {r: 0, g: 1, b: 0}; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -ctx.fillStyle = {r: -1, g: 0, b: 0}; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,0,0,255); -ctx.fillStyle = {r: 0, g: 2, b: 0}; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = {r: 1, g: 0, b: 0}; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 255,0,0,255); + ctx.fillStyle = {r: 0, g: 0, b: 1}; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,0,255,255); + ctx.fillStyle = {r: 0.2, g: 0.4, b: 0.6}; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 51,102,153,255); + ctx.fillStyle = {r: 0, g: 1, b: 0}; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + ctx.fillStyle = {r: -1, g: 0, b: 0}; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,0,0,255); + ctx.fillStyle = {r: 0, g: 2, b: 0}; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/fill-and-stroke-styles/2d.fillStyle.colorObject.transparency.html b/tests/wpt/web-platform-tests/html/canvas/element/fill-and-stroke-styles/2d.fillStyle.colorObject.transparency.html index 09a8eacdeca..b48715f093d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/fill-and-stroke-styles/2d.fillStyle.colorObject.transparency.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/fill-and-stroke-styles/2d.fillStyle.colorObject.transparency.html @@ -19,22 +19,21 @@ var t = async_test("ctx.fillStyle with color objects has transparency"); _addTest(function(canvas, ctx) { -ctx.fillStyle = {r: 0, g: 1, b: 0, a: 0}; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,0,0,0); -ctx.clearRect(0, 0, 100, 50); -ctx.fillStyle = {r: 0, g: 1, b: 0, a: -1}; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,0,0,0); -ctx.clearRect(0, 0, 100, 50); -ctx.fillStyle = {r: 0, g: 1, b: 0, a: 0.5}; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,128); -ctx.clearRect(0, 0, 100, 50); -ctx.fillStyle = {r: 0, g: 1, b: 0, a: 1}; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = {r: 0, g: 1, b: 0, a: 0}; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,0,0,0); + ctx.clearRect(0, 0, 100, 50); + ctx.fillStyle = {r: 0, g: 1, b: 0, a: -1}; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,0,0,0); + ctx.clearRect(0, 0, 100, 50); + ctx.fillStyle = {r: 0, g: 1, b: 0, a: 0.5}; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,128); + ctx.clearRect(0, 0, 100, 50); + ctx.fillStyle = {r: 0, g: 1, b: 0, a: 1}; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/fill-and-stroke-styles/2d.strokeStyle.colorObject.html b/tests/wpt/web-platform-tests/html/canvas/element/fill-and-stroke-styles/2d.strokeStyle.colorObject.html index a56a020abda..308e6b54b78 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/fill-and-stroke-styles/2d.strokeStyle.colorObject.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/fill-and-stroke-styles/2d.strokeStyle.colorObject.html @@ -19,26 +19,25 @@ var t = async_test("ctx.strokeStyle works with color objects"); _addTest(function(canvas, ctx) { -ctx.lineWidth = 50; -ctx.strokeStyle = {r: 1, g: 0, b: 0}; -ctx.strokeRect(25, 24, 50, 2); -_assertPixel(canvas, 50,25, 255,0,0,255); -ctx.strokeStyle = {r: 0, g: 0, b: 1}; -ctx.strokeRect(25, 24, 50, 2); -_assertPixel(canvas, 50,25, 0,0,255,255); -ctx.strokeStyle = {r: 0.2, g: 0.4, b: 0.6}; -ctx.strokeRect(25, 24, 50, 2); -_assertPixel(canvas, 50,25, 51,102,153,255); -ctx.strokeStyle = {r: 0, g: 1, b: 0}; -ctx.strokeRect(25, 24, 50, 2); -_assertPixel(canvas, 50,25, 0,255,0,255); -ctx.strokeStyle = {r: -1, g: 0, b: 0}; -ctx.strokeRect(25, 24, 50, 2); -_assertPixel(canvas, 50,25, 0,0,0,255); -ctx.strokeStyle = {r: 0, g: 2, b: 0}; -ctx.strokeRect(25, 24, 50, 2); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.lineWidth = 50; + ctx.strokeStyle = {r: 1, g: 0, b: 0}; + ctx.strokeRect(25, 24, 50, 2); + _assertPixel(canvas, 50,25, 255,0,0,255); + ctx.strokeStyle = {r: 0, g: 0, b: 1}; + ctx.strokeRect(25, 24, 50, 2); + _assertPixel(canvas, 50,25, 0,0,255,255); + ctx.strokeStyle = {r: 0.2, g: 0.4, b: 0.6}; + ctx.strokeRect(25, 24, 50, 2); + _assertPixel(canvas, 50,25, 51,102,153,255); + ctx.strokeStyle = {r: 0, g: 1, b: 0}; + ctx.strokeRect(25, 24, 50, 2); + _assertPixel(canvas, 50,25, 0,255,0,255); + ctx.strokeStyle = {r: -1, g: 0, b: 0}; + ctx.strokeRect(25, 24, 50, 2); + _assertPixel(canvas, 50,25, 0,0,0,255); + ctx.strokeStyle = {r: 0, g: 2, b: 0}; + ctx.strokeRect(25, 24, 50, 2); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/fill-and-stroke-styles/2d.strokeStyle.colorObject.transparency.html b/tests/wpt/web-platform-tests/html/canvas/element/fill-and-stroke-styles/2d.strokeStyle.colorObject.transparency.html index 1b19cab317a..0232140eafd 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/fill-and-stroke-styles/2d.strokeStyle.colorObject.transparency.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/fill-and-stroke-styles/2d.strokeStyle.colorObject.transparency.html @@ -19,22 +19,21 @@ var t = async_test("ctx.strokeStyle with color objects has transparency"); _addTest(function(canvas, ctx) { -ctx.lineWidth = 50; -ctx.strokeStyle = {r: 0, g: 1, b: 0, a: 0}; -ctx.strokeRect(25, 24, 50, 2); -_assertPixel(canvas, 50,25, 0,0,0,0); -ctx.strokeStyle = {r: 0, g: 1, b: 0, a: -1}; -ctx.strokeRect(25, 24, 50, 2); -_assertPixel(canvas, 50,25, 0,0,0,0); -ctx.clearRect(0, 0, 100, 50); -ctx.strokeStyle = {r: 0, g: 1, b: 0, a: 0.5}; -ctx.strokeRect(25, 24, 50, 2); -_assertPixel(canvas, 50,25, 0,255,0,128); -ctx.clearRect(0, 0, 100, 50); -ctx.strokeStyle = {r: 0, g: 1, b: 0, a: 1}; -ctx.strokeRect(25, 24, 50, 2); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.lineWidth = 50; + ctx.strokeStyle = {r: 0, g: 1, b: 0, a: 0}; + ctx.strokeRect(25, 24, 50, 2); + _assertPixel(canvas, 50,25, 0,0,0,0); + ctx.strokeStyle = {r: 0, g: 1, b: 0, a: -1}; + ctx.strokeRect(25, 24, 50, 2); + _assertPixel(canvas, 50,25, 0,0,0,0); + ctx.clearRect(0, 0, 100, 50); + ctx.strokeStyle = {r: 0, g: 1, b: 0, a: 0.5}; + ctx.strokeRect(25, 24, 50, 2); + _assertPixel(canvas, 50,25, 0,255,0,128); + ctx.clearRect(0, 0, 100, 50); + ctx.strokeStyle = {r: 0, g: 1, b: 0, a: 1}; + ctx.strokeRect(25, 24, 50, 2); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html index 77818444c87..2abd7cdee75 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html @@ -19,13 +19,12 @@ var t = async_test("Test exceptions on CanvasFilter() blur.object"); _addTest(function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur'}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: undefined}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 'foo'}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: [1,2]}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: NaN}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: {}}); }); - + assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur'}); }); + assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: undefined}); }); + assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 'foo'}); }); + assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: [1,2]}); }); + assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: NaN}); }); + assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: {}}); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html index a56840e6073..61c0f37591e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html @@ -19,50 +19,49 @@ var t = async_test("Test the functionality of ColorMatrix filters in CanvasFilter objects"); _addTest(function(canvas, ctx) { -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: 'foo'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: null}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 'a']}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, Infinity]}); }); -ctx.fillStyle = '#f00'; -ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 0}); -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 10,10, 255,0,0,255, 2); -ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 90}); -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 10,10, 0,91,0,255, 2); -ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 180}); -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 10,10, 0,109,109,255, 2); -ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 270}); -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 10,10, 109,18,255,255, 2); -ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'saturate', values: 0.5}); -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 10,10, 155,27,27,255, 2); -ctx.clearRect(0, 0, 100, 50); -ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'luminanceToAlpha'}); -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 10,10, 0,0,0,54, 2); -ctx.filter = new CanvasFilter({filter: 'colorMatrix', values: [ - 0, 0, 0, 0, 0, - 1, 1, 1, 1, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0 -]}); -ctx.fillRect(0, 0, 50, 25); -ctx.fillStyle = '#0f0'; -ctx.fillRect(50, 0, 50, 25); -ctx.fillStyle = '#00f'; -ctx.fillRect(0, 25, 50, 25); -ctx.fillStyle = '#fff'; -ctx.fillRect(50, 25, 50, 25); -_assertPixelApprox(canvas, 10,10, 0,255,0,255, 2); -_assertPixelApprox(canvas, 60,10, 0,255,0,255, 2); -_assertPixelApprox(canvas, 10,30, 0,255,0,255, 2); -_assertPixelApprox(canvas, 60,30, 0,255,0,255, 2); - + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: undefined}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: 'foo'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: null}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 'a']}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, Infinity]}); }); + ctx.fillStyle = '#f00'; + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 0}); + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 10,10, 255,0,0,255, 2); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 90}); + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 10,10, 0,91,0,255, 2); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 180}); + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 10,10, 0,109,109,255, 2); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 270}); + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 10,10, 109,18,255,255, 2); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'saturate', values: 0.5}); + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 10,10, 155,27,27,255, 2); + ctx.clearRect(0, 0, 100, 50); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'luminanceToAlpha'}); + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 10,10, 0,0,0,54, 2); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', values: [ + 0, 0, 0, 0, 0, + 1, 1, 1, 1, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0 + ]}); + ctx.fillRect(0, 0, 50, 25); + ctx.fillStyle = '#0f0'; + ctx.fillRect(50, 0, 50, 25); + ctx.fillStyle = '#00f'; + ctx.fillRect(0, 25, 50, 25); + ctx.fillStyle = '#fff'; + ctx.fillRect(50, 25, 50, 25); + _assertPixelApprox(canvas, 10,10, 0,255,0,255, 2); + _assertPixelApprox(canvas, 60,10, 0,255,0,255, 2); + _assertPixelApprox(canvas, 10,30, 0,255,0,255, 2); + _assertPixelApprox(canvas, 60,30, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html index c54299ff2a5..0512cac1c98 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html @@ -19,48 +19,47 @@ var t = async_test("Test pixels on CanvasFilter() componentTransfer with discrete type"); _addTest(function(canvas, ctx) { -// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement -function getTransformedValue(C, V) { - // Get the right interval - const n = V.length; - const k = C == 1 ? n - 1 : Math.floor(C * n); - return V[k]; -} + // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement + function getTransformedValue(C, V) { + // Get the right interval + const n = V.length; + const k = C == 1 ? n - 1 : Math.floor(C * n); + return V[k]; + } -function getColor(inputColor, tableValues) { - const result = [0, 0, 0]; - for (const i in inputColor) { - const C = inputColor[i]/255; - const Cprime = getTransformedValue(C, tableValues[i]); - result[i] = Math.max(0, Math.min(1, Cprime)) * 255; - } - return result; -} + function getColor(inputColor, tableValues) { + const result = [0, 0, 0]; + for (const i in inputColor) { + const C = inputColor[i]/255; + const Cprime = getTransformedValue(C, tableValues[i]); + result[i] = Math.max(0, Math.min(1, Cprime)) * 255; + } + return result; + } -tableValuesR = [0, 0, 1, 1]; -tableValuesG = [2, 0, 0.5, 3]; -tableValuesB = [1, -1, 5, 0]; -ctx.filter = new CanvasFilter({filter: 'componentTransfer', - funcR: {type: 'discrete', tableValues: tableValuesR}, - funcG: {type: 'discrete', tableValues: tableValuesG}, - funcB: {type: 'discrete', tableValues: tableValuesB}, -}); - -const inputColors = [ - [255, 255, 255], - [0, 0, 0], - [127, 0, 34], - [252, 186, 3], - [50, 68, 87], -]; + tableValuesR = [0, 0, 1, 1]; + tableValuesG = [2, 0, 0.5, 3]; + tableValuesB = [1, -1, 5, 0]; + ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'discrete', tableValues: tableValuesR}, + funcG: {type: 'discrete', tableValues: tableValuesG}, + funcB: {type: 'discrete', tableValues: tableValuesB}, + }); -for (const color of inputColors) { - let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]); - ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; - ctx.fillRect(0, 0, 10, 10); - _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); -} + const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], + ]; + for (const color of inputColors) { + let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); + } }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html index 110cd2396ea..c6feb50a35d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html @@ -19,39 +19,38 @@ var t = async_test("Test pixels on CanvasFilter() componentTransfer with gamma type"); _addTest(function(canvas, ctx) { -// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement -function getColor(inputColor, amplitude, exponent, offset) { - return [ - Math.max(0, Math.min(1, Math.pow(inputColor[0]/255, exponent[0]) * amplitude[0] + offset[0])) * 255, - Math.max(0, Math.min(1, Math.pow(inputColor[1]/255, exponent[1]) * amplitude[1] + offset[1])) * 255, - Math.max(0, Math.min(1, Math.pow(inputColor[2]/255, exponent[2]) * amplitude[2] + offset[2])) * 255, - ]; -} - -const amplitudes = [2, 1.1, 0.5]; -const exponents = [5, 3, 1]; -const offsets = [0.25, 0, 0.5]; -ctx.filter = new CanvasFilter({filter: 'componentTransfer', - funcR: {type: 'gamma', amplitude: amplitudes[0], exponent: exponents[0], offset: offsets[0]}, - funcG: {type: 'gamma', amplitude: amplitudes[1], exponent: exponents[1], offset: offsets[1]}, - funcB: {type: 'gamma', amplitude: amplitudes[2], exponent: exponents[2], offset: offsets[2]}, -}); - -const inputColors = [ - [255, 255, 255], - [0, 0, 0], - [127, 0, 34], - [252, 186, 3], - [50, 68, 87], -]; - -for (const color of inputColors) { - let outputColor = getColor(color, amplitudes, exponents, offsets); - ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; - ctx.fillRect(0, 0, 10, 10); - _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); -} - + // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement + function getColor(inputColor, amplitude, exponent, offset) { + return [ + Math.max(0, Math.min(1, Math.pow(inputColor[0]/255, exponent[0]) * amplitude[0] + offset[0])) * 255, + Math.max(0, Math.min(1, Math.pow(inputColor[1]/255, exponent[1]) * amplitude[1] + offset[1])) * 255, + Math.max(0, Math.min(1, Math.pow(inputColor[2]/255, exponent[2]) * amplitude[2] + offset[2])) * 255, + ]; + } + + const amplitudes = [2, 1.1, 0.5]; + const exponents = [5, 3, 1]; + const offsets = [0.25, 0, 0.5]; + ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'gamma', amplitude: amplitudes[0], exponent: exponents[0], offset: offsets[0]}, + funcG: {type: 'gamma', amplitude: amplitudes[1], exponent: exponents[1], offset: offsets[1]}, + funcB: {type: 'gamma', amplitude: amplitudes[2], exponent: exponents[2], offset: offsets[2]}, + }); + + const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], + ]; + + for (const color of inputColors) { + let outputColor = getColor(color, amplitudes, exponents, offsets); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); + } }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html index 96a3e4936ee..bb7dc41c3d8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html @@ -19,26 +19,25 @@ var t = async_test("Test pixels on CanvasFilter() componentTransfer with identity type"); _addTest(function(canvas, ctx) { -ctx.filter = new CanvasFilter({filter: 'componentTransfer', - funcR: {type: 'identity'}, - funcG: {type: 'identity'}, - funcB: {type: 'identity'}, -}); - -const inputColors = [ - [255, 255, 255], - [0, 0, 0], - [127, 0, 34], - [252, 186, 3], - [50, 68, 87], -]; - -for (const color of inputColors) { - ctx.fillStyle = `rgba(${color[0]}, ${color[1]}, ${color[2]}, 1)`, - ctx.fillRect(0, 0, 10, 10); - _assertPixel(canvas, 5, 5, color[0],color[1],color[2],255); -} - + ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'identity'}, + funcG: {type: 'identity'}, + funcB: {type: 'identity'}, + }); + + const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], + ]; + + for (const color of inputColors) { + ctx.fillStyle = `rgba(${color[0]}, ${color[1]}, ${color[2]}, 1)`, + ctx.fillRect(0, 0, 10, 10); + _assertPixel(canvas, 5, 5, color[0],color[1],color[2],255); + } }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html index 10f9931cc64..ee4a0539617 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html @@ -19,38 +19,37 @@ var t = async_test("Test pixels on CanvasFilter() componentTransfer with linear type"); _addTest(function(canvas, ctx) { -// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement -function getColor(inputColor, slopes, intercepts) { - return [ - Math.max(0, Math.min(1, inputColor[0]/255 * slopes[0] + intercepts[0])) * 255, - Math.max(0, Math.min(1, inputColor[1]/255 * slopes[1] + intercepts[1])) * 255, - Math.max(0, Math.min(1, inputColor[2]/255 * slopes[2] + intercepts[2])) * 255, - ]; -} - -const slopes = [0.5, 1.2, -0.2]; -const intercepts = [0.25, 0, 0.5]; -ctx.filter = new CanvasFilter({filter: 'componentTransfer', - funcR: {type: 'linear', slope: slopes[0], intercept: intercepts[0]}, - funcG: {type: 'linear', slope: slopes[1], intercept: intercepts[1]}, - funcB: {type: 'linear', slope: slopes[2], intercept: intercepts[2]}, -}); - -const inputColors = [ - [255, 255, 255], - [0, 0, 0], - [127, 0, 34], - [252, 186, 3], - [50, 68, 87], -]; - -for (const color of inputColors) { - let outputColor = getColor(color, slopes, intercepts); - ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; - ctx.fillRect(0, 0, 10, 10); - _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); -} - + // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement + function getColor(inputColor, slopes, intercepts) { + return [ + Math.max(0, Math.min(1, inputColor[0]/255 * slopes[0] + intercepts[0])) * 255, + Math.max(0, Math.min(1, inputColor[1]/255 * slopes[1] + intercepts[1])) * 255, + Math.max(0, Math.min(1, inputColor[2]/255 * slopes[2] + intercepts[2])) * 255, + ]; + } + + const slopes = [0.5, 1.2, -0.2]; + const intercepts = [0.25, 0, 0.5]; + ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'linear', slope: slopes[0], intercept: intercepts[0]}, + funcG: {type: 'linear', slope: slopes[1], intercept: intercepts[1]}, + funcB: {type: 'linear', slope: slopes[2], intercept: intercepts[2]}, + }); + + const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], + ]; + + for (const color of inputColors) { + let outputColor = getColor(color, slopes, intercepts); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); + } }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html index 7e743bf34f0..510d1304246 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html @@ -19,48 +19,47 @@ var t = async_test("Test pixels on CanvasFilter() componentTransfer with table type"); _addTest(function(canvas, ctx) { -// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement -function getTransformedValue(C, V) { - // Get the right interval - const n = V.length - 1; - const k = C == 1 ? n - 1 : Math.floor(C * n); - return V[k] + (C - k/n) * n * (V[k + 1] - V[k]); -} + // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement + function getTransformedValue(C, V) { + // Get the right interval + const n = V.length - 1; + const k = C == 1 ? n - 1 : Math.floor(C * n); + return V[k] + (C - k/n) * n * (V[k + 1] - V[k]); + } -function getColor(inputColor, tableValues) { - const result = [0, 0, 0]; - for (const i in inputColor) { - const C = inputColor[i]/255; - const Cprime = getTransformedValue(C, tableValues[i]); - result[i] = Math.max(0, Math.min(1, Cprime)) * 255; - } - return result; -} + function getColor(inputColor, tableValues) { + const result = [0, 0, 0]; + for (const i in inputColor) { + const C = inputColor[i]/255; + const Cprime = getTransformedValue(C, tableValues[i]); + result[i] = Math.max(0, Math.min(1, Cprime)) * 255; + } + return result; + } -tableValuesR = [0, 0, 1, 1]; -tableValuesG = [2, 0, 0.5, 3]; -tableValuesB = [1, -1, 5, 0]; -ctx.filter = new CanvasFilter({filter: 'componentTransfer', - funcR: {type: 'table', tableValues: tableValuesR}, - funcG: {type: 'table', tableValues: tableValuesG}, - funcB: {type: 'table', tableValues: tableValuesB}, -}); - -const inputColors = [ - [255, 255, 255], - [0, 0, 0], - [127, 0, 34], - [252, 186, 3], - [50, 68, 87], -]; + tableValuesR = [0, 0, 1, 1]; + tableValuesG = [2, 0, 0.5, 3]; + tableValuesB = [1, -1, 5, 0]; + ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'table', tableValues: tableValuesR}, + funcG: {type: 'table', tableValues: tableValuesG}, + funcB: {type: 'table', tableValues: tableValuesB}, + }); -for (const color of inputColors) { - let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]); - ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; - ctx.fillRect(0, 0, 10, 10); - _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); -} + const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], + ]; + for (const color of inputColors) { + let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); + } }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html index b994a91842c..4f4a9c17bd1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html @@ -19,24 +19,23 @@ var t = async_test("Test exceptions on CanvasFilter() convolveMatrix"); _addTest(function(canvas, ctx) { -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', divisor: 2}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: null}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: 1}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0]]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 'a'], [0]]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], 0]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0, Infinity]]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: []}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1, 2, 3, 4]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], []]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 2], []]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], [1, 2]]}); }); -// This should not throw an error -ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[]]}); -ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1]]}); - + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', divisor: 2}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: null}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: 1}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0]]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 'a'], [0]]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], 0]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0, Infinity]]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: []}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1, 2, 3, 4]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], []]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 2], []]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], [1, 2]]}); }); + // This should not throw an error + ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[]]}); + ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1]]}); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html index 71a8c9eb484..2a14e30bb75 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html @@ -19,105 +19,104 @@ var t = async_test("Test exceptions on CanvasFilter() dropShadow object"); _addTest(function(canvas, ctx) { -// dx -_assert(new CanvasFilter({filter: 'dropShadow', dx: 10}), "new CanvasFilter({filter: 'dropShadow', dx: 10})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: -1}), "new CanvasFilter({filter: 'dropShadow', dx: -1})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: 0.5}), "new CanvasFilter({filter: 'dropShadow', dx: 0.5})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: null}), "new CanvasFilter({filter: 'dropShadow', dx: null})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: true}), "new CanvasFilter({filter: 'dropShadow', dx: true})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: false}), "new CanvasFilter({filter: 'dropShadow', dx: false})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: []}), "new CanvasFilter({filter: 'dropShadow', dx: []})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: [20]}), "new CanvasFilter({filter: 'dropShadow', dx: [\""+(20)+"\"]})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: '30'}), "new CanvasFilter({filter: 'dropShadow', dx: '30'})"); -// dy -_assert(new CanvasFilter({filter: 'dropShadow', dy: 10}), "new CanvasFilter({filter: 'dropShadow', dy: 10})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: -1}), "new CanvasFilter({filter: 'dropShadow', dy: -1})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: 0.5}), "new CanvasFilter({filter: 'dropShadow', dy: 0.5})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: null}), "new CanvasFilter({filter: 'dropShadow', dy: null})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: true}), "new CanvasFilter({filter: 'dropShadow', dy: true})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: false}), "new CanvasFilter({filter: 'dropShadow', dy: false})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: []}), "new CanvasFilter({filter: 'dropShadow', dy: []})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: [20]}), "new CanvasFilter({filter: 'dropShadow', dy: [\""+(20)+"\"]})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: '30'}), "new CanvasFilter({filter: 'dropShadow', dy: '30'})"); -// floodOpacity -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: 10}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: 10})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: -1}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: -1})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: 0.5}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: 0.5})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: null}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: null})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: true}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: true})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: false}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: false})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: []}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: []})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: [20]}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: [\""+(20)+"\"]})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: '30'}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: '30'})"); -// stdDeviation -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: 10}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: 10})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: -1}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: -1})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: 0.5}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: 0.5})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: null}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: null})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: true}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: true})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: false}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: false})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: []}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: []})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [20]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [\""+(20)+"\"]})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: '30'}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: '30'})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [10, -1]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [10, -1]})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [0.5, null]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [0.5, null]})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [true, false]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [true, false]})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [[], [20]]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [[], [\""+(20)+"\"]]})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: ['30', ['40']]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: ['30', ['40']]})"); -// floodColor -_assert(new CanvasFilter({filter: 'dropShadow', floodColor: 'red'}), "new CanvasFilter({filter: 'dropShadow', floodColor: 'red'})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodColor: 'canvas'}), "new CanvasFilter({filter: 'dropShadow', floodColor: 'canvas'})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'}), "new CanvasFilter({filter: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodColor: '#aabbccdd'}), "new CanvasFilter({filter: 'dropShadow', floodColor: '#aabbccdd'})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodColor: '#abcd'}), "new CanvasFilter({filter: 'dropShadow', floodColor: '#abcd'})"); - -// dx -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: NaN}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: -Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: 'test'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: {}}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: [1, 2]}); }); -// dy -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: NaN}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: -Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: 'test'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: {}}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: [1, 2]}); }); -// floodOpacity -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: NaN}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: -Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: 'test'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: {}}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: [1, 2]}); }); -// stdDeviation -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: NaN}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: -Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: 'test'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: {}}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, 2, 3]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, NaN]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, Infinity]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, -Infinity]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, undefined]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, 'test']}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, {}]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, [2, 3]]}); }); -// floodColor -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: 'test'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: 'rgba(NaN, 3, 2, 1)'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: 10}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: null}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: NaN}); }); + // dx + _assert(new CanvasFilter({filter: 'dropShadow', dx: 10}), "new CanvasFilter({filter: 'dropShadow', dx: 10})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: -1}), "new CanvasFilter({filter: 'dropShadow', dx: -1})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: 0.5}), "new CanvasFilter({filter: 'dropShadow', dx: 0.5})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: null}), "new CanvasFilter({filter: 'dropShadow', dx: null})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: true}), "new CanvasFilter({filter: 'dropShadow', dx: true})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: false}), "new CanvasFilter({filter: 'dropShadow', dx: false})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: []}), "new CanvasFilter({filter: 'dropShadow', dx: []})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: [20]}), "new CanvasFilter({filter: 'dropShadow', dx: [\""+(20)+"\"]})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: '30'}), "new CanvasFilter({filter: 'dropShadow', dx: '30'})"); + // dy + _assert(new CanvasFilter({filter: 'dropShadow', dy: 10}), "new CanvasFilter({filter: 'dropShadow', dy: 10})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: -1}), "new CanvasFilter({filter: 'dropShadow', dy: -1})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: 0.5}), "new CanvasFilter({filter: 'dropShadow', dy: 0.5})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: null}), "new CanvasFilter({filter: 'dropShadow', dy: null})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: true}), "new CanvasFilter({filter: 'dropShadow', dy: true})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: false}), "new CanvasFilter({filter: 'dropShadow', dy: false})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: []}), "new CanvasFilter({filter: 'dropShadow', dy: []})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: [20]}), "new CanvasFilter({filter: 'dropShadow', dy: [\""+(20)+"\"]})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: '30'}), "new CanvasFilter({filter: 'dropShadow', dy: '30'})"); + // floodOpacity + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: 10}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: 10})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: -1}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: -1})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: 0.5}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: 0.5})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: null}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: null})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: true}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: true})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: false}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: false})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: []}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: []})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: [20]}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: [\""+(20)+"\"]})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: '30'}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: '30'})"); + // stdDeviation + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: 10}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: 10})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: -1}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: -1})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: 0.5}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: 0.5})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: null}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: null})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: true}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: true})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: false}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: false})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: []}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: []})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [20]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [\""+(20)+"\"]})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: '30'}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: '30'})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [10, -1]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [10, -1]})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [0.5, null]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [0.5, null]})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [true, false]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [true, false]})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [[], [20]]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [[], [\""+(20)+"\"]]})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: ['30', ['40']]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: ['30', ['40']]})"); + // floodColor + _assert(new CanvasFilter({filter: 'dropShadow', floodColor: 'red'}), "new CanvasFilter({filter: 'dropShadow', floodColor: 'red'})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodColor: 'canvas'}), "new CanvasFilter({filter: 'dropShadow', floodColor: 'canvas'})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'}), "new CanvasFilter({filter: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodColor: '#aabbccdd'}), "new CanvasFilter({filter: 'dropShadow', floodColor: '#aabbccdd'})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodColor: '#abcd'}), "new CanvasFilter({filter: 'dropShadow', floodColor: '#abcd'})"); + // dx + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: NaN}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: -Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: undefined}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: 'test'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: {}}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: [1, 2]}); }); + // dy + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: NaN}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: -Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: undefined}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: 'test'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: {}}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: [1, 2]}); }); + // floodOpacity + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: NaN}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: -Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: undefined}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: 'test'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: {}}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: [1, 2]}); }); + // stdDeviation + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: NaN}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: -Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: undefined}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: 'test'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: {}}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, 2, 3]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, NaN]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, Infinity]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, -Infinity]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, undefined]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, 'test']}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, {}]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, [2, 3]]}); }); + // floodColor + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: 'test'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: 'rgba(NaN, 3, 2, 1)'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: 10}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: undefined}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: null}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: NaN}); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.tentative.html b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.tentative.html index a4625db0197..059a71025d5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.tentative.html @@ -19,28 +19,27 @@ var t = async_test("Test CanvasFilter() object"); _addTest(function(canvas, ctx) { -_assert(ctx.filter == 'none', "ctx.filter == 'none'"); -ctx.filter = 'blur(5px)'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); -_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); -ctx.filter = new CanvasFilter([ - {filter: 'gaussianBlur', stdDeviation: 5}, - {filter: 'gaussianBlur', stdDeviation: 10} -]); -_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); -var canvas2 = document.createElement('canvas'); -var ctx2 = canvas2.getContext('2d'); -ctx2.filter = ctx.filter; -_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); -ctx.filter = 'blur(5px)'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = 'none'; -_assert(ctx.filter == 'none', "ctx.filter == 'none'"); -ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); -ctx.filter = 'this string is not a filter and should do nothing'; -_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); - + _assert(ctx.filter == 'none', "ctx.filter == 'none'"); + ctx.filter = 'blur(5px)'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); + _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); + ctx.filter = new CanvasFilter([ + {filter: 'gaussianBlur', stdDeviation: 5}, + {filter: 'gaussianBlur', stdDeviation: 10} + ]); + _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); + var canvas2 = document.createElement('canvas'); + var ctx2 = canvas2.getContext('2d'); + ctx2.filter = ctx.filter; + _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); + ctx.filter = 'blur(5px)'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = 'none'; + _assert(ctx.filter == 'none', "ctx.filter == 'none'"); + ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); + ctx.filter = 'this string is not a filter and should do nothing'; + _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html index 64f909a7fdb..7ab62e368d0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html @@ -19,111 +19,110 @@ var t = async_test("Test exceptions on CanvasFilter() turbulence object"); _addTest(function(canvas, ctx) { -const errorTestCases = [ - {baseFrequency: {}}, - {baseFrequency: -1}, - {baseFrequency: [0, -1]}, - {baseFrequency: NaN}, - {baseFrequency: Infinity}, - {baseFrequency: undefined}, - {baseFrequency: -Infinity}, - {baseFrequency: 'test'}, - - {numOctaves: {}}, - {numOctaves: -1}, - {numOctaves: NaN}, - {numOctaves: Infinity}, - {numOctaves: undefined}, - {numOctaves: -Infinity}, - {numOctaves: [1, 1]}, - {numOctaves: 'test'}, - - {seed: {}}, - {seed: NaN}, - {seed: Infinity}, - {seed: undefined}, - {seed: -Infinity}, - {seed: [1, 1]}, - {seed: 'test'}, - - {stitchTiles: {}}, - {stitchTiles: NaN}, - {stitchTiles: Infinity}, - {stitchTiles: undefined}, - {stitchTiles: -Infinity}, - {stitchTiles: [1, 1]}, - {stitchTiles: 'test'}, - {stitchTiles: null}, - {stitchTiles: []}, - {stitchTiles: [10]}, - {stitchTiles: 30}, - {stitchTiles: false}, - {stitchTiles: true}, - {stitchTiles: '10'}, - {stitchTiles: -1}, - - {type: {}}, - {type: NaN}, - {type: Infinity}, - {type: undefined}, - {type: -Infinity}, - {type: [1, 1]}, - {type: 'test'}, - {type: null}, - {type: []}, - {type: [10]}, - {type: 30}, - {type: false}, - {type: true}, - {type: '10'}, - {type: -1}, -] - -// null and [] = 0 when parsed as number -const workingTestCases = [ - {baseFrequency: null}, - {baseFrequency: []}, - {baseFrequency: [10]}, - {baseFrequency: [10, 3]}, - {baseFrequency: 30}, - {baseFrequency: false}, - {baseFrequency: true}, - {baseFrequency: '10'}, - - {numOctaves: null}, - {numOctaves: []}, - {numOctaves: [10]}, - {numOctaves: 30}, - {numOctaves: false}, - {numOctaves: true}, - {numOctaves: '10'}, - - {seed: null}, - {seed: []}, - {seed: [10]}, - {seed: 30}, - {seed: false}, - {seed: true}, - {seed: '10'}, - {seed: -1}, - - {stitchTiles: 'stitch'}, - {stitchTiles: 'noStitch'}, - - {type: 'fractalNoise'}, - {type: 'turbulence'}, -] - -for (testCase of errorTestCases) { - const filterOptions = {...{filter: 'turbulence'}, ...testCase}; - assert_throws_js(TypeError, function() { new CanvasFilter(filterOptions); }); -} - -for (testCase of workingTestCases) { - const filterOptions = {...{filter: 'turbulence'}, ...testCase}; - _assert(new CanvasFilter(filterOptions) != null, "new CanvasFilter(filterOptions) != null"); -} - + const errorTestCases = [ + {baseFrequency: {}}, + {baseFrequency: -1}, + {baseFrequency: [0, -1]}, + {baseFrequency: NaN}, + {baseFrequency: Infinity}, + {baseFrequency: undefined}, + {baseFrequency: -Infinity}, + {baseFrequency: 'test'}, + + {numOctaves: {}}, + {numOctaves: -1}, + {numOctaves: NaN}, + {numOctaves: Infinity}, + {numOctaves: undefined}, + {numOctaves: -Infinity}, + {numOctaves: [1, 1]}, + {numOctaves: 'test'}, + + {seed: {}}, + {seed: NaN}, + {seed: Infinity}, + {seed: undefined}, + {seed: -Infinity}, + {seed: [1, 1]}, + {seed: 'test'}, + + {stitchTiles: {}}, + {stitchTiles: NaN}, + {stitchTiles: Infinity}, + {stitchTiles: undefined}, + {stitchTiles: -Infinity}, + {stitchTiles: [1, 1]}, + {stitchTiles: 'test'}, + {stitchTiles: null}, + {stitchTiles: []}, + {stitchTiles: [10]}, + {stitchTiles: 30}, + {stitchTiles: false}, + {stitchTiles: true}, + {stitchTiles: '10'}, + {stitchTiles: -1}, + + {type: {}}, + {type: NaN}, + {type: Infinity}, + {type: undefined}, + {type: -Infinity}, + {type: [1, 1]}, + {type: 'test'}, + {type: null}, + {type: []}, + {type: [10]}, + {type: 30}, + {type: false}, + {type: true}, + {type: '10'}, + {type: -1}, + ] + + // null and [] = 0 when parsed as number + const workingTestCases = [ + {baseFrequency: null}, + {baseFrequency: []}, + {baseFrequency: [10]}, + {baseFrequency: [10, 3]}, + {baseFrequency: 30}, + {baseFrequency: false}, + {baseFrequency: true}, + {baseFrequency: '10'}, + + {numOctaves: null}, + {numOctaves: []}, + {numOctaves: [10]}, + {numOctaves: 30}, + {numOctaves: false}, + {numOctaves: true}, + {numOctaves: '10'}, + + {seed: null}, + {seed: []}, + {seed: [10]}, + {seed: 30}, + {seed: false}, + {seed: true}, + {seed: '10'}, + {seed: -1}, + + {stitchTiles: 'stitch'}, + {stitchTiles: 'noStitch'}, + + {type: 'fractalNoise'}, + {type: 'turbulence'}, + ] + + for (testCase of errorTestCases) { + const filterOptions = {...{filter: 'turbulence'}, ...testCase}; + assert_throws_js(TypeError, function() { new CanvasFilter(filterOptions); }); + } + + for (testCase of workingTestCases) { + const filterOptions = {...{filter: 'turbulence'}, ...testCase}; + _assert(new CanvasFilter(filterOptions) != null, "new CanvasFilter(filterOptions) != null"); + } }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.value.html b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.value.html index b5803655f5c..5716b9bd167 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.value.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/filters/2d.filter.value.html @@ -19,37 +19,36 @@ var t = async_test("test if ctx.filter works correctly"); _addTest(function(canvas, ctx) { -_assert(ctx.filter == 'none', "ctx.filter == 'none'"); -ctx.filter = 'blur(5px)'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.save(); -ctx.filter = 'none'; -_assert(ctx.filter == 'none', "ctx.filter == 'none'"); -ctx.restore(); -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); - -ctx.filter = 'blur(10)'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = 'blur 10px'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); - -ctx.filter = 'inherit'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = 'initial'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = 'unset'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); - -ctx.filter = ''; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = null; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = undefined; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); - -ctx.filter = 'blur( 5px)'; -assert_equals(ctx.filter, 'blur( 5px)'); - + _assert(ctx.filter == 'none', "ctx.filter == 'none'"); + ctx.filter = 'blur(5px)'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.save(); + ctx.filter = 'none'; + _assert(ctx.filter == 'none', "ctx.filter == 'none'"); + ctx.restore(); + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + + ctx.filter = 'blur(10)'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = 'blur 10px'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + + ctx.filter = 'inherit'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = 'initial'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = 'unset'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + + ctx.filter = ''; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = null; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = undefined; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + + ctx.filter = 'blur( 5px)'; + assert_equals(ctx.filter, 'blur( 5px)'); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha-expected.html index 72d97c663f8..0666e3098a7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha-expected.html @@ -21,6 +21,7 @@ canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.filter-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.blending-expected.html index b4512e2455e..8a450275889 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.filter-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.blending-expected.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<title>Canvas test: 2d.layer.global-states.alpha.filter</title> -<h1>2d.layer.global-states.alpha.filter</h1> +<title>Canvas test: 2d.layer.global-states.alpha.blending</title> +<h1>2d.layer.global-states.alpha.blending</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -17,11 +17,12 @@ ctx.fill(circle); ctx.globalAlpha = 0.6; - ctx.filter = 'drop-shadow(-9px 9px 0px #e81)'; + ctx.globalCompositeOperation = 'multiply'; canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.filter.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.blending.html index bf522c29457..8e15a2b9364 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.filter.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.blending.html @@ -1,8 +1,8 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<link rel="match" href="2d.layer.global-states.alpha.filter-expected.html"> -<title>Canvas test: 2d.layer.global-states.alpha.filter</title> -<h1>2d.layer.global-states.alpha.filter</h1> +<link rel="match" href="2d.layer.global-states.alpha.blending-expected.html"> +<title>Canvas test: 2d.layer.global-states.alpha.blending</title> +<h1>2d.layer.global-states.alpha.blending</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -18,10 +18,14 @@ ctx.fill(circle); ctx.globalAlpha = 0.6; - ctx.filter = 'drop-shadow(-9px 9px 0px #e81)'; + ctx.globalCompositeOperation = 'multiply'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.blending.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.blending.shadow-expected.html new file mode 100644 index 00000000000..d7ba158d161 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.blending.shadow-expected.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.alpha.blending.shadow</title> +<h1>2d.layer.global-states.alpha.blending.shadow</h1> +<p class="desc">Checks that layers correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'multiply'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + canvas2 = document.createElement("canvas"); + ctx2 = canvas2.getContext("2d"); + + ctx2.globalCompositeOperation = 'screen'; + ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; + ctx2.fillRect(50, 50, 75, 50); + ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; + ctx2.fillRect(70, 70, 75, 50); + + ctx.drawImage(canvas2, 0, 0); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.blending.shadow.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.blending.shadow.html new file mode 100644 index 00000000000..22946174cde --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.blending.shadow.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.alpha.blending.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.alpha.blending.shadow</title> +<h1>2d.layer.global-states.alpha.blending.shadow</h1> +<p class="desc">Checks that layers correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'multiply'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer(); + + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 255, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.globalcompositeoperation-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.composite-expected.html index 12fc31209ac..951049e638c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.globalcompositeoperation-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.composite-expected.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<title>Canvas test: 2d.layer.global-states.filter.globalcompositeoperation</title> -<h1>2d.layer.global-states.filter.globalcompositeoperation</h1> +<title>Canvas test: 2d.layer.global-states.alpha.composite</title> +<h1>2d.layer.global-states.alpha.composite</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -16,12 +16,13 @@ circle.arc(90, 90, 45, 0, 2 * Math.PI); ctx.fill(circle); + ctx.globalAlpha = 0.6; ctx.globalCompositeOperation = 'source-in'; - ctx.filter = 'drop-shadow(-9px 9px 0px #e81)'; canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.filter.globalcompositeoperation.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.composite.html index 54bafb9e652..1ac6a2cbfe8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.filter.globalcompositeoperation.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.composite.html @@ -1,8 +1,8 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<link rel="match" href="2d.layer.global-states.alpha.filter.globalcompositeoperation-expected.html"> -<title>Canvas test: 2d.layer.global-states.alpha.filter.globalcompositeoperation</title> -<h1>2d.layer.global-states.alpha.filter.globalcompositeoperation</h1> +<link rel="match" href="2d.layer.global-states.alpha.composite-expected.html"> +<title>Canvas test: 2d.layer.global-states.alpha.composite</title> +<h1>2d.layer.global-states.alpha.composite</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -19,10 +19,13 @@ ctx.globalAlpha = 0.6; ctx.globalCompositeOperation = 'source-in'; - ctx.filter = 'drop-shadow(-9px 9px 0px #e81)'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.filter.globalcompositeoperation-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.composite.shadow-expected.html index ab7e6cc6c19..a669a2271e9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.filter.globalcompositeoperation-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.composite.shadow-expected.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<title>Canvas test: 2d.layer.global-states.alpha.filter.globalcompositeoperation</title> -<h1>2d.layer.global-states.alpha.filter.globalcompositeoperation</h1> +<title>Canvas test: 2d.layer.global-states.alpha.composite.shadow</title> +<h1>2d.layer.global-states.alpha.composite.shadow</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -18,11 +18,14 @@ ctx.globalAlpha = 0.6; ctx.globalCompositeOperation = 'source-in'; - ctx.filter = 'drop-shadow(-9px 9px 0px #e81)'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.composite.shadow.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.composite.shadow.html new file mode 100644 index 00000000000..c07e717a663 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.composite.shadow.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.alpha.composite.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.alpha.composite.shadow</title> +<h1>2d.layer.global-states.alpha.composite.shadow</h1> +<p class="desc">Checks that layers correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'source-in'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer(); + + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 255, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.html index 10ef0e7b221..829796acbf9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.html @@ -21,6 +21,10 @@ ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.shadow-expected.html index 9daefc377bd..206eb750139 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.shadow-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.shadow-expected.html @@ -19,11 +19,12 @@ ctx.globalAlpha = 0.5; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'orange'; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.shadow.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.shadow.html index a0f4d79a223..bcb7fe50962 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.shadow.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.shadow.html @@ -20,10 +20,14 @@ ctx.globalAlpha = 0.5; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'orange'; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.filter-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.blending-expected.html index b4512e2455e..33fdf46a287 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.filter-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.blending-expected.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<title>Canvas test: 2d.layer.global-states.alpha.filter</title> -<h1>2d.layer.global-states.alpha.filter</h1> +<title>Canvas test: 2d.layer.global-states.blending</title> +<h1>2d.layer.global-states.blending</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -16,12 +16,12 @@ circle.arc(90, 90, 45, 0, 2 * Math.PI); ctx.fill(circle); - ctx.globalAlpha = 0.6; - ctx.filter = 'drop-shadow(-9px 9px 0px #e81)'; + ctx.globalCompositeOperation = 'multiply'; canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.blending.html index 7524ef56bb9..7d4d9ae4b5b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.blending.html @@ -1,8 +1,8 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<link rel="match" href="2d.layer.global-states.filter-expected.html"> -<title>Canvas test: 2d.layer.global-states.filter</title> -<h1>2d.layer.global-states.filter</h1> +<link rel="match" href="2d.layer.global-states.blending-expected.html"> +<title>Canvas test: 2d.layer.global-states.blending</title> +<h1>2d.layer.global-states.blending</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -17,10 +17,14 @@ circle.arc(90, 90, 45, 0, 2 * Math.PI); ctx.fill(circle); - ctx.filter = 'sepia(1) opacity(30%)'; + ctx.globalCompositeOperation = 'multiply'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.filter.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.blending.shadow-expected.html index 857db7ba991..02275c8cc21 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.filter.shadow-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.blending.shadow-expected.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<title>Canvas test: 2d.layer.global-states.alpha.filter.shadow</title> -<h1>2d.layer.global-states.alpha.filter.shadow</h1> +<title>Canvas test: 2d.layer.global-states.blending.shadow</title> +<h1>2d.layer.global-states.blending.shadow</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -16,15 +16,15 @@ circle.arc(90, 90, 45, 0, 2 * Math.PI); ctx.fill(circle); - ctx.globalAlpha = 0.5; - ctx.filter = 'sepia(0.5) drop-shadow(5px 5px 0px #81e)'; + ctx.globalCompositeOperation = 'multiply'; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'orange'; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.filter.shadow.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.blending.shadow.html index 3b4727bfc34..80f414d4ee5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.filter.shadow.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.blending.shadow.html @@ -1,9 +1,8 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<link rel="match" href="2d.layer.global-states.alpha.filter.shadow-expected.html"> -<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-5824"> -<title>Canvas test: 2d.layer.global-states.alpha.filter.shadow</title> -<h1>2d.layer.global-states.alpha.filter.shadow</h1> +<link rel="match" href="2d.layer.global-states.blending.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.blending.shadow</title> +<h1>2d.layer.global-states.blending.shadow</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -18,14 +17,17 @@ circle.arc(90, 90, 45, 0, 2 * Math.PI); ctx.fill(circle); - ctx.globalAlpha = 0.5; - ctx.filter = 'sepia(0.5) drop-shadow(5px 5px 0px #81e)'; + ctx.globalCompositeOperation = 'multiply'; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'orange'; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.globalcompositeoperation-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.composite-expected.html index 7e2e021b552..ed7669c4cfa 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.globalcompositeoperation-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.composite-expected.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<title>Canvas test: 2d.layer.global-states.globalcompositeoperation</title> -<h1>2d.layer.global-states.globalcompositeoperation</h1> +<title>Canvas test: 2d.layer.global-states.composite</title> +<h1>2d.layer.global-states.composite</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -21,6 +21,7 @@ canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.globalcompositeoperation.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.composite.html index f27336adf4b..898d1499241 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.globalcompositeoperation.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.composite.html @@ -1,8 +1,8 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<link rel="match" href="2d.layer.global-states.globalcompositeoperation-expected.html"> -<title>Canvas test: 2d.layer.global-states.globalcompositeoperation</title> -<h1>2d.layer.global-states.globalcompositeoperation</h1> +<link rel="match" href="2d.layer.global-states.composite-expected.html"> +<title>Canvas test: 2d.layer.global-states.composite</title> +<h1>2d.layer.global-states.composite</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -21,6 +21,10 @@ ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.filter.globalcompositeoperation-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.composite.shadow-expected.html index ab7e6cc6c19..e380cccab82 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.filter.globalcompositeoperation-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.composite.shadow-expected.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<title>Canvas test: 2d.layer.global-states.alpha.filter.globalcompositeoperation</title> -<h1>2d.layer.global-states.alpha.filter.globalcompositeoperation</h1> +<title>Canvas test: 2d.layer.global-states.composite.shadow</title> +<h1>2d.layer.global-states.composite.shadow</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -16,13 +16,15 @@ circle.arc(90, 90, 45, 0, 2 * Math.PI); ctx.fill(circle); - ctx.globalAlpha = 0.6; ctx.globalCompositeOperation = 'source-in'; - ctx.filter = 'drop-shadow(-9px 9px 0px #e81)'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.globalcompositeoperation.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.composite.shadow.html index 1f23dba96cc..9e32dddd40d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.globalcompositeoperation.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.composite.shadow.html @@ -1,8 +1,8 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<link rel="match" href="2d.layer.global-states.filter.globalcompositeoperation-expected.html"> -<title>Canvas test: 2d.layer.global-states.filter.globalcompositeoperation</title> -<h1>2d.layer.global-states.filter.globalcompositeoperation</h1> +<link rel="match" href="2d.layer.global-states.composite.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.composite.shadow</title> +<h1>2d.layer.global-states.composite.shadow</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -18,10 +18,16 @@ ctx.fill(circle); ctx.globalCompositeOperation = 'source-in'; - ctx.filter = 'drop-shadow(-9px 9px 0px #e81)'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha-expected.html new file mode 100644 index 00000000000..f304700feb3 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha-expected.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.alpha</title> +<h1>2d.layer.global-states.filter.alpha</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.blending-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.blending-expected.html new file mode 100644 index 00000000000..7c91ce42293 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.blending-expected.html @@ -0,0 +1,51 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.alpha.blending</title> +<h1>2d.layer.global-states.filter.alpha.blending</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'multiply'; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.blending.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.blending.html new file mode 100644 index 00000000000..6f92e6d33f0 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.blending.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.alpha.blending-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.alpha.blending</title> +<h1>2d.layer.global-states.filter.alpha.blending</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'multiply'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.blending.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.blending.shadow-expected.html new file mode 100644 index 00000000000..d9c93719b99 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.blending.shadow-expected.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.alpha.blending.shadow</title> +<h1>2d.layer.global-states.filter.alpha.blending.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'multiply'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.blending.shadow.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.blending.shadow.html new file mode 100644 index 00000000000..68bdee684d3 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.blending.shadow.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.alpha.blending.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.alpha.blending.shadow</title> +<h1>2d.layer.global-states.filter.alpha.blending.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'multiply'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.composite-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.composite-expected.html new file mode 100644 index 00000000000..8e0d98648ea --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.composite-expected.html @@ -0,0 +1,51 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.alpha.composite</title> +<h1>2d.layer.global-states.filter.alpha.composite</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'source-in'; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.composite.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.composite.html new file mode 100644 index 00000000000..72282d65598 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.composite.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.alpha.composite-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.alpha.composite</title> +<h1>2d.layer.global-states.filter.alpha.composite</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'source-in'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.composite.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.composite.shadow-expected.html new file mode 100644 index 00000000000..26d13a4cae9 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.composite.shadow-expected.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.alpha.composite.shadow</title> +<h1>2d.layer.global-states.filter.alpha.composite.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'source-in'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.composite.shadow.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.composite.shadow.html new file mode 100644 index 00000000000..71c99dba353 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.composite.shadow.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.alpha.composite.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.alpha.composite.shadow</title> +<h1>2d.layer.global-states.filter.alpha.composite.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'source-in'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.html new file mode 100644 index 00000000000..9e687bcaf8a --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.alpha-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.alpha</title> +<h1>2d.layer.global-states.filter.alpha</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.shadow-expected.html new file mode 100644 index 00000000000..9cc735fd42c --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.shadow-expected.html @@ -0,0 +1,53 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.alpha.shadow</title> +<h1>2d.layer.global-states.filter.alpha.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.5; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.shadow.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.shadow.html new file mode 100644 index 00000000000..a9564c44a7c --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.alpha.shadow.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.alpha.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.alpha.shadow</title> +<h1>2d.layer.global-states.filter.alpha.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.5; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.blending-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.blending-expected.html new file mode 100644 index 00000000000..f81dcf72dc2 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.blending-expected.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.blending</title> +<h1>2d.layer.global-states.filter.blending</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'multiply'; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.blending.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.blending.html new file mode 100644 index 00000000000..a812563398e --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.blending.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.blending-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.blending</title> +<h1>2d.layer.global-states.filter.blending</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'multiply'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.blending.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.blending.shadow-expected.html new file mode 100644 index 00000000000..a48485f7e8a --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.blending.shadow-expected.html @@ -0,0 +1,53 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.blending.shadow</title> +<h1>2d.layer.global-states.filter.blending.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'multiply'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.blending.shadow.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.blending.shadow.html new file mode 100644 index 00000000000..bf30126ff2f --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.blending.shadow.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.blending.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.blending.shadow</title> +<h1>2d.layer.global-states.filter.blending.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'multiply'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.composite-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.composite-expected.html new file mode 100644 index 00000000000..97e85a1593b --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.composite-expected.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.composite</title> +<h1>2d.layer.global-states.filter.composite</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'source-in'; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.composite.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.composite.html new file mode 100644 index 00000000000..a2636d85255 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.composite.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.composite-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.composite</title> +<h1>2d.layer.global-states.filter.composite</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'source-in'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.composite.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.composite.shadow-expected.html new file mode 100644 index 00000000000..79191ee3910 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.composite.shadow-expected.html @@ -0,0 +1,53 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.composite.shadow</title> +<h1>2d.layer.global-states.filter.composite.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'source-in'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.composite.shadow.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.composite.shadow.html new file mode 100644 index 00000000000..85b83b59b90 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.composite.shadow.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.composite.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.composite.shadow</title> +<h1>2d.layer.global-states.filter.composite.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'source-in'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.no-global-states-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.no-global-states-expected.html new file mode 100644 index 00000000000..e56fe0b3602 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.no-global-states-expected.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.no-global-states</title> +<h1>2d.layer.global-states.filter.no-global-states</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + // No global states. + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.no-global-states.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.no-global-states.html new file mode 100644 index 00000000000..af495b21cd2 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.no-global-states.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.no-global-states-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.no-global-states</title> +<h1>2d.layer.global-states.filter.no-global-states</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + // No global states. + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.shadow-expected.html index 6ec9b02f7cb..59cf16fa87d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.shadow-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.shadow-expected.html @@ -2,7 +2,7 @@ <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>Canvas test: 2d.layer.global-states.filter.shadow</title> <h1>2d.layer.global-states.filter.shadow</h1> -<p class="desc">Checks that layers correctly use global render states.</p> +<p class="desc">Checks that layers with filters correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> </canvas> @@ -10,24 +10,43 @@ const canvas = document.getElementById("canvas"); const ctx = canvas.getContext('2d'); - ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; - var circle = new Path2D(); - circle.arc(90, 90, 45, 0, 2 * Math.PI); - ctx.fill(circle); + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; - ctx.filter = 'sepia(1) opacity(70%)'; - ctx.shadowOffsetX = -10; - ctx.shadowOffsetY = 10; - ctx.shadowColor = 'rgba(0,1,0,0.5)'; - - canvas2 = document.createElement("canvas"); - ctx2 = canvas2.getContext("2d"); + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); - ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; - ctx2.fillRect(50, 50, 75, 50); - ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; - ctx2.fillRect(70, 70, 75, 50); + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; - ctx.drawImage(canvas2, 0, 0); + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.shadow.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.shadow.html index efa5dca2ae0..2c692d6db76 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.shadow.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.shadow.html @@ -1,10 +1,9 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <link rel="match" href="2d.layer.global-states.filter.shadow-expected.html"> -<meta name=fuzzy content="maxDifference=0-1; totalPixels=0-49"> <title>Canvas test: 2d.layer.global-states.filter.shadow</title> <h1>2d.layer.global-states.filter.shadow</h1> -<p class="desc">Checks that layers correctly use global render states.</p> +<p class="desc">Checks that layers with filters correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> </canvas> @@ -18,16 +17,22 @@ circle.arc(90, 90, 45, 0, 2 * Math.PI); ctx.fill(circle); - ctx.filter = 'sepia(1) opacity(70%)'; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'rgba(0,1,0,0.5)'; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; - ctx.beginLayer(); + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); - ctx.fillStyle = 'rgba(225, 0, 0, 1)'; + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); - ctx.fillStyle = 'rgba(0, 255, 0, 1)'; + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; ctx.fillRect(70, 70, 75, 50); ctx.endLayer(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.no_global_states-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.no-global-states-expected.html index 139ff8ac944..b91a2ae8b52 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.no_global_states-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.no-global-states-expected.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<title>Canvas test: 2d.layer.global-states.no_global_states</title> -<h1>2d.layer.global-states.no_global_states</h1> +<title>Canvas test: 2d.layer.global-states.no-global-states</title> +<h1>2d.layer.global-states.no-global-states</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -21,6 +21,7 @@ canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.no_global_states.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.no-global-states.html index 93d2bdeb927..d561be23410 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.no_global_states.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.no-global-states.html @@ -1,8 +1,8 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<link rel="match" href="2d.layer.global-states.no_global_states-expected.html"> -<title>Canvas test: 2d.layer.global-states.no_global_states</title> -<h1>2d.layer.global-states.no_global_states</h1> +<link rel="match" href="2d.layer.global-states.no-global-states-expected.html"> +<title>Canvas test: 2d.layer.global-states.no-global-states</title> +<h1>2d.layer.global-states.no-global-states</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -21,6 +21,10 @@ ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.shadow-expected.html index 6787bdd1e50..ba56644d6c2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.shadow-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.shadow-expected.html @@ -18,11 +18,12 @@ ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'orange'; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.shadow.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.shadow.html index da78b3435c7..bd9e868d1ef 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.shadow.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.shadow.html @@ -19,10 +19,14 @@ ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'orange'; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.several-complex-expected.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.several-complex-expected.html index 1944ea6d2ac..84ad6244740 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.several-complex-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.several-complex-expected.html @@ -14,7 +14,6 @@ ctx.fillRect(50, 50, 95, 70); ctx.globalAlpha = 0.5; - ctx.filter = 'sepia(0.5)'; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; ctx.shadowColor = 'orange'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.several-complex.html b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.several-complex.html index f99357bd7fd..6ae78f690ae 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.several-complex.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.several-complex.html @@ -16,7 +16,6 @@ ctx.fillRect(50, 50, 95, 70); ctx.globalAlpha = 0.5; - ctx.filter = 'sepia(0.5)'; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; ctx.shadowColor = 'orange'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.butt.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.butt.html index 59b1f76c686..f8c7cab1f2e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.butt.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.butt.html @@ -19,42 +19,41 @@ var t = async_test("lineCap 'butt' is rendered correctly"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineCap = 'butt'; -ctx.lineWidth = 20; - -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; -ctx.fillRect(15, 15, 20, 20); -ctx.beginPath(); -ctx.moveTo(25, 15); -ctx.lineTo(25, 35); -ctx.stroke(); - -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(75, 15); -ctx.lineTo(75, 35); -ctx.stroke(); -ctx.fillRect(65, 15, 20, 20); - -_assertPixel(canvas, 25,14, 0,255,0,255); -_assertPixel(canvas, 25,15, 0,255,0,255); -_assertPixel(canvas, 25,16, 0,255,0,255); -_assertPixel(canvas, 25,34, 0,255,0,255); -_assertPixel(canvas, 25,35, 0,255,0,255); -_assertPixel(canvas, 25,36, 0,255,0,255); - -_assertPixel(canvas, 75,14, 0,255,0,255); -_assertPixel(canvas, 75,15, 0,255,0,255); -_assertPixel(canvas, 75,16, 0,255,0,255); -_assertPixel(canvas, 75,34, 0,255,0,255); -_assertPixel(canvas, 75,35, 0,255,0,255); -_assertPixel(canvas, 75,36, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineCap = 'butt'; + ctx.lineWidth = 20; + + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + ctx.fillRect(15, 15, 20, 20); + ctx.beginPath(); + ctx.moveTo(25, 15); + ctx.lineTo(25, 35); + ctx.stroke(); + + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(75, 15); + ctx.lineTo(75, 35); + ctx.stroke(); + ctx.fillRect(65, 15, 20, 20); + + _assertPixel(canvas, 25,14, 0,255,0,255); + _assertPixel(canvas, 25,15, 0,255,0,255); + _assertPixel(canvas, 25,16, 0,255,0,255); + _assertPixel(canvas, 25,34, 0,255,0,255); + _assertPixel(canvas, 25,35, 0,255,0,255); + _assertPixel(canvas, 25,36, 0,255,0,255); + + _assertPixel(canvas, 75,14, 0,255,0,255); + _assertPixel(canvas, 75,15, 0,255,0,255); + _assertPixel(canvas, 75,16, 0,255,0,255); + _assertPixel(canvas, 75,34, 0,255,0,255); + _assertPixel(canvas, 75,35, 0,255,0,255); + _assertPixel(canvas, 75,36, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.closed.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.closed.html index 5f16ac95005..263c6c6c76f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.closed.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.closed.html @@ -19,27 +19,26 @@ var t = async_test("Line caps are not drawn at the corners of an unclosed rectangle"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineJoin = 'bevel'; -ctx.lineCap = 'square'; -ctx.lineWidth = 400; - -ctx.beginPath(); -ctx.moveTo(200, 200); -ctx.lineTo(200, 1000); -ctx.lineTo(1000, 1000); -ctx.lineTo(1000, 200); -ctx.closePath(); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineJoin = 'bevel'; + ctx.lineCap = 'square'; + ctx.lineWidth = 400; + + ctx.beginPath(); + ctx.moveTo(200, 200); + ctx.lineTo(200, 1000); + ctx.lineTo(1000, 1000); + ctx.lineTo(1000, 200); + ctx.closePath(); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.invalid.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.invalid.html index c62e71f6e29..22e98ee3263 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.invalid.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.invalid.html @@ -19,33 +19,32 @@ var t = async_test("Setting lineCap to invalid values is ignored"); _addTest(function(canvas, ctx) { -ctx.lineCap = 'butt' -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt' + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -ctx.lineCap = 'butt'; -ctx.lineCap = 'invalid'; -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt'; + ctx.lineCap = 'invalid'; + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -ctx.lineCap = 'butt'; -ctx.lineCap = 'ROUND'; -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt'; + ctx.lineCap = 'ROUND'; + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -ctx.lineCap = 'butt'; -ctx.lineCap = 'round\0'; -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt'; + ctx.lineCap = 'round\0'; + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -ctx.lineCap = 'butt'; -ctx.lineCap = 'round '; -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt'; + ctx.lineCap = 'round '; + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -ctx.lineCap = 'butt'; -ctx.lineCap = ""; -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); - -ctx.lineCap = 'butt'; -ctx.lineCap = 'bevel'; -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt'; + ctx.lineCap = ""; + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt'; + ctx.lineCap = 'bevel'; + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.open.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.open.html index fc5aca585c5..6f7918a1c9f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.open.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.open.html @@ -19,27 +19,26 @@ var t = async_test("Line caps are drawn at the corners of an unclosed rectangle"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineJoin = 'bevel'; -ctx.lineCap = 'square'; -ctx.lineWidth = 400; - -ctx.beginPath(); -ctx.moveTo(200, 200); -ctx.lineTo(200, 1000); -ctx.lineTo(1000, 1000); -ctx.lineTo(1000, 200); -ctx.lineTo(200, 200); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineJoin = 'bevel'; + ctx.lineCap = 'square'; + ctx.lineWidth = 400; + + ctx.beginPath(); + ctx.moveTo(200, 200); + ctx.lineTo(200, 1000); + ctx.lineTo(1000, 1000); + ctx.lineTo(1000, 200); + ctx.lineTo(200, 200); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.round.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.round.html index 48411812de0..3990ad384ea 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.round.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.round.html @@ -19,58 +19,57 @@ var t = async_test("lineCap 'round' is rendered correctly"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -var tol = 1; // tolerance to avoid antialiasing artifacts + var tol = 1; // tolerance to avoid antialiasing artifacts -ctx.lineCap = 'round'; -ctx.lineWidth = 20; + ctx.lineCap = 'round'; + ctx.lineWidth = 20; -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(35-tol, 15); -ctx.arc(25, 15, 10-tol, 0, Math.PI, true); -ctx.arc(25, 35, 10-tol, Math.PI, 0, true); -ctx.fill(); + ctx.beginPath(); + ctx.moveTo(35-tol, 15); + ctx.arc(25, 15, 10-tol, 0, Math.PI, true); + ctx.arc(25, 35, 10-tol, Math.PI, 0, true); + ctx.fill(); -ctx.beginPath(); -ctx.moveTo(25, 15); -ctx.lineTo(25, 35); -ctx.stroke(); + ctx.beginPath(); + ctx.moveTo(25, 15); + ctx.lineTo(25, 35); + ctx.stroke(); -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(75, 15); -ctx.lineTo(75, 35); -ctx.stroke(); + ctx.beginPath(); + ctx.moveTo(75, 15); + ctx.lineTo(75, 35); + ctx.stroke(); -ctx.beginPath(); -ctx.moveTo(85+tol, 15); -ctx.arc(75, 15, 10+tol, 0, Math.PI, true); -ctx.arc(75, 35, 10+tol, Math.PI, 0, true); -ctx.fill(); + ctx.beginPath(); + ctx.moveTo(85+tol, 15); + ctx.arc(75, 15, 10+tol, 0, Math.PI, true); + ctx.arc(75, 35, 10+tol, Math.PI, 0, true); + ctx.fill(); -_assertPixel(canvas, 17,6, 0,255,0,255); -_assertPixel(canvas, 25,6, 0,255,0,255); -_assertPixel(canvas, 32,6, 0,255,0,255); -_assertPixel(canvas, 17,43, 0,255,0,255); -_assertPixel(canvas, 25,43, 0,255,0,255); -_assertPixel(canvas, 32,43, 0,255,0,255); - -_assertPixel(canvas, 67,6, 0,255,0,255); -_assertPixel(canvas, 75,6, 0,255,0,255); -_assertPixel(canvas, 82,6, 0,255,0,255); -_assertPixel(canvas, 67,43, 0,255,0,255); -_assertPixel(canvas, 75,43, 0,255,0,255); -_assertPixel(canvas, 82,43, 0,255,0,255); + _assertPixel(canvas, 17,6, 0,255,0,255); + _assertPixel(canvas, 25,6, 0,255,0,255); + _assertPixel(canvas, 32,6, 0,255,0,255); + _assertPixel(canvas, 17,43, 0,255,0,255); + _assertPixel(canvas, 25,43, 0,255,0,255); + _assertPixel(canvas, 32,43, 0,255,0,255); + _assertPixel(canvas, 67,6, 0,255,0,255); + _assertPixel(canvas, 75,6, 0,255,0,255); + _assertPixel(canvas, 82,6, 0,255,0,255); + _assertPixel(canvas, 67,43, 0,255,0,255); + _assertPixel(canvas, 75,43, 0,255,0,255); + _assertPixel(canvas, 82,43, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.square.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.square.html index 3423fa79e47..8d6af320fea 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.square.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.square.html @@ -19,42 +19,41 @@ var t = async_test("lineCap 'square' is rendered correctly"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineCap = 'square'; -ctx.lineWidth = 20; - -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; -ctx.fillRect(15, 5, 20, 40); -ctx.beginPath(); -ctx.moveTo(25, 15); -ctx.lineTo(25, 35); -ctx.stroke(); - -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(75, 15); -ctx.lineTo(75, 35); -ctx.stroke(); -ctx.fillRect(65, 5, 20, 40); - -_assertPixel(canvas, 25,4, 0,255,0,255); -_assertPixel(canvas, 25,5, 0,255,0,255); -_assertPixel(canvas, 25,6, 0,255,0,255); -_assertPixel(canvas, 25,44, 0,255,0,255); -_assertPixel(canvas, 25,45, 0,255,0,255); -_assertPixel(canvas, 25,46, 0,255,0,255); - -_assertPixel(canvas, 75,4, 0,255,0,255); -_assertPixel(canvas, 75,5, 0,255,0,255); -_assertPixel(canvas, 75,6, 0,255,0,255); -_assertPixel(canvas, 75,44, 0,255,0,255); -_assertPixel(canvas, 75,45, 0,255,0,255); -_assertPixel(canvas, 75,46, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineCap = 'square'; + ctx.lineWidth = 20; + + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + ctx.fillRect(15, 5, 20, 40); + ctx.beginPath(); + ctx.moveTo(25, 15); + ctx.lineTo(25, 35); + ctx.stroke(); + + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(75, 15); + ctx.lineTo(75, 35); + ctx.stroke(); + ctx.fillRect(65, 5, 20, 40); + + _assertPixel(canvas, 25,4, 0,255,0,255); + _assertPixel(canvas, 25,5, 0,255,0,255); + _assertPixel(canvas, 25,6, 0,255,0,255); + _assertPixel(canvas, 25,44, 0,255,0,255); + _assertPixel(canvas, 25,45, 0,255,0,255); + _assertPixel(canvas, 25,46, 0,255,0,255); + + _assertPixel(canvas, 75,4, 0,255,0,255); + _assertPixel(canvas, 75,5, 0,255,0,255); + _assertPixel(canvas, 75,6, 0,255,0,255); + _assertPixel(canvas, 75,44, 0,255,0,255); + _assertPixel(canvas, 75,45, 0,255,0,255); + _assertPixel(canvas, 75,46, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.valid.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.valid.html index 2c02ede579b..a11d32030ea 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.valid.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cap.valid.html @@ -19,15 +19,14 @@ var t = async_test("Setting lineCap to valid values works"); _addTest(function(canvas, ctx) { -ctx.lineCap = 'butt' -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt' + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -ctx.lineCap = 'round'; -_assertSame(ctx.lineCap, 'round', "ctx.lineCap", "'round'"); - -ctx.lineCap = 'square'; -_assertSame(ctx.lineCap, 'square', "ctx.lineCap", "'square'"); + ctx.lineCap = 'round'; + _assertSame(ctx.lineCap, 'round', "ctx.lineCap", "'round'"); + ctx.lineCap = 'square'; + _assertSame(ctx.lineCap, 'square', "ctx.lineCap", "'square'"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cross.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cross.html index a664e372534..e6866e3e40a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cross.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.cross.html @@ -19,24 +19,23 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 200; -ctx.lineJoin = 'bevel'; - -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(110, 50); -ctx.lineTo(110, 60); -ctx.lineTo(100, 60); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 200; + ctx.lineJoin = 'bevel'; + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(110, 50); + ctx.lineTo(110, 60); + ctx.lineTo(100, 60); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.defaults.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.defaults.html index efea3ca1aaf..daa4634387c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.defaults.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.defaults.html @@ -19,11 +19,10 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -_assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1"); -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -_assertSame(ctx.lineJoin, 'miter', "ctx.lineJoin", "'miter'"); -_assertSame(ctx.miterLimit, 10, "ctx.miterLimit", "10"); - + _assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1"); + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + _assertSame(ctx.lineJoin, 'miter', "ctx.lineJoin", "'miter'"); + _assertSame(ctx.miterLimit, 10, "ctx.miterLimit", "10"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.invalid.strokestyle.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.invalid.strokestyle.html index 29bd98e5e52..89a234ecc38 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.invalid.strokestyle.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.invalid.strokestyle.html @@ -19,18 +19,17 @@ var t = async_test("Verify correct behavior of canvas on an invalid strokeStyle()"); _addTest(function(canvas, ctx) { -ctx.strokeStyle = 'rgb(0, 255, 0)'; -ctx.strokeStyle = 'nonsense'; -ctx.lineWidth = 200; -ctx.moveTo(0,100); -ctx.lineTo(200,100); -ctx.stroke(); -var imageData = ctx.getImageData(0, 0, 200, 200); -var imgdata = imageData.data; -_assert(imgdata[4] == 0, "imgdata[\""+(4)+"\"] == 0"); -_assert(imgdata[5] == 255, "imgdata[\""+(5)+"\"] == 255"); -_assert(imgdata[6] == 0, "imgdata[\""+(6)+"\"] == 0"); - + ctx.strokeStyle = 'rgb(0, 255, 0)'; + ctx.strokeStyle = 'nonsense'; + ctx.lineWidth = 200; + ctx.moveTo(0,100); + ctx.lineTo(200,100); + ctx.stroke(); + var imageData = ctx.getImageData(0, 0, 200, 200); + var imgdata = imageData.data; + _assert(imgdata[4] == 0, "imgdata[\""+(4)+"\"] == 0"); + _assert(imgdata[5] == 255, "imgdata[\""+(5)+"\"] == 255"); + _assert(imgdata[6] == 0, "imgdata[\""+(6)+"\"] == 0"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.bevel.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.bevel.html index c1320c2c0b3..041e9a16058 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.bevel.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.bevel.html @@ -19,61 +19,60 @@ var t = async_test("lineJoin 'bevel' is rendered correctly"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -var tol = 1; // tolerance to avoid antialiasing artifacts - -ctx.lineJoin = 'bevel'; -ctx.lineWidth = 20; - -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; - -ctx.fillRect(10, 10, 20, 20); -ctx.fillRect(20, 20, 20, 20); -ctx.beginPath(); -ctx.moveTo(30, 20); -ctx.lineTo(40-tol, 20); -ctx.lineTo(30, 10+tol); -ctx.fill(); - -ctx.beginPath(); -ctx.moveTo(10, 20); -ctx.lineTo(30, 20); -ctx.lineTo(30, 40); -ctx.stroke(); - - -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; - -ctx.beginPath(); -ctx.moveTo(60, 20); -ctx.lineTo(80, 20); -ctx.lineTo(80, 40); -ctx.stroke(); - -ctx.fillRect(60, 10, 20, 20); -ctx.fillRect(70, 20, 20, 20); -ctx.beginPath(); -ctx.moveTo(80, 20); -ctx.lineTo(90+tol, 20); -ctx.lineTo(80, 10-tol); -ctx.fill(); - -_assertPixel(canvas, 34,16, 0,255,0,255); -_assertPixel(canvas, 34,15, 0,255,0,255); -_assertPixel(canvas, 35,15, 0,255,0,255); -_assertPixel(canvas, 36,15, 0,255,0,255); -_assertPixel(canvas, 36,14, 0,255,0,255); - -_assertPixel(canvas, 84,16, 0,255,0,255); -_assertPixel(canvas, 84,15, 0,255,0,255); -_assertPixel(canvas, 85,15, 0,255,0,255); -_assertPixel(canvas, 86,15, 0,255,0,255); -_assertPixel(canvas, 86,14, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + var tol = 1; // tolerance to avoid antialiasing artifacts + + ctx.lineJoin = 'bevel'; + ctx.lineWidth = 20; + + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + + ctx.fillRect(10, 10, 20, 20); + ctx.fillRect(20, 20, 20, 20); + ctx.beginPath(); + ctx.moveTo(30, 20); + ctx.lineTo(40-tol, 20); + ctx.lineTo(30, 10+tol); + ctx.fill(); + + ctx.beginPath(); + ctx.moveTo(10, 20); + ctx.lineTo(30, 20); + ctx.lineTo(30, 40); + ctx.stroke(); + + + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + + ctx.beginPath(); + ctx.moveTo(60, 20); + ctx.lineTo(80, 20); + ctx.lineTo(80, 40); + ctx.stroke(); + + ctx.fillRect(60, 10, 20, 20); + ctx.fillRect(70, 20, 20, 20); + ctx.beginPath(); + ctx.moveTo(80, 20); + ctx.lineTo(90+tol, 20); + ctx.lineTo(80, 10-tol); + ctx.fill(); + + _assertPixel(canvas, 34,16, 0,255,0,255); + _assertPixel(canvas, 34,15, 0,255,0,255); + _assertPixel(canvas, 35,15, 0,255,0,255); + _assertPixel(canvas, 36,15, 0,255,0,255); + _assertPixel(canvas, 36,14, 0,255,0,255); + + _assertPixel(canvas, 84,16, 0,255,0,255); + _assertPixel(canvas, 84,15, 0,255,0,255); + _assertPixel(canvas, 85,15, 0,255,0,255); + _assertPixel(canvas, 86,15, 0,255,0,255); + _assertPixel(canvas, 86,14, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.closed.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.closed.html index 6fd9d9d300b..a52219cccef 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.closed.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.closed.html @@ -19,26 +19,25 @@ var t = async_test("Line joins are drawn at the corner of a closed rectangle"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineJoin = 'miter'; -ctx.lineWidth = 200; - -ctx.beginPath(); -ctx.moveTo(100, 50); -ctx.lineTo(100, 1000); -ctx.lineTo(1000, 1000); -ctx.lineTo(1000, 50); -ctx.closePath(); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineJoin = 'miter'; + ctx.lineWidth = 200; + + ctx.beginPath(); + ctx.moveTo(100, 50); + ctx.lineTo(100, 1000); + ctx.lineTo(1000, 1000); + ctx.lineTo(1000, 50); + ctx.closePath(); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.invalid.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.invalid.html index a1c5aa0dda8..3c34ef34751 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.invalid.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.invalid.html @@ -19,33 +19,32 @@ var t = async_test("Setting lineJoin to invalid values is ignored"); _addTest(function(canvas, ctx) { -ctx.lineJoin = 'bevel' -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel' + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -ctx.lineJoin = 'bevel'; -ctx.lineJoin = 'invalid'; -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel'; + ctx.lineJoin = 'invalid'; + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -ctx.lineJoin = 'bevel'; -ctx.lineJoin = 'ROUND'; -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel'; + ctx.lineJoin = 'ROUND'; + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -ctx.lineJoin = 'bevel'; -ctx.lineJoin = 'round\0'; -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel'; + ctx.lineJoin = 'round\0'; + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -ctx.lineJoin = 'bevel'; -ctx.lineJoin = 'round '; -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel'; + ctx.lineJoin = 'round '; + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -ctx.lineJoin = 'bevel'; -ctx.lineJoin = ""; -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); - -ctx.lineJoin = 'bevel'; -ctx.lineJoin = 'butt'; -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel'; + ctx.lineJoin = ""; + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel'; + ctx.lineJoin = 'butt'; + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.miter.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.miter.html index b4f8fbc9a40..5a3472e92d3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.miter.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.miter.html @@ -19,52 +19,51 @@ var t = async_test("lineJoin 'miter' is rendered correctly"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -ctx.lineJoin = 'miter'; -ctx.lineWidth = 20; + ctx.lineJoin = 'miter'; + ctx.lineWidth = 20; -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; -ctx.fillRect(10, 10, 30, 20); -ctx.fillRect(20, 10, 20, 30); + ctx.fillRect(10, 10, 30, 20); + ctx.fillRect(20, 10, 20, 30); -ctx.beginPath(); -ctx.moveTo(10, 20); -ctx.lineTo(30, 20); -ctx.lineTo(30, 40); -ctx.stroke(); + ctx.beginPath(); + ctx.moveTo(10, 20); + ctx.lineTo(30, 20); + ctx.lineTo(30, 40); + ctx.stroke(); -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(60, 20); -ctx.lineTo(80, 20); -ctx.lineTo(80, 40); -ctx.stroke(); + ctx.beginPath(); + ctx.moveTo(60, 20); + ctx.lineTo(80, 20); + ctx.lineTo(80, 40); + ctx.stroke(); -ctx.fillRect(60, 10, 30, 20); -ctx.fillRect(70, 10, 20, 30); + ctx.fillRect(60, 10, 30, 20); + ctx.fillRect(70, 10, 20, 30); -_assertPixel(canvas, 38,12, 0,255,0,255); -_assertPixel(canvas, 39,11, 0,255,0,255); -_assertPixel(canvas, 40,10, 0,255,0,255); -_assertPixel(canvas, 41,9, 0,255,0,255); -_assertPixel(canvas, 42,8, 0,255,0,255); - -_assertPixel(canvas, 88,12, 0,255,0,255); -_assertPixel(canvas, 89,11, 0,255,0,255); -_assertPixel(canvas, 90,10, 0,255,0,255); -_assertPixel(canvas, 91,9, 0,255,0,255); -_assertPixel(canvas, 92,8, 0,255,0,255); + _assertPixel(canvas, 38,12, 0,255,0,255); + _assertPixel(canvas, 39,11, 0,255,0,255); + _assertPixel(canvas, 40,10, 0,255,0,255); + _assertPixel(canvas, 41,9, 0,255,0,255); + _assertPixel(canvas, 42,8, 0,255,0,255); + _assertPixel(canvas, 88,12, 0,255,0,255); + _assertPixel(canvas, 89,11, 0,255,0,255); + _assertPixel(canvas, 90,10, 0,255,0,255); + _assertPixel(canvas, 91,9, 0,255,0,255); + _assertPixel(canvas, 92,8, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.open.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.open.html index 162b1f87b29..55b7a8b49e8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.open.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.open.html @@ -19,26 +19,25 @@ var t = async_test("Line joins are not drawn at the corner of an unclosed rectangle"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineJoin = 'miter'; -ctx.lineWidth = 200; - -ctx.beginPath(); -ctx.moveTo(100, 50); -ctx.lineTo(100, 1000); -ctx.lineTo(1000, 1000); -ctx.lineTo(1000, 50); -ctx.lineTo(100, 50); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineJoin = 'miter'; + ctx.lineWidth = 200; + + ctx.beginPath(); + ctx.moveTo(100, 50); + ctx.lineTo(100, 1000); + ctx.lineTo(1000, 1000); + ctx.lineTo(1000, 50); + ctx.lineTo(100, 50); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.parallel.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.parallel.html index c26182b0b47..cd736b503d4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.parallel.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.parallel.html @@ -19,23 +19,22 @@ var t = async_test("Line joins are drawn at 180-degree joins"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 300; -ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.moveTo(-100, 25); -ctx.lineTo(0, 25); -ctx.lineTo(-100, 25); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 300; + ctx.lineJoin = 'round'; + ctx.beginPath(); + ctx.moveTo(-100, 25); + ctx.lineTo(0, 25); + ctx.lineTo(-100, 25); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.round.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.round.html index f1e60182f3c..fb968b99667 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.round.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.round.html @@ -19,59 +19,58 @@ var t = async_test("lineJoin 'round' is rendered correctly"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -var tol = 1; // tolerance to avoid antialiasing artifacts - -ctx.lineJoin = 'round'; -ctx.lineWidth = 20; - -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; - -ctx.fillRect(10, 10, 20, 20); -ctx.fillRect(20, 20, 20, 20); -ctx.beginPath(); -ctx.moveTo(30, 20); -ctx.arc(30, 20, 10-tol, 0, 2*Math.PI, true); -ctx.fill(); - -ctx.beginPath(); -ctx.moveTo(10, 20); -ctx.lineTo(30, 20); -ctx.lineTo(30, 40); -ctx.stroke(); - - -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; - -ctx.beginPath(); -ctx.moveTo(60, 20); -ctx.lineTo(80, 20); -ctx.lineTo(80, 40); -ctx.stroke(); - -ctx.fillRect(60, 10, 20, 20); -ctx.fillRect(70, 20, 20, 20); -ctx.beginPath(); -ctx.moveTo(80, 20); -ctx.arc(80, 20, 10+tol, 0, 2*Math.PI, true); -ctx.fill(); - -_assertPixel(canvas, 36,14, 0,255,0,255); -_assertPixel(canvas, 36,13, 0,255,0,255); -_assertPixel(canvas, 37,13, 0,255,0,255); -_assertPixel(canvas, 38,13, 0,255,0,255); -_assertPixel(canvas, 38,12, 0,255,0,255); - -_assertPixel(canvas, 86,14, 0,255,0,255); -_assertPixel(canvas, 86,13, 0,255,0,255); -_assertPixel(canvas, 87,13, 0,255,0,255); -_assertPixel(canvas, 88,13, 0,255,0,255); -_assertPixel(canvas, 88,12, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + var tol = 1; // tolerance to avoid antialiasing artifacts + + ctx.lineJoin = 'round'; + ctx.lineWidth = 20; + + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + + ctx.fillRect(10, 10, 20, 20); + ctx.fillRect(20, 20, 20, 20); + ctx.beginPath(); + ctx.moveTo(30, 20); + ctx.arc(30, 20, 10-tol, 0, 2*Math.PI, true); + ctx.fill(); + + ctx.beginPath(); + ctx.moveTo(10, 20); + ctx.lineTo(30, 20); + ctx.lineTo(30, 40); + ctx.stroke(); + + + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + + ctx.beginPath(); + ctx.moveTo(60, 20); + ctx.lineTo(80, 20); + ctx.lineTo(80, 40); + ctx.stroke(); + + ctx.fillRect(60, 10, 20, 20); + ctx.fillRect(70, 20, 20, 20); + ctx.beginPath(); + ctx.moveTo(80, 20); + ctx.arc(80, 20, 10+tol, 0, 2*Math.PI, true); + ctx.fill(); + + _assertPixel(canvas, 36,14, 0,255,0,255); + _assertPixel(canvas, 36,13, 0,255,0,255); + _assertPixel(canvas, 37,13, 0,255,0,255); + _assertPixel(canvas, 38,13, 0,255,0,255); + _assertPixel(canvas, 38,12, 0,255,0,255); + + _assertPixel(canvas, 86,14, 0,255,0,255); + _assertPixel(canvas, 86,13, 0,255,0,255); + _assertPixel(canvas, 87,13, 0,255,0,255); + _assertPixel(canvas, 88,13, 0,255,0,255); + _assertPixel(canvas, 88,12, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.valid.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.valid.html index 57179641f7d..3e5e200cb58 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.valid.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.join.valid.html @@ -19,15 +19,14 @@ var t = async_test("Setting lineJoin to valid values works"); _addTest(function(canvas, ctx) { -ctx.lineJoin = 'bevel' -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel' + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -ctx.lineJoin = 'round'; -_assertSame(ctx.lineJoin, 'round', "ctx.lineJoin", "'round'"); - -ctx.lineJoin = 'miter'; -_assertSame(ctx.lineJoin, 'miter', "ctx.lineJoin", "'miter'"); + ctx.lineJoin = 'round'; + _assertSame(ctx.lineJoin, 'round', "ctx.lineJoin", "'round'"); + ctx.lineJoin = 'miter'; + _assertSame(ctx.lineJoin, 'miter', "ctx.lineJoin", "'miter'"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.acute.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.acute.html index 7807d5942da..6acba4f3d29 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.acute.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.acute.html @@ -19,33 +19,32 @@ var t = async_test("Miter joins are drawn correctly with acute angles"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 200; -ctx.lineJoin = 'miter'; - -ctx.strokeStyle = '#0f0'; -ctx.miterLimit = 2.614; -ctx.beginPath(); -ctx.moveTo(100, 1000); -ctx.lineTo(100, 100); -ctx.lineTo(1000, 1000); -ctx.stroke(); - -ctx.strokeStyle = '#f00'; -ctx.miterLimit = 2.613; -ctx.beginPath(); -ctx.moveTo(100, 1000); -ctx.lineTo(100, 100); -ctx.lineTo(1000, 1000); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 200; + ctx.lineJoin = 'miter'; + + ctx.strokeStyle = '#0f0'; + ctx.miterLimit = 2.614; + ctx.beginPath(); + ctx.moveTo(100, 1000); + ctx.lineTo(100, 100); + ctx.lineTo(1000, 1000); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.miterLimit = 2.613; + ctx.beginPath(); + ctx.moveTo(100, 1000); + ctx.lineTo(100, 100); + ctx.lineTo(1000, 1000); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.exceeded.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.exceeded.html index 9c31cdd4ff6..542851d580b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.exceeded.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.exceeded.html @@ -19,25 +19,24 @@ var t = async_test("Miter joins are not drawn when the miter limit is exceeded"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 400; -ctx.lineJoin = 'miter'; - -ctx.strokeStyle = '#f00'; -ctx.miterLimit = 1.414; -ctx.beginPath(); -ctx.moveTo(200, 1000); -ctx.lineTo(200, 200); -ctx.lineTo(1000, 201); // slightly non-right-angle to avoid being a special case -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 400; + ctx.lineJoin = 'miter'; + + ctx.strokeStyle = '#f00'; + ctx.miterLimit = 1.414; + ctx.beginPath(); + ctx.moveTo(200, 1000); + ctx.lineTo(200, 200); + ctx.lineTo(1000, 201); // slightly non-right-angle to avoid being a special case + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.invalid.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.invalid.html index 994956123c3..826a6e24a7e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.invalid.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.invalid.html @@ -19,41 +19,40 @@ var t = async_test("Setting miterLimit to invalid values is ignored"); _addTest(function(canvas, ctx) { -ctx.miterLimit = 1.5; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = 0; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + ctx.miterLimit = 0; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = -1; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + ctx.miterLimit = -1; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = Infinity; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + ctx.miterLimit = Infinity; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = -Infinity; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + ctx.miterLimit = -Infinity; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = NaN; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + ctx.miterLimit = NaN; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = 'string'; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + ctx.miterLimit = 'string'; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = true; -_assertSame(ctx.miterLimit, 1, "ctx.miterLimit", "1"); - -ctx.miterLimit = 1.5; -ctx.miterLimit = false; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + ctx.miterLimit = true; + _assertSame(ctx.miterLimit, 1, "ctx.miterLimit", "1"); + ctx.miterLimit = 1.5; + ctx.miterLimit = false; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.lineedge.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.lineedge.html index 33d96f36cc8..68eeb061627 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.lineedge.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.lineedge.html @@ -19,22 +19,21 @@ var t = async_test("Miter joins are not drawn when the miter limit is exceeded at the corners of a zero-height rectangle"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 200; -ctx.lineJoin = 'miter'; + ctx.lineWidth = 200; + ctx.lineJoin = 'miter'; -ctx.strokeStyle = '#f00'; -ctx.miterLimit = 1.414; -ctx.beginPath(); -ctx.strokeRect(100, 25, 200, 0); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); + ctx.strokeStyle = '#f00'; + ctx.miterLimit = 1.414; + ctx.beginPath(); + ctx.strokeRect(100, 25, 200, 0); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.obtuse.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.obtuse.html index 73507f623c2..2dd08f6afc0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.obtuse.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.obtuse.html @@ -19,33 +19,32 @@ var t = async_test("Miter joins are drawn correctly with obtuse angles"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 1600; -ctx.lineJoin = 'miter'; - -ctx.strokeStyle = '#0f0'; -ctx.miterLimit = 1.083; -ctx.beginPath(); -ctx.moveTo(800, 10000); -ctx.lineTo(800, 300); -ctx.lineTo(10000, -8900); -ctx.stroke(); - -ctx.strokeStyle = '#f00'; -ctx.miterLimit = 1.082; -ctx.beginPath(); -ctx.moveTo(800, 10000); -ctx.lineTo(800, 300); -ctx.lineTo(10000, -8900); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 1600; + ctx.lineJoin = 'miter'; + + ctx.strokeStyle = '#0f0'; + ctx.miterLimit = 1.083; + ctx.beginPath(); + ctx.moveTo(800, 10000); + ctx.lineTo(800, 300); + ctx.lineTo(10000, -8900); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.miterLimit = 1.082; + ctx.beginPath(); + ctx.moveTo(800, 10000); + ctx.lineTo(800, 300); + ctx.lineTo(10000, -8900); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.rightangle.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.rightangle.html index a8b528bf056..7ae9f5e232a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.rightangle.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.rightangle.html @@ -19,25 +19,24 @@ var t = async_test("Miter joins are not drawn when the miter limit is exceeded, on exact right angles"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 400; -ctx.lineJoin = 'miter'; - -ctx.strokeStyle = '#f00'; -ctx.miterLimit = 1.414; -ctx.beginPath(); -ctx.moveTo(200, 1000); -ctx.lineTo(200, 200); -ctx.lineTo(1000, 200); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 400; + ctx.lineJoin = 'miter'; + + ctx.strokeStyle = '#f00'; + ctx.miterLimit = 1.414; + ctx.beginPath(); + ctx.moveTo(200, 1000); + ctx.lineTo(200, 200); + ctx.lineTo(1000, 200); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.valid.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.valid.html index a96c1cd1843..51b00c292d8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.valid.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.valid.html @@ -19,18 +19,17 @@ var t = async_test("Setting miterLimit to valid values works"); _addTest(function(canvas, ctx) { -ctx.miterLimit = 1.5; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = "1e1"; -_assertSame(ctx.miterLimit, 10, "ctx.miterLimit", "10"); + ctx.miterLimit = "1e1"; + _assertSame(ctx.miterLimit, 10, "ctx.miterLimit", "10"); -ctx.miterLimit = 1/1024; -_assertSame(ctx.miterLimit, 1/1024, "ctx.miterLimit", "1/1024"); - -ctx.miterLimit = 1000; -_assertSame(ctx.miterLimit, 1000, "ctx.miterLimit", "1000"); + ctx.miterLimit = 1/1024; + _assertSame(ctx.miterLimit, 1/1024, "ctx.miterLimit", "1/1024"); + ctx.miterLimit = 1000; + _assertSame(ctx.miterLimit, 1000, "ctx.miterLimit", "1000"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.within.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.within.html index c5d71cda574..f4388660094 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.within.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.miter.within.html @@ -19,25 +19,24 @@ var t = async_test("Miter joins are drawn when the miter limit is not quite exceeded"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 400; -ctx.lineJoin = 'miter'; - -ctx.strokeStyle = '#0f0'; -ctx.miterLimit = 1.416; -ctx.beginPath(); -ctx.moveTo(200, 1000); -ctx.lineTo(200, 200); -ctx.lineTo(1000, 201); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 400; + ctx.lineJoin = 'miter'; + + ctx.strokeStyle = '#0f0'; + ctx.miterLimit = 1.416; + ctx.beginPath(); + ctx.moveTo(200, 1000); + ctx.lineTo(200, 200); + ctx.lineTo(1000, 201); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.union.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.union.html index e9f5a85e02a..9d43cebee7d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.union.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.union.html @@ -19,27 +19,26 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 100; -ctx.lineCap = 'round'; - -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 24); -ctx.lineTo(100, 25); -ctx.lineTo(0, 26); -ctx.closePath(); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 25,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 25,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 24); + ctx.lineTo(100, 25); + ctx.lineTo(0, 26); + ctx.closePath(); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 25,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 25,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.basic.html index b0fe6c46650..f2e9a9f86dd 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.basic.html @@ -19,44 +19,43 @@ var t = async_test("lineWidth determines the width of line strokes"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 20; -// Draw a green line over a red box, to check the line is not too small -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; -ctx.fillRect(15, 15, 20, 20); -ctx.beginPath(); -ctx.moveTo(25, 15); -ctx.lineTo(25, 35); -ctx.stroke(); - -// Draw a green box over a red line, to check the line is not too large -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(75, 15); -ctx.lineTo(75, 35); -ctx.stroke(); -ctx.fillRect(65, 15, 20, 20); - -_assertPixel(canvas, 14,25, 0,255,0,255); -_assertPixel(canvas, 15,25, 0,255,0,255); -_assertPixel(canvas, 16,25, 0,255,0,255); -_assertPixel(canvas, 25,25, 0,255,0,255); -_assertPixel(canvas, 34,25, 0,255,0,255); -_assertPixel(canvas, 35,25, 0,255,0,255); -_assertPixel(canvas, 36,25, 0,255,0,255); - -_assertPixel(canvas, 64,25, 0,255,0,255); -_assertPixel(canvas, 65,25, 0,255,0,255); -_assertPixel(canvas, 66,25, 0,255,0,255); -_assertPixel(canvas, 75,25, 0,255,0,255); -_assertPixel(canvas, 84,25, 0,255,0,255); -_assertPixel(canvas, 85,25, 0,255,0,255); -_assertPixel(canvas, 86,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 20; + // Draw a green line over a red box, to check the line is not too small + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + ctx.fillRect(15, 15, 20, 20); + ctx.beginPath(); + ctx.moveTo(25, 15); + ctx.lineTo(25, 35); + ctx.stroke(); + + // Draw a green box over a red line, to check the line is not too large + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(75, 15); + ctx.lineTo(75, 35); + ctx.stroke(); + ctx.fillRect(65, 15, 20, 20); + + _assertPixel(canvas, 14,25, 0,255,0,255); + _assertPixel(canvas, 15,25, 0,255,0,255); + _assertPixel(canvas, 16,25, 0,255,0,255); + _assertPixel(canvas, 25,25, 0,255,0,255); + _assertPixel(canvas, 34,25, 0,255,0,255); + _assertPixel(canvas, 35,25, 0,255,0,255); + _assertPixel(canvas, 36,25, 0,255,0,255); + + _assertPixel(canvas, 64,25, 0,255,0,255); + _assertPixel(canvas, 65,25, 0,255,0,255); + _assertPixel(canvas, 66,25, 0,255,0,255); + _assertPixel(canvas, 75,25, 0,255,0,255); + _assertPixel(canvas, 84,25, 0,255,0,255); + _assertPixel(canvas, 85,25, 0,255,0,255); + _assertPixel(canvas, 86,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.invalid.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.invalid.html index a5a1a6d8d7e..363060cf6d2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.invalid.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.invalid.html @@ -19,41 +19,40 @@ var t = async_test("Setting lineWidth to invalid values is ignored"); _addTest(function(canvas, ctx) { -ctx.lineWidth = 1.5; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = 0; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + ctx.lineWidth = 0; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = -1; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + ctx.lineWidth = -1; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = Infinity; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + ctx.lineWidth = Infinity; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = -Infinity; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + ctx.lineWidth = -Infinity; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = NaN; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + ctx.lineWidth = NaN; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = 'string'; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + ctx.lineWidth = 'string'; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = true; -_assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1"); - -ctx.lineWidth = 1.5; -ctx.lineWidth = false; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + ctx.lineWidth = true; + _assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1"); + ctx.lineWidth = 1.5; + ctx.lineWidth = false; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.scaledefault.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.scaledefault.html index 9c50a0d68e1..6c4ec52b5d2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.scaledefault.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.scaledefault.html @@ -19,21 +19,20 @@ var t = async_test("Default lineWidth strokes are affected by scale transformations"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.scale(50, 50); -ctx.strokeStyle = '#0f0'; -ctx.moveTo(0, 0.5); -ctx.lineTo(2, 0.5); -ctx.stroke(); - -_assertPixel(canvas, 25,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 75,25, 0,255,0,255); -_assertPixel(canvas, 50,5, 0,255,0,255); -_assertPixel(canvas, 50,45, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.scale(50, 50); + ctx.strokeStyle = '#0f0'; + ctx.moveTo(0, 0.5); + ctx.lineTo(2, 0.5); + ctx.stroke(); + + _assertPixel(canvas, 25,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 75,25, 0,255,0,255); + _assertPixel(canvas, 50,5, 0,255,0,255); + _assertPixel(canvas, 50,45, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.transformed.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.transformed.html index f42f859a31e..600ce93fb74 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.transformed.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.transformed.html @@ -19,50 +19,49 @@ var t = async_test("Line stroke widths are affected by scale transformations"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 4; -// Draw a green line over a red box, to check the line is not too small -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; -ctx.fillRect(15, 15, 20, 20); -ctx.save(); - ctx.scale(5, 1); - ctx.beginPath(); - ctx.moveTo(5, 15); - ctx.lineTo(5, 35); - ctx.stroke(); -ctx.restore(); + ctx.lineWidth = 4; + // Draw a green line over a red box, to check the line is not too small + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + ctx.fillRect(15, 15, 20, 20); + ctx.save(); + ctx.scale(5, 1); + ctx.beginPath(); + ctx.moveTo(5, 15); + ctx.lineTo(5, 35); + ctx.stroke(); + ctx.restore(); -// Draw a green box over a red line, to check the line is not too large -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; -ctx.save(); - ctx.scale(-5, 1); - ctx.beginPath(); - ctx.moveTo(-15, 15); - ctx.lineTo(-15, 35); - ctx.stroke(); -ctx.restore(); -ctx.fillRect(65, 15, 20, 20); + // Draw a green box over a red line, to check the line is not too large + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + ctx.save(); + ctx.scale(-5, 1); + ctx.beginPath(); + ctx.moveTo(-15, 15); + ctx.lineTo(-15, 35); + ctx.stroke(); + ctx.restore(); + ctx.fillRect(65, 15, 20, 20); -_assertPixel(canvas, 14,25, 0,255,0,255); -_assertPixel(canvas, 15,25, 0,255,0,255); -_assertPixel(canvas, 16,25, 0,255,0,255); -_assertPixel(canvas, 25,25, 0,255,0,255); -_assertPixel(canvas, 34,25, 0,255,0,255); -_assertPixel(canvas, 35,25, 0,255,0,255); -_assertPixel(canvas, 36,25, 0,255,0,255); - -_assertPixel(canvas, 64,25, 0,255,0,255); -_assertPixel(canvas, 65,25, 0,255,0,255); -_assertPixel(canvas, 66,25, 0,255,0,255); -_assertPixel(canvas, 75,25, 0,255,0,255); -_assertPixel(canvas, 84,25, 0,255,0,255); -_assertPixel(canvas, 85,25, 0,255,0,255); -_assertPixel(canvas, 86,25, 0,255,0,255); + _assertPixel(canvas, 14,25, 0,255,0,255); + _assertPixel(canvas, 15,25, 0,255,0,255); + _assertPixel(canvas, 16,25, 0,255,0,255); + _assertPixel(canvas, 25,25, 0,255,0,255); + _assertPixel(canvas, 34,25, 0,255,0,255); + _assertPixel(canvas, 35,25, 0,255,0,255); + _assertPixel(canvas, 36,25, 0,255,0,255); + _assertPixel(canvas, 64,25, 0,255,0,255); + _assertPixel(canvas, 65,25, 0,255,0,255); + _assertPixel(canvas, 66,25, 0,255,0,255); + _assertPixel(canvas, 75,25, 0,255,0,255); + _assertPixel(canvas, 84,25, 0,255,0,255); + _assertPixel(canvas, 85,25, 0,255,0,255); + _assertPixel(canvas, 86,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.valid.html b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.valid.html index 9078809d65b..1a76b0ed4cf 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.valid.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/line-styles/2d.line.width.valid.html @@ -19,18 +19,17 @@ var t = async_test("Setting lineWidth to valid values works"); _addTest(function(canvas, ctx) { -ctx.lineWidth = 1.5; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = "1e1"; -_assertSame(ctx.lineWidth, 10, "ctx.lineWidth", "10"); + ctx.lineWidth = "1e1"; + _assertSame(ctx.lineWidth, 10, "ctx.lineWidth", "10"); -ctx.lineWidth = 1/1024; -_assertSame(ctx.lineWidth, 1/1024, "ctx.lineWidth", "1/1024"); - -ctx.lineWidth = 1000; -_assertSame(ctx.lineWidth, 1000, "ctx.lineWidth", "1000"); + ctx.lineWidth = 1/1024; + _assertSame(ctx.lineWidth, 1/1024, "ctx.lineWidth", "1/1024"); + ctx.lineWidth = 1000; + _assertSame(ctx.lineWidth, 1000, "ctx.lineWidth", "1000"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/manual/drawing-images-to-the-canvas/drawimage_zerosize-image.html b/tests/wpt/web-platform-tests/html/canvas/element/manual/drawing-images-to-the-canvas/drawimage_zerosize-image.html new file mode 100644 index 00000000000..1c4e74866ab --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/element/manual/drawing-images-to-the-canvas/drawimage_zerosize-image.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<title>Canvas test: 2d.drawImage.zerosource.image</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.drawImage.zerosource.image</h1> +<p class="desc">drawImage with zero-sized source rectangle from image draws nothing without exception</p> + + +<p class="output">Actual output:</p> +<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas> +<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> +<ul id="d"></ul> +<script> +var t = async_test("drawImage with zero-sized source rectangle from image draws nothing without exception"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.drawImage(document.getElementById('red-zerowidth.svg'), 0, 0, 100, 50); +ctx.drawImage(document.getElementById('red-zeroheight.svg'), 0, 0, 100, 50); +ctx.drawImage(document.getElementById('red-zerosize.svg'), 0, 0, 100, 50); +_assertPixel(canvas, 50,25, 0,255,0,255); + + +}); +</script> +<img src="/images/red-zerowidth.svg" id="red-zerowidth.svg" class="resource"> +<img src="/images/red-zeroheight.svg" id="red-zeroheight.svg" class="resource"> +<img src="/images/red-zerosize.svg" id="red-zerosize.svg" class="resource"> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.1.html index 838492d182a..85ebff4c0ab 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.1.html @@ -19,15 +19,14 @@ var t = async_test("arc() draws pi/2 .. -pi anticlockwise correctly"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 0); -ctx.arc(100, 0, 150, Math.PI/2, -Math.PI, true); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 0); + ctx.arc(100, 0, 150, Math.PI/2, -Math.PI, true); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.2.html index 7ddcbcbe477..7eefabd993c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.2.html @@ -19,15 +19,14 @@ var t = async_test("arc() draws -3pi/2 .. -pi anticlockwise correctly"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 0); -ctx.arc(100, 0, 150, -3*Math.PI/2, -Math.PI, true); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 0); + ctx.arc(100, 0, 150, -3*Math.PI/2, -Math.PI, true); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.3.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.3.html index f5df8a2bf2c..899c50dc904 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.3.html @@ -19,15 +19,14 @@ var t = async_test("arc() wraps angles mod 2pi when anticlockwise and end > start+2pi"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 0); -ctx.arc(100, 0, 150, (512+1/2)*Math.PI, (1024-1)*Math.PI, true); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 0); + ctx.arc(100, 0, 150, (512+1/2)*Math.PI, (1024-1)*Math.PI, true); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.4.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.4.html index 635112f76bc..3f1bd84d698 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.4.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.4.html @@ -19,18 +19,17 @@ var t = async_test("arc() draws a full circle when clockwise and end > start+2pi"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.arc(50, 25, 60, (512+1/2)*Math.PI, (1024-1)*Math.PI, false); -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.arc(50, 25, 60, (512+1/2)*Math.PI, (1024-1)*Math.PI, false); + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.5.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.5.html index 59edd27bbef..2373bd4f0a6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.5.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.5.html @@ -19,15 +19,14 @@ var t = async_test("arc() wraps angles mod 2pi when clockwise and start > end+2pi"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 0); -ctx.arc(100, 0, 150, (1024-1)*Math.PI, (512+1/2)*Math.PI, false); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 0); + ctx.arc(100, 0, 150, (1024-1)*Math.PI, (512+1/2)*Math.PI, false); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.6.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.6.html index 83f960b60e2..b0b03cff79f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.6.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.angle.6.html @@ -19,18 +19,17 @@ var t = async_test("arc() draws a full circle when anticlockwise and start > end+2pi"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.arc(50, 25, 60, (1024-1)*Math.PI, (512+1/2)*Math.PI, true); -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.arc(50, 25, 60, (1024-1)*Math.PI, (512+1/2)*Math.PI, true); + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.default.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.default.html index 51c1f1a8f80..b52941fe3f2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.default.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.default.html @@ -19,15 +19,14 @@ var t = async_test("arc() with missing last argument defaults to clockwise"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 0); -ctx.arc(100, 0, 150, -Math.PI, Math.PI/2); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 0); + ctx.arc(100, 0, 150, -Math.PI, Math.PI/2); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.empty.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.empty.html index bff80290015..295ee4bbb29 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.empty.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.empty.html @@ -19,15 +19,14 @@ var t = async_test("arc() with an empty path does not draw a straight line to the start point"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.arc(200, 25, 5, 0, 2*Math.PI, true); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.arc(200, 25, 5, 0, 2*Math.PI, true); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.end.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.end.html index aa26b659218..a581a40e8e9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.end.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.end.html @@ -19,17 +19,16 @@ var t = async_test("arc() adds the end point of the arc to the subpath"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(-100, 0); -ctx.arc(-100, 0, 25, -Math.PI/2, Math.PI/2, true); -ctx.lineTo(100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(-100, 0); + ctx.arc(-100, 0, 25, -Math.PI/2, Math.PI/2, true); + ctx.lineTo(100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.negative.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.negative.html index 9d1f4d89193..fd81ebadcd7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.negative.html @@ -19,10 +19,9 @@ var t = async_test("arc() with negative radius throws INDEX_SIZE_ERR"); _addTest(function(canvas, ctx) { -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.arc(0, 0, -1, 0, 0, true); }); -var path = new Path2D(); -assert_throws_dom("INDEX_SIZE_ERR", function() { path.arc(10, 10, -5, 0, 1, false); }); - + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.arc(0, 0, -1, 0, 0, true); }); + var path = new Path2D(); + assert_throws_dom("INDEX_SIZE_ERR", function() { path.arc(10, 10, -5, 0, 1, false); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.nonempty.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.nonempty.html index 63a472ba9af..982829013d7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.nonempty.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.nonempty.html @@ -19,16 +19,15 @@ var t = async_test("arc() with a non-empty path does draw a straight line to the start point"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arc(200, 25, 5, 0, 2*Math.PI, true); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arc(200, 25, 5, 0, 2*Math.PI, true); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.nonfinite.html index 04d51bffc0f..a1b15e7a88e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.nonfinite.html @@ -19,58 +19,57 @@ var t = async_test("arc() with Infinity/NaN is ignored"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.arc(Infinity, 0, 50, 0, 2*Math.PI, true); -ctx.arc(-Infinity, 0, 50, 0, 2*Math.PI, true); -ctx.arc(NaN, 0, 50, 0, 2*Math.PI, true); -ctx.arc(0, Infinity, 50, 0, 2*Math.PI, true); -ctx.arc(0, -Infinity, 50, 0, 2*Math.PI, true); -ctx.arc(0, NaN, 50, 0, 2*Math.PI, true); -ctx.arc(0, 0, Infinity, 0, 2*Math.PI, true); -ctx.arc(0, 0, -Infinity, 0, 2*Math.PI, true); -ctx.arc(0, 0, NaN, 0, 2*Math.PI, true); -ctx.arc(0, 0, 50, Infinity, 2*Math.PI, true); -ctx.arc(0, 0, 50, -Infinity, 2*Math.PI, true); -ctx.arc(0, 0, 50, NaN, 2*Math.PI, true); -ctx.arc(0, 0, 50, 0, Infinity, true); -ctx.arc(0, 0, 50, 0, -Infinity, true); -ctx.arc(0, 0, 50, 0, NaN, true); -ctx.arc(Infinity, Infinity, 50, 0, 2*Math.PI, true); -ctx.arc(Infinity, Infinity, Infinity, 0, 2*Math.PI, true); -ctx.arc(Infinity, Infinity, Infinity, Infinity, 2*Math.PI, true); -ctx.arc(Infinity, Infinity, Infinity, Infinity, Infinity, true); -ctx.arc(Infinity, Infinity, Infinity, 0, Infinity, true); -ctx.arc(Infinity, Infinity, 50, Infinity, 2*Math.PI, true); -ctx.arc(Infinity, Infinity, 50, Infinity, Infinity, true); -ctx.arc(Infinity, Infinity, 50, 0, Infinity, true); -ctx.arc(Infinity, 0, Infinity, 0, 2*Math.PI, true); -ctx.arc(Infinity, 0, Infinity, Infinity, 2*Math.PI, true); -ctx.arc(Infinity, 0, Infinity, Infinity, Infinity, true); -ctx.arc(Infinity, 0, Infinity, 0, Infinity, true); -ctx.arc(Infinity, 0, 50, Infinity, 2*Math.PI, true); -ctx.arc(Infinity, 0, 50, Infinity, Infinity, true); -ctx.arc(Infinity, 0, 50, 0, Infinity, true); -ctx.arc(0, Infinity, Infinity, 0, 2*Math.PI, true); -ctx.arc(0, Infinity, Infinity, Infinity, 2*Math.PI, true); -ctx.arc(0, Infinity, Infinity, Infinity, Infinity, true); -ctx.arc(0, Infinity, Infinity, 0, Infinity, true); -ctx.arc(0, Infinity, 50, Infinity, 2*Math.PI, true); -ctx.arc(0, Infinity, 50, Infinity, Infinity, true); -ctx.arc(0, Infinity, 50, 0, Infinity, true); -ctx.arc(0, 0, Infinity, Infinity, 2*Math.PI, true); -ctx.arc(0, 0, Infinity, Infinity, Infinity, true); -ctx.arc(0, 0, Infinity, 0, Infinity, true); -ctx.arc(0, 0, 50, Infinity, Infinity, true); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.arc(Infinity, 0, 50, 0, 2*Math.PI, true); + ctx.arc(-Infinity, 0, 50, 0, 2*Math.PI, true); + ctx.arc(NaN, 0, 50, 0, 2*Math.PI, true); + ctx.arc(0, Infinity, 50, 0, 2*Math.PI, true); + ctx.arc(0, -Infinity, 50, 0, 2*Math.PI, true); + ctx.arc(0, NaN, 50, 0, 2*Math.PI, true); + ctx.arc(0, 0, Infinity, 0, 2*Math.PI, true); + ctx.arc(0, 0, -Infinity, 0, 2*Math.PI, true); + ctx.arc(0, 0, NaN, 0, 2*Math.PI, true); + ctx.arc(0, 0, 50, Infinity, 2*Math.PI, true); + ctx.arc(0, 0, 50, -Infinity, 2*Math.PI, true); + ctx.arc(0, 0, 50, NaN, 2*Math.PI, true); + ctx.arc(0, 0, 50, 0, Infinity, true); + ctx.arc(0, 0, 50, 0, -Infinity, true); + ctx.arc(0, 0, 50, 0, NaN, true); + ctx.arc(Infinity, Infinity, 50, 0, 2*Math.PI, true); + ctx.arc(Infinity, Infinity, Infinity, 0, 2*Math.PI, true); + ctx.arc(Infinity, Infinity, Infinity, Infinity, 2*Math.PI, true); + ctx.arc(Infinity, Infinity, Infinity, Infinity, Infinity, true); + ctx.arc(Infinity, Infinity, Infinity, 0, Infinity, true); + ctx.arc(Infinity, Infinity, 50, Infinity, 2*Math.PI, true); + ctx.arc(Infinity, Infinity, 50, Infinity, Infinity, true); + ctx.arc(Infinity, Infinity, 50, 0, Infinity, true); + ctx.arc(Infinity, 0, Infinity, 0, 2*Math.PI, true); + ctx.arc(Infinity, 0, Infinity, Infinity, 2*Math.PI, true); + ctx.arc(Infinity, 0, Infinity, Infinity, Infinity, true); + ctx.arc(Infinity, 0, Infinity, 0, Infinity, true); + ctx.arc(Infinity, 0, 50, Infinity, 2*Math.PI, true); + ctx.arc(Infinity, 0, 50, Infinity, Infinity, true); + ctx.arc(Infinity, 0, 50, 0, Infinity, true); + ctx.arc(0, Infinity, Infinity, 0, 2*Math.PI, true); + ctx.arc(0, Infinity, Infinity, Infinity, 2*Math.PI, true); + ctx.arc(0, Infinity, Infinity, Infinity, Infinity, true); + ctx.arc(0, Infinity, Infinity, 0, Infinity, true); + ctx.arc(0, Infinity, 50, Infinity, 2*Math.PI, true); + ctx.arc(0, Infinity, 50, Infinity, Infinity, true); + ctx.arc(0, Infinity, 50, 0, Infinity, true); + ctx.arc(0, 0, Infinity, Infinity, 2*Math.PI, true); + ctx.arc(0, 0, Infinity, Infinity, Infinity, true); + ctx.arc(0, 0, Infinity, 0, Infinity, true); + ctx.arc(0, 0, 50, Infinity, Infinity, true); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.scale.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.scale.1.html index c100c6476fa..951c9ae26c3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.scale.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.scale.1.html @@ -19,35 +19,34 @@ var t = async_test("Non-uniformly scaled arcs are the right shape"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.scale(2, 0.5); -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.arc(25, 50, 56, 0, 2*Math.PI, false); -ctx.fill(); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(-25, 50); -ctx.arc(-25, 50, 24, 0, 2*Math.PI, false); -ctx.moveTo(75, 50); -ctx.arc(75, 50, 24, 0, 2*Math.PI, false); -ctx.moveTo(25, -25); -ctx.arc(25, -25, 24, 0, 2*Math.PI, false); -ctx.moveTo(25, 125); -ctx.arc(25, 125, 24, 0, 2*Math.PI, false); -ctx.fill(); - -_assertPixel(canvas, 0,0, 0,255,0,255); -_assertPixel(canvas, 50,0, 0,255,0,255); -_assertPixel(canvas, 99,0, 0,255,0,255); -_assertPixel(canvas, 0,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 99,25, 0,255,0,255); -_assertPixel(canvas, 0,49, 0,255,0,255); -_assertPixel(canvas, 50,49, 0,255,0,255); -_assertPixel(canvas, 99,49, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(2, 0.5); + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.arc(25, 50, 56, 0, 2*Math.PI, false); + ctx.fill(); + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(-25, 50); + ctx.arc(-25, 50, 24, 0, 2*Math.PI, false); + ctx.moveTo(75, 50); + ctx.arc(75, 50, 24, 0, 2*Math.PI, false); + ctx.moveTo(25, -25); + ctx.arc(25, -25, 24, 0, 2*Math.PI, false); + ctx.moveTo(25, 125); + ctx.arc(25, 125, 24, 0, 2*Math.PI, false); + ctx.fill(); + + _assertPixel(canvas, 0,0, 0,255,0,255); + _assertPixel(canvas, 50,0, 0,255,0,255); + _assertPixel(canvas, 99,0, 0,255,0,255); + _assertPixel(canvas, 0,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 99,25, 0,255,0,255); + _assertPixel(canvas, 0,49, 0,255,0,255); + _assertPixel(canvas, 50,49, 0,255,0,255); + _assertPixel(canvas, 99,49, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.scale.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.scale.2.html index 1045e402769..6b39e162222 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.scale.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.scale.2.html @@ -19,25 +19,24 @@ var t = async_test("Highly scaled arcs are the right shape"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.scale(100, 100); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 1.2; -ctx.beginPath(); -ctx.arc(0, 0, 0.6, 0, Math.PI/2, false); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 50,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 98,25, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 50,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(100, 100); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 1.2; + ctx.beginPath(); + ctx.arc(0, 0, 0.6, 0, Math.PI/2, false); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 50,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 98,25, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 50,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.selfintersect.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.selfintersect.1.html index c97c833ec1a..3bc81bd77a7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.selfintersect.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.selfintersect.1.html @@ -19,19 +19,18 @@ var t = async_test("arc() with lineWidth > 2*radius is drawn sensibly"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 200; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.arc(100, 50, 25, 0, -Math.PI/2, true); -ctx.stroke(); -ctx.beginPath(); -ctx.arc(0, 0, 25, 0, -Math.PI/2, true); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 200; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.arc(100, 50, 25, 0, -Math.PI/2, true); + ctx.stroke(); + ctx.beginPath(); + ctx.arc(0, 0, 25, 0, -Math.PI/2, true); + ctx.stroke(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.selfintersect.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.selfintersect.2.html index 58c51e32ec8..e3b14a782f6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.selfintersect.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.selfintersect.2.html @@ -19,23 +19,22 @@ var t = async_test("arc() with lineWidth > 2*radius is drawn sensibly"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 180; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.arc(-50, 50, 25, 0, -Math.PI/2, true); -ctx.stroke(); -ctx.beginPath(); -ctx.arc(100, 0, 25, 0, -Math.PI/2, true); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,10, 0,255,0,255); -_assertPixel(canvas, 97,1, 0,255,0,255); -_assertPixel(canvas, 97,2, 0,255,0,255); -_assertPixel(canvas, 97,3, 0,255,0,255); -_assertPixel(canvas, 2,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 180; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.arc(-50, 50, 25, 0, -Math.PI/2, true); + ctx.stroke(); + ctx.beginPath(); + ctx.arc(100, 0, 25, 0, -Math.PI/2, true); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,10, 0,255,0,255); + _assertPixel(canvas, 97,1, 0,255,0,255); + _assertPixel(canvas, 97,2, 0,255,0,255); + _assertPixel(canvas, 97,3, 0,255,0,255); + _assertPixel(canvas, 2,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.1.html index 29bf2cf6532..8a456841ad6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.1.html @@ -19,20 +19,19 @@ var t = async_test("arc() from 0 to pi does not draw anything in the wrong half"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.arc(50, 50, 50, 0, Math.PI, false); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 20,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.arc(50, 50, 50, 0, Math.PI, false); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 20,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.2.html index aad3a519645..f820eed761e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.2.html @@ -19,20 +19,19 @@ var t = async_test("arc() from 0 to pi draws stuff in the right half"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 100; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.arc(50, 50, 50, 0, Math.PI, true); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 20,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 100; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.arc(50, 50, 50, 0, Math.PI, true); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 20,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.3.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.3.html index 8f9e2735828..aa08d441944 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.3.html @@ -19,19 +19,18 @@ var t = async_test("arc() from 0 to -pi/2 does not draw anything in the wrong quadrant"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 100; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.arc(0, 50, 50, 0, -Math.PI/2, false); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 100; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.arc(0, 50, 50, 0, -Math.PI/2, false); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.4.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.4.html index 4efa26369f9..b00d4468f2b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.4.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.4.html @@ -19,19 +19,18 @@ var t = async_test("arc() from 0 to -pi/2 draws stuff in the right quadrant"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 150; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.arc(-50, 50, 100, 0, -Math.PI/2, true); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 150; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.arc(-50, 50, 100, 0, -Math.PI/2, true); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.5.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.5.html index 21727d4f499..f5574d2773e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.5.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.5.html @@ -19,19 +19,18 @@ var t = async_test("arc() from 0 to 5pi does not draw crazy things"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 200; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.arc(300, 0, 100, 0, 5*Math.PI, false); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 200; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.arc(300, 0, 100, 0, 5*Math.PI, false); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.twopie.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.twopie.1.html index a07eb101bd8..6312efb3e89 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.twopie.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.twopie.1.html @@ -19,15 +19,14 @@ var t = async_test("arc() draws nothing when end = start + 2pi-e and anticlockwise"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, true); -ctx.stroke(); -_assertPixel(canvas, 50,20, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, true); + ctx.stroke(); + _assertPixel(canvas, 50,20, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.twopie.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.twopie.2.html index 5ea0c1e60f0..132c2d38ddf 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.twopie.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.twopie.2.html @@ -19,15 +19,14 @@ var t = async_test("arc() draws a full circle when end = start + 2pi-e and clockwise"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, false); -ctx.stroke(); -_assertPixel(canvas, 50,20, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, false); + ctx.stroke(); + _assertPixel(canvas, 50,20, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.twopie.3.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.twopie.3.html index 8e1d50e002f..204ed54a1ec 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.twopie.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.twopie.3.html @@ -19,15 +19,14 @@ var t = async_test("arc() draws a full circle when end = start + 2pi+e and anticlockwise"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, true); -ctx.stroke(); -_assertPixel(canvas, 50,20, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, true); + ctx.stroke(); + _assertPixel(canvas, 50,20, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.twopie.4.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.twopie.4.html index 914fc4b18d8..d5535a79497 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.twopie.4.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.twopie.4.html @@ -19,15 +19,14 @@ var t = async_test("arc() draws nothing when end = start + 2pi+e and clockwise"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, false); -ctx.stroke(); -_assertPixel(canvas, 50,20, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, false); + ctx.stroke(); + _assertPixel(canvas, 50,20, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.zero.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.zero.1.html index b648c869adc..2c93425b1e1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.zero.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.zero.1.html @@ -19,15 +19,14 @@ var t = async_test("arc() draws nothing when startAngle = endAngle and anticlockwise"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.arc(50, 25, 50, 0, 0, true); -ctx.stroke(); -_assertPixel(canvas, 50,20, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.arc(50, 25, 50, 0, 0, true); + ctx.stroke(); + _assertPixel(canvas, 50,20, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.zero.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.zero.2.html index 4aab17a7a5a..c290c2f32f6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.zero.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.zero.2.html @@ -19,15 +19,14 @@ var t = async_test("arc() draws nothing when startAngle = endAngle and clockwise"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.arc(50, 25, 50, 0, 0, false); -ctx.stroke(); -_assertPixel(canvas, 50,20, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.arc(50, 25, 50, 0, 0, false); + ctx.stroke(); + _assertPixel(canvas, 50,20, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.zeroradius.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.zeroradius.html index 6f50bb474f9..f75403b2f34 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.zeroradius.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.zeroradius.html @@ -19,16 +19,15 @@ var t = async_test("arc() with zero radius draws a line to the start point"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00' -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arc(200, 25, 0, 0, Math.PI, true); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00' + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arc(200, 25, 0, 0, Math.PI, true); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.coincide.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.coincide.1.html index 9b963505ee2..01c8091c463 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.coincide.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.coincide.1.html @@ -19,27 +19,26 @@ var t = async_test("arcTo() has no effect if P0 = P1"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; - -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(0, 25, 50, 1000, 1); -ctx.lineTo(100, 25); -ctx.stroke(); - -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.arcTo(50, 25, 100, 25, 1); -ctx.stroke(); - -_assertPixel(canvas, 50,1, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 50,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(0, 25, 50, 1000, 1); + ctx.lineTo(100, 25); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.arcTo(50, 25, 100, 25, 1); + ctx.stroke(); + + _assertPixel(canvas, 50,1, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 50,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.coincide.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.coincide.2.html index 4cabedd056a..d216949aae9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.coincide.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.coincide.2.html @@ -19,17 +19,16 @@ var t = async_test("arcTo() draws a straight line to P1 if P1 = P2"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(100, 25, 100, 25, 1); -ctx.stroke(); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(100, 25, 100, 25, 1); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.collinear.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.collinear.1.html index 393c7a7f673..e91e2e4b1b4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.collinear.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.collinear.1.html @@ -19,24 +19,23 @@ var t = async_test("arcTo() with all points on a line, and P1 between P0/P2, draws a straight line to P1"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; - -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(100, 25, 200, 25, 1); -ctx.stroke(); - -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(-100, 25); -ctx.arcTo(0, 25, 100, 25, 1); -ctx.stroke(); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(100, 25, 200, 25, 1); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(-100, 25); + ctx.arcTo(0, 25, 100, 25, 1); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.collinear.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.collinear.2.html index 7dc386b5183..97b1339295c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.collinear.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.collinear.2.html @@ -19,24 +19,23 @@ var t = async_test("arcTo() with all points on a line, and P2 between P0/P1, draws a straight line to P1"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; - -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(100, 25, 10, 25, 1); -ctx.stroke(); - -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 25); -ctx.arcTo(200, 25, 110, 25, 1); -ctx.stroke(); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(100, 25, 10, 25, 1); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 25); + ctx.arcTo(200, 25, 110, 25, 1); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.collinear.3.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.collinear.3.html index 76930e5fd12..2f4394f038d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.collinear.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.collinear.3.html @@ -19,29 +19,28 @@ var t = async_test("arcTo() with all points on a line, and P0 between P1/P2, draws a straight line to P1"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; - -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(100, 25, -100, 25, 1); -ctx.stroke(); - -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 25); -ctx.arcTo(200, 25, 0, 25, 1); -ctx.stroke(); - -ctx.beginPath(); -ctx.moveTo(-100, 25); -ctx.arcTo(0, 25, -200, 25, 1); -ctx.stroke(); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(100, 25, -100, 25, 1); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 25); + ctx.arcTo(200, 25, 0, 25, 1); + ctx.stroke(); + + ctx.beginPath(); + ctx.moveTo(-100, 25); + ctx.arcTo(0, 25, -200, 25, 1); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.ensuresubpath.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.ensuresubpath.1.html index 756cfe602c7..2781bcbba37 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.ensuresubpath.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.ensuresubpath.1.html @@ -19,15 +19,14 @@ var t = async_test("If there is no subpath, the first control point is added (and nothing is drawn up to it)"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.arcTo(100, 50, 200, 50, 0.1); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.arcTo(100, 50, 200, 50, 0.1); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.ensuresubpath.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.ensuresubpath.2.html index 18b1992d89d..f5da07c1c6a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.ensuresubpath.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.ensuresubpath.2.html @@ -19,16 +19,15 @@ var t = async_test("If there is no subpath, the first control point is added"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.arcTo(0, 25, 50, 250, 0.1); // adds (x1,y1), draws nothing -ctx.lineTo(100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.arcTo(0, 25, 50, 250, 0.1); // adds (x1,y1), draws nothing + ctx.lineTo(100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.negative.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.negative.html index 78f4fcebf7b..0091ca2a671 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.negative.html @@ -19,10 +19,9 @@ var t = async_test("arcTo() with negative radius throws an exception"); _addTest(function(canvas, ctx) { -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.arcTo(0, 0, 0, 0, -1); }); -var path = new Path2D(); -assert_throws_dom("INDEX_SIZE_ERR", function() { path.arcTo(10, 10, 20, 20, -5); }); - + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.arcTo(0, 0, 0, 0, -1); }); + var path = new Path2D(); + assert_throws_dom("INDEX_SIZE_ERR", function() { path.arcTo(10, 10, 20, 20, -5); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.nonfinite.html index d05e05d2781..0d7be1d3608 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.nonfinite.html @@ -19,56 +19,55 @@ var t = async_test("arcTo() with Infinity/NaN is ignored"); _addTest(function(canvas, ctx) { -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.arcTo(Infinity, 50, 0, 50, 0); -ctx.arcTo(-Infinity, 50, 0, 50, 0); -ctx.arcTo(NaN, 50, 0, 50, 0); -ctx.arcTo(0, Infinity, 0, 50, 0); -ctx.arcTo(0, -Infinity, 0, 50, 0); -ctx.arcTo(0, NaN, 0, 50, 0); -ctx.arcTo(0, 50, Infinity, 50, 0); -ctx.arcTo(0, 50, -Infinity, 50, 0); -ctx.arcTo(0, 50, NaN, 50, 0); -ctx.arcTo(0, 50, 0, Infinity, 0); -ctx.arcTo(0, 50, 0, -Infinity, 0); -ctx.arcTo(0, 50, 0, NaN, 0); -ctx.arcTo(0, 50, 0, 50, Infinity); -ctx.arcTo(0, 50, 0, 50, -Infinity); -ctx.arcTo(0, 50, 0, 50, NaN); -ctx.arcTo(Infinity, Infinity, 0, 50, 0); -ctx.arcTo(Infinity, Infinity, Infinity, 50, 0); -ctx.arcTo(Infinity, Infinity, Infinity, Infinity, 0); -ctx.arcTo(Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.arcTo(Infinity, Infinity, Infinity, 50, Infinity); -ctx.arcTo(Infinity, Infinity, 0, Infinity, 0); -ctx.arcTo(Infinity, Infinity, 0, Infinity, Infinity); -ctx.arcTo(Infinity, Infinity, 0, 50, Infinity); -ctx.arcTo(Infinity, 50, Infinity, 50, 0); -ctx.arcTo(Infinity, 50, Infinity, Infinity, 0); -ctx.arcTo(Infinity, 50, Infinity, Infinity, Infinity); -ctx.arcTo(Infinity, 50, Infinity, 50, Infinity); -ctx.arcTo(Infinity, 50, 0, Infinity, 0); -ctx.arcTo(Infinity, 50, 0, Infinity, Infinity); -ctx.arcTo(Infinity, 50, 0, 50, Infinity); -ctx.arcTo(0, Infinity, Infinity, 50, 0); -ctx.arcTo(0, Infinity, Infinity, Infinity, 0); -ctx.arcTo(0, Infinity, Infinity, Infinity, Infinity); -ctx.arcTo(0, Infinity, Infinity, 50, Infinity); -ctx.arcTo(0, Infinity, 0, Infinity, 0); -ctx.arcTo(0, Infinity, 0, Infinity, Infinity); -ctx.arcTo(0, Infinity, 0, 50, Infinity); -ctx.arcTo(0, 50, Infinity, Infinity, 0); -ctx.arcTo(0, 50, Infinity, Infinity, Infinity); -ctx.arcTo(0, 50, Infinity, 50, Infinity); -ctx.arcTo(0, 50, 0, Infinity, Infinity); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); - + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.arcTo(Infinity, 50, 0, 50, 0); + ctx.arcTo(-Infinity, 50, 0, 50, 0); + ctx.arcTo(NaN, 50, 0, 50, 0); + ctx.arcTo(0, Infinity, 0, 50, 0); + ctx.arcTo(0, -Infinity, 0, 50, 0); + ctx.arcTo(0, NaN, 0, 50, 0); + ctx.arcTo(0, 50, Infinity, 50, 0); + ctx.arcTo(0, 50, -Infinity, 50, 0); + ctx.arcTo(0, 50, NaN, 50, 0); + ctx.arcTo(0, 50, 0, Infinity, 0); + ctx.arcTo(0, 50, 0, -Infinity, 0); + ctx.arcTo(0, 50, 0, NaN, 0); + ctx.arcTo(0, 50, 0, 50, Infinity); + ctx.arcTo(0, 50, 0, 50, -Infinity); + ctx.arcTo(0, 50, 0, 50, NaN); + ctx.arcTo(Infinity, Infinity, 0, 50, 0); + ctx.arcTo(Infinity, Infinity, Infinity, 50, 0); + ctx.arcTo(Infinity, Infinity, Infinity, Infinity, 0); + ctx.arcTo(Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.arcTo(Infinity, Infinity, Infinity, 50, Infinity); + ctx.arcTo(Infinity, Infinity, 0, Infinity, 0); + ctx.arcTo(Infinity, Infinity, 0, Infinity, Infinity); + ctx.arcTo(Infinity, Infinity, 0, 50, Infinity); + ctx.arcTo(Infinity, 50, Infinity, 50, 0); + ctx.arcTo(Infinity, 50, Infinity, Infinity, 0); + ctx.arcTo(Infinity, 50, Infinity, Infinity, Infinity); + ctx.arcTo(Infinity, 50, Infinity, 50, Infinity); + ctx.arcTo(Infinity, 50, 0, Infinity, 0); + ctx.arcTo(Infinity, 50, 0, Infinity, Infinity); + ctx.arcTo(Infinity, 50, 0, 50, Infinity); + ctx.arcTo(0, Infinity, Infinity, 50, 0); + ctx.arcTo(0, Infinity, Infinity, Infinity, 0); + ctx.arcTo(0, Infinity, Infinity, Infinity, Infinity); + ctx.arcTo(0, Infinity, Infinity, 50, Infinity); + ctx.arcTo(0, Infinity, 0, Infinity, 0); + ctx.arcTo(0, Infinity, 0, Infinity, Infinity); + ctx.arcTo(0, Infinity, 0, 50, Infinity); + ctx.arcTo(0, 50, Infinity, Infinity, 0); + ctx.arcTo(0, 50, Infinity, Infinity, Infinity); + ctx.arcTo(0, 50, Infinity, 50, Infinity); + ctx.arcTo(0, 50, 0, Infinity, Infinity); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.scale.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.scale.html index 00d9f99b96a..6645f052603 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.scale.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.scale.html @@ -19,28 +19,27 @@ var t = async_test("arcTo scales the curve, not just the control points"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 50); -ctx.translate(100, 0); -ctx.scale(0.1, 1); -ctx.arcTo(50, 50, 50, 0, 50); -ctx.lineTo(-1000, 0); -ctx.fill(); - -_assertPixel(canvas, 0,0, 0,255,0,255); -_assertPixel(canvas, 50,0, 0,255,0,255); -_assertPixel(canvas, 99,0, 0,255,0,255); -_assertPixel(canvas, 0,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 99,25, 0,255,0,255); -_assertPixel(canvas, 0,49, 0,255,0,255); -_assertPixel(canvas, 50,49, 0,255,0,255); -_assertPixel(canvas, 99,49, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 50); + ctx.translate(100, 0); + ctx.scale(0.1, 1); + ctx.arcTo(50, 50, 50, 0, 50); + ctx.lineTo(-1000, 0); + ctx.fill(); + + _assertPixel(canvas, 0,0, 0,255,0,255); + _assertPixel(canvas, 50,0, 0,255,0,255); + _assertPixel(canvas, 99,0, 0,255,0,255); + _assertPixel(canvas, 0,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 99,25, 0,255,0,255); + _assertPixel(canvas, 0,49, 0,255,0,255); + _assertPixel(canvas, 50,49, 0,255,0,255); + _assertPixel(canvas, 99,49, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.shape.curve1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.shape.curve1.html index 0caf25048d3..4617b2cbbb6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.shape.curve1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.shape.curve1.html @@ -19,41 +19,40 @@ var t = async_test("arcTo() curves in the right kind of shape"); _addTest(function(canvas, ctx) { -var tol = 1.5; // tolerance to avoid antialiasing artifacts - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 10; -ctx.beginPath(); -ctx.moveTo(10, 25); -ctx.arcTo(75, 25, 75, 60, 20); -ctx.stroke(); - -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.rect(10, 20, 45, 10); -ctx.moveTo(80, 45); -ctx.arc(55, 45, 25+tol, 0, -Math.PI/2, true); -ctx.arc(55, 45, 15-tol, -Math.PI/2, 0, false); -ctx.fill(); - -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 55,19, 0,255,0,255); -_assertPixel(canvas, 55,20, 0,255,0,255); -_assertPixel(canvas, 55,21, 0,255,0,255); -_assertPixel(canvas, 64,22, 0,255,0,255); -_assertPixel(canvas, 65,21, 0,255,0,255); -_assertPixel(canvas, 72,28, 0,255,0,255); -_assertPixel(canvas, 73,27, 0,255,0,255); -_assertPixel(canvas, 78,36, 0,255,0,255); -_assertPixel(canvas, 79,35, 0,255,0,255); -_assertPixel(canvas, 80,44, 0,255,0,255); -_assertPixel(canvas, 80,45, 0,255,0,255); -_assertPixel(canvas, 80,46, 0,255,0,255); -_assertPixel(canvas, 65,45, 0,255,0,255); - + var tol = 1.5; // tolerance to avoid antialiasing artifacts + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 10; + ctx.beginPath(); + ctx.moveTo(10, 25); + ctx.arcTo(75, 25, 75, 60, 20); + ctx.stroke(); + + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.rect(10, 20, 45, 10); + ctx.moveTo(80, 45); + ctx.arc(55, 45, 25+tol, 0, -Math.PI/2, true); + ctx.arc(55, 45, 15-tol, -Math.PI/2, 0, false); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 55,19, 0,255,0,255); + _assertPixel(canvas, 55,20, 0,255,0,255); + _assertPixel(canvas, 55,21, 0,255,0,255); + _assertPixel(canvas, 64,22, 0,255,0,255); + _assertPixel(canvas, 65,21, 0,255,0,255); + _assertPixel(canvas, 72,28, 0,255,0,255); + _assertPixel(canvas, 73,27, 0,255,0,255); + _assertPixel(canvas, 78,36, 0,255,0,255); + _assertPixel(canvas, 79,35, 0,255,0,255); + _assertPixel(canvas, 80,44, 0,255,0,255); + _assertPixel(canvas, 80,45, 0,255,0,255); + _assertPixel(canvas, 80,46, 0,255,0,255); + _assertPixel(canvas, 65,45, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.shape.curve2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.shape.curve2.html index 3e1677bec01..bcc4326eea2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.shape.curve2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.shape.curve2.html @@ -19,40 +19,39 @@ var t = async_test("arcTo() curves in the right kind of shape"); _addTest(function(canvas, ctx) { -var tol = 1.5; // tolerance to avoid antialiasing artifacts - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.rect(10, 20, 45, 10); -ctx.moveTo(80, 45); -ctx.arc(55, 45, 25-tol, 0, -Math.PI/2, true); -ctx.arc(55, 45, 15+tol, -Math.PI/2, 0, false); -ctx.fill(); - -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 10; -ctx.beginPath(); -ctx.moveTo(10, 25); -ctx.arcTo(75, 25, 75, 60, 20); -ctx.stroke(); - -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 55,19, 0,255,0,255); -_assertPixel(canvas, 55,20, 0,255,0,255); -_assertPixel(canvas, 55,21, 0,255,0,255); -_assertPixel(canvas, 64,22, 0,255,0,255); -_assertPixel(canvas, 65,21, 0,255,0,255); -_assertPixel(canvas, 72,28, 0,255,0,255); -_assertPixel(canvas, 73,27, 0,255,0,255); -_assertPixel(canvas, 78,36, 0,255,0,255); -_assertPixel(canvas, 79,35, 0,255,0,255); -_assertPixel(canvas, 80,44, 0,255,0,255); -_assertPixel(canvas, 80,45, 0,255,0,255); -_assertPixel(canvas, 80,46, 0,255,0,255); - + var tol = 1.5; // tolerance to avoid antialiasing artifacts + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.rect(10, 20, 45, 10); + ctx.moveTo(80, 45); + ctx.arc(55, 45, 25-tol, 0, -Math.PI/2, true); + ctx.arc(55, 45, 15+tol, -Math.PI/2, 0, false); + ctx.fill(); + + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 10; + ctx.beginPath(); + ctx.moveTo(10, 25); + ctx.arcTo(75, 25, 75, 60, 20); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 55,19, 0,255,0,255); + _assertPixel(canvas, 55,20, 0,255,0,255); + _assertPixel(canvas, 55,21, 0,255,0,255); + _assertPixel(canvas, 64,22, 0,255,0,255); + _assertPixel(canvas, 65,21, 0,255,0,255); + _assertPixel(canvas, 72,28, 0,255,0,255); + _assertPixel(canvas, 73,27, 0,255,0,255); + _assertPixel(canvas, 78,36, 0,255,0,255); + _assertPixel(canvas, 79,35, 0,255,0,255); + _assertPixel(canvas, 80,44, 0,255,0,255); + _assertPixel(canvas, 80,45, 0,255,0,255); + _assertPixel(canvas, 80,46, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.shape.end.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.shape.end.html index 8a41dcd7b61..829c70f5f47 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.shape.end.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.shape.end.html @@ -19,21 +19,20 @@ var t = async_test("arcTo() does not draw anything from P1 to P2"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.moveTo(-100, -100); -ctx.arcTo(-100, 25, 200, 25, 10); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.moveTo(-100, -100); + ctx.arcTo(-100, 25, 200, 25, 10); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.shape.start.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.shape.start.html index 1ee229ef327..0abeedf433d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.shape.start.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.shape.start.html @@ -19,21 +19,20 @@ var t = async_test("arcTo() draws a straight line from P0 to P1"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(200, 25, 200, 50, 10); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(200, 25, 200, 50, 10); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.transformation.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.transformation.html index 32811f23005..5aa8562b1df 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.transformation.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.transformation.html @@ -19,27 +19,26 @@ var t = async_test("arcTo joins up to the last subpath point correctly"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 50); -ctx.translate(100, 0); -ctx.arcTo(50, 50, 50, 0, 50); -ctx.lineTo(-100, 0); -ctx.fill(); - -_assertPixel(canvas, 0,0, 0,255,0,255); -_assertPixel(canvas, 50,0, 0,255,0,255); -_assertPixel(canvas, 99,0, 0,255,0,255); -_assertPixel(canvas, 0,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 99,25, 0,255,0,255); -_assertPixel(canvas, 0,49, 0,255,0,255); -_assertPixel(canvas, 50,49, 0,255,0,255); -_assertPixel(canvas, 99,49, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 50); + ctx.translate(100, 0); + ctx.arcTo(50, 50, 50, 0, 50); + ctx.lineTo(-100, 0); + ctx.fill(); + + _assertPixel(canvas, 0,0, 0,255,0,255); + _assertPixel(canvas, 50,0, 0,255,0,255); + _assertPixel(canvas, 99,0, 0,255,0,255); + _assertPixel(canvas, 0,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 99,25, 0,255,0,255); + _assertPixel(canvas, 0,49, 0,255,0,255); + _assertPixel(canvas, 50,49, 0,255,0,255); + _assertPixel(canvas, 99,49, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.zero.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.zero.1.html index 4bacbf0dbce..bb2cc1d3e36 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.zero.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.zero.1.html @@ -19,24 +19,23 @@ var t = async_test("arcTo() with zero radius draws a straight line from P0 to P1"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; - -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(100, 25, 100, 100, 0); -ctx.stroke(); - -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(0, -25); -ctx.arcTo(50, -25, 50, 50, 0); -ctx.stroke(); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(100, 25, 100, 100, 0); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(0, -25); + ctx.arcTo(50, -25, 50, 50, 0); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.zero.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.zero.2.html index 1f26b5942b2..d2eeee535d2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.zero.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.arcTo.zero.2.html @@ -19,24 +19,23 @@ var t = async_test("arcTo() with zero radius draws a straight line from P0 to P1, even when all points are collinear"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; - -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(100, 25, -100, 25, 0); -ctx.stroke(); - -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 25); -ctx.arcTo(200, 25, 50, 25, 0); -ctx.stroke(); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(100, 25, -100, 25, 0); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 25); + ctx.arcTo(200, 25, 50, 25, 0); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.beginPath.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.beginPath.html index a21282cc3e5..316f6af9428 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.beginPath.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.beginPath.html @@ -19,14 +19,13 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.rect(0, 0, 100, 50); -ctx.beginPath(); -ctx.fillStyle = '#f00'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.rect(0, 0, 100, 50); + ctx.beginPath(); + ctx.fillStyle = '#f00'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.basic.html index 7f90f7bde46..0c3d7f948b9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.basic.html @@ -19,16 +19,15 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.bezierCurveTo(100, 25, 100, 25, 100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.bezierCurveTo(100, 25, 100, 25, 100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.html index 1e6f8298c5a..ebcce3f48cf 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.html @@ -19,16 +19,15 @@ var t = async_test("If there is no subpath, the first control point is added (and nothing is drawn up to it)"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.bezierCurveTo(100, 50, 200, 50, 200, 50); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 95,45, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.bezierCurveTo(100, 50, 200, 50, 200, 50); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 95,45, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.html index 875601c5dab..c269b72d333 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.html @@ -19,16 +19,15 @@ var t = async_test("If there is no subpath, the first control point is added"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.bezierCurveTo(0, 25, 100, 25, 100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 5,45, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.bezierCurveTo(0, 25, 100, 25, 100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 5,45, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.nonfinite.html index e6da7b27267..6278a672830 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.nonfinite.html @@ -19,90 +19,89 @@ var t = async_test("bezierCurveTo() with Infinity/NaN is ignored"); _addTest(function(canvas, ctx) { -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, 50); -ctx.bezierCurveTo(-Infinity, 50, 0, 50, 0, 50); -ctx.bezierCurveTo(NaN, 50, 0, 50, 0, 50); -ctx.bezierCurveTo(0, Infinity, 0, 50, 0, 50); -ctx.bezierCurveTo(0, -Infinity, 0, 50, 0, 50); -ctx.bezierCurveTo(0, NaN, 0, 50, 0, 50); -ctx.bezierCurveTo(0, 50, Infinity, 50, 0, 50); -ctx.bezierCurveTo(0, 50, -Infinity, 50, 0, 50); -ctx.bezierCurveTo(0, 50, NaN, 50, 0, 50); -ctx.bezierCurveTo(0, 50, 0, Infinity, 0, 50); -ctx.bezierCurveTo(0, 50, 0, -Infinity, 0, 50); -ctx.bezierCurveTo(0, 50, 0, NaN, 0, 50); -ctx.bezierCurveTo(0, 50, 0, 50, Infinity, 50); -ctx.bezierCurveTo(0, 50, 0, 50, -Infinity, 50); -ctx.bezierCurveTo(0, 50, 0, 50, NaN, 50); -ctx.bezierCurveTo(0, 50, 0, 50, 0, Infinity); -ctx.bezierCurveTo(0, 50, 0, 50, 0, -Infinity); -ctx.bezierCurveTo(0, 50, 0, 50, 0, NaN); -ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, 50); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, 50); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, 50); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, 50); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, 50); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, 50); -ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, 50); -ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, 50); -ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, Infinity); -ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, 50); -ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, 50); -ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, 50); -ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, Infinity); -ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, 50); -ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, Infinity); -ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, 50); -ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, 50); -ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, Infinity); -ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, 50); -ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, Infinity); -ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, 50); -ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, 50); -ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, 50); -ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, Infinity); -ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, 50); -ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, Infinity); -ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, Infinity); -ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, 50); -ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, 50); -ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, Infinity); -ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, 50); -ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, Infinity); -ctx.bezierCurveTo(0, Infinity, 0, 50, 0, Infinity); -ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, 50); -ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, 50); -ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, Infinity); -ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, 50); -ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, Infinity); -ctx.bezierCurveTo(0, 50, Infinity, 50, 0, Infinity); -ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, 50); -ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(0, 50, 0, Infinity, 0, Infinity); -ctx.bezierCurveTo(0, 50, 0, 50, Infinity, Infinity); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); - + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, 50); + ctx.bezierCurveTo(-Infinity, 50, 0, 50, 0, 50); + ctx.bezierCurveTo(NaN, 50, 0, 50, 0, 50); + ctx.bezierCurveTo(0, Infinity, 0, 50, 0, 50); + ctx.bezierCurveTo(0, -Infinity, 0, 50, 0, 50); + ctx.bezierCurveTo(0, NaN, 0, 50, 0, 50); + ctx.bezierCurveTo(0, 50, Infinity, 50, 0, 50); + ctx.bezierCurveTo(0, 50, -Infinity, 50, 0, 50); + ctx.bezierCurveTo(0, 50, NaN, 50, 0, 50); + ctx.bezierCurveTo(0, 50, 0, Infinity, 0, 50); + ctx.bezierCurveTo(0, 50, 0, -Infinity, 0, 50); + ctx.bezierCurveTo(0, 50, 0, NaN, 0, 50); + ctx.bezierCurveTo(0, 50, 0, 50, Infinity, 50); + ctx.bezierCurveTo(0, 50, 0, 50, -Infinity, 50); + ctx.bezierCurveTo(0, 50, 0, 50, NaN, 50); + ctx.bezierCurveTo(0, 50, 0, 50, 0, Infinity); + ctx.bezierCurveTo(0, 50, 0, 50, 0, -Infinity); + ctx.bezierCurveTo(0, 50, 0, 50, 0, NaN); + ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, 50); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, 50); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, 50); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, 50); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, 50); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, 50); + ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, 50); + ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, 50); + ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, Infinity); + ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, 50); + ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, 50); + ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, 50); + ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, Infinity); + ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, 50); + ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, Infinity); + ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, 50); + ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, 50); + ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, Infinity); + ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, 50); + ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, Infinity); + ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, 50); + ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, 50); + ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, 50); + ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, Infinity); + ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, 50); + ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, Infinity); + ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, Infinity); + ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, 50); + ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, 50); + ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, Infinity); + ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, 50); + ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, Infinity); + ctx.bezierCurveTo(0, Infinity, 0, 50, 0, Infinity); + ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, 50); + ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, 50); + ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, Infinity); + ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, 50); + ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, Infinity); + ctx.bezierCurveTo(0, 50, Infinity, 50, 0, Infinity); + ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, 50); + ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(0, 50, 0, Infinity, 0, Infinity); + ctx.bezierCurveTo(0, 50, 0, 50, Infinity, Infinity); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.scaled.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.scaled.html index d24b83786fc..e7a5d8b524c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.scaled.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.scaled.html @@ -19,21 +19,20 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.scale(1000, 1000); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 0.055; -ctx.beginPath(); -ctx.moveTo(-2, 3.1); -ctx.bezierCurveTo(-2, -1, 2.1, -1, 2.1, 3.1); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(1000, 1000); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 0.055; + ctx.beginPath(); + ctx.moveTo(-2, 3.1); + ctx.bezierCurveTo(-2, -1, 2.1, -1, 2.1, 3.1); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.shape.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.shape.html index 7ebe1e3460c..cbc28244252 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.shape.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.bezierCurveTo.shape.html @@ -19,20 +19,19 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 55; -ctx.beginPath(); -ctx.moveTo(-2000, 3100); -ctx.bezierCurveTo(-2000, -1000, 2100, -1000, 2100, 3100); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 55; + ctx.beginPath(); + ctx.moveTo(-2000, 3100); + ctx.bezierCurveTo(-2000, -1000, 2100, -1000, 2100, 3100); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.basic.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.basic.1.html index c49afd431ff..a5515e4f7ee 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.basic.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.basic.1.html @@ -19,18 +19,17 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(0, 0, 100, 50); -ctx.clip(); + ctx.beginPath(); + ctx.rect(0, 0, 100, 50); + ctx.clip(); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.basic.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.basic.2.html index dfba3b8164a..27e1ad0b0cf 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.basic.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.basic.2.html @@ -19,18 +19,17 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(-100, 0, 100, 50); -ctx.clip(); + ctx.beginPath(); + ctx.rect(-100, 0, 100, 50); + ctx.clip(); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.empty.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.empty.html index ba7a869f5cd..17208ad797e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.empty.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.empty.html @@ -19,17 +19,16 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.clip(); + ctx.beginPath(); + ctx.clip(); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.intersect.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.intersect.html index 1cdd9603d79..c1057f26457 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.intersect.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.intersect.html @@ -19,21 +19,20 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(0, 0, 50, 50); -ctx.clip(); -ctx.beginPath(); -ctx.rect(50, 0, 50, 50) -ctx.clip(); + ctx.beginPath(); + ctx.rect(0, 0, 50, 50); + ctx.clip(); + ctx.beginPath(); + ctx.rect(50, 0, 50, 50) + ctx.clip(); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.unaffected.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.unaffected.html index 893877f876d..66f03796021 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.unaffected.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.unaffected.html @@ -19,23 +19,22 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; + ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 0); -ctx.lineTo(0, 50); -ctx.lineTo(100, 50); -ctx.lineTo(100, 0); -ctx.clip(); + ctx.beginPath(); + ctx.moveTo(0, 0); + ctx.lineTo(0, 50); + ctx.lineTo(100, 50); + ctx.lineTo(100, 0); + ctx.clip(); -ctx.lineTo(0, 0); -ctx.fill(); - -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.lineTo(0, 0); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.winding.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.winding.1.html index 5e8fa814243..46e4db9b6c9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.winding.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.winding.1.html @@ -19,26 +19,25 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.beginPath(); -ctx.moveTo(-10, -10); -ctx.lineTo(110, -10); -ctx.lineTo(110, 60); -ctx.lineTo(-10, 60); -ctx.lineTo(-10, -10); -ctx.lineTo(0, 0); -ctx.lineTo(0, 50); -ctx.lineTo(100, 50); -ctx.lineTo(100, 0); -ctx.clip(); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.beginPath(); + ctx.moveTo(-10, -10); + ctx.lineTo(110, -10); + ctx.lineTo(110, 60); + ctx.lineTo(-10, 60); + ctx.lineTo(-10, -10); + ctx.lineTo(0, 0); + ctx.lineTo(0, 50); + ctx.lineTo(100, 50); + ctx.lineTo(100, 0); + ctx.clip(); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.winding.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.winding.2.html index ae8fd4c4d94..9341353a8d1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.winding.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.clip.winding.2.html @@ -19,30 +19,29 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.beginPath(); -ctx.moveTo(-10, -10); -ctx.lineTo(110, -10); -ctx.lineTo(110, 60); -ctx.lineTo(-10, 60); -ctx.lineTo(-10, -10); -ctx.clip(); - -ctx.beginPath(); -ctx.moveTo(0, 0); -ctx.lineTo(0, 50); -ctx.lineTo(100, 50); -ctx.lineTo(100, 0); -ctx.lineTo(0, 0); -ctx.clip(); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.beginPath(); + ctx.moveTo(-10, -10); + ctx.lineTo(110, -10); + ctx.lineTo(110, 60); + ctx.lineTo(-10, 60); + ctx.lineTo(-10, -10); + ctx.clip(); + + ctx.beginPath(); + ctx.moveTo(0, 0); + ctx.lineTo(0, 50); + ctx.lineTo(100, 50); + ctx.lineTo(100, 0); + ctx.lineTo(0, 0); + ctx.clip(); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.closePath.empty.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.closePath.empty.html index e9840f195a3..898cdc5fa6d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.closePath.empty.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.closePath.empty.html @@ -19,13 +19,12 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.closePath(); -ctx.fillStyle = '#f00'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.closePath(); + ctx.fillStyle = '#f00'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.closePath.newline.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.closePath.newline.html index 2ad2609e1ae..07ec4b2a829 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.closePath.newline.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.closePath.newline.html @@ -19,18 +19,17 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.moveTo(-100, 25); -ctx.lineTo(-100, -100); -ctx.lineTo(200, -100); -ctx.lineTo(200, 25); -ctx.closePath(); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.moveTo(-100, 25); + ctx.lineTo(-100, -100); + ctx.lineTo(200, -100); + ctx.lineTo(200, 25); + ctx.closePath(); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.closePath.nextpoint.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.closePath.nextpoint.html index 7538af29f30..648d7ad37af 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.closePath.nextpoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.closePath.nextpoint.html @@ -19,17 +19,16 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.moveTo(-100, 25); -ctx.lineTo(-100, -1000); -ctx.closePath(); -ctx.lineTo(1000, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.moveTo(-100, 25); + ctx.lineTo(-100, -1000); + ctx.closePath(); + ctx.lineTo(1000, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.ellipse.basics.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.ellipse.basics.html index 13ba8be5b6e..d46dc31d261 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.ellipse.basics.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.ellipse.basics.html @@ -19,14 +19,13 @@ var t = async_test("Verify canvas throws error when drawing ellipse with negative radii."); _addTest(function(canvas, ctx) { -ctx.ellipse(10, 10, 10, 5, 0, 0, 1, false); -ctx.ellipse(10, 10, 10, 0, 0, 0, 1, false); -ctx.ellipse(10, 10, -0, 5, 0, 0, 1, false); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.ellipse(10, 10, -2, 5, 0, 0, 1, false); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.ellipse(10, 10, 0, -1.5, 0, 0, 1, false); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.ellipse(10, 10, -2, -5, 0, 0, 1, false); }); -ctx.ellipse(80, 0, 10, 4294967277, Math.PI / -84, -Math.PI / 2147483436, false); - + ctx.ellipse(10, 10, 10, 5, 0, 0, 1, false); + ctx.ellipse(10, 10, 10, 0, 0, 0, 1, false); + ctx.ellipse(10, 10, -0, 5, 0, 0, 1, false); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.ellipse(10, 10, -2, 5, 0, 0, 1, false); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.ellipse(10, 10, 0, -1.5, 0, 0, 1, false); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.ellipse(10, 10, -2, -5, 0, 0, 1, false); }); + ctx.ellipse(80, 0, 10, 4294967277, Math.PI / -84, -Math.PI / 2147483436, false); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.closed.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.closed.basic.html index 890c15cf4b2..010dbf43e1a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.closed.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.closed.basic.html @@ -19,18 +19,17 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fill(); - -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.fillStyle = '#0f0'; + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.closed.unaffected.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.closed.unaffected.html index bd42e95181f..e00a6c8f550 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.closed.unaffected.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.closed.unaffected.html @@ -19,21 +19,20 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#00f'; -ctx.fillRect(0, 0, 100, 50); - -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.lineTo(100, 50); -ctx.fillStyle = '#f00'; -ctx.fill(); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -_assertPixel(canvas, 90,10, 0,255,0,255); -_assertPixel(canvas, 10,40, 0,255,0,255); - + ctx.fillStyle = '#00f'; + ctx.fillRect(0, 0, 100, 50); + + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.lineTo(100, 50); + ctx.fillStyle = '#f00'; + ctx.fill(); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + _assertPixel(canvas, 90,10, 0,255,0,255); + _assertPixel(canvas, 10,40, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.overlap.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.overlap.html index eb50ac6846b..08782ed11ee 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.overlap.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.overlap.html @@ -19,17 +19,16 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#000'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#000'; + ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = 'rgba(0, 255, 0, 0.5)'; -ctx.rect(0, 0, 100, 50); -ctx.closePath(); -ctx.rect(10, 10, 80, 30); -ctx.fill(); - -_assertPixelApprox(canvas, 50,25, 0,127,0,255, 1); + ctx.fillStyle = 'rgba(0, 255, 0, 0.5)'; + ctx.rect(0, 0, 100, 50); + ctx.closePath(); + ctx.rect(10, 10, 80, 30); + ctx.fill(); + _assertPixelApprox(canvas, 50,25, 0,127,0,255, 1); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.winding.add.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.winding.add.html index 5fbcd652601..ef9a2a0f939 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.winding.add.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.winding.add.html @@ -19,23 +19,22 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.fillStyle = '#0f0'; -ctx.moveTo(-10, -10); -ctx.lineTo(110, -10); -ctx.lineTo(110, 60); -ctx.lineTo(-10, 60); -ctx.lineTo(-10, -10); -ctx.lineTo(0, 0); -ctx.lineTo(100, 0); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fill(); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.moveTo(-10, -10); + ctx.lineTo(110, -10); + ctx.lineTo(110, 60); + ctx.lineTo(-10, 60); + ctx.lineTo(-10, -10); + ctx.lineTo(0, 0); + ctx.lineTo(100, 0); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.winding.subtract.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.winding.subtract.1.html index 963e5d3c75d..eecf0198e27 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.winding.subtract.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.winding.subtract.1.html @@ -19,23 +19,22 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.fillStyle = '#f00'; -ctx.moveTo(-10, -10); -ctx.lineTo(110, -10); -ctx.lineTo(110, 60); -ctx.lineTo(-10, 60); -ctx.lineTo(-10, -10); -ctx.lineTo(0, 0); -ctx.lineTo(0, 50); -ctx.lineTo(100, 50); -ctx.lineTo(100, 0); -ctx.fill(); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#f00'; + ctx.moveTo(-10, -10); + ctx.lineTo(110, -10); + ctx.lineTo(110, 60); + ctx.lineTo(-10, 60); + ctx.lineTo(-10, -10); + ctx.lineTo(0, 0); + ctx.lineTo(0, 50); + ctx.lineTo(100, 50); + ctx.lineTo(100, 0); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.winding.subtract.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.winding.subtract.2.html index 305d628b9e5..cf8b6a6ce98 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.winding.subtract.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.winding.subtract.2.html @@ -19,22 +19,21 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.fillStyle = '#f00'; -ctx.moveTo(-10, -10); -ctx.lineTo(110, -10); -ctx.lineTo(110, 60); -ctx.lineTo(-10, 60); -ctx.moveTo(0, 0); -ctx.lineTo(0, 50); -ctx.lineTo(100, 50); -ctx.lineTo(100, 0); -ctx.fill(); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#f00'; + ctx.moveTo(-10, -10); + ctx.lineTo(110, -10); + ctx.lineTo(110, 60); + ctx.lineTo(-10, 60); + ctx.moveTo(0, 0); + ctx.lineTo(0, 50); + ctx.lineTo(100, 50); + ctx.lineTo(100, 0); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.winding.subtract.3.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.winding.subtract.3.html index 4bda1bd248f..e056e330039 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.winding.subtract.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.fill.winding.subtract.3.html @@ -19,28 +19,27 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.fillStyle = '#0f0'; -ctx.moveTo(-10, -10); -ctx.lineTo(110, -10); -ctx.lineTo(110, 60); -ctx.lineTo(-10, 60); -ctx.lineTo(-10, -10); -ctx.lineTo(-20, -20); -ctx.lineTo(120, -20); -ctx.lineTo(120, 70); -ctx.lineTo(-20, 70); -ctx.lineTo(-20, -20); -ctx.lineTo(0, 0); -ctx.lineTo(0, 50); -ctx.lineTo(100, 50); -ctx.lineTo(100, 0); -ctx.fill(); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.moveTo(-10, -10); + ctx.lineTo(110, -10); + ctx.lineTo(110, 60); + ctx.lineTo(-10, 60); + ctx.lineTo(-10, -10); + ctx.lineTo(-20, -20); + ctx.lineTo(120, -20); + ctx.lineTo(120, 70); + ctx.lineTo(-20, 70); + ctx.lineTo(-20, -20); + ctx.lineTo(0, 0); + ctx.lineTo(0, 50); + ctx.lineTo(100, 50); + ctx.lineTo(100, 0); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.initial.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.initial.html index ec17cc330aa..a3de93a7999 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.initial.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.initial.html @@ -19,13 +19,12 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.closePath(); -ctx.fillStyle = '#f00'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.closePath(); + ctx.fillStyle = '#f00'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.arc.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.arc.html index ecf184227d0..bc4bc560e56 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.arc.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.arc.html @@ -19,16 +19,15 @@ var t = async_test("isPointInPath() works on arcs"); _addTest(function(canvas, ctx) { -ctx.arc(50, 25, 10, 0, Math.PI, false); -_assertSame(ctx.isPointInPath(50, 10), false, "ctx.isPointInPath(50, 10)", "false"); -_assertSame(ctx.isPointInPath(50, 20), false, "ctx.isPointInPath(50, 20)", "false"); -_assertSame(ctx.isPointInPath(50, 30), true, "ctx.isPointInPath(50, 30)", "true"); -_assertSame(ctx.isPointInPath(50, 40), false, "ctx.isPointInPath(50, 40)", "false"); -_assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); -_assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); -_assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); -_assertSame(ctx.isPointInPath(70, 30), false, "ctx.isPointInPath(70, 30)", "false"); - + ctx.arc(50, 25, 10, 0, Math.PI, false); + _assertSame(ctx.isPointInPath(50, 10), false, "ctx.isPointInPath(50, 10)", "false"); + _assertSame(ctx.isPointInPath(50, 20), false, "ctx.isPointInPath(50, 20)", "false"); + _assertSame(ctx.isPointInPath(50, 30), true, "ctx.isPointInPath(50, 30)", "true"); + _assertSame(ctx.isPointInPath(50, 40), false, "ctx.isPointInPath(50, 40)", "false"); + _assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); + _assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); + _assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); + _assertSame(ctx.isPointInPath(70, 30), false, "ctx.isPointInPath(70, 30)", "false"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.basic.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.basic.1.html index 09cdfd2c9e2..22562c60a28 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.basic.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.basic.1.html @@ -19,10 +19,9 @@ var t = async_test("isPointInPath() detects whether the point is inside the path"); _addTest(function(canvas, ctx) { -ctx.rect(0, 0, 20, 20); -_assertSame(ctx.isPointInPath(10, 10), true, "ctx.isPointInPath(10, 10)", "true"); -_assertSame(ctx.isPointInPath(30, 10), false, "ctx.isPointInPath(30, 10)", "false"); - + ctx.rect(0, 0, 20, 20); + _assertSame(ctx.isPointInPath(10, 10), true, "ctx.isPointInPath(10, 10)", "true"); + _assertSame(ctx.isPointInPath(30, 10), false, "ctx.isPointInPath(30, 10)", "false"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.basic.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.basic.2.html index f2bd51a216f..9fc1060df8d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.basic.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.basic.2.html @@ -19,10 +19,9 @@ var t = async_test("isPointInPath() detects whether the point is inside the path"); _addTest(function(canvas, ctx) { -ctx.rect(20, 0, 20, 20); -_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); -_assertSame(ctx.isPointInPath(30, 10), true, "ctx.isPointInPath(30, 10)", "true"); - + ctx.rect(20, 0, 20, 20); + _assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); + _assertSame(ctx.isPointInPath(30, 10), true, "ctx.isPointInPath(30, 10)", "true"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.basic.html index fc30dfe4645..5e3edfcc809 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.basic.html @@ -19,47 +19,46 @@ var t = async_test("Verify the winding rule in isPointInPath works for for rect path."); _addTest(function(canvas, ctx) { -canvas.width = 200; -canvas.height = 200; + canvas.width = 200; + canvas.height = 200; -// Testing default isPointInPath -ctx.beginPath(); -ctx.rect(0, 0, 100, 100); -ctx.rect(25, 25, 50, 50); -_assertSame(ctx.isPointInPath(50, 50), true, "ctx.isPointInPath(50, 50)", "true"); -_assertSame(ctx.isPointInPath(NaN, 50), false, "ctx.isPointInPath(NaN, 50)", "false"); -_assertSame(ctx.isPointInPath(50, NaN), false, "ctx.isPointInPath(50, NaN)", "false"); + // Testing default isPointInPath + ctx.beginPath(); + ctx.rect(0, 0, 100, 100); + ctx.rect(25, 25, 50, 50); + _assertSame(ctx.isPointInPath(50, 50), true, "ctx.isPointInPath(50, 50)", "true"); + _assertSame(ctx.isPointInPath(NaN, 50), false, "ctx.isPointInPath(NaN, 50)", "false"); + _assertSame(ctx.isPointInPath(50, NaN), false, "ctx.isPointInPath(50, NaN)", "false"); -// Testing nonzero isPointInPath -ctx.beginPath(); -ctx.rect(0, 0, 100, 100); -ctx.rect(25, 25, 50, 50); -_assertSame(ctx.isPointInPath(50, 50, 'nonzero'), true, "ctx.isPointInPath(50, 50, 'nonzero')", "true"); + // Testing nonzero isPointInPath + ctx.beginPath(); + ctx.rect(0, 0, 100, 100); + ctx.rect(25, 25, 50, 50); + _assertSame(ctx.isPointInPath(50, 50, 'nonzero'), true, "ctx.isPointInPath(50, 50, 'nonzero')", "true"); -// Testing evenodd isPointInPath -ctx.beginPath(); -ctx.rect(0, 0, 100, 100); -ctx.rect(25, 25, 50, 50); -_assertSame(ctx.isPointInPath(50, 50, 'evenodd'), false, "ctx.isPointInPath(50, 50, 'evenodd')", "false"); + // Testing evenodd isPointInPath + ctx.beginPath(); + ctx.rect(0, 0, 100, 100); + ctx.rect(25, 25, 50, 50); + _assertSame(ctx.isPointInPath(50, 50, 'evenodd'), false, "ctx.isPointInPath(50, 50, 'evenodd')", "false"); -// Testing extremely large scale -ctx.save(); -ctx.scale(Number.MAX_VALUE, Number.MAX_VALUE); -ctx.beginPath(); -ctx.rect(-10, -10, 20, 20); -_assertSame(ctx.isPointInPath(0, 0, 'nonzero'), true, "ctx.isPointInPath(0, 0, 'nonzero')", "true"); -_assertSame(ctx.isPointInPath(0, 0, 'evenodd'), true, "ctx.isPointInPath(0, 0, 'evenodd')", "true"); -ctx.restore(); - -// Check with non-invertible ctm. -ctx.save(); -ctx.scale(0, 0); -ctx.beginPath(); -ctx.rect(-10, -10, 20, 20); -_assertSame(ctx.isPointInPath(0, 0, 'nonzero'), false, "ctx.isPointInPath(0, 0, 'nonzero')", "false"); -_assertSame(ctx.isPointInPath(0, 0, 'evenodd'), false, "ctx.isPointInPath(0, 0, 'evenodd')", "false"); -ctx.restore(); + // Testing extremely large scale + ctx.save(); + ctx.scale(Number.MAX_VALUE, Number.MAX_VALUE); + ctx.beginPath(); + ctx.rect(-10, -10, 20, 20); + _assertSame(ctx.isPointInPath(0, 0, 'nonzero'), true, "ctx.isPointInPath(0, 0, 'nonzero')", "true"); + _assertSame(ctx.isPointInPath(0, 0, 'evenodd'), true, "ctx.isPointInPath(0, 0, 'evenodd')", "true"); + ctx.restore(); + // Check with non-invertible ctm. + ctx.save(); + ctx.scale(0, 0); + ctx.beginPath(); + ctx.rect(-10, -10, 20, 20); + _assertSame(ctx.isPointInPath(0, 0, 'nonzero'), false, "ctx.isPointInPath(0, 0, 'nonzero')", "false"); + _assertSame(ctx.isPointInPath(0, 0, 'evenodd'), false, "ctx.isPointInPath(0, 0, 'evenodd')", "false"); + ctx.restore(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.bezier.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.bezier.html index 576c4f26e99..b2f2d23724a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.bezier.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.bezier.html @@ -19,29 +19,28 @@ var t = async_test("isPointInPath() works on Bezier curves"); _addTest(function(canvas, ctx) { -ctx.moveTo(25, 25); -ctx.bezierCurveTo(50, -50, 50, 100, 75, 25); -_assertSame(ctx.isPointInPath(25, 20), false, "ctx.isPointInPath(25, 20)", "false"); -_assertSame(ctx.isPointInPath(25, 30), false, "ctx.isPointInPath(25, 30)", "false"); -_assertSame(ctx.isPointInPath(30, 20), true, "ctx.isPointInPath(30, 20)", "true"); -_assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); -_assertSame(ctx.isPointInPath(40, 2), false, "ctx.isPointInPath(40, 2)", "false"); -_assertSame(ctx.isPointInPath(40, 20), true, "ctx.isPointInPath(40, 20)", "true"); -_assertSame(ctx.isPointInPath(40, 30), false, "ctx.isPointInPath(40, 30)", "false"); -_assertSame(ctx.isPointInPath(40, 47), false, "ctx.isPointInPath(40, 47)", "false"); -_assertSame(ctx.isPointInPath(45, 20), true, "ctx.isPointInPath(45, 20)", "true"); -_assertSame(ctx.isPointInPath(45, 30), false, "ctx.isPointInPath(45, 30)", "false"); -_assertSame(ctx.isPointInPath(55, 20), false, "ctx.isPointInPath(55, 20)", "false"); -_assertSame(ctx.isPointInPath(55, 30), true, "ctx.isPointInPath(55, 30)", "true"); -_assertSame(ctx.isPointInPath(60, 2), false, "ctx.isPointInPath(60, 2)", "false"); -_assertSame(ctx.isPointInPath(60, 20), false, "ctx.isPointInPath(60, 20)", "false"); -_assertSame(ctx.isPointInPath(60, 30), true, "ctx.isPointInPath(60, 30)", "true"); -_assertSame(ctx.isPointInPath(60, 47), false, "ctx.isPointInPath(60, 47)", "false"); -_assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); -_assertSame(ctx.isPointInPath(70, 30), true, "ctx.isPointInPath(70, 30)", "true"); -_assertSame(ctx.isPointInPath(75, 20), false, "ctx.isPointInPath(75, 20)", "false"); -_assertSame(ctx.isPointInPath(75, 30), false, "ctx.isPointInPath(75, 30)", "false"); - + ctx.moveTo(25, 25); + ctx.bezierCurveTo(50, -50, 50, 100, 75, 25); + _assertSame(ctx.isPointInPath(25, 20), false, "ctx.isPointInPath(25, 20)", "false"); + _assertSame(ctx.isPointInPath(25, 30), false, "ctx.isPointInPath(25, 30)", "false"); + _assertSame(ctx.isPointInPath(30, 20), true, "ctx.isPointInPath(30, 20)", "true"); + _assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); + _assertSame(ctx.isPointInPath(40, 2), false, "ctx.isPointInPath(40, 2)", "false"); + _assertSame(ctx.isPointInPath(40, 20), true, "ctx.isPointInPath(40, 20)", "true"); + _assertSame(ctx.isPointInPath(40, 30), false, "ctx.isPointInPath(40, 30)", "false"); + _assertSame(ctx.isPointInPath(40, 47), false, "ctx.isPointInPath(40, 47)", "false"); + _assertSame(ctx.isPointInPath(45, 20), true, "ctx.isPointInPath(45, 20)", "true"); + _assertSame(ctx.isPointInPath(45, 30), false, "ctx.isPointInPath(45, 30)", "false"); + _assertSame(ctx.isPointInPath(55, 20), false, "ctx.isPointInPath(55, 20)", "false"); + _assertSame(ctx.isPointInPath(55, 30), true, "ctx.isPointInPath(55, 30)", "true"); + _assertSame(ctx.isPointInPath(60, 2), false, "ctx.isPointInPath(60, 2)", "false"); + _assertSame(ctx.isPointInPath(60, 20), false, "ctx.isPointInPath(60, 20)", "false"); + _assertSame(ctx.isPointInPath(60, 30), true, "ctx.isPointInPath(60, 30)", "true"); + _assertSame(ctx.isPointInPath(60, 47), false, "ctx.isPointInPath(60, 47)", "false"); + _assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); + _assertSame(ctx.isPointInPath(70, 30), true, "ctx.isPointInPath(70, 30)", "true"); + _assertSame(ctx.isPointInPath(75, 20), false, "ctx.isPointInPath(75, 20)", "false"); + _assertSame(ctx.isPointInPath(75, 30), false, "ctx.isPointInPath(75, 30)", "false"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.bigarc.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.bigarc.html index a9995208e4a..77cb495137d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.bigarc.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.bigarc.html @@ -19,16 +19,15 @@ var t = async_test("isPointInPath() works on unclosed arcs larger than 2pi"); _addTest(function(canvas, ctx) { -ctx.arc(50, 25, 10, 0, 7, false); -_assertSame(ctx.isPointInPath(50, 10), false, "ctx.isPointInPath(50, 10)", "false"); -_assertSame(ctx.isPointInPath(50, 20), true, "ctx.isPointInPath(50, 20)", "true"); -_assertSame(ctx.isPointInPath(50, 30), true, "ctx.isPointInPath(50, 30)", "true"); -_assertSame(ctx.isPointInPath(50, 40), false, "ctx.isPointInPath(50, 40)", "false"); -_assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); -_assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); -_assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); -_assertSame(ctx.isPointInPath(70, 30), false, "ctx.isPointInPath(70, 30)", "false"); - + ctx.arc(50, 25, 10, 0, 7, false); + _assertSame(ctx.isPointInPath(50, 10), false, "ctx.isPointInPath(50, 10)", "false"); + _assertSame(ctx.isPointInPath(50, 20), true, "ctx.isPointInPath(50, 20)", "true"); + _assertSame(ctx.isPointInPath(50, 30), true, "ctx.isPointInPath(50, 30)", "true"); + _assertSame(ctx.isPointInPath(50, 40), false, "ctx.isPointInPath(50, 40)", "false"); + _assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); + _assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); + _assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); + _assertSame(ctx.isPointInPath(70, 30), false, "ctx.isPointInPath(70, 30)", "false"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.edge.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.edge.html index 01106f92a70..b00da5a2a71 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.edge.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.edge.html @@ -19,20 +19,19 @@ var t = async_test("isPointInPath() counts points on the path as being inside"); _addTest(function(canvas, ctx) { -ctx.rect(0, 0, 20, 20); -_assertSame(ctx.isPointInPath(0, 0), true, "ctx.isPointInPath(0, 0)", "true"); -_assertSame(ctx.isPointInPath(10, 0), true, "ctx.isPointInPath(10, 0)", "true"); -_assertSame(ctx.isPointInPath(20, 0), true, "ctx.isPointInPath(20, 0)", "true"); -_assertSame(ctx.isPointInPath(20, 10), true, "ctx.isPointInPath(20, 10)", "true"); -_assertSame(ctx.isPointInPath(20, 20), true, "ctx.isPointInPath(20, 20)", "true"); -_assertSame(ctx.isPointInPath(10, 20), true, "ctx.isPointInPath(10, 20)", "true"); -_assertSame(ctx.isPointInPath(0, 20), true, "ctx.isPointInPath(0, 20)", "true"); -_assertSame(ctx.isPointInPath(0, 10), true, "ctx.isPointInPath(0, 10)", "true"); -_assertSame(ctx.isPointInPath(10, -0.01), false, "ctx.isPointInPath(10, -0.01)", "false"); -_assertSame(ctx.isPointInPath(10, 20.01), false, "ctx.isPointInPath(10, 20.01)", "false"); -_assertSame(ctx.isPointInPath(-0.01, 10), false, "ctx.isPointInPath(-0.01, 10)", "false"); -_assertSame(ctx.isPointInPath(20.01, 10), false, "ctx.isPointInPath(20.01, 10)", "false"); - + ctx.rect(0, 0, 20, 20); + _assertSame(ctx.isPointInPath(0, 0), true, "ctx.isPointInPath(0, 0)", "true"); + _assertSame(ctx.isPointInPath(10, 0), true, "ctx.isPointInPath(10, 0)", "true"); + _assertSame(ctx.isPointInPath(20, 0), true, "ctx.isPointInPath(20, 0)", "true"); + _assertSame(ctx.isPointInPath(20, 10), true, "ctx.isPointInPath(20, 10)", "true"); + _assertSame(ctx.isPointInPath(20, 20), true, "ctx.isPointInPath(20, 20)", "true"); + _assertSame(ctx.isPointInPath(10, 20), true, "ctx.isPointInPath(10, 20)", "true"); + _assertSame(ctx.isPointInPath(0, 20), true, "ctx.isPointInPath(0, 20)", "true"); + _assertSame(ctx.isPointInPath(0, 10), true, "ctx.isPointInPath(0, 10)", "true"); + _assertSame(ctx.isPointInPath(10, -0.01), false, "ctx.isPointInPath(10, -0.01)", "false"); + _assertSame(ctx.isPointInPath(10, 20.01), false, "ctx.isPointInPath(10, 20.01)", "false"); + _assertSame(ctx.isPointInPath(-0.01, 10), false, "ctx.isPointInPath(-0.01, 10)", "false"); + _assertSame(ctx.isPointInPath(20.01, 10), false, "ctx.isPointInPath(20.01, 10)", "false"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.empty.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.empty.html index 5ba237094b4..3edfe01a2ae 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.empty.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.empty.html @@ -19,8 +19,7 @@ var t = async_test("isPointInPath() works when there is no path"); _addTest(function(canvas, ctx) { -_assertSame(ctx.isPointInPath(0, 0), false, "ctx.isPointInPath(0, 0)", "false"); - + _assertSame(ctx.isPointInPath(0, 0), false, "ctx.isPointInPath(0, 0)", "false"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.nonfinite.html index 1523f4ca81d..4ef541a4313 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.nonfinite.html @@ -19,15 +19,14 @@ var t = async_test("isPointInPath() returns false for non-finite arguments"); _addTest(function(canvas, ctx) { -ctx.rect(-100, -50, 200, 100); -_assertSame(ctx.isPointInPath(Infinity, 0), false, "ctx.isPointInPath(Infinity, 0)", "false"); -_assertSame(ctx.isPointInPath(-Infinity, 0), false, "ctx.isPointInPath(-Infinity, 0)", "false"); -_assertSame(ctx.isPointInPath(NaN, 0), false, "ctx.isPointInPath(NaN, 0)", "false"); -_assertSame(ctx.isPointInPath(0, Infinity), false, "ctx.isPointInPath(0, Infinity)", "false"); -_assertSame(ctx.isPointInPath(0, -Infinity), false, "ctx.isPointInPath(0, -Infinity)", "false"); -_assertSame(ctx.isPointInPath(0, NaN), false, "ctx.isPointInPath(0, NaN)", "false"); -_assertSame(ctx.isPointInPath(NaN, NaN), false, "ctx.isPointInPath(NaN, NaN)", "false"); - + ctx.rect(-100, -50, 200, 100); + _assertSame(ctx.isPointInPath(Infinity, 0), false, "ctx.isPointInPath(Infinity, 0)", "false"); + _assertSame(ctx.isPointInPath(-Infinity, 0), false, "ctx.isPointInPath(-Infinity, 0)", "false"); + _assertSame(ctx.isPointInPath(NaN, 0), false, "ctx.isPointInPath(NaN, 0)", "false"); + _assertSame(ctx.isPointInPath(0, Infinity), false, "ctx.isPointInPath(0, Infinity)", "false"); + _assertSame(ctx.isPointInPath(0, -Infinity), false, "ctx.isPointInPath(0, -Infinity)", "false"); + _assertSame(ctx.isPointInPath(0, NaN), false, "ctx.isPointInPath(0, NaN)", "false"); + _assertSame(ctx.isPointInPath(NaN, NaN), false, "ctx.isPointInPath(NaN, NaN)", "false"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.outside.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.outside.html index 4f3b38f6956..6431879eb66 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.outside.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.outside.html @@ -19,15 +19,14 @@ var t = async_test("isPointInPath() works on paths outside the canvas"); _addTest(function(canvas, ctx) { -ctx.rect(0, -100, 20, 20); -ctx.rect(20, -10, 20, 20); -_assertSame(ctx.isPointInPath(10, -110), false, "ctx.isPointInPath(10, -110)", "false"); -_assertSame(ctx.isPointInPath(10, -90), true, "ctx.isPointInPath(10, -90)", "true"); -_assertSame(ctx.isPointInPath(10, -70), false, "ctx.isPointInPath(10, -70)", "false"); -_assertSame(ctx.isPointInPath(30, -20), false, "ctx.isPointInPath(30, -20)", "false"); -_assertSame(ctx.isPointInPath(30, 0), true, "ctx.isPointInPath(30, 0)", "true"); -_assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); - + ctx.rect(0, -100, 20, 20); + ctx.rect(20, -10, 20, 20); + _assertSame(ctx.isPointInPath(10, -110), false, "ctx.isPointInPath(10, -110)", "false"); + _assertSame(ctx.isPointInPath(10, -90), true, "ctx.isPointInPath(10, -90)", "true"); + _assertSame(ctx.isPointInPath(10, -70), false, "ctx.isPointInPath(10, -70)", "false"); + _assertSame(ctx.isPointInPath(30, -20), false, "ctx.isPointInPath(30, -20)", "false"); + _assertSame(ctx.isPointInPath(30, 0), true, "ctx.isPointInPath(30, 0)", "true"); + _assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.subpath.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.subpath.html index 92e25e24983..5d664557d8e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.subpath.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.subpath.html @@ -19,15 +19,14 @@ var t = async_test("isPointInPath() uses the current path, not just the subpath"); _addTest(function(canvas, ctx) { -ctx.rect(0, 0, 20, 20); -ctx.beginPath(); -ctx.rect(20, 0, 20, 20); -ctx.closePath(); -ctx.rect(40, 0, 20, 20); -_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); -_assertSame(ctx.isPointInPath(30, 10), true, "ctx.isPointInPath(30, 10)", "true"); -_assertSame(ctx.isPointInPath(50, 10), true, "ctx.isPointInPath(50, 10)", "true"); - + ctx.rect(0, 0, 20, 20); + ctx.beginPath(); + ctx.rect(20, 0, 20, 20); + ctx.closePath(); + ctx.rect(40, 0, 20, 20); + _assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); + _assertSame(ctx.isPointInPath(30, 10), true, "ctx.isPointInPath(30, 10)", "true"); + _assertSame(ctx.isPointInPath(50, 10), true, "ctx.isPointInPath(50, 10)", "true"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.transform.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.transform.1.html index a210993ab98..7268c3255ff 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.transform.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.transform.1.html @@ -19,15 +19,14 @@ var t = async_test("isPointInPath() handles transformations correctly"); _addTest(function(canvas, ctx) { -ctx.translate(50, 0); -ctx.rect(0, 0, 20, 20); -_assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); -_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); -_assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); -_assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); -_assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); -_assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); - + ctx.translate(50, 0); + ctx.rect(0, 0, 20, 20); + _assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); + _assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); + _assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); + _assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); + _assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); + _assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.transform.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.transform.2.html index f74cdde1ef8..3adac7a4191 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.transform.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.transform.2.html @@ -19,15 +19,14 @@ var t = async_test("isPointInPath() handles transformations correctly"); _addTest(function(canvas, ctx) { -ctx.rect(50, 0, 20, 20); -ctx.translate(50, 0); -_assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); -_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); -_assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); -_assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); -_assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); -_assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); - + ctx.rect(50, 0, 20, 20); + ctx.translate(50, 0); + _assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); + _assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); + _assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); + _assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); + _assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); + _assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.transform.3.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.transform.3.html index 3469734dc94..8769c8a593b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.transform.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.transform.3.html @@ -19,15 +19,14 @@ var t = async_test("isPointInPath() handles transformations correctly"); _addTest(function(canvas, ctx) { -ctx.scale(-1, 1); -ctx.rect(-70, 0, 20, 20); -_assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); -_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); -_assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); -_assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); -_assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); -_assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); - + ctx.scale(-1, 1); + ctx.rect(-70, 0, 20, 20); + _assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); + _assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); + _assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); + _assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); + _assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); + _assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.transform.4.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.transform.4.html index 94a2e159366..1bcc0bc3a3f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.transform.4.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.transform.4.html @@ -19,13 +19,12 @@ var t = async_test("isPointInPath() handles transformations correctly"); _addTest(function(canvas, ctx) { -ctx.translate(50, 0); -ctx.rect(50, 0, 20, 20); -ctx.translate(0, 50); -_assertSame(ctx.isPointInPath(60, 10), false, "ctx.isPointInPath(60, 10)", "false"); -_assertSame(ctx.isPointInPath(110, 10), true, "ctx.isPointInPath(110, 10)", "true"); -_assertSame(ctx.isPointInPath(110, 60), false, "ctx.isPointInPath(110, 60)", "false"); - + ctx.translate(50, 0); + ctx.rect(50, 0, 20, 20); + ctx.translate(0, 50); + _assertSame(ctx.isPointInPath(60, 10), false, "ctx.isPointInPath(60, 10)", "false"); + _assertSame(ctx.isPointInPath(110, 10), true, "ctx.isPointInPath(110, 10)", "true"); + _assertSame(ctx.isPointInPath(110, 60), false, "ctx.isPointInPath(110, 60)", "false"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.unclosed.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.unclosed.html index 41aa9c695b8..2e3b711129e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.unclosed.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.unclosed.html @@ -19,13 +19,12 @@ var t = async_test("isPointInPath() works on unclosed subpaths"); _addTest(function(canvas, ctx) { -ctx.moveTo(0, 0); -ctx.lineTo(20, 0); -ctx.lineTo(20, 20); -ctx.lineTo(0, 20); -_assertSame(ctx.isPointInPath(10, 10), true, "ctx.isPointInPath(10, 10)", "true"); -_assertSame(ctx.isPointInPath(30, 10), false, "ctx.isPointInPath(30, 10)", "false"); - + ctx.moveTo(0, 0); + ctx.lineTo(20, 0); + ctx.lineTo(20, 20); + ctx.lineTo(0, 20); + _assertSame(ctx.isPointInPath(10, 10), true, "ctx.isPointInPath(10, 10)", "true"); + _assertSame(ctx.isPointInPath(30, 10), false, "ctx.isPointInPath(30, 10)", "false"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.winding.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.winding.html index 82c78c7e378..ec225707974 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.winding.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInPath.winding.html @@ -19,28 +19,27 @@ var t = async_test("isPointInPath() uses the non-zero winding number rule"); _addTest(function(canvas, ctx) { -// Create a square ring, using opposite windings to make a hole in the centre -ctx.moveTo(0, 0); -ctx.lineTo(50, 0); -ctx.lineTo(50, 50); -ctx.lineTo(0, 50); -ctx.lineTo(0, 0); -ctx.lineTo(10, 10); -ctx.lineTo(10, 40); -ctx.lineTo(40, 40); -ctx.lineTo(40, 10); -ctx.lineTo(10, 10); - -_assertSame(ctx.isPointInPath(5, 5), true, "ctx.isPointInPath(5, 5)", "true"); -_assertSame(ctx.isPointInPath(25, 5), true, "ctx.isPointInPath(25, 5)", "true"); -_assertSame(ctx.isPointInPath(45, 5), true, "ctx.isPointInPath(45, 5)", "true"); -_assertSame(ctx.isPointInPath(5, 25), true, "ctx.isPointInPath(5, 25)", "true"); -_assertSame(ctx.isPointInPath(25, 25), false, "ctx.isPointInPath(25, 25)", "false"); -_assertSame(ctx.isPointInPath(45, 25), true, "ctx.isPointInPath(45, 25)", "true"); -_assertSame(ctx.isPointInPath(5, 45), true, "ctx.isPointInPath(5, 45)", "true"); -_assertSame(ctx.isPointInPath(25, 45), true, "ctx.isPointInPath(25, 45)", "true"); -_assertSame(ctx.isPointInPath(45, 45), true, "ctx.isPointInPath(45, 45)", "true"); - + // Create a square ring, using opposite windings to make a hole in the centre + ctx.moveTo(0, 0); + ctx.lineTo(50, 0); + ctx.lineTo(50, 50); + ctx.lineTo(0, 50); + ctx.lineTo(0, 0); + ctx.lineTo(10, 10); + ctx.lineTo(10, 40); + ctx.lineTo(40, 40); + ctx.lineTo(40, 10); + ctx.lineTo(10, 10); + + _assertSame(ctx.isPointInPath(5, 5), true, "ctx.isPointInPath(5, 5)", "true"); + _assertSame(ctx.isPointInPath(25, 5), true, "ctx.isPointInPath(25, 5)", "true"); + _assertSame(ctx.isPointInPath(45, 5), true, "ctx.isPointInPath(45, 5)", "true"); + _assertSame(ctx.isPointInPath(5, 25), true, "ctx.isPointInPath(5, 25)", "true"); + _assertSame(ctx.isPointInPath(25, 25), false, "ctx.isPointInPath(25, 25)", "false"); + _assertSame(ctx.isPointInPath(45, 25), true, "ctx.isPointInPath(45, 25)", "true"); + _assertSame(ctx.isPointInPath(5, 45), true, "ctx.isPointInPath(5, 45)", "true"); + _assertSame(ctx.isPointInPath(25, 45), true, "ctx.isPointInPath(25, 45)", "true"); + _assertSame(ctx.isPointInPath(45, 45), true, "ctx.isPointInPath(45, 45)", "true"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInStroke.scaleddashes.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInStroke.scaleddashes.html index 1d1c9ba938d..e27baa15493 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInStroke.scaleddashes.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInStroke.scaleddashes.html @@ -19,21 +19,20 @@ var t = async_test("isPointInStroke() should return correct results on dashed paths at high scale factors"); _addTest(function(canvas, ctx) { -var scale = 20; -ctx.setLineDash([10, 21.4159]); // dash from t=0 to t=10 along the circle -ctx.scale(scale, scale); -ctx.ellipse(6, 10, 5, 5, 0, 2*Math.PI, false); -ctx.stroke(); - -// hit-test the beginning of the dash (t=0) -_assertSame(ctx.isPointInStroke(11*scale, 10*scale), true, "ctx.isPointInStroke(11*scale, 10*scale)", "true"); -// hit-test the middle of the dash (t=5) -_assertSame(ctx.isPointInStroke(8.70*scale, 14.21*scale), true, "ctx.isPointInStroke(8.70*scale, 14.21*scale)", "true"); -// hit-test the end of the dash (t=9.8) -_assertSame(ctx.isPointInStroke(4.10*scale, 14.63*scale), true, "ctx.isPointInStroke(4.10*scale, 14.63*scale)", "true"); -// hit-test past the end of the dash (t=10.2) -_assertSame(ctx.isPointInStroke(3.74*scale, 14.46*scale), false, "ctx.isPointInStroke(3.74*scale, 14.46*scale)", "false"); - + var scale = 20; + ctx.setLineDash([10, 21.4159]); // dash from t=0 to t=10 along the circle + ctx.scale(scale, scale); + ctx.ellipse(6, 10, 5, 5, 0, 2*Math.PI, false); + ctx.stroke(); + + // hit-test the beginning of the dash (t=0) + _assertSame(ctx.isPointInStroke(11*scale, 10*scale), true, "ctx.isPointInStroke(11*scale, 10*scale)", "true"); + // hit-test the middle of the dash (t=5) + _assertSame(ctx.isPointInStroke(8.70*scale, 14.21*scale), true, "ctx.isPointInStroke(8.70*scale, 14.21*scale)", "true"); + // hit-test the end of the dash (t=9.8) + _assertSame(ctx.isPointInStroke(4.10*scale, 14.63*scale), true, "ctx.isPointInStroke(4.10*scale, 14.63*scale)", "true"); + // hit-test past the end of the dash (t=10.2) + _assertSame(ctx.isPointInStroke(3.74*scale, 14.46*scale), false, "ctx.isPointInStroke(3.74*scale, 14.46*scale)", "false"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInpath.invalid.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInpath.invalid.html index 3bdd8f770c2..301c7c447d3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInpath.invalid.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInpath.invalid.html @@ -19,32 +19,31 @@ var t = async_test("Verify isPointInPath throws exceptions with invalid inputs."); _addTest(function(canvas, ctx) { -canvas.width = 200; -canvas.height = 200; -path = new Path2D(); -path.rect(0, 0, 100, 100); -path.rect(25, 25, 50, 50); -// Testing invalid enumeration isPointInPath (w/ and w/o Path object'); -assert_throws_js(TypeError, function() { ctx.isPointInPath(path, 50, 50, 'gazonk'); }); -assert_throws_js(TypeError, function() { ctx.isPointInPath(50, 50, 'gazonk'); }); - -// Testing invalid type isPointInPath with Path object'); -assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50); }); -assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, 'nonzero'); }); -assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, 'evenodd'); }); -assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, null); }); -assert_throws_js(TypeError, function() { ctx.isPointInPath(path, 50, 50, null); }); -assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50); }); -assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, 'nonzero'); }); -assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, 'evenodd'); }); -assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, undefined); }); -assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50); }); -assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50, 'nonzero'); }); -assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50, 'evenodd'); }); -assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50); }); -assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50, 'nonzero'); }); -assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50, 'evenodd'); }); - + canvas.width = 200; + canvas.height = 200; + path = new Path2D(); + path.rect(0, 0, 100, 100); + path.rect(25, 25, 50, 50); + // Testing invalid enumeration isPointInPath (w/ and w/o Path object'); + assert_throws_js(TypeError, function() { ctx.isPointInPath(path, 50, 50, 'gazonk'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(50, 50, 'gazonk'); }); + + // Testing invalid type isPointInPath with Path object'); + assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, 'nonzero'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, 'evenodd'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, null); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(path, 50, 50, null); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, 'nonzero'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, 'evenodd'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, undefined); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50, 'nonzero'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50, 'evenodd'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50, 'nonzero'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50, 'evenodd'); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInpath.multi.path.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInpath.multi.path.html index 38949b89c83..d71bd8a4c44 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInpath.multi.path.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.isPointInpath.multi.path.html @@ -19,30 +19,29 @@ var t = async_test("Verify the winding rule in isPointInPath works for path object."); _addTest(function(canvas, ctx) { -canvas.width = 200; -canvas.height = 200; - -// Testing default isPointInPath with Path object'); -path = new Path2D(); -path.rect(0, 0, 100, 100); -path.rect(25, 25, 50, 50); -_assertSame(ctx.isPointInPath(path, 50, 50), true, "ctx.isPointInPath(path, 50, 50)", "true"); -_assertSame(ctx.isPointInPath(path, 50, 50, undefined), true, "ctx.isPointInPath(path, 50, 50, undefined)", "true"); -_assertSame(ctx.isPointInPath(path, NaN, 50), false, "ctx.isPointInPath(path, NaN, 50)", "false"); -_assertSame(ctx.isPointInPath(path, 50, NaN), false, "ctx.isPointInPath(path, 50, NaN)", "false"); - -// Testing nonzero isPointInPath with Path object'); -path = new Path2D(); -path.rect(0, 0, 100, 100); -path.rect(25, 25, 50, 50); -_assertSame(ctx.isPointInPath(path, 50, 50, 'nonzero'), true, "ctx.isPointInPath(path, 50, 50, 'nonzero')", "true"); - -// Testing evenodd isPointInPath with Path object'); -path = new Path2D(); -path.rect(0, 0, 100, 100); -path.rect(25, 25, 50, 50); -assert_false(ctx.isPointInPath(path, 50, 50, 'evenodd')); - + canvas.width = 200; + canvas.height = 200; + + // Testing default isPointInPath with Path object'); + path = new Path2D(); + path.rect(0, 0, 100, 100); + path.rect(25, 25, 50, 50); + _assertSame(ctx.isPointInPath(path, 50, 50), true, "ctx.isPointInPath(path, 50, 50)", "true"); + _assertSame(ctx.isPointInPath(path, 50, 50, undefined), true, "ctx.isPointInPath(path, 50, 50, undefined)", "true"); + _assertSame(ctx.isPointInPath(path, NaN, 50), false, "ctx.isPointInPath(path, NaN, 50)", "false"); + _assertSame(ctx.isPointInPath(path, 50, NaN), false, "ctx.isPointInPath(path, 50, NaN)", "false"); + + // Testing nonzero isPointInPath with Path object'); + path = new Path2D(); + path.rect(0, 0, 100, 100); + path.rect(25, 25, 50, 50); + _assertSame(ctx.isPointInPath(path, 50, 50, 'nonzero'), true, "ctx.isPointInPath(path, 50, 50, 'nonzero')", "true"); + + // Testing evenodd isPointInPath with Path object'); + path = new Path2D(); + path.rect(0, 0, 100, 100); + path.rect(25, 25, 50, 50); + assert_false(ctx.isPointInPath(path, 50, 50, 'evenodd')); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.basic.html index 4a2cca3a3af..c6f2caa1968 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.basic.html @@ -19,16 +19,15 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.lineTo(100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.lineTo(100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.ensuresubpath.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.ensuresubpath.1.html index 0fa8f1c0549..ada8f0ca296 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.ensuresubpath.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.ensuresubpath.1.html @@ -19,15 +19,14 @@ var t = async_test("If there is no subpath, the point is added and nothing is drawn"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.lineTo(100, 50); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.lineTo(100, 50); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.ensuresubpath.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.ensuresubpath.2.html index e5b2aa335c2..ac1f9238ffd 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.ensuresubpath.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.ensuresubpath.2.html @@ -19,16 +19,15 @@ var t = async_test("If there is no subpath, the point is added and used for subsequent drawing"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.lineTo(0, 25); -ctx.lineTo(100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.lineTo(0, 25); + ctx.lineTo(100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.nextpoint.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.nextpoint.html index 54b586176de..f403c6b5088 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.nextpoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.nextpoint.html @@ -19,17 +19,16 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.moveTo(-100, -100); -ctx.lineTo(0, 25); -ctx.lineTo(100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.moveTo(-100, -100); + ctx.lineTo(0, 25); + ctx.lineTo(100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.nonfinite.details.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.nonfinite.details.html index 12643d65fd0..d7595db7d13 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.nonfinite.details.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.nonfinite.details.html @@ -19,12 +19,11 @@ var t = async_test("lineTo() with Infinity/NaN for first arg still converts the second arg"); _addTest(function(canvas, ctx) { -for (var arg1 of [Infinity, -Infinity, NaN]) { - var converted = false; - ctx.lineTo(arg1, { valueOf: function() { converted = true; return 0; } }); - _assert(converted, "converted"); -} - + for (var arg1 of [Infinity, -Infinity, NaN]) { + var converted = false; + ctx.lineTo(arg1, { valueOf: function() { converted = true; return 0; } }); + _assert(converted, "converted"); + } }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.nonfinite.html index fa3acf53851..8246064ea34 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.lineTo.nonfinite.html @@ -19,22 +19,21 @@ var t = async_test("lineTo() with Infinity/NaN is ignored"); _addTest(function(canvas, ctx) { -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.lineTo(Infinity, 50); -ctx.lineTo(-Infinity, 50); -ctx.lineTo(NaN, 50); -ctx.lineTo(0, Infinity); -ctx.lineTo(0, -Infinity); -ctx.lineTo(0, NaN); -ctx.lineTo(Infinity, Infinity); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); - + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.lineTo(Infinity, 50); + ctx.lineTo(-Infinity, 50); + ctx.lineTo(NaN, 50); + ctx.lineTo(0, Infinity); + ctx.lineTo(0, -Infinity); + ctx.lineTo(0, NaN); + ctx.lineTo(Infinity, Infinity); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.moveTo.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.moveTo.basic.html index 3ab41dc0399..d08d67621eb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.moveTo.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.moveTo.basic.html @@ -19,17 +19,16 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.rect(0, 0, 10, 50); -ctx.moveTo(100, 0); -ctx.lineTo(10, 0); -ctx.lineTo(10, 50); -ctx.lineTo(100, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 90,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.rect(0, 0, 10, 50); + ctx.moveTo(100, 0); + ctx.lineTo(10, 0); + ctx.lineTo(10, 50); + ctx.lineTo(100, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 90,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.moveTo.multiple.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.moveTo.multiple.html index 24307b4e9ed..384d9fb437e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.moveTo.multiple.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.moveTo.multiple.html @@ -19,17 +19,16 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.moveTo(0, 25); -ctx.moveTo(100, 25); -ctx.moveTo(0, 25); -ctx.lineTo(100, 25); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.moveTo(0, 25); + ctx.moveTo(100, 25); + ctx.moveTo(0, 25); + ctx.lineTo(100, 25); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.moveTo.newsubpath.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.moveTo.newsubpath.html index 456b7538ace..2a3d69b6375 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.moveTo.newsubpath.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.moveTo.newsubpath.html @@ -19,17 +19,16 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.moveTo(0, 0); -ctx.moveTo(100, 0); -ctx.moveTo(100, 50); -ctx.moveTo(0, 50); -ctx.fillStyle = '#f00'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.moveTo(0, 0); + ctx.moveTo(100, 0); + ctx.moveTo(100, 50); + ctx.moveTo(0, 50); + ctx.fillStyle = '#f00'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.moveTo.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.moveTo.nonfinite.html index 4f61d9e58b9..c6cd6f81786 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.moveTo.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.moveTo.nonfinite.html @@ -19,21 +19,20 @@ var t = async_test("moveTo() with Infinity/NaN is ignored"); _addTest(function(canvas, ctx) { -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.moveTo(Infinity, 50); -ctx.moveTo(-Infinity, 50); -ctx.moveTo(NaN, 50); -ctx.moveTo(0, Infinity); -ctx.moveTo(0, -Infinity); -ctx.moveTo(0, NaN); -ctx.moveTo(Infinity, Infinity); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.moveTo(Infinity, 50); + ctx.moveTo(-Infinity, 50); + ctx.moveTo(NaN, 50); + ctx.moveTo(0, Infinity); + ctx.moveTo(0, -Infinity); + ctx.moveTo(0, NaN); + ctx.moveTo(Infinity, Infinity); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.basic.html index 1c2da33f967..ffbf039440f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.basic.html @@ -19,16 +19,15 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.quadraticCurveTo(100, 25, 100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.quadraticCurveTo(100, 25, 100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.html index 6c75732daca..f8b8b515bab 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.html @@ -19,16 +19,15 @@ var t = async_test("If there is no subpath, the first control point is added (and nothing is drawn up to it)"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.quadraticCurveTo(100, 50, 200, 50); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 95,45, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.quadraticCurveTo(100, 50, 200, 50); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 95,45, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.html index 8da6964cc2f..189c744c659 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.html @@ -19,16 +19,15 @@ var t = async_test("If there is no subpath, the first control point is added"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.quadraticCurveTo(0, 25, 100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 5,45, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.quadraticCurveTo(0, 25, 100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 5,45, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.nonfinite.html index 4bc7107fca2..1488e78a00a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.nonfinite.html @@ -19,38 +19,37 @@ var t = async_test("quadraticCurveTo() with Infinity/NaN is ignored"); _addTest(function(canvas, ctx) { -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.quadraticCurveTo(Infinity, 50, 0, 50); -ctx.quadraticCurveTo(-Infinity, 50, 0, 50); -ctx.quadraticCurveTo(NaN, 50, 0, 50); -ctx.quadraticCurveTo(0, Infinity, 0, 50); -ctx.quadraticCurveTo(0, -Infinity, 0, 50); -ctx.quadraticCurveTo(0, NaN, 0, 50); -ctx.quadraticCurveTo(0, 50, Infinity, 50); -ctx.quadraticCurveTo(0, 50, -Infinity, 50); -ctx.quadraticCurveTo(0, 50, NaN, 50); -ctx.quadraticCurveTo(0, 50, 0, Infinity); -ctx.quadraticCurveTo(0, 50, 0, -Infinity); -ctx.quadraticCurveTo(0, 50, 0, NaN); -ctx.quadraticCurveTo(Infinity, Infinity, 0, 50); -ctx.quadraticCurveTo(Infinity, Infinity, Infinity, 50); -ctx.quadraticCurveTo(Infinity, Infinity, Infinity, Infinity); -ctx.quadraticCurveTo(Infinity, Infinity, 0, Infinity); -ctx.quadraticCurveTo(Infinity, 50, Infinity, 50); -ctx.quadraticCurveTo(Infinity, 50, Infinity, Infinity); -ctx.quadraticCurveTo(Infinity, 50, 0, Infinity); -ctx.quadraticCurveTo(0, Infinity, Infinity, 50); -ctx.quadraticCurveTo(0, Infinity, Infinity, Infinity); -ctx.quadraticCurveTo(0, Infinity, 0, Infinity); -ctx.quadraticCurveTo(0, 50, Infinity, Infinity); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); - + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.quadraticCurveTo(Infinity, 50, 0, 50); + ctx.quadraticCurveTo(-Infinity, 50, 0, 50); + ctx.quadraticCurveTo(NaN, 50, 0, 50); + ctx.quadraticCurveTo(0, Infinity, 0, 50); + ctx.quadraticCurveTo(0, -Infinity, 0, 50); + ctx.quadraticCurveTo(0, NaN, 0, 50); + ctx.quadraticCurveTo(0, 50, Infinity, 50); + ctx.quadraticCurveTo(0, 50, -Infinity, 50); + ctx.quadraticCurveTo(0, 50, NaN, 50); + ctx.quadraticCurveTo(0, 50, 0, Infinity); + ctx.quadraticCurveTo(0, 50, 0, -Infinity); + ctx.quadraticCurveTo(0, 50, 0, NaN); + ctx.quadraticCurveTo(Infinity, Infinity, 0, 50); + ctx.quadraticCurveTo(Infinity, Infinity, Infinity, 50); + ctx.quadraticCurveTo(Infinity, Infinity, Infinity, Infinity); + ctx.quadraticCurveTo(Infinity, Infinity, 0, Infinity); + ctx.quadraticCurveTo(Infinity, 50, Infinity, 50); + ctx.quadraticCurveTo(Infinity, 50, Infinity, Infinity); + ctx.quadraticCurveTo(Infinity, 50, 0, Infinity); + ctx.quadraticCurveTo(0, Infinity, Infinity, 50); + ctx.quadraticCurveTo(0, Infinity, Infinity, Infinity); + ctx.quadraticCurveTo(0, Infinity, 0, Infinity); + ctx.quadraticCurveTo(0, 50, Infinity, Infinity); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.scaled.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.scaled.html index 4b6ffaa741b..90973a8f977 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.scaled.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.scaled.html @@ -19,21 +19,20 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.scale(1000, 1000); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 0.055; -ctx.beginPath(); -ctx.moveTo(-1, 1.05); -ctx.quadraticCurveTo(0, -1, 1.2, 1.05); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(1000, 1000); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 0.055; + ctx.beginPath(); + ctx.moveTo(-1, 1.05); + ctx.quadraticCurveTo(0, -1, 1.2, 1.05); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.shape.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.shape.html index 58d35dc22f2..23725c24210 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.shape.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.quadraticCurveTo.shape.html @@ -19,20 +19,19 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 55; -ctx.beginPath(); -ctx.moveTo(-1000, 1050); -ctx.quadraticCurveTo(0, -1000, 1200, 1050); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 55; + ctx.beginPath(); + ctx.moveTo(-1000, 1050); + ctx.quadraticCurveTo(0, -1000, 1200, 1050); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.basic.html index 296800decd5..716cd29af70 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.basic.html @@ -19,13 +19,12 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.rect(0, 0, 100, 50); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.rect(0, 0, 100, 50); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.closed.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.closed.html index 60a237770fa..385a88ab7ef 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.closed.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.closed.html @@ -19,15 +19,14 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 200; -ctx.lineJoin = 'miter'; -ctx.rect(100, 50, 100, 100); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 200; + ctx.lineJoin = 'miter'; + ctx.rect(100, 50, 100, 100); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.end.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.end.1.html index 6f3338b8411..e1fd8052d8d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.end.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.end.1.html @@ -19,15 +19,14 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.rect(200, 100, 400, 1000); -ctx.lineTo(-2000, -1000); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.rect(200, 100, 400, 1000); + ctx.lineTo(-2000, -1000); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.end.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.end.2.html index e5a1776dd64..d30bb111f12 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.end.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.end.2.html @@ -19,20 +19,19 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 450; -ctx.lineCap = 'round'; -ctx.lineJoin = 'bevel'; -ctx.rect(150, 150, 2000, 2000); -ctx.lineTo(160, 160); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 450; + ctx.lineCap = 'round'; + ctx.lineJoin = 'bevel'; + ctx.rect(150, 150, 2000, 2000); + ctx.lineTo(160, 160); + ctx.stroke(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.negative.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.negative.html index e7e51371e16..b917137baea 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.negative.html @@ -19,20 +19,19 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.fillStyle = '#0f0'; -ctx.rect(0, 0, 50, 25); -ctx.rect(100, 0, -50, 25); -ctx.rect(0, 50, 50, -25); -ctx.rect(100, 50, -50, -25); -ctx.fill(); -_assertPixel(canvas, 25,12, 0,255,0,255); -_assertPixel(canvas, 75,12, 0,255,0,255); -_assertPixel(canvas, 25,37, 0,255,0,255); -_assertPixel(canvas, 75,37, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.fillStyle = '#0f0'; + ctx.rect(0, 0, 50, 25); + ctx.rect(100, 0, -50, 25); + ctx.rect(0, 50, 50, -25); + ctx.rect(100, 50, -50, -25); + ctx.fill(); + _assertPixel(canvas, 25,12, 0,255,0,255); + _assertPixel(canvas, 75,12, 0,255,0,255); + _assertPixel(canvas, 25,37, 0,255,0,255); + _assertPixel(canvas, 75,37, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.newsubpath.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.newsubpath.html index e2c5a4cff83..32b70ff2d8e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.newsubpath.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.newsubpath.html @@ -19,17 +19,16 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.moveTo(-100, 25); -ctx.lineTo(-50, 25); -ctx.rect(200, 25, 1, 1); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.moveTo(-100, 25); + ctx.lineTo(-50, 25); + ctx.rect(200, 25, 1, 1); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.nonfinite.html index b8517e8fa4d..c0d245a49c8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.nonfinite.html @@ -19,38 +19,37 @@ var t = async_test("rect() with Infinity/NaN is ignored"); _addTest(function(canvas, ctx) { -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.rect(Infinity, 50, 1, 1); -ctx.rect(-Infinity, 50, 1, 1); -ctx.rect(NaN, 50, 1, 1); -ctx.rect(0, Infinity, 1, 1); -ctx.rect(0, -Infinity, 1, 1); -ctx.rect(0, NaN, 1, 1); -ctx.rect(0, 50, Infinity, 1); -ctx.rect(0, 50, -Infinity, 1); -ctx.rect(0, 50, NaN, 1); -ctx.rect(0, 50, 1, Infinity); -ctx.rect(0, 50, 1, -Infinity); -ctx.rect(0, 50, 1, NaN); -ctx.rect(Infinity, Infinity, 1, 1); -ctx.rect(Infinity, Infinity, Infinity, 1); -ctx.rect(Infinity, Infinity, Infinity, Infinity); -ctx.rect(Infinity, Infinity, 1, Infinity); -ctx.rect(Infinity, 50, Infinity, 1); -ctx.rect(Infinity, 50, Infinity, Infinity); -ctx.rect(Infinity, 50, 1, Infinity); -ctx.rect(0, Infinity, Infinity, 1); -ctx.rect(0, Infinity, Infinity, Infinity); -ctx.rect(0, Infinity, 1, Infinity); -ctx.rect(0, 50, Infinity, Infinity); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); - + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.rect(Infinity, 50, 1, 1); + ctx.rect(-Infinity, 50, 1, 1); + ctx.rect(NaN, 50, 1, 1); + ctx.rect(0, Infinity, 1, 1); + ctx.rect(0, -Infinity, 1, 1); + ctx.rect(0, NaN, 1, 1); + ctx.rect(0, 50, Infinity, 1); + ctx.rect(0, 50, -Infinity, 1); + ctx.rect(0, 50, NaN, 1); + ctx.rect(0, 50, 1, Infinity); + ctx.rect(0, 50, 1, -Infinity); + ctx.rect(0, 50, 1, NaN); + ctx.rect(Infinity, Infinity, 1, 1); + ctx.rect(Infinity, Infinity, Infinity, 1); + ctx.rect(Infinity, Infinity, Infinity, Infinity); + ctx.rect(Infinity, Infinity, 1, Infinity); + ctx.rect(Infinity, 50, Infinity, 1); + ctx.rect(Infinity, 50, Infinity, Infinity); + ctx.rect(Infinity, 50, 1, Infinity); + ctx.rect(0, Infinity, Infinity, 1); + ctx.rect(0, Infinity, Infinity, Infinity); + ctx.rect(0, Infinity, 1, Infinity); + ctx.rect(0, 50, Infinity, Infinity); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.selfintersect.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.selfintersect.html index e7c73dfaffb..8ebbf0c1f5b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.selfintersect.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.selfintersect.html @@ -19,15 +19,14 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 90; -ctx.beginPath(); -ctx.rect(45, 20, 10, 10); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 90; + ctx.beginPath(); + ctx.rect(45, 20, 10, 10); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.winding.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.winding.html index c9547fe32aa..d7350ef38c7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.winding.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.winding.html @@ -19,20 +19,19 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.fillStyle = '#f00'; -ctx.rect(0, 0, 50, 50); -ctx.rect(100, 50, -50, -50); -ctx.rect(0, 25, 100, -25); -ctx.rect(100, 25, -100, 25); -ctx.fill(); -_assertPixel(canvas, 25,12, 0,255,0,255); -_assertPixel(canvas, 75,12, 0,255,0,255); -_assertPixel(canvas, 25,37, 0,255,0,255); -_assertPixel(canvas, 75,37, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.fillStyle = '#f00'; + ctx.rect(0, 0, 50, 50); + ctx.rect(100, 50, -50, -50); + ctx.rect(0, 25, 100, -25); + ctx.rect(100, 25, -100, 25); + ctx.fill(); + _assertPixel(canvas, 25,12, 0,255,0,255); + _assertPixel(canvas, 75,12, 0,255,0,255); + _assertPixel(canvas, 25,37, 0,255,0,255); + _assertPixel(canvas, 75,37, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.1.html index 9a210e74414..c773ef61d05 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.1.html @@ -19,15 +19,14 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.rect(0, 50, 100, 0); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.rect(0, 50, 100, 0); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.2.html index 0e3a7c87d66..5888231fc6d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.2.html @@ -19,15 +19,14 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.rect(50, -100, 0, 250); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.rect(50, -100, 0, 250); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.3.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.3.html index e92b121f312..c000b008fb8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.3.html @@ -19,15 +19,14 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.rect(50, 25, 0, 0); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.rect(50, 25, 0, 0); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.4.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.4.html index 086ef94f292..bb3ecb3aa56 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.4.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.4.html @@ -19,15 +19,14 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.rect(100, 25, 0, 0); -ctx.lineTo(0, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.rect(100, 25, 0, 0); + ctx.lineTo(0, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.5.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.5.html index 880cab56140..081c753d919 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.5.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.5.html @@ -19,15 +19,14 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.moveTo(0, 0); -ctx.rect(100, 25, 0, 0); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.moveTo(0, 0); + ctx.rect(100, 25, 0, 0); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.6.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.6.html index 34c9d15cfed..dafb273d562 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.6.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.rect.zero.6.html @@ -19,17 +19,16 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineJoin = 'miter'; -ctx.miterLimit = 1.5; -ctx.lineWidth = 200; -ctx.beginPath(); -ctx.rect(100, 25, 1000, 0); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineJoin = 'miter'; + ctx.miterLimit = 1.5; + ctx.lineWidth = 200; + ctx.beginPath(); + ctx.rect(100, 25, 1000, 0); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.dompoint.html index bdcf60d44cc..3bb890ae969 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.dompoint.html @@ -19,36 +19,35 @@ var t = async_test("Verify that when one radius is given to roundRect(), specified as a DOMPoint, it applies to all corners."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20)]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20)]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.dompoint.single argument.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.dompoint.single argument.html index 6e13276c987..96e933870ba 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.dompoint.single argument.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.dompoint.single argument.html @@ -19,36 +19,35 @@ var t = async_test("Verify that when one radius is given to roundRect() as a non-array argument, specified as a DOMPoint, it applies to all corners."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, new DOMPoint(40, 20)); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, new DOMPoint(40, 20)); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.dompointinit.html index 6186d98eafa..1315233d79b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.dompointinit.html @@ -19,36 +19,35 @@ var t = async_test("Verify that when one radius is given to roundRect(), specified as a DOMPointInit, applies to all corners."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.dompointinit.single.argument.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.dompointinit.single.argument.html index 7bf91ffe35c..f5c6d009591 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.dompointinit.single.argument.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.dompointinit.single.argument.html @@ -19,36 +19,35 @@ var t = async_test("Verify that when one radius is given to roundRect() as a non-array argument, specified as a DOMPointInit, applies to all corners."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, {x: 40, y: 20}); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, {x: 40, y: 20}); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.double.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.double.html index 250bf7d6ab5..402631a7a00 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.double.html @@ -19,16 +19,15 @@ var t = async_test("Verify that when one radius is given to roundRect(), specified as a double, it applies to all corners."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [20]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [20]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.double.single.argument.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.double.single.argument.html index e5e953de74b..ed4887c2deb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.double.single.argument.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.1.radius.double.single.argument.html @@ -19,16 +19,15 @@ var t = async_test("Verify that when one radius is given to roundRect() as a non-array argument, specified as a double, it applies to all corners."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, 20); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, 20); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.1.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.1.dompoint.html index 699603b4fdb..00a9c145824 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.1.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.1.dompoint.html @@ -19,28 +19,27 @@ var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottom-right corners."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.1.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.1.dompointinit.html index 55c06ca2ebb..e9b3a7bf798 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.1.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.1.dompointinit.html @@ -19,28 +19,27 @@ var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPointInit, applies to the top-left and bottom-right corners."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.1.double.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.1.double.html index 1d38197baff..a2f02104e27 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.1.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.1.double.html @@ -19,16 +19,15 @@ var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a double, applies to the top-left and bottom-right corners."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [20, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [20, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.2.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.2.dompoint.html index 701109d4f2e..57df30d5ae0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.2.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.2.dompoint.html @@ -19,28 +19,27 @@ var t = async_test("Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottom-left corners."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20)]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20)]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.2.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.2.dompointinit.html index 409d5014c31..5942ab750fe 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.2.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.2.dompointinit.html @@ -19,28 +19,27 @@ var t = async_test("Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPointInit, applies to the top-right and bottom-left corners."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.2.double.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.2.double.html index a0c458f006d..2390a61dfd8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.2.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.2.radii.2.double.html @@ -19,16 +19,15 @@ var t = async_test("Verify that when two radii are given to roundRect(), the second radius, specified as a double, applies to the top-right and bottom-left corners."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 20]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 20]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.1.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.1.dompoint.html index ac4a3ddd894..f4fa76afac3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.1.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.1.dompoint.html @@ -19,23 +19,22 @@ var t = async_test("Verify that when three radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left corner."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// other corners -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // other corners + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.1.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.1.dompointinit.html index bdfba5df419..4e7dc947f43 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.1.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.1.dompointinit.html @@ -19,23 +19,22 @@ var t = async_test("Verify that when three radii are given to roundRect(), the first radius, specified as a DOMPointInit, applies to the top-left corner."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// other corners -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // other corners + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.1.double.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.1.double.html index 3e8931e7fc0..d7888da6d9a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.1.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.1.double.html @@ -19,16 +19,15 @@ var t = async_test("Verify that when three radii are given to roundRect(), the first radius, specified as a double, applies to the top-left corner."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [20, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [20, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.2.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.2.dompoint.html index 7546120a699..38a8baac539 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.2.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.2.dompoint.html @@ -19,28 +19,27 @@ var t = async_test("Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottom-left corners."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20), 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20), 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.2.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.2.dompointinit.html index d8c805c28b6..5e867caf428 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.2.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.2.dompointinit.html @@ -19,28 +19,27 @@ var t = async_test("Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottom-left corners."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.2.double.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.2.double.html index c3d722bac4e..41edff205cf 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.2.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.2.double.html @@ -19,16 +19,15 @@ var t = async_test("Verify that when three radii are given to roundRect(), the second radius, specified as a double, applies to the top-right and bottom-left corners."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 20, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 20, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.3.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.3.dompoint.html index 1d61ce57059..6d6a1a6ae05 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.3.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.3.dompoint.html @@ -19,23 +19,22 @@ var t = async_test("Verify that when three radii are given to roundRect(), the third radius, specified as a DOMPoint, applies to the bottom-right corner."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, new DOMPoint(40, 20)]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, new DOMPoint(40, 20)]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.3.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.3.dompointinit.html index f1714a84e32..132420e3432 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.3.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.3.dompointinit.html @@ -19,23 +19,22 @@ var t = async_test("Verify that when three radii are given to roundRect(), the third radius, specified as a DOMPointInit, applies to the bottom-right corner."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, {x: 40, y: 20}]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, {x: 40, y: 20}]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.3.double.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.3.double.html index f3f5721a729..75a8e924ff4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.3.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.3.radii.3.double.html @@ -19,16 +19,15 @@ var t = async_test("Verify that when three radii are given to roundRect(), the third radius, specified as a double, applies to the bottom-right corner."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, 20]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, 20]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.1.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.1.dompoint.html index 4ecff46aeec..b681b59f4e2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.1.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.1.dompoint.html @@ -19,23 +19,22 @@ var t = async_test("Verify that when four radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left corner."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// other corners -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // other corners + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.1.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.1.dompointinit.html index e5b1feed32f..e5542894b36 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.1.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.1.dompointinit.html @@ -19,23 +19,22 @@ var t = async_test("Verify that when four radii are given to roundRect(), the first radius, specified as a DOMPointInit, applies to the top-left corner."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// other corners -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // other corners + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.1.double.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.1.double.html index 7c22f2457cb..028effa82b1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.1.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.1.double.html @@ -19,16 +19,15 @@ var t = async_test("Verify that when four radii are given to roundRect(), the first radius, specified as a double, applies to the top-left corner."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [20, 0, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [20, 0, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.2.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.2.dompoint.html index f897a721cf7..d3c16eb4936 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.2.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.2.dompoint.html @@ -19,23 +19,22 @@ var t = async_test("Verify that when four radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right corner."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20), 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20), 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.2.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.2.dompointinit.html index 826befa02a5..ab5ad3f4da9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.2.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.2.dompointinit.html @@ -19,23 +19,22 @@ var t = async_test("Verify that when four radii are given to roundRect(), the second radius, specified as a DOMPointInit, applies to the top-right corner."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.2.double.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.2.double.html index a0db8fa25e3..ec229e396a8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.2.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.2.double.html @@ -19,16 +19,15 @@ var t = async_test("Verify that when four radii are given to roundRect(), the second radius, specified as a double, applies to the top-right corner."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 20, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 20, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.3.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.3.dompoint.html index ac4f0795c68..5367543fa3d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.3.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.3.dompoint.html @@ -19,23 +19,22 @@ var t = async_test("Verify that when four radii are given to roundRect(), the third radius, specified as a DOMPoint, applies to the bottom-right corner."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, new DOMPoint(40, 20), 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, new DOMPoint(40, 20), 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.3.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.3.dompointinit.html index b902fb9fce2..89df524d53a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.3.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.3.dompointinit.html @@ -19,23 +19,22 @@ var t = async_test("Verify that when four radii are given to roundRect(), the third radius, specified as a DOMPointInit, applies to the bottom-right corner."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, {x: 40, y: 20}, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, {x: 40, y: 20}, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.3.double.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.3.double.html index d69e2da221d..22ba747b377 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.3.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.3.double.html @@ -19,16 +19,15 @@ var t = async_test("Verify that when four radii are given to roundRect(), the third radius, specified as a double, applies to the bottom-right corner."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, 20, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, 20, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.4.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.4.dompoint.html index f660fdaa648..b15c2918840 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.4.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.4.dompoint.html @@ -19,23 +19,22 @@ var t = async_test("Verify that when four radii are given to roundRect(), the fourth radius, specified as a DOMPoint, applies to the bottom-left corner."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, 0, new DOMPoint(40, 20)]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, 0, new DOMPoint(40, 20)]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.4.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.4.dompointinit.html index 0764d3e0014..d9b03a1225b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.4.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.4.dompointinit.html @@ -19,23 +19,22 @@ var t = async_test("Verify that when four radii are given to roundRect(), the fourth radius, specified as a DOMPointInit, applies to the bottom-left corner."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, 0, {x: 40, y: 20}]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, 0, {x: 40, y: 20}]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.4.double.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.4.double.html index 7a2cd952e60..62ccf859582 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.4.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.4.radii.4.double.html @@ -19,16 +19,15 @@ var t = async_test("Verify that when four radii are given to roundRect(), the fourth radius, specified as a double, applies to the bottom-left corner."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, 0, 20]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, 0, 20]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.badinput.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.badinput.html index d18e99b4ed1..39e1d0c6554 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.badinput.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.badinput.html @@ -19,15 +19,14 @@ var t = async_test("roundRect() throws or does not throw errors given the strange inputs."); _addTest(function(canvas, ctx) { -ctx.roundRect(0, 0, 100, 100, { foo: "bar" }); //=> DOMPointInit -ctx.roundRect(0, 0, 100, 100, undefined); //=> "missing" -> 0 -ctx.roundRect(0, 0, 100, 100, [[]]); //=> « DOMPointInit » -ctx.roundRect(0, 0, 100, 100, [[25]]); //=> « DOMPointInit » -ctx.roundRect(0, 0, 100, 100, [undefined]); //=> « DOMPointInit » -assert_throws_js(TypeError, function() { ctx.roundRect(0, 0, 100, 100, 0n); }); -assert_throws_js(TypeError, function() { ctx.roundRect(0, 0, 100, 100, { x: 0n }); }); -assert_throws_js(TypeError, function() { ctx.roundRect(0, 0, 100, 100, [{ x: 0n }]); }); - + ctx.roundRect(0, 0, 100, 100, { foo: "bar" }); //=> DOMPointInit + ctx.roundRect(0, 0, 100, 100, undefined); //=> "missing" -> 0 + ctx.roundRect(0, 0, 100, 100, [[]]); //=> « DOMPointInit » + ctx.roundRect(0, 0, 100, 100, [[25]]); //=> « DOMPointInit » + ctx.roundRect(0, 0, 100, 100, [undefined]); //=> « DOMPointInit » + assert_throws_js(TypeError, function() { ctx.roundRect(0, 0, 100, 100, 0n); }); + assert_throws_js(TypeError, function() { ctx.roundRect(0, 0, 100, 100, { x: 0n }); }); + assert_throws_js(TypeError, function() { ctx.roundRect(0, 0, 100, 100, [{ x: 0n }]); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.closed.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.closed.html index 40756e5d941..89aeb3b865c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.closed.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.closed.html @@ -19,15 +19,14 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 200; -ctx.lineJoin = 'miter'; -ctx.roundRect(100, 50, 100, 100, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 200; + ctx.lineJoin = 'miter'; + ctx.roundRect(100, 50, 100, 100, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.end.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.end.1.html index 10ab8c1fb83..be98ce5841b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.end.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.end.1.html @@ -19,15 +19,14 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.roundRect(200, 100, 400, 1000, [0]); -ctx.lineTo(-2000, -1000); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.roundRect(200, 100, 400, 1000, [0]); + ctx.lineTo(-2000, -1000); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.end.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.end.2.html index 3b95d1ca88e..16131ad345a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.end.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.end.2.html @@ -19,20 +19,19 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 450; -ctx.lineCap = 'round'; -ctx.lineJoin = 'bevel'; -ctx.roundRect(150, 150, 2000, 2000, [0]); -ctx.lineTo(160, 160); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 450; + ctx.lineCap = 'round'; + ctx.lineJoin = 'bevel'; + ctx.roundRect(150, 150, 2000, 2000, [0]); + ctx.lineTo(160, 160); + ctx.stroke(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.end.3.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.end.3.html index 48fc4988aa8..f9454080eb0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.end.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.end.3.html @@ -19,18 +19,17 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.roundRect(101, 51, 2000, 2000, [500, 500, 500, 500]); -ctx.lineTo(-1, -1); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.roundRect(101, 51, 2000, 2000, [500, 500, 500, 500]); + ctx.lineTo(-1, -1); + ctx.stroke(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.end.4.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.end.4.html index 4b70fbc344a..52d49c32e73 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.end.4.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.end.4.html @@ -19,18 +19,17 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 10; -ctx.roundRect(-1, -1, 2000, 2000, [1000, 1000, 1000, 1000]); -ctx.lineTo(-150, -150); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 10; + ctx.roundRect(-1, -1, 2000, 2000, [1000, 1000, 1000, 1000]); + ctx.lineTo(-150, -150); + ctx.stroke(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.negative.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.negative.html index 81ffe8c93e4..66e1172432a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.negative.html @@ -19,26 +19,25 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.fillStyle = '#0f0'; -ctx.roundRect(0, 0, 50, 25, [10, 0, 0, 0]); -ctx.roundRect(100, 0, -50, 25, [10, 0, 0, 0]); -ctx.roundRect(0, 50, 50, -25, [10, 0, 0, 0]); -ctx.roundRect(100, 50, -50, -25, [10, 0, 0, 0]); -ctx.fill(); -// All rects drawn -_assertPixel(canvas, 25,12, 0,255,0,255); -_assertPixel(canvas, 75,12, 0,255,0,255); -_assertPixel(canvas, 25,37, 0,255,0,255); -_assertPixel(canvas, 75,37, 0,255,0,255); -// Correct corners are rounded. -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.fillStyle = '#0f0'; + ctx.roundRect(0, 0, 50, 25, [10, 0, 0, 0]); + ctx.roundRect(100, 0, -50, 25, [10, 0, 0, 0]); + ctx.roundRect(0, 50, 50, -25, [10, 0, 0, 0]); + ctx.roundRect(100, 50, -50, -25, [10, 0, 0, 0]); + ctx.fill(); + // All rects drawn + _assertPixel(canvas, 25,12, 0,255,0,255); + _assertPixel(canvas, 75,12, 0,255,0,255); + _assertPixel(canvas, 25,37, 0,255,0,255); + _assertPixel(canvas, 75,37, 0,255,0,255); + // Correct corners are rounded. + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.newsubpath.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.newsubpath.html index 892ef6e5f19..df3990a3767 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.newsubpath.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.newsubpath.html @@ -19,17 +19,16 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.moveTo(-100, 25); -ctx.lineTo(-50, 25); -ctx.roundRect(200, 25, 1, 1, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.moveTo(-100, 25); + ctx.lineTo(-50, 25); + ctx.roundRect(200, 25, 1, 1, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.nonfinite.html index a047b73177f..5f0f0b6eafa 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.nonfinite.html @@ -19,97 +19,96 @@ var t = async_test("roundRect() with Infinity/NaN is ignored"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.roundRect(Infinity, 50, 1, 1, [0]); -ctx.roundRect(-Infinity, 50, 1, 1, [0]); -ctx.roundRect(NaN, 50, 1, 1, [0]); -ctx.roundRect(0, Infinity, 1, 1, [0]); -ctx.roundRect(0, -Infinity, 1, 1, [0]); -ctx.roundRect(0, NaN, 1, 1, [0]); -ctx.roundRect(0, 50, Infinity, 1, [0]); -ctx.roundRect(0, 50, -Infinity, 1, [0]); -ctx.roundRect(0, 50, NaN, 1, [0]); -ctx.roundRect(0, 50, 1, Infinity, [0]); -ctx.roundRect(0, 50, 1, -Infinity, [0]); -ctx.roundRect(0, 50, 1, NaN, [0]); -ctx.roundRect(0, 50, 1, 1, [Infinity]); -ctx.roundRect(0, 50, 1, 1, [-Infinity]); -ctx.roundRect(0, 50, 1, 1, [NaN]); -ctx.roundRect(0, 50, 1, 1, [Infinity,0]); -ctx.roundRect(0, 50, 1, 1, [-Infinity,0]); -ctx.roundRect(0, 50, 1, 1, [NaN,0]); -ctx.roundRect(0, 50, 1, 1, [0,Infinity]); -ctx.roundRect(0, 50, 1, 1, [0,-Infinity]); -ctx.roundRect(0, 50, 1, 1, [0,NaN]); -ctx.roundRect(0, 50, 1, 1, [Infinity,0,0]); -ctx.roundRect(0, 50, 1, 1, [-Infinity,0,0]); -ctx.roundRect(0, 50, 1, 1, [NaN,0,0]); -ctx.roundRect(0, 50, 1, 1, [0,Infinity,0]); -ctx.roundRect(0, 50, 1, 1, [0,-Infinity,0]); -ctx.roundRect(0, 50, 1, 1, [0,NaN,0]); -ctx.roundRect(0, 50, 1, 1, [0,0,Infinity]); -ctx.roundRect(0, 50, 1, 1, [0,0,-Infinity]); -ctx.roundRect(0, 50, 1, 1, [0,0,NaN]); -ctx.roundRect(0, 50, 1, 1, [Infinity,0,0,0]); -ctx.roundRect(0, 50, 1, 1, [-Infinity,0,0,0]); -ctx.roundRect(0, 50, 1, 1, [NaN,0,0,0]); -ctx.roundRect(0, 50, 1, 1, [0,Infinity,0,0]); -ctx.roundRect(0, 50, 1, 1, [0,-Infinity,0,0]); -ctx.roundRect(0, 50, 1, 1, [0,NaN,0,0]); -ctx.roundRect(0, 50, 1, 1, [0,0,Infinity,0]); -ctx.roundRect(0, 50, 1, 1, [0,0,-Infinity,0]); -ctx.roundRect(0, 50, 1, 1, [0,0,NaN,0]); -ctx.roundRect(0, 50, 1, 1, [0,0,0,Infinity]); -ctx.roundRect(0, 50, 1, 1, [0,0,0,-Infinity]); -ctx.roundRect(0, 50, 1, 1, [0,0,0,NaN]); -ctx.roundRect(Infinity, Infinity, 1, 1, [0]); -ctx.roundRect(Infinity, Infinity, Infinity, 1, [0]); -ctx.roundRect(Infinity, Infinity, Infinity, Infinity, [0]); -ctx.roundRect(Infinity, Infinity, Infinity, Infinity, [Infinity]); -ctx.roundRect(Infinity, Infinity, Infinity, 1, [Infinity]); -ctx.roundRect(Infinity, Infinity, 1, Infinity, [0]); -ctx.roundRect(Infinity, Infinity, 1, Infinity, [Infinity]); -ctx.roundRect(Infinity, Infinity, 1, 1, [Infinity]); -ctx.roundRect(Infinity, 50, Infinity, 1, [0]); -ctx.roundRect(Infinity, 50, Infinity, Infinity, [0]); -ctx.roundRect(Infinity, 50, Infinity, Infinity, [Infinity]); -ctx.roundRect(Infinity, 50, Infinity, 1, [Infinity]); -ctx.roundRect(Infinity, 50, 1, Infinity, [0]); -ctx.roundRect(Infinity, 50, 1, Infinity, [Infinity]); -ctx.roundRect(Infinity, 50, 1, 1, [Infinity]); -ctx.roundRect(0, Infinity, Infinity, 1, [0]); -ctx.roundRect(0, Infinity, Infinity, Infinity, [0]); -ctx.roundRect(0, Infinity, Infinity, Infinity, [Infinity]); -ctx.roundRect(0, Infinity, Infinity, 1, [Infinity]); -ctx.roundRect(0, Infinity, 1, Infinity, [0]); -ctx.roundRect(0, Infinity, 1, Infinity, [Infinity]); -ctx.roundRect(0, Infinity, 1, 1, [Infinity]); -ctx.roundRect(0, 50, Infinity, Infinity, [0]); -ctx.roundRect(0, 50, Infinity, Infinity, [Infinity]); -ctx.roundRect(0, 50, Infinity, 1, [Infinity]); -ctx.roundRect(0, 50, 1, Infinity, [Infinity]); -ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, Infinity)]); -ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, -Infinity)]); -ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, NaN)]); -ctx.roundRect(0, 0, 100, 100, [new DOMPoint(Infinity, 10)]); -ctx.roundRect(0, 0, 100, 100, [new DOMPoint(-Infinity, 10)]); -ctx.roundRect(0, 0, 100, 100, [new DOMPoint(NaN, 10)]); -ctx.roundRect(0, 0, 100, 100, [{x: 10, y: Infinity}]); -ctx.roundRect(0, 0, 100, 100, [{x: 10, y: -Infinity}]); -ctx.roundRect(0, 0, 100, 100, [{x: 10, y: NaN}]); -ctx.roundRect(0, 0, 100, 100, [{x: Infinity, y: 10}]); -ctx.roundRect(0, 0, 100, 100, [{x: -Infinity, y: 10}]); -ctx.roundRect(0, 0, 100, 100, [{x: NaN, y: 10}]); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.roundRect(Infinity, 50, 1, 1, [0]); + ctx.roundRect(-Infinity, 50, 1, 1, [0]); + ctx.roundRect(NaN, 50, 1, 1, [0]); + ctx.roundRect(0, Infinity, 1, 1, [0]); + ctx.roundRect(0, -Infinity, 1, 1, [0]); + ctx.roundRect(0, NaN, 1, 1, [0]); + ctx.roundRect(0, 50, Infinity, 1, [0]); + ctx.roundRect(0, 50, -Infinity, 1, [0]); + ctx.roundRect(0, 50, NaN, 1, [0]); + ctx.roundRect(0, 50, 1, Infinity, [0]); + ctx.roundRect(0, 50, 1, -Infinity, [0]); + ctx.roundRect(0, 50, 1, NaN, [0]); + ctx.roundRect(0, 50, 1, 1, [Infinity]); + ctx.roundRect(0, 50, 1, 1, [-Infinity]); + ctx.roundRect(0, 50, 1, 1, [NaN]); + ctx.roundRect(0, 50, 1, 1, [Infinity,0]); + ctx.roundRect(0, 50, 1, 1, [-Infinity,0]); + ctx.roundRect(0, 50, 1, 1, [NaN,0]); + ctx.roundRect(0, 50, 1, 1, [0,Infinity]); + ctx.roundRect(0, 50, 1, 1, [0,-Infinity]); + ctx.roundRect(0, 50, 1, 1, [0,NaN]); + ctx.roundRect(0, 50, 1, 1, [Infinity,0,0]); + ctx.roundRect(0, 50, 1, 1, [-Infinity,0,0]); + ctx.roundRect(0, 50, 1, 1, [NaN,0,0]); + ctx.roundRect(0, 50, 1, 1, [0,Infinity,0]); + ctx.roundRect(0, 50, 1, 1, [0,-Infinity,0]); + ctx.roundRect(0, 50, 1, 1, [0,NaN,0]); + ctx.roundRect(0, 50, 1, 1, [0,0,Infinity]); + ctx.roundRect(0, 50, 1, 1, [0,0,-Infinity]); + ctx.roundRect(0, 50, 1, 1, [0,0,NaN]); + ctx.roundRect(0, 50, 1, 1, [Infinity,0,0,0]); + ctx.roundRect(0, 50, 1, 1, [-Infinity,0,0,0]); + ctx.roundRect(0, 50, 1, 1, [NaN,0,0,0]); + ctx.roundRect(0, 50, 1, 1, [0,Infinity,0,0]); + ctx.roundRect(0, 50, 1, 1, [0,-Infinity,0,0]); + ctx.roundRect(0, 50, 1, 1, [0,NaN,0,0]); + ctx.roundRect(0, 50, 1, 1, [0,0,Infinity,0]); + ctx.roundRect(0, 50, 1, 1, [0,0,-Infinity,0]); + ctx.roundRect(0, 50, 1, 1, [0,0,NaN,0]); + ctx.roundRect(0, 50, 1, 1, [0,0,0,Infinity]); + ctx.roundRect(0, 50, 1, 1, [0,0,0,-Infinity]); + ctx.roundRect(0, 50, 1, 1, [0,0,0,NaN]); + ctx.roundRect(Infinity, Infinity, 1, 1, [0]); + ctx.roundRect(Infinity, Infinity, Infinity, 1, [0]); + ctx.roundRect(Infinity, Infinity, Infinity, Infinity, [0]); + ctx.roundRect(Infinity, Infinity, Infinity, Infinity, [Infinity]); + ctx.roundRect(Infinity, Infinity, Infinity, 1, [Infinity]); + ctx.roundRect(Infinity, Infinity, 1, Infinity, [0]); + ctx.roundRect(Infinity, Infinity, 1, Infinity, [Infinity]); + ctx.roundRect(Infinity, Infinity, 1, 1, [Infinity]); + ctx.roundRect(Infinity, 50, Infinity, 1, [0]); + ctx.roundRect(Infinity, 50, Infinity, Infinity, [0]); + ctx.roundRect(Infinity, 50, Infinity, Infinity, [Infinity]); + ctx.roundRect(Infinity, 50, Infinity, 1, [Infinity]); + ctx.roundRect(Infinity, 50, 1, Infinity, [0]); + ctx.roundRect(Infinity, 50, 1, Infinity, [Infinity]); + ctx.roundRect(Infinity, 50, 1, 1, [Infinity]); + ctx.roundRect(0, Infinity, Infinity, 1, [0]); + ctx.roundRect(0, Infinity, Infinity, Infinity, [0]); + ctx.roundRect(0, Infinity, Infinity, Infinity, [Infinity]); + ctx.roundRect(0, Infinity, Infinity, 1, [Infinity]); + ctx.roundRect(0, Infinity, 1, Infinity, [0]); + ctx.roundRect(0, Infinity, 1, Infinity, [Infinity]); + ctx.roundRect(0, Infinity, 1, 1, [Infinity]); + ctx.roundRect(0, 50, Infinity, Infinity, [0]); + ctx.roundRect(0, 50, Infinity, Infinity, [Infinity]); + ctx.roundRect(0, 50, Infinity, 1, [Infinity]); + ctx.roundRect(0, 50, 1, Infinity, [Infinity]); + ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, Infinity)]); + ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, -Infinity)]); + ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, NaN)]); + ctx.roundRect(0, 0, 100, 100, [new DOMPoint(Infinity, 10)]); + ctx.roundRect(0, 0, 100, 100, [new DOMPoint(-Infinity, 10)]); + ctx.roundRect(0, 0, 100, 100, [new DOMPoint(NaN, 10)]); + ctx.roundRect(0, 0, 100, 100, [{x: 10, y: Infinity}]); + ctx.roundRect(0, 0, 100, 100, [{x: 10, y: -Infinity}]); + ctx.roundRect(0, 0, 100, 100, [{x: 10, y: NaN}]); + ctx.roundRect(0, 0, 100, 100, [{x: Infinity, y: 10}]); + ctx.roundRect(0, 0, 100, 100, [{x: -Infinity, y: 10}]); + ctx.roundRect(0, 0, 100, 100, [{x: NaN, y: 10}]); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.intersecting.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.intersecting.1.html index e7675ba35c3..913b17e45e9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.intersecting.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.intersecting.1.html @@ -19,21 +19,20 @@ var t = async_test("Check that roundRects with intersecting corner arcs are rendered correctly."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [40, 40, 40, 40]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 2,25, 0,255,0,255); -_assertPixel(canvas, 50,1, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 50,48, 0,255,0,255); -_assertPixel(canvas, 97,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [40, 40, 40, 40]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 2,25, 0,255,0,255); + _assertPixel(canvas, 50,1, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 50,48, 0,255,0,255); + _assertPixel(canvas, 97,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.intersecting.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.intersecting.2.html index 48140ca60ed..abd7f860880 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.intersecting.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.intersecting.2.html @@ -19,21 +19,20 @@ var t = async_test("Check that roundRects with intersecting corner arcs are rendered correctly."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [1000, 1000, 1000, 1000]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 2,25, 0,255,0,255); -_assertPixel(canvas, 50,1, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 50,48, 0,255,0,255); -_assertPixel(canvas, 97,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [1000, 1000, 1000, 1000]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 2,25, 0,255,0,255); + _assertPixel(canvas, 50,1, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 50,48, 0,255,0,255); + _assertPixel(canvas, 97,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.negative.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.negative.html index c7c0bda6ff7..ac2532dcfeb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.negative.html @@ -19,13 +19,12 @@ var t = async_test("roundRect() with negative radius throws an exception"); _addTest(function(canvas, ctx) { -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [-1])}); -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [1, -1])}); -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [new DOMPoint(-1, 1), 1])}); -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [new DOMPoint(1, -1)])}); -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [{x: -1, y: 1}, 1])}); -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [{x: 1, y: -1}])}); - + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [-1])}); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [1, -1])}); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [new DOMPoint(-1, 1), 1])}); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [new DOMPoint(1, -1)])}); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [{x: -1, y: 1}, 1])}); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [{x: 1, y: -1}])}); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.noargument.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.noargument.html index e45b20b7a07..cfaf87ecf22 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.noargument.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.noargument.html @@ -19,31 +19,30 @@ var t = async_test("Check that roundRect draws a rectangle when no radii are provided."); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(10, 10, 80, 30); -ctx.fillStyle = '#0f0'; -ctx.fill(); -// upper left corner (10, 10) -_assertPixel(canvas, 10,9, 255,0,0,255); -_assertPixel(canvas, 9,10, 255,0,0,255); -_assertPixel(canvas, 10,10, 0,255,0,255); - -// upper right corner (89, 10) -_assertPixel(canvas, 90,10, 255,0,0,255); -_assertPixel(canvas, 89,9, 255,0,0,255); -_assertPixel(canvas, 89,10, 0,255,0,255); - -// lower right corner (89, 39) -_assertPixel(canvas, 89,40, 255,0,0,255); -_assertPixel(canvas, 90,39, 255,0,0,255); -_assertPixel(canvas, 89,39, 0,255,0,255); - -// lower left corner (10, 30) -_assertPixel(canvas, 9,39, 255,0,0,255); -_assertPixel(canvas, 10,40, 255,0,0,255); -_assertPixel(canvas, 10,39, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(10, 10, 80, 30); + ctx.fillStyle = '#0f0'; + ctx.fill(); + // upper left corner (10, 10) + _assertPixel(canvas, 10,9, 255,0,0,255); + _assertPixel(canvas, 9,10, 255,0,0,255); + _assertPixel(canvas, 10,10, 0,255,0,255); + + // upper right corner (89, 10) + _assertPixel(canvas, 90,10, 255,0,0,255); + _assertPixel(canvas, 89,9, 255,0,0,255); + _assertPixel(canvas, 89,10, 0,255,0,255); + + // lower right corner (89, 39) + _assertPixel(canvas, 89,40, 255,0,0,255); + _assertPixel(canvas, 90,39, 255,0,0,255); + _assertPixel(canvas, 89,39, 0,255,0,255); + + // lower left corner (10, 30) + _assertPixel(canvas, 9,39, 255,0,0,255); + _assertPixel(canvas, 10,40, 255,0,0,255); + _assertPixel(canvas, 10,39, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.none.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.none.html index 16a03c1fdc5..8363285ffc2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.none.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.none.html @@ -19,8 +19,7 @@ var t = async_test("Check that roundRect throws an RangeError if radii is an empty array."); _addTest(function(canvas, ctx) { -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 100, 50, [])}); - + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 100, 50, [])}); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.toomany.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.toomany.html index c6a960b0590..d8fe4bb45cc 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.toomany.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.radius.toomany.html @@ -19,8 +19,7 @@ var t = async_test("Check that roundRect throws an IndeSizeError if radii has more than four items."); _addTest(function(canvas, ctx) { -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 100, 50, [0, 0, 0, 0, 0])}); - + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 100, 50, [0, 0, 0, 0, 0])}); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.selfintersect.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.selfintersect.html index d644d66e7ca..7a69aaf4c60 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.selfintersect.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.selfintersect.html @@ -19,15 +19,14 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.roundRect(0, 0, 100, 50, [0]); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 90; -ctx.beginPath(); -ctx.roundRect(45, 20, 10, 10, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.roundRect(0, 0, 100, 50, [0]); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 90; + ctx.beginPath(); + ctx.roundRect(45, 20, 10, 10, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.winding.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.winding.html index 6bcad2c9642..9c1f985eb92 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.winding.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.winding.html @@ -19,20 +19,19 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.fillStyle = '#f00'; -ctx.roundRect(0, 0, 50, 50, [0]); -ctx.roundRect(100, 50, -50, -50, [0]); -ctx.roundRect(0, 25, 100, -25, [0]); -ctx.roundRect(100, 25, -100, 25, [0]); -ctx.fill(); -_assertPixel(canvas, 25,12, 0,255,0,255); -_assertPixel(canvas, 75,12, 0,255,0,255); -_assertPixel(canvas, 25,37, 0,255,0,255); -_assertPixel(canvas, 75,37, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.fillStyle = '#f00'; + ctx.roundRect(0, 0, 50, 50, [0]); + ctx.roundRect(100, 50, -50, -50, [0]); + ctx.roundRect(0, 25, 100, -25, [0]); + ctx.roundRect(100, 25, -100, 25, [0]); + ctx.fill(); + _assertPixel(canvas, 25,12, 0,255,0,255); + _assertPixel(canvas, 75,12, 0,255,0,255); + _assertPixel(canvas, 25,37, 0,255,0,255); + _assertPixel(canvas, 75,37, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.1.html index 690087f0aa0..4e9a804dc23 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.1.html @@ -19,15 +19,14 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.roundRect(0, 50, 100, 0, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.roundRect(0, 50, 100, 0, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.2.html index cfeb923299a..ac64fa7818c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.2.html @@ -19,15 +19,14 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.roundRect(50, -100, 0, 250, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.roundRect(50, -100, 0, 250, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.3.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.3.html index 39151f38c76..a807715b352 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.3.html @@ -19,15 +19,14 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.roundRect(50, 25, 0, 0, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.roundRect(50, 25, 0, 0, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.4.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.4.html index 20dccbeaa0b..fc51918c27d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.4.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.4.html @@ -19,15 +19,14 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.roundRect(100, 25, 0, 0, [0]); -ctx.lineTo(0, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.roundRect(100, 25, 0, 0, [0]); + ctx.lineTo(0, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.5.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.5.html index bcb84a59171..de7d41b68fa 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.5.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.5.html @@ -19,15 +19,14 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.moveTo(0, 0); -ctx.roundRect(100, 25, 0, 0, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.moveTo(0, 0); + ctx.roundRect(100, 25, 0, 0, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.6.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.6.html index 829503767dc..1e8e338a739 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.6.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.roundrect.zero.6.html @@ -19,17 +19,16 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineJoin = 'miter'; -ctx.miterLimit = 1.5; -ctx.lineWidth = 200; -ctx.beginPath(); -ctx.roundRect(100, 25, 1000, 0, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineJoin = 'miter'; + ctx.miterLimit = 1.5; + ctx.lineWidth = 200; + ctx.beginPath(); + ctx.roundRect(100, 25, 1000, 0, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.empty.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.empty.html index 5a2a91bd0fe..aa459ec9869 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.empty.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.empty.html @@ -19,21 +19,20 @@ var t = async_test("Empty subpaths are not stroked"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.moveTo(40, 25); -ctx.moveTo(60, 25); -ctx.stroke(); - -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.beginPath(); + ctx.moveTo(40, 25); + ctx.moveTo(60, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.overlap.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.overlap.html index c1b425d18c7..a577f227697 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.overlap.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.overlap.html @@ -19,19 +19,18 @@ var t = async_test("Stroked subpaths are combined before being drawn"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#000'; -ctx.fillRect(0, 0, 100, 50); - -ctx.strokeStyle = 'rgba(0, 255, 0, 0.5)'; -ctx.lineWidth = 50; -ctx.moveTo(0, 20); -ctx.lineTo(100, 20); -ctx.moveTo(0, 30); -ctx.lineTo(100, 30); -ctx.stroke(); - -_assertPixelApprox(canvas, 50,25, 0,127,0,255, 1); - + ctx.fillStyle = '#000'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = 'rgba(0, 255, 0, 0.5)'; + ctx.lineWidth = 50; + ctx.moveTo(0, 20); + ctx.lineTo(100, 20); + ctx.moveTo(0, 30); + ctx.lineTo(100, 30); + ctx.stroke(); + + _assertPixelApprox(canvas, 50,25, 0,127,0,255, 1); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.arc.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.arc.html index abef923f6a6..6474a15424c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.arc.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.arc.html @@ -19,26 +19,25 @@ var t = async_test("Zero-length line segments from arcTo and arc are removed before stroking"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.arcTo(50, 25, 150, 25, 10); -ctx.stroke(); + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.arcTo(50, 25, 150, 25, 10); + ctx.stroke(); -ctx.beginPath(); -ctx.moveTo(60, 25); -ctx.arc(50, 25, 10, 0, 0, false); -ctx.stroke(); - -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.beginPath(); + ctx.moveTo(60, 25); + ctx.arc(50, 25, 10, 0, 0, false); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.closed.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.closed.html index 4515669bc8e..16b46852a1b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.closed.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.closed.html @@ -19,22 +19,21 @@ var t = async_test("Zero-length line segments from closed paths are removed before stroking"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.lineTo(50, 25); -ctx.closePath(); -ctx.stroke(); - -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.lineTo(50, 25); + ctx.closePath(); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.corner.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.corner.html index 532c7465950..226fccc6d4b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.corner.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.corner.html @@ -19,24 +19,23 @@ var t = async_test("Zero-length line segments are removed before stroking with miters"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 400; -ctx.lineJoin = 'miter'; -ctx.miterLimit = 1.4; - -ctx.beginPath(); -ctx.moveTo(-1000, 200); -ctx.lineTo(-100, 200); -ctx.lineTo(-100, 200); -ctx.lineTo(-100, 200); -ctx.lineTo(-100, 1000); -ctx.stroke(); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 400; + ctx.lineJoin = 'miter'; + ctx.miterLimit = 1.4; + + ctx.beginPath(); + ctx.moveTo(-1000, 200); + ctx.lineTo(-100, 200); + ctx.lineTo(-100, 200); + ctx.lineTo(-100, 200); + ctx.lineTo(-100, 1000); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.curve.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.curve.html index 6055d8b3f4c..8023b7b3f93 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.curve.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.curve.html @@ -19,26 +19,25 @@ var t = async_test("Zero-length line segments from quadraticCurveTo and bezierCurveTo are removed before stroking"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.quadraticCurveTo(50, 25, 50, 25); -ctx.stroke(); + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.quadraticCurveTo(50, 25, 50, 25); + ctx.stroke(); -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.bezierCurveTo(50, 25, 50, 25, 50, 25); -ctx.stroke(); - -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.bezierCurveTo(50, 25, 50, 25, 50, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.line.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.line.html index 2d8dcbe4995..97f88847c0b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.line.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.line.html @@ -19,21 +19,20 @@ var t = async_test("Zero-length line segments from lineTo are removed before stroking"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.lineTo(50, 25); -ctx.stroke(); - -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.lineTo(50, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.rect.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.rect.html index 28b02ca3255..bf1fc9aa207 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.rect.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.prune.rect.html @@ -19,22 +19,21 @@ var t = async_test("Zero-length line segments from rect and strokeRect are removed before stroking"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.rect(50, 25, 0, 0); -ctx.stroke(); + ctx.beginPath(); + ctx.rect(50, 25, 0, 0); + ctx.stroke(); -ctx.strokeRect(50, 25, 0, 0); - -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.strokeRect(50, 25, 0, 0); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.scale1.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.scale1.html index 29ccc6613da..3e4651ec4a1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.scale1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.scale1.html @@ -19,35 +19,34 @@ var t = async_test("Stroke line widths are scaled by the current transformation matrix"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.beginPath(); -ctx.rect(25, 12.5, 50, 25); -ctx.save(); -ctx.scale(50, 25); -ctx.strokeStyle = '#0f0'; -ctx.stroke(); -ctx.restore(); - -ctx.beginPath(); -ctx.rect(-25, -12.5, 150, 75); -ctx.save(); -ctx.scale(50, 25); -ctx.strokeStyle = '#f00'; -ctx.stroke(); -ctx.restore(); - -_assertPixel(canvas, 0,0, 0,255,0,255); -_assertPixel(canvas, 50,0, 0,255,0,255); -_assertPixel(canvas, 99,0, 0,255,0,255); -_assertPixel(canvas, 0,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 99,25, 0,255,0,255); -_assertPixel(canvas, 0,49, 0,255,0,255); -_assertPixel(canvas, 50,49, 0,255,0,255); -_assertPixel(canvas, 99,49, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.beginPath(); + ctx.rect(25, 12.5, 50, 25); + ctx.save(); + ctx.scale(50, 25); + ctx.strokeStyle = '#0f0'; + ctx.stroke(); + ctx.restore(); + + ctx.beginPath(); + ctx.rect(-25, -12.5, 150, 75); + ctx.save(); + ctx.scale(50, 25); + ctx.strokeStyle = '#f00'; + ctx.stroke(); + ctx.restore(); + + _assertPixel(canvas, 0,0, 0,255,0,255); + _assertPixel(canvas, 50,0, 0,255,0,255); + _assertPixel(canvas, 99,0, 0,255,0,255); + _assertPixel(canvas, 0,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 99,25, 0,255,0,255); + _assertPixel(canvas, 0,49, 0,255,0,255); + _assertPixel(canvas, 50,49, 0,255,0,255); + _assertPixel(canvas, 99,49, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.scale2.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.scale2.html index bc72c5c140f..099efec76c4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.scale2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.scale2.html @@ -19,37 +19,36 @@ var t = async_test("Stroke line widths are scaled by the current transformation matrix"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.beginPath(); -ctx.rect(25, 12.5, 50, 25); -ctx.save(); -ctx.rotate(Math.PI/2); -ctx.scale(25, 50); -ctx.strokeStyle = '#0f0'; -ctx.stroke(); -ctx.restore(); - -ctx.beginPath(); -ctx.rect(-25, -12.5, 150, 75); -ctx.save(); -ctx.rotate(Math.PI/2); -ctx.scale(25, 50); -ctx.strokeStyle = '#f00'; -ctx.stroke(); -ctx.restore(); - -_assertPixel(canvas, 0,0, 0,255,0,255); -_assertPixel(canvas, 50,0, 0,255,0,255); -_assertPixel(canvas, 99,0, 0,255,0,255); -_assertPixel(canvas, 0,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 99,25, 0,255,0,255); -_assertPixel(canvas, 0,49, 0,255,0,255); -_assertPixel(canvas, 50,49, 0,255,0,255); -_assertPixel(canvas, 99,49, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.beginPath(); + ctx.rect(25, 12.5, 50, 25); + ctx.save(); + ctx.rotate(Math.PI/2); + ctx.scale(25, 50); + ctx.strokeStyle = '#0f0'; + ctx.stroke(); + ctx.restore(); + + ctx.beginPath(); + ctx.rect(-25, -12.5, 150, 75); + ctx.save(); + ctx.rotate(Math.PI/2); + ctx.scale(25, 50); + ctx.strokeStyle = '#f00'; + ctx.stroke(); + ctx.restore(); + + _assertPixel(canvas, 0,0, 0,255,0,255); + _assertPixel(canvas, 50,0, 0,255,0,255); + _assertPixel(canvas, 99,0, 0,255,0,255); + _assertPixel(canvas, 0,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 99,25, 0,255,0,255); + _assertPixel(canvas, 0,49, 0,255,0,255); + _assertPixel(canvas, 50,49, 0,255,0,255); + _assertPixel(canvas, 99,49, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.skew.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.skew.html index b902a1dc275..86f3eebf1d5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.skew.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.skew.html @@ -19,51 +19,50 @@ var t = async_test("Strokes lines are skewed by the current transformation matrix"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.save(); -ctx.beginPath(); -ctx.moveTo(49, -50); -ctx.lineTo(201, -50); -ctx.rotate(Math.PI/4); -ctx.scale(1, 283); -ctx.strokeStyle = '#0f0'; -ctx.stroke(); -ctx.restore(); + ctx.save(); + ctx.beginPath(); + ctx.moveTo(49, -50); + ctx.lineTo(201, -50); + ctx.rotate(Math.PI/4); + ctx.scale(1, 283); + ctx.strokeStyle = '#0f0'; + ctx.stroke(); + ctx.restore(); -ctx.save(); -ctx.beginPath(); -ctx.translate(-150, 0); -ctx.moveTo(49, -50); -ctx.lineTo(199, -50); -ctx.rotate(Math.PI/4); -ctx.scale(1, 142); -ctx.strokeStyle = '#f00'; -ctx.stroke(); -ctx.restore(); + ctx.save(); + ctx.beginPath(); + ctx.translate(-150, 0); + ctx.moveTo(49, -50); + ctx.lineTo(199, -50); + ctx.rotate(Math.PI/4); + ctx.scale(1, 142); + ctx.strokeStyle = '#f00'; + ctx.stroke(); + ctx.restore(); -ctx.save(); -ctx.beginPath(); -ctx.translate(-150, 0); -ctx.moveTo(49, -50); -ctx.lineTo(199, -50); -ctx.rotate(Math.PI/4); -ctx.scale(1, 142); -ctx.strokeStyle = '#f00'; -ctx.stroke(); -ctx.restore(); - -_assertPixel(canvas, 0,0, 0,255,0,255); -_assertPixel(canvas, 50,0, 0,255,0,255); -_assertPixel(canvas, 99,0, 0,255,0,255); -_assertPixel(canvas, 0,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 99,25, 0,255,0,255); -_assertPixel(canvas, 0,49, 0,255,0,255); -_assertPixel(canvas, 50,49, 0,255,0,255); -_assertPixel(canvas, 99,49, 0,255,0,255); + ctx.save(); + ctx.beginPath(); + ctx.translate(-150, 0); + ctx.moveTo(49, -50); + ctx.lineTo(199, -50); + ctx.rotate(Math.PI/4); + ctx.scale(1, 142); + ctx.strokeStyle = '#f00'; + ctx.stroke(); + ctx.restore(); + _assertPixel(canvas, 0,0, 0,255,0,255); + _assertPixel(canvas, 50,0, 0,255,0,255); + _assertPixel(canvas, 99,0, 0,255,0,255); + _assertPixel(canvas, 0,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 99,25, 0,255,0,255); + _assertPixel(canvas, 0,49, 0,255,0,255); + _assertPixel(canvas, 50,49, 0,255,0,255); + _assertPixel(canvas, 99,49, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.unaffected.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.unaffected.html index 9b05a6aa0db..8e6b41946fb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.unaffected.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.unaffected.html @@ -19,23 +19,22 @@ var t = async_test("Stroking does not start a new path or subpath"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 50; -ctx.moveTo(-100, 25); -ctx.lineTo(-100, -100); -ctx.lineTo(200, -100); -ctx.lineTo(200, 25); -ctx.strokeStyle = '#f00'; -ctx.stroke(); - -ctx.closePath(); -ctx.strokeStyle = '#0f0'; -ctx.stroke(); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 50; + ctx.moveTo(-100, 25); + ctx.lineTo(-100, -100); + ctx.lineTo(200, -100); + ctx.lineTo(200, 25); + ctx.strokeStyle = '#f00'; + ctx.stroke(); + + ctx.closePath(); + ctx.strokeStyle = '#0f0'; + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.union.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.union.html index daa8da93493..73198ab24d1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.union.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.stroke.union.html @@ -19,19 +19,18 @@ var t = async_test("Strokes in opposite directions are unioned, not subtracted"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 40; -ctx.moveTo(0, 10); -ctx.lineTo(100, 10); -ctx.moveTo(100, 40); -ctx.lineTo(0, 40); -ctx.stroke(); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 40; + ctx.moveTo(0, 10); + ctx.lineTo(100, 10); + ctx.moveTo(100, 40); + ctx.lineTo(0, 40); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.transformation.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.transformation.basic.html index d77b66a68fc..1cdc81e4f65 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.transformation.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.transformation.basic.html @@ -19,17 +19,16 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.translate(-100, 0); -ctx.rect(100, 0, 100, 50); -ctx.translate(0, -100); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.translate(-100, 0); + ctx.rect(100, 0, 100, 50); + ctx.translate(0, -100); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.transformation.changing.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.transformation.changing.html index 5f79285a81d..8f711b6b9ae 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.transformation.changing.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.transformation.changing.html @@ -19,23 +19,22 @@ var t = async_test("Transformations are applied while building paths, not when drawing"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.moveTo(0, 0); -ctx.translate(100, 0); -ctx.lineTo(0, 0); -ctx.translate(0, 50); -ctx.lineTo(0, 0); -ctx.translate(-100, 0); -ctx.lineTo(0, 0); -ctx.translate(1000, 1000); -ctx.rotate(Math.PI/2); -ctx.scale(0.1, 0.1); -ctx.fill(); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.moveTo(0, 0); + ctx.translate(100, 0); + ctx.lineTo(0, 0); + ctx.translate(0, 50); + ctx.lineTo(0, 0); + ctx.translate(-100, 0); + ctx.lineTo(0, 0); + ctx.translate(1000, 1000); + ctx.rotate(Math.PI/2); + ctx.scale(0.1, 0.1); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.transformation.multiple.html b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.transformation.multiple.html index aafa11c127b..af06c063713 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.transformation.multiple.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/path-objects/2d.path.transformation.multiple.html @@ -19,28 +19,27 @@ var t = async_test("Transformations are applied while building paths, not when drawing"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.fillStyle = '#f00'; -ctx.translate(-100, 0); -ctx.rect(0, 0, 100, 50); -ctx.fill(); -ctx.translate(100, 0); -ctx.fill(); - -ctx.beginPath(); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.translate(0, -50); -ctx.moveTo(0, 25); -ctx.lineTo(100, 25); -ctx.stroke(); -ctx.translate(0, 50); -ctx.stroke(); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#f00'; + ctx.translate(-100, 0); + ctx.rect(0, 0, 100, 50); + ctx.fill(); + ctx.translate(100, 0); + ctx.fill(); + + ctx.beginPath(); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.translate(0, -50); + ctx.moveTo(0, 25); + ctx.lineTo(100, 25); + ctx.stroke(); + ctx.translate(0, 50); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create.and.resize.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create.and.resize.html index 49d029267cf..1ecd3fbd655 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create.and.resize.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create.and.resize.html @@ -19,15 +19,14 @@ var t = async_test("Verify no crash when resizing an image bitmap to zero."); _addTest(function(canvas, ctx) { -var image = new Image(); -image.onload = t.step_func(function() { - var options = { resizeHeight: 0 }; - var p1 = createImageBitmap(image, options); - p1.catch(function(error){}); - t.done(); -}); -image.src = 'red.png'; - + var image = new Image(); + image.onload = t.step_func(function() { + var options = { resizeHeight: 0 }; + var p1 = createImageBitmap(image, options); + p1.catch(function(error){}); + t.done(); + }); + image.src = 'red.png'; }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.basic.html index aa1ca36182e..1ea73690e89 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.basic.html @@ -19,8 +19,7 @@ var t = async_test("createImageData(imgdata) exists and returns something"); _addTest(function(canvas, ctx) { -_assertDifferent(ctx.createImageData(ctx.createImageData(1, 1)), null, "ctx.createImageData(ctx.createImageData(1, 1))", "null"); - + _assertDifferent(ctx.createImageData(ctx.createImageData(1, 1)), null, "ctx.createImageData(ctx.createImageData(1, 1))", "null"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.initial.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.initial.html index 1d8ffbf0000..8709623a0c8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.initial.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.initial.html @@ -19,19 +19,18 @@ var t = async_test("createImageData(imgdata) returns transparent black data of the right size"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -var imgdata1 = ctx.getImageData(0, 0, 10, 20); -var imgdata2 = ctx.createImageData(imgdata1); -_assertSame(imgdata2.data.length, imgdata1.data.length, "imgdata2.data.length", "imgdata1.data.length"); -_assertSame(imgdata2.width, imgdata1.width, "imgdata2.width", "imgdata1.width"); -_assertSame(imgdata2.height, imgdata1.height, "imgdata2.height", "imgdata1.height"); -var isTransparentBlack = true; -for (var i = 0; i < imgdata2.data.length; ++i) - if (imgdata2.data[i] !== 0) - isTransparentBlack = false; -_assert(isTransparentBlack, "isTransparentBlack"); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + var imgdata1 = ctx.getImageData(0, 0, 10, 20); + var imgdata2 = ctx.createImageData(imgdata1); + _assertSame(imgdata2.data.length, imgdata1.data.length, "imgdata2.data.length", "imgdata1.data.length"); + _assertSame(imgdata2.width, imgdata1.width, "imgdata2.width", "imgdata1.width"); + _assertSame(imgdata2.height, imgdata1.height, "imgdata2.height", "imgdata1.height"); + var isTransparentBlack = true; + for (var i = 0; i < imgdata2.data.length; ++i) + if (imgdata2.data[i] !== 0) + isTransparentBlack = false; + _assert(isTransparentBlack, "isTransparentBlack"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.this.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.this.html index c98aab3ff44..dd4b80ec083 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.this.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.this.html @@ -19,11 +19,10 @@ var t = async_test("createImageData(imgdata) should throw when called with the wrong |this|"); _addTest(function(canvas, ctx) { -var imgdata = ctx.createImageData(1, 1); -assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call(null, imgdata); }); -assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call(undefined, imgdata); }); -assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call({}, imgdata); }); - + var imgdata = ctx.createImageData(1, 1); + assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call(null, imgdata); }); + assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call(undefined, imgdata); }); + assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call({}, imgdata); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.type.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.type.html index f339dde2364..36f3db99be3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.type.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.type.html @@ -19,14 +19,13 @@ var t = async_test("createImageData(imgdata) returns an ImageData object containing a Uint8ClampedArray object"); _addTest(function(canvas, ctx) { -_assertDifferent(window.ImageData, undefined, "window.ImageData", "undefined"); -_assertDifferent(window.Uint8ClampedArray, undefined, "window.Uint8ClampedArray", "undefined"); -window.ImageData.prototype.thisImplementsImageData = true; -window.Uint8ClampedArray.prototype.thisImplementsUint8ClampedArray = true; -var imgdata = ctx.createImageData(ctx.createImageData(1, 1)); -_assert(imgdata.thisImplementsImageData, "imgdata.thisImplementsImageData"); -_assert(imgdata.data.thisImplementsUint8ClampedArray, "imgdata.data.thisImplementsUint8ClampedArray"); - + _assertDifferent(window.ImageData, undefined, "window.ImageData", "undefined"); + _assertDifferent(window.Uint8ClampedArray, undefined, "window.Uint8ClampedArray", "undefined"); + window.ImageData.prototype.thisImplementsImageData = true; + window.Uint8ClampedArray.prototype.thisImplementsUint8ClampedArray = true; + var imgdata = ctx.createImageData(ctx.createImageData(1, 1)); + _assert(imgdata.thisImplementsImageData, "imgdata.thisImplementsImageData"); + _assert(imgdata.data.thisImplementsUint8ClampedArray, "imgdata.data.thisImplementsUint8ClampedArray"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.zero.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.zero.html index 06447cb6907..02619376a1b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.zero.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create1.zero.html @@ -19,8 +19,7 @@ var t = async_test("createImageData(null) throws TypeError"); _addTest(function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.createImageData(null); }); - + assert_throws_js(TypeError, function() { ctx.createImageData(null); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.basic.html index 017d9cfe286..807b6dbfa21 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.basic.html @@ -19,8 +19,7 @@ var t = async_test("createImageData(sw, sh) exists and returns something"); _addTest(function(canvas, ctx) { -_assertDifferent(ctx.createImageData(1, 1), null, "ctx.createImageData(1, 1)", "null"); - + _assertDifferent(ctx.createImageData(1, 1), null, "ctx.createImageData(1, 1)", "null"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.double.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.double.html index 57b912bc7fe..31aa42d5a89 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.double.html @@ -19,13 +19,12 @@ var t = async_test("createImageData(w, h) double is converted to long"); _addTest(function(canvas, ctx) { -var imgdata1 = ctx.createImageData(10.01, 10.99); -var imgdata2 = ctx.createImageData(-10.01, -10.99); -_assertSame(imgdata1.width, 10, "imgdata1.width", "10"); -_assertSame(imgdata1.height, 10, "imgdata1.height", "10"); -_assertSame(imgdata2.width, 10, "imgdata2.width", "10"); -_assertSame(imgdata2.height, 10, "imgdata2.height", "10"); - + var imgdata1 = ctx.createImageData(10.01, 10.99); + var imgdata2 = ctx.createImageData(-10.01, -10.99); + _assertSame(imgdata1.width, 10, "imgdata1.width", "10"); + _assertSame(imgdata1.height, 10, "imgdata1.height", "10"); + _assertSame(imgdata2.width, 10, "imgdata2.width", "10"); + _assertSame(imgdata2.height, 10, "imgdata2.height", "10"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.initial.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.initial.html index 57cb7ce926f..c2a69b4c06c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.initial.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.initial.html @@ -19,16 +19,15 @@ var t = async_test("createImageData(sw, sh) returns transparent black data of the right size"); _addTest(function(canvas, ctx) { -var imgdata = ctx.createImageData(10, 20); -_assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); -_assert(imgdata.width < imgdata.height, "imgdata.width < imgdata.height"); -_assert(imgdata.width > 0, "imgdata.width > 0"); -var isTransparentBlack = true; -for (var i = 0; i < imgdata.data.length; ++i) - if (imgdata.data[i] !== 0) - isTransparentBlack = false; -_assert(isTransparentBlack, "isTransparentBlack"); - + var imgdata = ctx.createImageData(10, 20); + _assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); + _assert(imgdata.width < imgdata.height, "imgdata.width < imgdata.height"); + _assert(imgdata.width > 0, "imgdata.width > 0"); + var isTransparentBlack = true; + for (var i = 0; i < imgdata.data.length; ++i) + if (imgdata.data[i] !== 0) + isTransparentBlack = false; + _assert(isTransparentBlack, "isTransparentBlack"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.large.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.large.html index 8daa111db53..73b2a1c19f2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.large.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.large.html @@ -19,16 +19,15 @@ var t = async_test("createImageData(sw, sh) works for sizes much larger than the canvas"); _addTest(function(canvas, ctx) { -var imgdata = ctx.createImageData(1000, 2000); -_assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); -_assert(imgdata.width < imgdata.height, "imgdata.width < imgdata.height"); -_assert(imgdata.width > 0, "imgdata.width > 0"); -var isTransparentBlack = true; -for (var i = 0; i < imgdata.data.length; i += 7813) // check ~1024 points (assuming normal scaling) - if (imgdata.data[i] !== 0) - isTransparentBlack = false; -_assert(isTransparentBlack, "isTransparentBlack"); - + var imgdata = ctx.createImageData(1000, 2000); + _assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); + _assert(imgdata.width < imgdata.height, "imgdata.width < imgdata.height"); + _assert(imgdata.width > 0, "imgdata.width > 0"); + var isTransparentBlack = true; + for (var i = 0; i < imgdata.data.length; i += 7813) // check ~1024 points (assuming normal scaling) + if (imgdata.data[i] !== 0) + isTransparentBlack = false; + _assert(isTransparentBlack, "isTransparentBlack"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.negative.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.negative.html index 87c0ca26d07..7c4a3944eb0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.negative.html @@ -19,14 +19,13 @@ var t = async_test("createImageData(sw, sh) takes the absolute magnitude of the size arguments"); _addTest(function(canvas, ctx) { -var imgdata1 = ctx.createImageData(10, 20); -var imgdata2 = ctx.createImageData(-10, 20); -var imgdata3 = ctx.createImageData(10, -20); -var imgdata4 = ctx.createImageData(-10, -20); -_assertSame(imgdata1.data.length, imgdata2.data.length, "imgdata1.data.length", "imgdata2.data.length"); -_assertSame(imgdata2.data.length, imgdata3.data.length, "imgdata2.data.length", "imgdata3.data.length"); -_assertSame(imgdata3.data.length, imgdata4.data.length, "imgdata3.data.length", "imgdata4.data.length"); - + var imgdata1 = ctx.createImageData(10, 20); + var imgdata2 = ctx.createImageData(-10, 20); + var imgdata3 = ctx.createImageData(10, -20); + var imgdata4 = ctx.createImageData(-10, -20); + _assertSame(imgdata1.data.length, imgdata2.data.length, "imgdata1.data.length", "imgdata2.data.length"); + _assertSame(imgdata2.data.length, imgdata3.data.length, "imgdata2.data.length", "imgdata3.data.length"); + _assertSame(imgdata3.data.length, imgdata4.data.length, "imgdata3.data.length", "imgdata4.data.length"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.nonfinite.html index 55fcb761fca..af30dc9124b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.nonfinite.html @@ -19,24 +19,23 @@ var t = async_test("createImageData() throws TypeError if arguments are not finite"); _addTest(function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.createImageData(-Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.createImageData(NaN, 10); }); -assert_throws_js(TypeError, function() { ctx.createImageData(10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.createImageData(10, -Infinity); }); -assert_throws_js(TypeError, function() { ctx.createImageData(10, NaN); }); -assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, Infinity); }); -var posinfobj = { valueOf: function() { return Infinity; } }, - neginfobj = { valueOf: function() { return -Infinity; } }, - nanobj = { valueOf: function() { return -Infinity; } }; -assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.createImageData(neginfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.createImageData(nanobj, 10); }); -assert_throws_js(TypeError, function() { ctx.createImageData(10, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.createImageData(10, neginfobj); }); -assert_throws_js(TypeError, function() { ctx.createImageData(10, nanobj); }); -assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, posinfobj); }); - + assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.createImageData(-Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.createImageData(NaN, 10); }); + assert_throws_js(TypeError, function() { ctx.createImageData(10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.createImageData(10, -Infinity); }); + assert_throws_js(TypeError, function() { ctx.createImageData(10, NaN); }); + assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, Infinity); }); + var posinfobj = { valueOf: function() { return Infinity; } }, + neginfobj = { valueOf: function() { return -Infinity; } }, + nanobj = { valueOf: function() { return -Infinity; } }; + assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.createImageData(neginfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.createImageData(nanobj, 10); }); + assert_throws_js(TypeError, function() { ctx.createImageData(10, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.createImageData(10, neginfobj); }); + assert_throws_js(TypeError, function() { ctx.createImageData(10, nanobj); }); + assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, posinfobj); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.round.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.round.html index 045cd0610ca..c62243f4185 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.round.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.round.html @@ -19,11 +19,10 @@ var t = async_test("createImageData(w, h) is rounded the same as getImageData(0, 0, w, h)"); _addTest(function(canvas, ctx) { -var imgdata1 = ctx.createImageData(10.01, 10.99); -var imgdata2 = ctx.getImageData(0, 0, 10.01, 10.99); -_assertSame(imgdata1.width, imgdata2.width, "imgdata1.width", "imgdata2.width"); -_assertSame(imgdata1.height, imgdata2.height, "imgdata1.height", "imgdata2.height"); - + var imgdata1 = ctx.createImageData(10.01, 10.99); + var imgdata2 = ctx.getImageData(0, 0, 10.01, 10.99); + _assertSame(imgdata1.width, imgdata2.width, "imgdata1.width", "imgdata2.width"); + _assertSame(imgdata1.height, imgdata2.height, "imgdata1.height", "imgdata2.height"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.this.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.this.html index 1937609c878..f5373d0eddd 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.this.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.this.html @@ -19,10 +19,9 @@ var t = async_test("createImageData(sw, sh) should throw when called with the wrong |this|"); _addTest(function(canvas, ctx) { -assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call(null, 1, 1); }); -assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call(undefined, 1, 1); }); -assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call({}, 1, 1); }); - + assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call(null, 1, 1); }); + assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call(undefined, 1, 1); }); + assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call({}, 1, 1); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.type.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.type.html index 2ca1706f7f7..d595d338458 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.type.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.type.html @@ -19,14 +19,13 @@ var t = async_test("createImageData(sw, sh) returns an ImageData object containing a Uint8ClampedArray object"); _addTest(function(canvas, ctx) { -_assertDifferent(window.ImageData, undefined, "window.ImageData", "undefined"); -_assertDifferent(window.Uint8ClampedArray, undefined, "window.Uint8ClampedArray", "undefined"); -window.ImageData.prototype.thisImplementsImageData = true; -window.Uint8ClampedArray.prototype.thisImplementsUint8ClampedArray = true; -var imgdata = ctx.createImageData(1, 1); -_assert(imgdata.thisImplementsImageData, "imgdata.thisImplementsImageData"); -_assert(imgdata.data.thisImplementsUint8ClampedArray, "imgdata.data.thisImplementsUint8ClampedArray"); - + _assertDifferent(window.ImageData, undefined, "window.ImageData", "undefined"); + _assertDifferent(window.Uint8ClampedArray, undefined, "window.Uint8ClampedArray", "undefined"); + window.ImageData.prototype.thisImplementsImageData = true; + window.Uint8ClampedArray.prototype.thisImplementsUint8ClampedArray = true; + var imgdata = ctx.createImageData(1, 1); + _assert(imgdata.thisImplementsImageData, "imgdata.thisImplementsImageData"); + _assert(imgdata.data.thisImplementsUint8ClampedArray, "imgdata.data.thisImplementsUint8ClampedArray"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.zero.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.zero.html index c23ca70eaf0..cc949162d3b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.zero.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.create2.zero.html @@ -19,12 +19,11 @@ var t = async_test("createImageData(sw, sh) throws INDEX_SIZE_ERR if size is zero"); _addTest(function(canvas, ctx) { -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(10, 0); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0, 10); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0, 0); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0.99, 10); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(10, 0.1); }); - + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(10, 0); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0, 10); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0, 0); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0.99, 10); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(10, 0.1); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.basic.html index a4762aca953..5f8f1995401 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.basic.html @@ -19,8 +19,7 @@ var t = async_test("getImageData() exists and returns something"); _addTest(function(canvas, ctx) { -_assertDifferent(ctx.getImageData(0, 0, 100, 50), null, "ctx.getImageData(0, 0, 100, 50)", "null"); - + _assertDifferent(ctx.getImageData(0, 0, 100, 50), null, "ctx.getImageData(0, 0, 100, 50)", "null"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.clamp.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.clamp.html index 3c0b1750a51..0047e910b78 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.clamp.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.clamp.html @@ -19,19 +19,18 @@ var t = async_test("getImageData() clamps colors to the range [0, 255]"); _addTest(function(canvas, ctx) { -ctx.fillStyle = 'rgb(-100, -200, -300)'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = 'rgb(256, 300, 400)'; -ctx.fillRect(20, 10, 60, 10); -var imgdata1 = ctx.getImageData(10, 5, 1, 1); -_assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata1.data[1], 0, "imgdata1.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata1.data[2], 0, "imgdata1.data[\""+(2)+"\"]", "0"); -var imgdata2 = ctx.getImageData(30, 15, 1, 1); -_assertSame(imgdata2.data[0], 255, "imgdata2.data[\""+(0)+"\"]", "255"); -_assertSame(imgdata2.data[1], 255, "imgdata2.data[\""+(1)+"\"]", "255"); -_assertSame(imgdata2.data[2], 255, "imgdata2.data[\""+(2)+"\"]", "255"); - + ctx.fillStyle = 'rgb(-100, -200, -300)'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = 'rgb(256, 300, 400)'; + ctx.fillRect(20, 10, 60, 10); + var imgdata1 = ctx.getImageData(10, 5, 1, 1); + _assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata1.data[1], 0, "imgdata1.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata1.data[2], 0, "imgdata1.data[\""+(2)+"\"]", "0"); + var imgdata2 = ctx.getImageData(30, 15, 1, 1); + _assertSame(imgdata2.data[0], 255, "imgdata2.data[\""+(0)+"\"]", "255"); + _assertSame(imgdata2.data[1], 255, "imgdata2.data[\""+(1)+"\"]", "255"); + _assertSame(imgdata2.data[2], 255, "imgdata2.data[\""+(2)+"\"]", "255"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.double.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.double.html index 9ff3e9a132b..5cea5fcbc23 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.double.html @@ -19,13 +19,12 @@ var t = async_test("createImageData(w, h) double is converted to long"); _addTest(function(canvas, ctx) { -var imgdata1 = ctx.getImageData(0, 0, 10.01, 10.99); -var imgdata2 = ctx.getImageData(0, 0, -10.01, -10.99); -_assertSame(imgdata1.width, 10, "imgdata1.width", "10"); -_assertSame(imgdata1.height, 10, "imgdata1.height", "10"); -_assertSame(imgdata2.width, 10, "imgdata2.width", "10"); -_assertSame(imgdata2.height, 10, "imgdata2.height", "10"); - + var imgdata1 = ctx.getImageData(0, 0, 10.01, 10.99); + var imgdata2 = ctx.getImageData(0, 0, -10.01, -10.99); + _assertSame(imgdata1.width, 10, "imgdata1.width", "10"); + _assertSame(imgdata1.height, 10, "imgdata1.height", "10"); + _assertSame(imgdata2.width, 10, "imgdata2.width", "10"); + _assertSame(imgdata2.height, 10, "imgdata2.height", "10"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.invalid.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.invalid.html index dd6cc755784..689e72f69bc 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.invalid.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.invalid.html @@ -19,26 +19,25 @@ var t = async_test("Verify getImageData() behavior in invalid cases."); _addTest(function(canvas, ctx) { -imageData = ctx.getImageData(0,0,2,2); -var testValues = [NaN, true, false, "\"garbage\"", "-1", - "0", "1", "2", Infinity, -Infinity, - -5, -0.5, 0, 0.5, 5, - 5.4, 255, 256, null, undefined]; -var testResults = [0, 1, 0, 0, 0, - 0, 1, 2, 255, 0, - 0, 0, 0, 0, 5, - 5, 255, 255, 0, 0]; -for (var i = 0; i < testValues.length; i++) { - imageData.data[0] = testValues[i]; - _assert(imageData.data[0] == testResults[i], "imageData.data[\""+(0)+"\"] == testResults[\""+(i)+"\"]"); -} -imageData.data['foo']='garbage'; -_assert(imageData.data['foo'] == 'garbage', "imageData.data['foo'] == 'garbage'"); -imageData.data[-1]='garbage'; -_assert(imageData.data[-1] == undefined, "imageData.data[-1] == undefined"); -imageData.data[17]='garbage'; -_assert(imageData.data[17] == undefined, "imageData.data[\""+(17)+"\"] == undefined"); - + imageData = ctx.getImageData(0,0,2,2); + var testValues = [NaN, true, false, "\"garbage\"", "-1", + "0", "1", "2", Infinity, -Infinity, + -5, -0.5, 0, 0.5, 5, + 5.4, 255, 256, null, undefined]; + var testResults = [0, 1, 0, 0, 0, + 0, 1, 2, 255, 0, + 0, 0, 0, 0, 5, + 5, 255, 255, 0, 0]; + for (var i = 0; i < testValues.length; i++) { + imageData.data[0] = testValues[i]; + _assert(imageData.data[0] == testResults[i], "imageData.data[\""+(0)+"\"] == testResults[\""+(i)+"\"]"); + } + imageData.data['foo']='garbage'; + _assert(imageData.data['foo'] == 'garbage', "imageData.data['foo'] == 'garbage'"); + imageData.data[-1]='garbage'; + _assert(imageData.data[-1] == undefined, "imageData.data[-1] == undefined"); + imageData.data[17]='garbage'; + _assert(imageData.data[17] == undefined, "imageData.data[\""+(17)+"\"] == undefined"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.large.crash.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.large.crash.html index cb8e6064004..f41eec7b9bb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.large.crash.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.large.crash.html @@ -19,8 +19,7 @@ var t = async_test("Test that canvas crash when image data cannot be allocated."); _addTest(function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.getImageData(10, 0xffffffff, 2147483647, 10); }); - + assert_throws_js(TypeError, function() { ctx.getImageData(10, 0xffffffff, 2147483647, 10); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.length.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.length.html index be99e1e5255..41b9832025f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.length.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.length.html @@ -19,9 +19,8 @@ var t = async_test("getImageData() returns a correctly-sized Uint8ClampedArray"); _addTest(function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); -_assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); - + var imgdata = ctx.getImageData(0, 0, 10, 10); + _assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.nonfinite.html index a5884606d7b..a80e905cfd3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.nonfinite.html @@ -19,56 +19,55 @@ var t = async_test("getImageData() throws TypeError if arguments are not finite"); _addTest(function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(-Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(NaN, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, -Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, NaN, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, -Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, NaN, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, -Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, NaN); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, Infinity); }); -var posinfobj = { valueOf: function() { return Infinity; } }, - neginfobj = { valueOf: function() { return -Infinity; } }, - nanobj = { valueOf: function() { return -Infinity; } }; -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(neginfobj, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(nanobj, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, neginfobj, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, nanobj, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, neginfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, nanobj, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, neginfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, nanobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, posinfobj); }); - + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(-Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(NaN, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, -Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, NaN, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, -Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, NaN, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, -Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, NaN); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, Infinity); }); + var posinfobj = { valueOf: function() { return Infinity; } }, + neginfobj = { valueOf: function() { return -Infinity; } }, + nanobj = { valueOf: function() { return -Infinity; } }; + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(neginfobj, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(nanobj, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, neginfobj, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, nanobj, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, neginfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, nanobj, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, neginfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, nanobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, posinfobj); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.nonpremul.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.nonpremul.html index 6c8599846c6..bc833c2198f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.nonpremul.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.nonpremul.html @@ -19,15 +19,14 @@ var t = async_test("getImageData() returns non-premultiplied colors"); _addTest(function(canvas, ctx) { -ctx.fillStyle = 'rgba(255, 255, 255, 0.5)'; -ctx.fillRect(0, 0, 100, 50); -var imgdata = ctx.getImageData(10, 10, 10, 10); -_assert(imgdata.data[0] > 200, "imgdata.data[\""+(0)+"\"] > 200"); -_assert(imgdata.data[1] > 200, "imgdata.data[\""+(1)+"\"] > 200"); -_assert(imgdata.data[2] > 200, "imgdata.data[\""+(2)+"\"] > 200"); -_assert(imgdata.data[3] > 100, "imgdata.data[\""+(3)+"\"] > 100"); -_assert(imgdata.data[3] < 200, "imgdata.data[\""+(3)+"\"] < 200"); - + ctx.fillStyle = 'rgba(255, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + var imgdata = ctx.getImageData(10, 10, 10, 10); + _assert(imgdata.data[0] > 200, "imgdata.data[\""+(0)+"\"] > 200"); + _assert(imgdata.data[1] > 200, "imgdata.data[\""+(1)+"\"] > 200"); + _assert(imgdata.data[2] > 200, "imgdata.data[\""+(2)+"\"] > 200"); + _assert(imgdata.data[3] > 100, "imgdata.data[\""+(3)+"\"] > 100"); + _assert(imgdata.data[3] < 200, "imgdata.data[\""+(3)+"\"] < 200"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.order.alpha.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.order.alpha.html index 6b368aa7d4c..e5b57f650e2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.order.alpha.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.order.alpha.html @@ -19,12 +19,11 @@ var t = async_test("getImageData() returns A in the fourth component"); _addTest(function(canvas, ctx) { -ctx.fillStyle = 'rgba(0, 0, 0, 0.5)'; -ctx.fillRect(0, 0, 100, 50); -var imgdata = ctx.getImageData(0, 0, 10, 10); -_assert(imgdata.data[3] < 200, "imgdata.data[\""+(3)+"\"] < 200"); -_assert(imgdata.data[3] > 100, "imgdata.data[\""+(3)+"\"] > 100"); - + ctx.fillStyle = 'rgba(0, 0, 0, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + var imgdata = ctx.getImageData(0, 0, 10, 10); + _assert(imgdata.data[3] < 200, "imgdata.data[\""+(3)+"\"] < 200"); + _assert(imgdata.data[3] > 100, "imgdata.data[\""+(3)+"\"] > 100"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.order.cols.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.order.cols.html index 23ff82c0550..66fd984ebd8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.order.cols.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.order.cols.html @@ -19,15 +19,14 @@ var t = async_test("getImageData() returns leftmost columns first"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#fff'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#000'; -ctx.fillRect(0, 0, 2, 50); -var imgdata = ctx.getImageData(0, 0, 10, 10); -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata.data[Math.round(imgdata.width/2*4)], 255, "imgdata.data[Math.round(imgdata.width/2*4)]", "255"); -_assertSame(imgdata.data[Math.round((imgdata.height/2)*imgdata.width*4)], 0, "imgdata.data[Math.round((imgdata.height/2)*imgdata.width*4)]", "0"); - + ctx.fillStyle = '#fff'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#000'; + ctx.fillRect(0, 0, 2, 50); + var imgdata = ctx.getImageData(0, 0, 10, 10); + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata.data[Math.round(imgdata.width/2*4)], 255, "imgdata.data[Math.round(imgdata.width/2*4)]", "255"); + _assertSame(imgdata.data[Math.round((imgdata.height/2)*imgdata.width*4)], 0, "imgdata.data[Math.round((imgdata.height/2)*imgdata.width*4)]", "0"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.order.rgb.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.order.rgb.html index db297dd55c7..4d15ce79277 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.order.rgb.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.order.rgb.html @@ -19,18 +19,17 @@ var t = async_test("getImageData() returns R then G then B"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#48c'; -ctx.fillRect(0, 0, 100, 50); -var imgdata = ctx.getImageData(0, 0, 10, 10); -_assertSame(imgdata.data[0], 0x44, "imgdata.data[\""+(0)+"\"]", "0x44"); -_assertSame(imgdata.data[1], 0x88, "imgdata.data[\""+(1)+"\"]", "0x88"); -_assertSame(imgdata.data[2], 0xCC, "imgdata.data[\""+(2)+"\"]", "0xCC"); -_assertSame(imgdata.data[3], 255, "imgdata.data[\""+(3)+"\"]", "255"); -_assertSame(imgdata.data[4], 0x44, "imgdata.data[\""+(4)+"\"]", "0x44"); -_assertSame(imgdata.data[5], 0x88, "imgdata.data[\""+(5)+"\"]", "0x88"); -_assertSame(imgdata.data[6], 0xCC, "imgdata.data[\""+(6)+"\"]", "0xCC"); -_assertSame(imgdata.data[7], 255, "imgdata.data[\""+(7)+"\"]", "255"); - + ctx.fillStyle = '#48c'; + ctx.fillRect(0, 0, 100, 50); + var imgdata = ctx.getImageData(0, 0, 10, 10); + _assertSame(imgdata.data[0], 0x44, "imgdata.data[\""+(0)+"\"]", "0x44"); + _assertSame(imgdata.data[1], 0x88, "imgdata.data[\""+(1)+"\"]", "0x88"); + _assertSame(imgdata.data[2], 0xCC, "imgdata.data[\""+(2)+"\"]", "0xCC"); + _assertSame(imgdata.data[3], 255, "imgdata.data[\""+(3)+"\"]", "255"); + _assertSame(imgdata.data[4], 0x44, "imgdata.data[\""+(4)+"\"]", "0x44"); + _assertSame(imgdata.data[5], 0x88, "imgdata.data[\""+(5)+"\"]", "0x88"); + _assertSame(imgdata.data[6], 0xCC, "imgdata.data[\""+(6)+"\"]", "0xCC"); + _assertSame(imgdata.data[7], 255, "imgdata.data[\""+(7)+"\"]", "255"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.order.rows.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.order.rows.html index 332bc053027..086ce322e04 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.order.rows.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.order.rows.html @@ -19,15 +19,14 @@ var t = async_test("getImageData() returns topmost rows first"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#fff'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#000'; -ctx.fillRect(0, 0, 100, 2); -var imgdata = ctx.getImageData(0, 0, 10, 10); -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata.data[Math.floor(imgdata.width/2*4)], 0, "imgdata.data[Math.floor(imgdata.width/2*4)]", "0"); -_assertSame(imgdata.data[(imgdata.height/2)*imgdata.width*4], 255, "imgdata.data[(imgdata.height/2)*imgdata.width*4]", "255"); - + ctx.fillStyle = '#fff'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#000'; + ctx.fillRect(0, 0, 100, 2); + var imgdata = ctx.getImageData(0, 0, 10, 10); + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata.data[Math.floor(imgdata.width/2*4)], 0, "imgdata.data[Math.floor(imgdata.width/2*4)]", "0"); + _assertSame(imgdata.data[(imgdata.height/2)*imgdata.width*4], 255, "imgdata.data[(imgdata.height/2)*imgdata.width*4]", "255"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.range.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.range.html index f5dfa6bb8ae..d9211917729 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.range.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.range.html @@ -19,15 +19,14 @@ var t = async_test("getImageData() returns values in the range [0, 255]"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#000'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#fff'; -ctx.fillRect(20, 10, 60, 10); -var imgdata1 = ctx.getImageData(10, 5, 1, 1); -_assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); -var imgdata2 = ctx.getImageData(30, 15, 1, 1); -_assertSame(imgdata2.data[0], 255, "imgdata2.data[\""+(0)+"\"]", "255"); - + ctx.fillStyle = '#000'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#fff'; + ctx.fillRect(20, 10, 60, 10); + var imgdata1 = ctx.getImageData(10, 5, 1, 1); + _assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); + var imgdata2 = ctx.getImageData(30, 15, 1, 1); + _assertSame(imgdata2.data[0], 255, "imgdata2.data[\""+(0)+"\"]", "255"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.rounding.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.rounding.html index 7b9ab46fab0..9255be087b6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.rounding.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.rounding.html @@ -19,26 +19,25 @@ var t = async_test("Test the handling of non-integer source coordinates in getImageData()."); _addTest(function(canvas, ctx) { -function testDimensions(sx, sy, sw, sh, width, height) -{ - imageData = ctx.getImageData(sx, sy, sw, sh); - _assert(imageData.width == width, "imageData.width == width"); - _assert(imageData.height == height, "imageData.height == height"); -} + function testDimensions(sx, sy, sw, sh, width, height) + { + imageData = ctx.getImageData(sx, sy, sw, sh); + _assert(imageData.width == width, "imageData.width == width"); + _assert(imageData.height == height, "imageData.height == height"); + } -testDimensions(0, 0, 20, 10, 20, 10); + testDimensions(0, 0, 20, 10, 20, 10); -testDimensions(.1, .2, 20, 10, 20, 10); -testDimensions(.9, .8, 20, 10, 20, 10); + testDimensions(.1, .2, 20, 10, 20, 10); + testDimensions(.9, .8, 20, 10, 20, 10); -testDimensions(0, 0, 20.9, 10.9, 20, 10); -testDimensions(0, 0, 20.1, 10.1, 20, 10); + testDimensions(0, 0, 20.9, 10.9, 20, 10); + testDimensions(0, 0, 20.1, 10.1, 20, 10); -testDimensions(-1, -1, 20, 10, 20, 10); - -testDimensions(-1.1, 0, 20, 10, 20, 10); -testDimensions(-1.9, 0, 20, 10, 20, 10); + testDimensions(-1, -1, 20, 10, 20, 10); + testDimensions(-1.1, 0, 20, 10, 20, 10); + testDimensions(-1.9, 0, 20, 10, 20, 10); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.source.negative.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.source.negative.html index 7e705896f2e..0b84b1cacac 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.source.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.source.negative.html @@ -19,27 +19,26 @@ var t = async_test("getImageData() works with negative width and height, and returns top-to-bottom left-to-right"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#000'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#fff'; -ctx.fillRect(20, 10, 60, 10); - -var imgdata1 = ctx.getImageData(85, 25, -10, -10); -_assertSame(imgdata1.data[0], 255, "imgdata1.data[\""+(0)+"\"]", "255"); -_assertSame(imgdata1.data[1], 255, "imgdata1.data[\""+(1)+"\"]", "255"); -_assertSame(imgdata1.data[2], 255, "imgdata1.data[\""+(2)+"\"]", "255"); -_assertSame(imgdata1.data[3], 255, "imgdata1.data[\""+(3)+"\"]", "255"); -_assertSame(imgdata1.data[imgdata1.data.length-4+0], 0, "imgdata1.data[imgdata1.data.length-4+0]", "0"); -_assertSame(imgdata1.data[imgdata1.data.length-4+1], 0, "imgdata1.data[imgdata1.data.length-4+1]", "0"); -_assertSame(imgdata1.data[imgdata1.data.length-4+2], 0, "imgdata1.data[imgdata1.data.length-4+2]", "0"); -_assertSame(imgdata1.data[imgdata1.data.length-4+3], 255, "imgdata1.data[imgdata1.data.length-4+3]", "255"); - -var imgdata2 = ctx.getImageData(0, 0, -1, -1); -_assertSame(imgdata2.data[0], 0, "imgdata2.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata2.data[1], 0, "imgdata2.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata2.data[2], 0, "imgdata2.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata2.data[3], 0, "imgdata2.data[\""+(3)+"\"]", "0"); - + ctx.fillStyle = '#000'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#fff'; + ctx.fillRect(20, 10, 60, 10); + + var imgdata1 = ctx.getImageData(85, 25, -10, -10); + _assertSame(imgdata1.data[0], 255, "imgdata1.data[\""+(0)+"\"]", "255"); + _assertSame(imgdata1.data[1], 255, "imgdata1.data[\""+(1)+"\"]", "255"); + _assertSame(imgdata1.data[2], 255, "imgdata1.data[\""+(2)+"\"]", "255"); + _assertSame(imgdata1.data[3], 255, "imgdata1.data[\""+(3)+"\"]", "255"); + _assertSame(imgdata1.data[imgdata1.data.length-4+0], 0, "imgdata1.data[imgdata1.data.length-4+0]", "0"); + _assertSame(imgdata1.data[imgdata1.data.length-4+1], 0, "imgdata1.data[imgdata1.data.length-4+1]", "0"); + _assertSame(imgdata1.data[imgdata1.data.length-4+2], 0, "imgdata1.data[imgdata1.data.length-4+2]", "0"); + _assertSame(imgdata1.data[imgdata1.data.length-4+3], 255, "imgdata1.data[imgdata1.data.length-4+3]", "255"); + + var imgdata2 = ctx.getImageData(0, 0, -1, -1); + _assertSame(imgdata2.data[0], 0, "imgdata2.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata2.data[1], 0, "imgdata2.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata2.data[2], 0, "imgdata2.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata2.data[3], 0, "imgdata2.data[\""+(3)+"\"]", "0"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.source.outside.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.source.outside.html index ccc75a2e01f..fca97f2e6f6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.source.outside.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.source.outside.html @@ -19,67 +19,66 @@ var t = async_test("getImageData() returns transparent black outside the canvas"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#08f'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#08f'; + ctx.fillRect(0, 0, 100, 50); -var imgdata1 = ctx.getImageData(-10, 5, 1, 1); -_assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata1.data[1], 0, "imgdata1.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata1.data[2], 0, "imgdata1.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata1.data[3], 0, "imgdata1.data[\""+(3)+"\"]", "0"); + var imgdata1 = ctx.getImageData(-10, 5, 1, 1); + _assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata1.data[1], 0, "imgdata1.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata1.data[2], 0, "imgdata1.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata1.data[3], 0, "imgdata1.data[\""+(3)+"\"]", "0"); -var imgdata2 = ctx.getImageData(10, -5, 1, 1); -_assertSame(imgdata2.data[0], 0, "imgdata2.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata2.data[1], 0, "imgdata2.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata2.data[2], 0, "imgdata2.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata2.data[3], 0, "imgdata2.data[\""+(3)+"\"]", "0"); + var imgdata2 = ctx.getImageData(10, -5, 1, 1); + _assertSame(imgdata2.data[0], 0, "imgdata2.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata2.data[1], 0, "imgdata2.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata2.data[2], 0, "imgdata2.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata2.data[3], 0, "imgdata2.data[\""+(3)+"\"]", "0"); -var imgdata3 = ctx.getImageData(200, 5, 1, 1); -_assertSame(imgdata3.data[0], 0, "imgdata3.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata3.data[1], 0, "imgdata3.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata3.data[2], 0, "imgdata3.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata3.data[3], 0, "imgdata3.data[\""+(3)+"\"]", "0"); + var imgdata3 = ctx.getImageData(200, 5, 1, 1); + _assertSame(imgdata3.data[0], 0, "imgdata3.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata3.data[1], 0, "imgdata3.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata3.data[2], 0, "imgdata3.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata3.data[3], 0, "imgdata3.data[\""+(3)+"\"]", "0"); -var imgdata4 = ctx.getImageData(10, 60, 1, 1); -_assertSame(imgdata4.data[0], 0, "imgdata4.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata4.data[1], 0, "imgdata4.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata4.data[2], 0, "imgdata4.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata4.data[3], 0, "imgdata4.data[\""+(3)+"\"]", "0"); + var imgdata4 = ctx.getImageData(10, 60, 1, 1); + _assertSame(imgdata4.data[0], 0, "imgdata4.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata4.data[1], 0, "imgdata4.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata4.data[2], 0, "imgdata4.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata4.data[3], 0, "imgdata4.data[\""+(3)+"\"]", "0"); -var imgdata5 = ctx.getImageData(100, 10, 1, 1); -_assertSame(imgdata5.data[0], 0, "imgdata5.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata5.data[1], 0, "imgdata5.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata5.data[2], 0, "imgdata5.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata5.data[3], 0, "imgdata5.data[\""+(3)+"\"]", "0"); + var imgdata5 = ctx.getImageData(100, 10, 1, 1); + _assertSame(imgdata5.data[0], 0, "imgdata5.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata5.data[1], 0, "imgdata5.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata5.data[2], 0, "imgdata5.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata5.data[3], 0, "imgdata5.data[\""+(3)+"\"]", "0"); -var imgdata6 = ctx.getImageData(0, 10, 1, 1); -_assertSame(imgdata6.data[0], 0, "imgdata6.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata6.data[1], 136, "imgdata6.data[\""+(1)+"\"]", "136"); -_assertSame(imgdata6.data[2], 255, "imgdata6.data[\""+(2)+"\"]", "255"); -_assertSame(imgdata6.data[3], 255, "imgdata6.data[\""+(3)+"\"]", "255"); - -var imgdata7 = ctx.getImageData(-10, 10, 20, 20); -_assertSame(imgdata7.data[ 0*4+0], 0, "imgdata7.data[ 0*4+0]", "0"); -_assertSame(imgdata7.data[ 0*4+1], 0, "imgdata7.data[ 0*4+1]", "0"); -_assertSame(imgdata7.data[ 0*4+2], 0, "imgdata7.data[ 0*4+2]", "0"); -_assertSame(imgdata7.data[ 0*4+3], 0, "imgdata7.data[ 0*4+3]", "0"); -_assertSame(imgdata7.data[ 9*4+0], 0, "imgdata7.data[ 9*4+0]", "0"); -_assertSame(imgdata7.data[ 9*4+1], 0, "imgdata7.data[ 9*4+1]", "0"); -_assertSame(imgdata7.data[ 9*4+2], 0, "imgdata7.data[ 9*4+2]", "0"); -_assertSame(imgdata7.data[ 9*4+3], 0, "imgdata7.data[ 9*4+3]", "0"); -_assertSame(imgdata7.data[10*4+0], 0, "imgdata7.data[10*4+0]", "0"); -_assertSame(imgdata7.data[10*4+1], 136, "imgdata7.data[10*4+1]", "136"); -_assertSame(imgdata7.data[10*4+2], 255, "imgdata7.data[10*4+2]", "255"); -_assertSame(imgdata7.data[10*4+3], 255, "imgdata7.data[10*4+3]", "255"); -_assertSame(imgdata7.data[19*4+0], 0, "imgdata7.data[19*4+0]", "0"); -_assertSame(imgdata7.data[19*4+1], 136, "imgdata7.data[19*4+1]", "136"); -_assertSame(imgdata7.data[19*4+2], 255, "imgdata7.data[19*4+2]", "255"); -_assertSame(imgdata7.data[19*4+3], 255, "imgdata7.data[19*4+3]", "255"); -_assertSame(imgdata7.data[20*4+0], 0, "imgdata7.data[20*4+0]", "0"); -_assertSame(imgdata7.data[20*4+1], 0, "imgdata7.data[20*4+1]", "0"); -_assertSame(imgdata7.data[20*4+2], 0, "imgdata7.data[20*4+2]", "0"); -_assertSame(imgdata7.data[20*4+3], 0, "imgdata7.data[20*4+3]", "0"); + var imgdata6 = ctx.getImageData(0, 10, 1, 1); + _assertSame(imgdata6.data[0], 0, "imgdata6.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata6.data[1], 136, "imgdata6.data[\""+(1)+"\"]", "136"); + _assertSame(imgdata6.data[2], 255, "imgdata6.data[\""+(2)+"\"]", "255"); + _assertSame(imgdata6.data[3], 255, "imgdata6.data[\""+(3)+"\"]", "255"); + var imgdata7 = ctx.getImageData(-10, 10, 20, 20); + _assertSame(imgdata7.data[ 0*4+0], 0, "imgdata7.data[ 0*4+0]", "0"); + _assertSame(imgdata7.data[ 0*4+1], 0, "imgdata7.data[ 0*4+1]", "0"); + _assertSame(imgdata7.data[ 0*4+2], 0, "imgdata7.data[ 0*4+2]", "0"); + _assertSame(imgdata7.data[ 0*4+3], 0, "imgdata7.data[ 0*4+3]", "0"); + _assertSame(imgdata7.data[ 9*4+0], 0, "imgdata7.data[ 9*4+0]", "0"); + _assertSame(imgdata7.data[ 9*4+1], 0, "imgdata7.data[ 9*4+1]", "0"); + _assertSame(imgdata7.data[ 9*4+2], 0, "imgdata7.data[ 9*4+2]", "0"); + _assertSame(imgdata7.data[ 9*4+3], 0, "imgdata7.data[ 9*4+3]", "0"); + _assertSame(imgdata7.data[10*4+0], 0, "imgdata7.data[10*4+0]", "0"); + _assertSame(imgdata7.data[10*4+1], 136, "imgdata7.data[10*4+1]", "136"); + _assertSame(imgdata7.data[10*4+2], 255, "imgdata7.data[10*4+2]", "255"); + _assertSame(imgdata7.data[10*4+3], 255, "imgdata7.data[10*4+3]", "255"); + _assertSame(imgdata7.data[19*4+0], 0, "imgdata7.data[19*4+0]", "0"); + _assertSame(imgdata7.data[19*4+1], 136, "imgdata7.data[19*4+1]", "136"); + _assertSame(imgdata7.data[19*4+2], 255, "imgdata7.data[19*4+2]", "255"); + _assertSame(imgdata7.data[19*4+3], 255, "imgdata7.data[19*4+3]", "255"); + _assertSame(imgdata7.data[20*4+0], 0, "imgdata7.data[20*4+0]", "0"); + _assertSame(imgdata7.data[20*4+1], 0, "imgdata7.data[20*4+1]", "0"); + _assertSame(imgdata7.data[20*4+2], 0, "imgdata7.data[20*4+2]", "0"); + _assertSame(imgdata7.data[20*4+3], 0, "imgdata7.data[20*4+3]", "0"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.source.size.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.source.size.html index 418b2e3e394..800edb8baf5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.source.size.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.source.size.html @@ -19,11 +19,10 @@ var t = async_test("getImageData() returns bigger ImageData for bigger source rectangle"); _addTest(function(canvas, ctx) { -var imgdata1 = ctx.getImageData(0, 0, 10, 10); -var imgdata2 = ctx.getImageData(0, 0, 20, 20); -_assert(imgdata2.width > imgdata1.width, "imgdata2.width > imgdata1.width"); -_assert(imgdata2.height > imgdata1.height, "imgdata2.height > imgdata1.height"); - + var imgdata1 = ctx.getImageData(0, 0, 10, 10); + var imgdata2 = ctx.getImageData(0, 0, 20, 20); + _assert(imgdata2.width > imgdata1.width, "imgdata2.width > imgdata1.width"); + _assert(imgdata2.height > imgdata1.height, "imgdata2.height > imgdata1.height"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.type.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.type.html index d030dd409c9..748d46b166b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.type.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.type.html @@ -19,14 +19,13 @@ var t = async_test("getImageData() returns an ImageData object containing a Uint8ClampedArray object"); _addTest(function(canvas, ctx) { -_assertDifferent(window.ImageData, undefined, "window.ImageData", "undefined"); -_assertDifferent(window.Uint8ClampedArray, undefined, "window.Uint8ClampedArray", "undefined"); -window.ImageData.prototype.thisImplementsImageData = true; -window.Uint8ClampedArray.prototype.thisImplementsUint8ClampedArray = true; -var imgdata = ctx.getImageData(0, 0, 1, 1); -_assert(imgdata.thisImplementsImageData, "imgdata.thisImplementsImageData"); -_assert(imgdata.data.thisImplementsUint8ClampedArray, "imgdata.data.thisImplementsUint8ClampedArray"); - + _assertDifferent(window.ImageData, undefined, "window.ImageData", "undefined"); + _assertDifferent(window.Uint8ClampedArray, undefined, "window.Uint8ClampedArray", "undefined"); + window.ImageData.prototype.thisImplementsImageData = true; + window.Uint8ClampedArray.prototype.thisImplementsUint8ClampedArray = true; + var imgdata = ctx.getImageData(0, 0, 1, 1); + _assert(imgdata.thisImplementsImageData, "imgdata.thisImplementsImageData"); + _assert(imgdata.data.thisImplementsUint8ClampedArray, "imgdata.data.thisImplementsUint8ClampedArray"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.unaffected.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.unaffected.html index 15ad997d5f1..f2f4a2e4fa0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.unaffected.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.unaffected.html @@ -19,23 +19,22 @@ var t = async_test("getImageData() is not affected by context state"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 50, 50) -ctx.fillStyle = '#f00'; -ctx.fillRect(50, 0, 50, 50) -ctx.save(); -ctx.translate(50, 0); -ctx.globalAlpha = 0.1; -ctx.globalCompositeOperation = 'destination-atop'; -ctx.shadowColor = '#f00'; -ctx.rect(0, 0, 5, 5); -ctx.clip(); -var imgdata = ctx.getImageData(0, 0, 50, 50); -ctx.restore(); -ctx.putImageData(imgdata, 50, 0); -_assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 50) + ctx.fillStyle = '#f00'; + ctx.fillRect(50, 0, 50, 50) + ctx.save(); + ctx.translate(50, 0); + ctx.globalAlpha = 0.1; + ctx.globalCompositeOperation = 'destination-atop'; + ctx.shadowColor = '#f00'; + ctx.rect(0, 0, 5, 5); + ctx.clip(); + var imgdata = ctx.getImageData(0, 0, 50, 50); + ctx.restore(); + ctx.putImageData(imgdata, 50, 0); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.zero.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.zero.html index 3139003dfc7..438bc2fb1e8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.zero.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.get.zero.html @@ -19,14 +19,13 @@ var t = async_test("getImageData() throws INDEX_SIZE_ERR if size is zero"); _addTest(function(canvas, ctx) { -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, 0); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0, 10); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0, 0); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0.1, 10); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, 0.99); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, -0.1, 10); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, -0.99); }); - + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, 0); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0, 10); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0, 0); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0.1, 10); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, 0.99); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, -0.1, 10); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, -0.99); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.clamp.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.clamp.html index e3a17ed6628..df8ef1ba20c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.clamp.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.clamp.html @@ -19,36 +19,35 @@ var t = async_test("ImageData.data clamps numbers to [0, 255]"); _addTest(function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); - -imgdata.data[0] = 100; -imgdata.data[0] = 300; -_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); -imgdata.data[0] = 100; -imgdata.data[0] = -100; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); - -imgdata.data[0] = 100; -imgdata.data[0] = 200+Math.pow(2, 32); -_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); -imgdata.data[0] = 100; -imgdata.data[0] = -200-Math.pow(2, 32); -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); - -imgdata.data[0] = 100; -imgdata.data[0] = Math.pow(10, 39); -_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); -imgdata.data[0] = 100; -imgdata.data[0] = -Math.pow(10, 39); -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); - -imgdata.data[0] = 100; -imgdata.data[0] = -Infinity; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -imgdata.data[0] = 100; -imgdata.data[0] = Infinity; -_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); - + var imgdata = ctx.getImageData(0, 0, 10, 10); + + imgdata.data[0] = 100; + imgdata.data[0] = 300; + _assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); + imgdata.data[0] = 100; + imgdata.data[0] = -100; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + + imgdata.data[0] = 100; + imgdata.data[0] = 200+Math.pow(2, 32); + _assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); + imgdata.data[0] = 100; + imgdata.data[0] = -200-Math.pow(2, 32); + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + + imgdata.data[0] = 100; + imgdata.data[0] = Math.pow(10, 39); + _assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); + imgdata.data[0] = 100; + imgdata.data[0] = -Math.pow(10, 39); + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + + imgdata.data[0] = 100; + imgdata.data[0] = -Infinity; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + imgdata.data[0] = 100; + imgdata.data[0] = Infinity; + _assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.array.bounds.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.array.bounds.html index 7c6e0178fdf..01affeb947f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.array.bounds.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.array.bounds.html @@ -19,15 +19,14 @@ var t = async_test("ImageData has a usable constructor"); _addTest(function(canvas, ctx) { -_assertDifferent(window.ImageData, undefined, "window.ImageData", "undefined"); - -assert_throws_dom("INVALID_STATE_ERR", function() { new ImageData(new Uint8ClampedArray(0), 1); }); -assert_throws_dom("INVALID_STATE_ERR", function() { new ImageData(new Uint8ClampedArray(3), 1); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(new Uint8ClampedArray(4), 0); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(new Uint8ClampedArray(4), 1, 2); }); -assert_throws_js(TypeError, function() { new ImageData(new Uint8Array(8), 1, 2); }); -assert_throws_js(TypeError, function() { new ImageData(new Int8Array(8), 1, 2); }); - + _assertDifferent(window.ImageData, undefined, "window.ImageData", "undefined"); + + assert_throws_dom("INVALID_STATE_ERR", function() { new ImageData(new Uint8ClampedArray(0), 1); }); + assert_throws_dom("INVALID_STATE_ERR", function() { new ImageData(new Uint8ClampedArray(3), 1); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(new Uint8ClampedArray(4), 0); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(new Uint8ClampedArray(4), 1, 2); }); + assert_throws_js(TypeError, function() { new ImageData(new Uint8Array(8), 1, 2); }); + assert_throws_js(TypeError, function() { new ImageData(new Int8Array(8), 1, 2); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.array.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.array.html index 200b7eed934..0cdc025764b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.array.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.array.html @@ -19,14 +19,13 @@ var t = async_test("ImageData has a usable constructor"); _addTest(function(canvas, ctx) { -_assertDifferent(window.ImageData, undefined, "window.ImageData", "undefined"); - -var array = new Uint8ClampedArray(8); -var imgdata = new window.ImageData(array, 1, 2); -_assertSame(imgdata.width, 1, "imgdata.width", "1"); -_assertSame(imgdata.height, 2, "imgdata.height", "2"); -_assertSame(imgdata.data, array, "imgdata.data", "array"); + _assertDifferent(window.ImageData, undefined, "window.ImageData", "undefined"); + var array = new Uint8ClampedArray(8); + var imgdata = new window.ImageData(array, 1, 2); + _assertSame(imgdata.width, 1, "imgdata.width", "1"); + _assertSame(imgdata.height, 2, "imgdata.height", "2"); + _assertSame(imgdata.data, array, "imgdata.data", "array"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.basics.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.basics.html index b01b9da51b8..f7811e7441c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.basics.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.basics.html @@ -19,93 +19,92 @@ var t = async_test("Testing different type of ImageData constructor"); _addTest(function(canvas, ctx) { -function setRGBA(imageData, i, rgba) -{ - var s = i * 4; - imageData[s] = rgba[0]; - imageData[s + 1] = rgba[1]; - imageData[s + 2] = rgba[2]; - imageData[s + 3] = rgba[3]; -} - -function getRGBA(imageData, i) -{ - var result = []; - var s = i * 4; - for (var j = 0; j < 4; j++) { - result[j] = imageData[s + j]; - } - return result; -} - -function assertArrayEquals(actual, expected) -{ - _assertSame(typeof actual, "object", "typeof actual", "\"object\""); - _assertDifferent(actual, null, "actual", "null"); - _assertSame("length" in actual, true, "\"length\" in actual", "true"); - _assertSame(actual.length, expected.length, "actual.length", "expected.length"); - for (var i = 0; i < actual.length; i++) { - _assertSame(actual.hasOwnProperty(i), expected.hasOwnProperty(i), "actual.hasOwnProperty(i)", "expected.hasOwnProperty(i)"); - _assertSame(actual[i], expected[i], "actual[\""+(i)+"\"]", "expected[\""+(i)+"\"]"); - } -} - -_assertDifferent(ImageData, undefined, "ImageData", "undefined"); -imageData = new ImageData(100, 50); - -_assertDifferent(imageData, null, "imageData", "null"); -_assertDifferent(imageData.data, null, "imageData.data", "null"); -_assertSame(imageData.width, 100, "imageData.width", "100"); -_assertSame(imageData.height, 50, "imageData.height", "50"); -assertArrayEquals(getRGBA(imageData.data, 4), [0, 0, 0, 0]); - -var testColor = [0, 255, 255, 128]; -setRGBA(imageData.data, 4, testColor); -assertArrayEquals(getRGBA(imageData.data, 4), testColor); - -assert_throws_js(TypeError, function() { ImageData(1, 1); }); -assert_throws_js(TypeError, function() { new ImageData(10); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(0, 10); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(10, 0); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData('width', 'height'); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(1 << 31, 1 << 31); }); -assert_throws_js(TypeError, function() { new ImageData(new Uint8ClampedArray(0)); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(new Uint8Array(100), 25); }); -assert_throws_dom("INVALID_STATE_ERR", function() { new ImageData(new Uint8ClampedArray(27), 2); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(new Uint8ClampedArray(28), 7, 0); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(new Uint8ClampedArray(104), 14); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(new Uint8ClampedArray([12, 34, 168, 65328]), 1, 151); }); -assert_throws_js(TypeError, function() { new ImageData(self, 4, 4); }); -assert_throws_js(TypeError, function() { new ImageData(null, 4, 4); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(imageData.data, 0); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(imageData.data, 13); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(imageData.data, 1 << 31); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(imageData.data, 'biggish'); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(imageData.data, 1 << 24, 1 << 31); }); -_assertSame(new ImageData(new Uint8ClampedArray(28), 7).height, 1, "new ImageData(new Uint8ClampedArray(28), 7).height", "1"); - -imageDataFromData = new ImageData(imageData.data, 100); -_assertSame(imageDataFromData.width, 100, "imageDataFromData.width", "100"); -_assertSame(imageDataFromData.height, 50, "imageDataFromData.height", "50"); -_assertSame(imageDataFromData.data, imageData.data, "imageDataFromData.data", "imageData.data"); -assertArrayEquals(getRGBA(imageDataFromData.data, 10), getRGBA(imageData.data, 10)); -setRGBA(imageData.data, 10, testColor); -assertArrayEquals(getRGBA(imageDataFromData.data, 10), getRGBA(imageData.data, 10)); - -var data = new Uint8ClampedArray(400); -data[22] = 129; -imageDataFromData = new ImageData(data, 20, 5); -_assertSame(imageDataFromData.width, 20, "imageDataFromData.width", "20"); -_assertSame(imageDataFromData.height, 5, "imageDataFromData.height", "5"); -_assertSame(imageDataFromData.data, data, "imageDataFromData.data", "data"); -assertArrayEquals(getRGBA(imageDataFromData.data, 2), getRGBA(data, 2)); -setRGBA(imageDataFromData.data, 2, testColor); -assertArrayEquals(getRGBA(imageDataFromData.data, 2), getRGBA(data, 2)); - -if (window.SharedArrayBuffer) { - assert_throws_js(TypeError, function() { new ImageData(new Uint16Array(new SharedArrayBuffer(32)), 4, 2); }); -} - + function setRGBA(imageData, i, rgba) + { + var s = i * 4; + imageData[s] = rgba[0]; + imageData[s + 1] = rgba[1]; + imageData[s + 2] = rgba[2]; + imageData[s + 3] = rgba[3]; + } + + function getRGBA(imageData, i) + { + var result = []; + var s = i * 4; + for (var j = 0; j < 4; j++) { + result[j] = imageData[s + j]; + } + return result; + } + + function assertArrayEquals(actual, expected) + { + _assertSame(typeof actual, "object", "typeof actual", "\"object\""); + _assertDifferent(actual, null, "actual", "null"); + _assertSame("length" in actual, true, "\"length\" in actual", "true"); + _assertSame(actual.length, expected.length, "actual.length", "expected.length"); + for (var i = 0; i < actual.length; i++) { + _assertSame(actual.hasOwnProperty(i), expected.hasOwnProperty(i), "actual.hasOwnProperty(i)", "expected.hasOwnProperty(i)"); + _assertSame(actual[i], expected[i], "actual[\""+(i)+"\"]", "expected[\""+(i)+"\"]"); + } + } + + _assertDifferent(ImageData, undefined, "ImageData", "undefined"); + imageData = new ImageData(100, 50); + + _assertDifferent(imageData, null, "imageData", "null"); + _assertDifferent(imageData.data, null, "imageData.data", "null"); + _assertSame(imageData.width, 100, "imageData.width", "100"); + _assertSame(imageData.height, 50, "imageData.height", "50"); + assertArrayEquals(getRGBA(imageData.data, 4), [0, 0, 0, 0]); + + var testColor = [0, 255, 255, 128]; + setRGBA(imageData.data, 4, testColor); + assertArrayEquals(getRGBA(imageData.data, 4), testColor); + + assert_throws_js(TypeError, function() { ImageData(1, 1); }); + assert_throws_js(TypeError, function() { new ImageData(10); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(0, 10); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(10, 0); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData('width', 'height'); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(1 << 31, 1 << 31); }); + assert_throws_js(TypeError, function() { new ImageData(new Uint8ClampedArray(0)); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(new Uint8Array(100), 25); }); + assert_throws_dom("INVALID_STATE_ERR", function() { new ImageData(new Uint8ClampedArray(27), 2); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(new Uint8ClampedArray(28), 7, 0); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(new Uint8ClampedArray(104), 14); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(new Uint8ClampedArray([12, 34, 168, 65328]), 1, 151); }); + assert_throws_js(TypeError, function() { new ImageData(self, 4, 4); }); + assert_throws_js(TypeError, function() { new ImageData(null, 4, 4); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(imageData.data, 0); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(imageData.data, 13); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(imageData.data, 1 << 31); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(imageData.data, 'biggish'); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { new ImageData(imageData.data, 1 << 24, 1 << 31); }); + _assertSame(new ImageData(new Uint8ClampedArray(28), 7).height, 1, "new ImageData(new Uint8ClampedArray(28), 7).height", "1"); + + imageDataFromData = new ImageData(imageData.data, 100); + _assertSame(imageDataFromData.width, 100, "imageDataFromData.width", "100"); + _assertSame(imageDataFromData.height, 50, "imageDataFromData.height", "50"); + _assertSame(imageDataFromData.data, imageData.data, "imageDataFromData.data", "imageData.data"); + assertArrayEquals(getRGBA(imageDataFromData.data, 10), getRGBA(imageData.data, 10)); + setRGBA(imageData.data, 10, testColor); + assertArrayEquals(getRGBA(imageDataFromData.data, 10), getRGBA(imageData.data, 10)); + + var data = new Uint8ClampedArray(400); + data[22] = 129; + imageDataFromData = new ImageData(data, 20, 5); + _assertSame(imageDataFromData.width, 20, "imageDataFromData.width", "20"); + _assertSame(imageDataFromData.height, 5, "imageDataFromData.height", "5"); + _assertSame(imageDataFromData.data, data, "imageDataFromData.data", "data"); + assertArrayEquals(getRGBA(imageDataFromData.data, 2), getRGBA(data, 2)); + setRGBA(imageDataFromData.data, 2, testColor); + assertArrayEquals(getRGBA(imageDataFromData.data, 2), getRGBA(data, 2)); + + if (window.SharedArrayBuffer) { + assert_throws_js(TypeError, function() { new ImageData(new Uint16Array(new SharedArrayBuffer(32)), 4, 2); }); + } }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.size.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.size.html index e7480501423..a11d8e23400 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.size.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.size.html @@ -19,16 +19,15 @@ var t = async_test("ImageData has a usable constructor"); _addTest(function(canvas, ctx) { -_assertDifferent(window.ImageData, undefined, "window.ImageData", "undefined"); - -var imgdata = new window.ImageData(2, 3); -_assertSame(imgdata.width, 2, "imgdata.width", "2"); -_assertSame(imgdata.height, 3, "imgdata.height", "3"); -_assertSame(imgdata.data.length, 2 * 3 * 4, "imgdata.data.length", "2 * 3 * 4"); -for (var i = 0; i < imgdata.data.length; ++i) { - _assertSame(imgdata.data[i], 0, "imgdata.data[\""+(i)+"\"]", "0"); -} - + _assertDifferent(window.ImageData, undefined, "window.ImageData", "undefined"); + + var imgdata = new window.ImageData(2, 3); + _assertSame(imgdata.width, 2, "imgdata.width", "2"); + _assertSame(imgdata.height, 3, "imgdata.height", "3"); + _assertSame(imgdata.data.length, 2 * 3 * 4, "imgdata.data.length", "2 * 3 * 4"); + for (var i = 0; i < imgdata.data.length; ++i) { + _assertSame(imgdata.data[i], 0, "imgdata.data[\""+(i)+"\"]", "0"); + } }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.nan.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.nan.html index 496686bbfae..974b5898a31 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.nan.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.nan.html @@ -19,14 +19,13 @@ var t = async_test("ImageData.data converts NaN to 0"); _addTest(function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); -imgdata.data[0] = 100; -imgdata.data[0] = NaN; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -imgdata.data[0] = 100; -imgdata.data[0] = "cheese"; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); - + var imgdata = ctx.getImageData(0, 0, 10, 10); + imgdata.data[0] = 100; + imgdata.data[0] = NaN; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + imgdata.data[0] = 100; + imgdata.data[0] = "cheese"; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.properties.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.properties.html index ed03fce9832..7eefdb2f554 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.properties.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.properties.html @@ -19,11 +19,10 @@ var t = async_test("ImageData objects have the right properties"); _addTest(function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); -_assertSame(typeof(imgdata.width), 'number', "typeof(imgdata.width)", "'number'"); -_assertSame(typeof(imgdata.height), 'number', "typeof(imgdata.height)", "'number'"); -_assertSame(typeof(imgdata.data), 'object', "typeof(imgdata.data)", "'object'"); - + var imgdata = ctx.getImageData(0, 0, 10, 10); + _assertSame(typeof(imgdata.width), 'number', "typeof(imgdata.width)", "'number'"); + _assertSame(typeof(imgdata.height), 'number', "typeof(imgdata.height)", "'number'"); + _assertSame(typeof(imgdata.data), 'object', "typeof(imgdata.data)", "'object'"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.readonly.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.readonly.html index 3b2f7051b1a..f002466bab5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.readonly.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.readonly.html @@ -19,21 +19,20 @@ var t = async_test("ImageData objects properties are read-only"); _addTest(function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); -var w = imgdata.width; -var h = imgdata.height; -var d = imgdata.data; -imgdata.width = 123; -imgdata.height = 123; -imgdata.data = [100,100,100,100]; -_assertSame(imgdata.width, w, "imgdata.width", "w"); -_assertSame(imgdata.height, h, "imgdata.height", "h"); -_assertSame(imgdata.data, d, "imgdata.data", "d"); -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata.data[1], 0, "imgdata.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata.data[2], 0, "imgdata.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata.data[3], 0, "imgdata.data[\""+(3)+"\"]", "0"); - + var imgdata = ctx.getImageData(0, 0, 10, 10); + var w = imgdata.width; + var h = imgdata.height; + var d = imgdata.data; + imgdata.width = 123; + imgdata.height = 123; + imgdata.data = [100,100,100,100]; + _assertSame(imgdata.width, w, "imgdata.width", "w"); + _assertSame(imgdata.height, h, "imgdata.height", "h"); + _assertSame(imgdata.data, d, "imgdata.data", "d"); + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata.data[1], 0, "imgdata.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata.data[2], 0, "imgdata.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata.data[3], 0, "imgdata.data[\""+(3)+"\"]", "0"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.round.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.round.html index d052930d525..0f7da4fff55 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.round.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.round.html @@ -19,36 +19,35 @@ var t = async_test("ImageData.data rounds numbers with round-to-zero"); _addTest(function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); -imgdata.data[0] = 0.499; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -imgdata.data[0] = 0.5; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -imgdata.data[0] = 0.501; -_assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1"); -imgdata.data[0] = 1.499; -_assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1"); -imgdata.data[0] = 1.5; -_assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); -imgdata.data[0] = 1.501; -_assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); -imgdata.data[0] = 2.5; -_assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); -imgdata.data[0] = 3.5; -_assertSame(imgdata.data[0], 4, "imgdata.data[\""+(0)+"\"]", "4"); -imgdata.data[0] = 252.5; -_assertSame(imgdata.data[0], 252, "imgdata.data[\""+(0)+"\"]", "252"); -imgdata.data[0] = 253.5; -_assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254"); -imgdata.data[0] = 254.5; -_assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254"); -imgdata.data[0] = 256.5; -_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); -imgdata.data[0] = -0.5; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -imgdata.data[0] = -1.5; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); - + var imgdata = ctx.getImageData(0, 0, 10, 10); + imgdata.data[0] = 0.499; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + imgdata.data[0] = 0.5; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + imgdata.data[0] = 0.501; + _assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1"); + imgdata.data[0] = 1.499; + _assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1"); + imgdata.data[0] = 1.5; + _assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); + imgdata.data[0] = 1.501; + _assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); + imgdata.data[0] = 2.5; + _assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); + imgdata.data[0] = 3.5; + _assertSame(imgdata.data[0], 4, "imgdata.data[\""+(0)+"\"]", "4"); + imgdata.data[0] = 252.5; + _assertSame(imgdata.data[0], 252, "imgdata.data[\""+(0)+"\"]", "252"); + imgdata.data[0] = 253.5; + _assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254"); + imgdata.data[0] = 254.5; + _assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254"); + imgdata.data[0] = 256.5; + _assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); + imgdata.data[0] = -0.5; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + imgdata.data[0] = -1.5; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.set.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.set.html index 6afa7e87630..3d03bd6769c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.set.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.set.html @@ -19,12 +19,11 @@ var t = async_test("ImageData.data can be modified"); _addTest(function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); -imgdata.data[0] = 100; -_assertSame(imgdata.data[0], 100, "imgdata.data[\""+(0)+"\"]", "100"); -imgdata.data[0] = 200; -_assertSame(imgdata.data[0], 200, "imgdata.data[\""+(0)+"\"]", "200"); - + var imgdata = ctx.getImageData(0, 0, 10, 10); + imgdata.data[0] = 100; + _assertSame(imgdata.data[0], 100, "imgdata.data[\""+(0)+"\"]", "100"); + imgdata.data[0] = 200; + _assertSame(imgdata.data[0], 200, "imgdata.data[\""+(0)+"\"]", "200"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.string.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.string.html index d54594a15dc..eda6f2838da 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.string.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.string.html @@ -19,17 +19,16 @@ var t = async_test("ImageData.data converts strings to numbers with ToNumber"); _addTest(function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); -imgdata.data[0] = 100; -imgdata.data[0] = "110"; -_assertSame(imgdata.data[0], 110, "imgdata.data[\""+(0)+"\"]", "110"); -imgdata.data[0] = 100; -imgdata.data[0] = "0x78"; -_assertSame(imgdata.data[0], 120, "imgdata.data[\""+(0)+"\"]", "120"); -imgdata.data[0] = 100; -imgdata.data[0] = " +130e0 "; -_assertSame(imgdata.data[0], 130, "imgdata.data[\""+(0)+"\"]", "130"); - + var imgdata = ctx.getImageData(0, 0, 10, 10); + imgdata.data[0] = 100; + imgdata.data[0] = "110"; + _assertSame(imgdata.data[0], 110, "imgdata.data[\""+(0)+"\"]", "110"); + imgdata.data[0] = 100; + imgdata.data[0] = "0x78"; + _assertSame(imgdata.data[0], 120, "imgdata.data[\""+(0)+"\"]", "120"); + imgdata.data[0] = 100; + imgdata.data[0] = " +130e0 "; + _assertSame(imgdata.data[0], 130, "imgdata.data[\""+(0)+"\"]", "130"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.undefined.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.undefined.html index 3013c886886..96867bec4a6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.undefined.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.object.undefined.html @@ -19,11 +19,10 @@ var t = async_test("ImageData.data converts undefined to 0"); _addTest(function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); -imgdata.data[0] = 100; -imgdata.data[0] = undefined; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); - + var imgdata = ctx.getImageData(0, 0, 10, 10); + imgdata.data[0] = 100; + imgdata.data[0] = undefined; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.alpha.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.alpha.html index ae8ad977766..6ee38802f62 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.alpha.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.alpha.html @@ -19,14 +19,13 @@ var t = async_test("putImageData() puts non-solid image data correctly"); _addTest(function(canvas, ctx) { -ctx.fillStyle = 'rgba(0, 255, 0, 0.25)'; -ctx.fillRect(0, 0, 100, 50) -var imgdata = ctx.getImageData(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.putImageData(imgdata, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,64, 2); - + ctx.fillStyle = 'rgba(0, 255, 0, 0.25)'; + ctx.fillRect(0, 0, 100, 50) + var imgdata = ctx.getImageData(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.putImageData(imgdata, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,64, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.basic.html index 9a7021fd56a..17f7d3e8e6e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.basic.html @@ -19,14 +19,13 @@ var t = async_test("putImageData() puts image data from getImageData() onto the canvas"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -var imgdata = ctx.getImageData(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.putImageData(imgdata, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + var imgdata = ctx.getImageData(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.putImageData(imgdata, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.clip.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.clip.html index 229b8129563..948f6170951 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.clip.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.clip.html @@ -19,18 +19,17 @@ var t = async_test("putImageData() is not affected by clipping regions"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -var imgdata = ctx.getImageData(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.beginPath(); -ctx.rect(0, 0, 50, 50); -ctx.clip(); -ctx.putImageData(imgdata, 0, 0); -_assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + var imgdata = ctx.getImageData(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.beginPath(); + ctx.rect(0, 0, 50, 50); + ctx.clip(); + ctx.putImageData(imgdata, 0, 0); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.created.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.created.html index 3f515b2523e..4db45873a17 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.created.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.created.html @@ -19,18 +19,17 @@ var t = async_test("putImageData() puts image data from createImageData() onto the canvas"); _addTest(function(canvas, ctx) { -var imgdata = ctx.createImageData(100, 50); -for (var i = 0; i < imgdata.data.length; i += 4) { - imgdata.data[i] = 0; - imgdata.data[i+1] = 255; - imgdata.data[i+2] = 0; - imgdata.data[i+3] = 255; -} -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.putImageData(imgdata, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - + var imgdata = ctx.createImageData(100, 50); + for (var i = 0; i < imgdata.data.length; i += 4) { + imgdata.data[i] = 0; + imgdata.data[i+1] = 255; + imgdata.data[i+2] = 0; + imgdata.data[i+3] = 255; + } + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.putImageData(imgdata, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.cross.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.cross.html index 282ad03e6d5..10226834a30 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.cross.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.cross.html @@ -19,16 +19,15 @@ var t = async_test("putImageData() accepts image data got from a different canvas"); _addTest(function(canvas, ctx) { -var canvas2 = document.createElement('canvas'); -var ctx2 = canvas2.getContext('2d'); -ctx2.fillStyle = '#0f0'; -ctx2.fillRect(0, 0, 100, 50) -var imgdata = ctx2.getImageData(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.putImageData(imgdata, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - + var canvas2 = document.createElement('canvas'); + var ctx2 = canvas2.getContext('2d'); + ctx2.fillStyle = '#0f0'; + ctx2.fillRect(0, 0, 100, 50) + var imgdata = ctx2.getImageData(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.putImageData(imgdata, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.negative.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.negative.html index 81226e6978f..efaa6f25508 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.negative.html @@ -19,25 +19,24 @@ var t = async_test("putImageData() handles negative-sized dirty rectangles correctly"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 20, 20) - -var imgdata = ctx.getImageData(0, 0, 100, 50); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#f00'; -ctx.fillRect(40, 20, 20, 20) -ctx.putImageData(imgdata, 40, 20, 20, 20, -20, -20); - -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); -_assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 20, 20) + + var imgdata = ctx.getImageData(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#f00'; + ctx.fillRect(40, 20, 20, 20) + ctx.putImageData(imgdata, 40, 20, 20, 20, -20, -20); + + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.outside.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.outside.html index 8750c332d60..86a77369f05 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.outside.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.outside.html @@ -19,27 +19,26 @@ var t = async_test("putImageData() handles dirty rectangles outside the canvas correctly"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) - -var imgdata = ctx.getImageData(0, 0, 100, 50); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) - -ctx.putImageData(imgdata, 100, 20, 20, 20, -20, -20); -ctx.putImageData(imgdata, 200, 200, 0, 0, 100, 50); -ctx.putImageData(imgdata, 40, 20, -30, -20, 30, 20); -ctx.putImageData(imgdata, -30, 20, 0, 0, 30, 20); - -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 98,15, 0,255,0,255, 2); -_assertPixelApprox(canvas, 98,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 98,45, 0,255,0,255, 2); -_assertPixelApprox(canvas, 1,5, 0,255,0,255, 2); -_assertPixelApprox(canvas, 1,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 1,45, 0,255,0,255, 2); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + + var imgdata = ctx.getImageData(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + + ctx.putImageData(imgdata, 100, 20, 20, 20, -20, -20); + ctx.putImageData(imgdata, 200, 200, 0, 0, 100, 50); + ctx.putImageData(imgdata, 40, 20, -30, -20, 30, 20); + ctx.putImageData(imgdata, -30, 20, 0, 0, 30, 20); + + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,15, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,45, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.rect1.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.rect1.html index 104896d2017..786db5ac4f6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.rect1.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.rect1.html @@ -19,25 +19,24 @@ var t = async_test("putImageData() only modifies areas inside the dirty rectangle, using width and height"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 20, 20) - -var imgdata = ctx.getImageData(0, 0, 100, 50); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#f00'; -ctx.fillRect(40, 20, 20, 20) -ctx.putImageData(imgdata, 40, 20, 0, 0, 20, 20); - -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); -_assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 20, 20) + + var imgdata = ctx.getImageData(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#f00'; + ctx.fillRect(40, 20, 20, 20) + ctx.putImageData(imgdata, 40, 20, 0, 0, 20, 20); + + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.rect2.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.rect2.html index 7acb2205a35..f5f8a3a0d1e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.rect2.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.rect2.html @@ -19,25 +19,24 @@ var t = async_test("putImageData() only modifies areas inside the dirty rectangle, using x and y"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#0f0'; -ctx.fillRect(60, 30, 20, 20) - -var imgdata = ctx.getImageData(0, 0, 100, 50); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#f00'; -ctx.fillRect(40, 20, 20, 20) -ctx.putImageData(imgdata, -20, -10, 60, 30, 20, 20); - -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); -_assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#0f0'; + ctx.fillRect(60, 30, 20, 20) + + var imgdata = ctx.getImageData(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#f00'; + ctx.fillRect(40, 20, 20, 20) + ctx.putImageData(imgdata, -20, -10, 60, 30, 20, 20); + + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.zero.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.zero.html index 336e02a35a2..d3799104dd0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.zero.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.dirty.zero.html @@ -19,14 +19,13 @@ var t = async_test("putImageData() with zero-sized dirty rectangle puts nothing"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -var imgdata = ctx.getImageData(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -ctx.putImageData(imgdata, 0, 0, 0, 0, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + var imgdata = ctx.getImageData(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + ctx.putImageData(imgdata, 0, 0, 0, 0, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.modified.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.modified.html index f5f085a0010..70b70a866f0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.modified.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.modified.html @@ -19,19 +19,18 @@ var t = async_test("putImageData() puts modified image data correctly"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#f00'; -ctx.fillRect(45, 20, 10, 10) -var imgdata = ctx.getImageData(45, 20, 10, 10); -for (var i = 0, len = imgdata.width*imgdata.height*4; i < len; i += 4) -{ - imgdata.data[i] = 0; - imgdata.data[i+1] = 255; -} -ctx.putImageData(imgdata, 45, 20); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#f00'; + ctx.fillRect(45, 20, 10, 10) + var imgdata = ctx.getImageData(45, 20, 10, 10); + for (var i = 0, len = imgdata.width*imgdata.height*4; i < len; i += 4) + { + imgdata.data[i] = 0; + imgdata.data[i+1] = 255; + } + ctx.putImageData(imgdata, 45, 20); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.nonfinite.html index a5c956babad..ab03f9f20fa 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.nonfinite.html @@ -19,90 +19,89 @@ var t = async_test("putImageData() throws TypeError if arguments are not finite"); _addTest(function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, -Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, NaN, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, -Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, NaN, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, -Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, NaN, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, -Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, NaN); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, Infinity); }); - + var imgdata = ctx.getImageData(0, 0, 10, 10); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, -Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, NaN, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, -Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, NaN, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, -Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, NaN, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, -Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, NaN); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, Infinity); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.null.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.null.html index 068c664f0a3..4ed429fe7c7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.null.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.null.html @@ -19,8 +19,7 @@ var t = async_test("putImageData() with null imagedata throws TypeError"); _addTest(function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.putImageData(null, 0, 0); }); - + assert_throws_js(TypeError, function() { ctx.putImageData(null, 0, 0); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.path.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.path.html index b81054d2281..e32d7cc257b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.path.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.path.html @@ -19,15 +19,14 @@ var t = async_test("putImageData() does not affect the current path"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.rect(0, 0, 100, 50); -var imgdata = ctx.getImageData(0, 0, 100, 50); -ctx.putImageData(imgdata, 0, 0); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.rect(0, 0, 100, 50); + var imgdata = ctx.getImageData(0, 0, 100, 50); + ctx.putImageData(imgdata, 0, 0); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.unaffected.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.unaffected.html index 345cb5cbc71..bad06b745f4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.unaffected.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.unaffected.html @@ -19,20 +19,19 @@ var t = async_test("putImageData() is not affected by context state"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -var imgdata = ctx.getImageData(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.globalAlpha = 0.1; -ctx.globalCompositeOperation = 'destination-atop'; -ctx.shadowColor = '#f00'; -ctx.shadowBlur = 1; -ctx.translate(100, 50); -ctx.scale(0.1, 0.1); -ctx.putImageData(imgdata, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + var imgdata = ctx.getImageData(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.globalAlpha = 0.1; + ctx.globalCompositeOperation = 'destination-atop'; + ctx.shadowColor = '#f00'; + ctx.shadowBlur = 1; + ctx.translate(100, 50); + ctx.scale(0.1, 0.1); + ctx.putImageData(imgdata, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.unchanged.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.unchanged.html index cf800bc666a..026e4347ed9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.unchanged.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.unchanged.html @@ -19,25 +19,24 @@ var t = async_test("putImageData(getImageData(...), ...) has no effect"); _addTest(function(canvas, ctx) { -var i = 0; -for (var y = 0; y < 16; ++y) { - for (var x = 0; x < 16; ++x, ++i) { - ctx.fillStyle = 'rgba(' + i + ',' + (Math.floor(i*1.5) % 256) + ',' + (Math.floor(i*23.3) % 256) + ',' + (i/256) + ')'; - ctx.fillRect(x, y, 1, 1); - } -} -var imgdata1 = ctx.getImageData(0.1, 0.2, 15.8, 15.9); -var olddata = []; -for (var i = 0; i < imgdata1.data.length; ++i) - olddata[i] = imgdata1.data[i]; - -ctx.putImageData(imgdata1, 0.1, 0.2); - -var imgdata2 = ctx.getImageData(0.1, 0.2, 15.8, 15.9); -for (var i = 0; i < imgdata2.data.length; ++i) { - _assertSame(olddata[i], imgdata2.data[i], "olddata[\""+(i)+"\"]", "imgdata2.data[\""+(i)+"\"]"); -} - + var i = 0; + for (var y = 0; y < 16; ++y) { + for (var x = 0; x < 16; ++x, ++i) { + ctx.fillStyle = 'rgba(' + i + ',' + (Math.floor(i*1.5) % 256) + ',' + (Math.floor(i*23.3) % 256) + ',' + (i/256) + ')'; + ctx.fillRect(x, y, 1, 1); + } + } + var imgdata1 = ctx.getImageData(0.1, 0.2, 15.8, 15.9); + var olddata = []; + for (var i = 0; i < imgdata1.data.length; ++i) + olddata[i] = imgdata1.data[i]; + + ctx.putImageData(imgdata1, 0.1, 0.2); + + var imgdata2 = ctx.getImageData(0.1, 0.2, 15.8, 15.9); + for (var i = 0; i < imgdata2.data.length; ++i) { + _assertSame(olddata[i], imgdata2.data[i], "olddata[\""+(i)+"\"]", "imgdata2.data[\""+(i)+"\"]"); + } }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.wrongtype.html b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.wrongtype.html index 88386f028f9..9e43b1fbe90 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.wrongtype.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/pixel-manipulation/2d.imageData.put.wrongtype.html @@ -19,11 +19,10 @@ var t = async_test("putImageData() does not accept non-ImageData objects"); _addTest(function(canvas, ctx) { -var imgdata = { width: 1, height: 1, data: [255, 0, 0, 255] }; -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.putImageData("cheese", 0, 0); }); -assert_throws_js(TypeError, function() { ctx.putImageData(42, 0, 0); }); - + var imgdata = { width: 1, height: 1, data: [255, 0, 0, 255] }; + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.putImageData("cheese", 0, 0); }); + assert_throws_js(TypeError, function() { ctx.putImageData(42, 0, 0); }); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/reset/2d.reset.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/reset/2d.reset.basic.html index 8f63730851d..0753ec6da87 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/reset/2d.reset.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/reset/2d.reset.basic.html @@ -19,17 +19,16 @@ var t = async_test("reset clears to transparent black"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height); -ctx.reset(); -_assertPixel(canvas, 0,0, 0,0,0,0); -_assertPixel(canvas, 50,25, 0,0,0,0); -_assertPixel(canvas, 25,50, 0,0,0,0); -_assertPixel(canvas, 100,50, 0,0,0,0); -_assertPixel(canvas, 0,50, 0,0,0,0); -_assertPixel(canvas, 100,0, 0,0,0,0); -t.done(); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height); + ctx.reset(); + _assertPixel(canvas, 0,0, 0,0,0,0); + _assertPixel(canvas, 50,25, 0,0,0,0); + _assertPixel(canvas, 25,50, 0,0,0,0); + _assertPixel(canvas, 100,50, 0,0,0,0); + _assertPixel(canvas, 0,50, 0,0,0,0); + _assertPixel(canvas, 100,0, 0,0,0,0); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/scroll/2d.scrollPathIntoView.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/scroll/2d.scrollPathIntoView.basic.html index 8263eb7b808..e4cf8ea9ad2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/scroll/2d.scrollPathIntoView.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/scroll/2d.scrollPathIntoView.basic.html @@ -19,19 +19,18 @@ var t = async_test("scrollPathIntoView() works"); _addTest(function(canvas, ctx) { -var div = document.createElement('div'); -div.style.cssText = 'width: 200vw; height: 200vh'; -document.body.appendChild(div); -canvas.style.cssText = 'position: absolute; top: 100px; left: 200px; border: none;'; -window.scrollTo(0, 0); - -ctx.beginPath(); -ctx.rect(4, 8, 16, 32); -ctx.scrollPathIntoView(); -var rect = canvas.getBoundingClientRect(); -_assertSame(Math.round(rect.top), -8, "Math.round(rect.top)", "-8"); -_assertSame(Math.round(rect.left), 200, "Math.round(rect.left)", "200"); - + var div = document.createElement('div'); + div.style.cssText = 'width: 200vw; height: 200vh'; + document.body.appendChild(div); + canvas.style.cssText = 'position: absolute; top: 100px; left: 200px; border: none;'; + window.scrollTo(0, 0); + + ctx.beginPath(); + ctx.rect(4, 8, 16, 32); + ctx.scrollPathIntoView(); + var rect = canvas.getBoundingClientRect(); + _assertSame(Math.round(rect.top), -8, "Math.round(rect.top)", "-8"); + _assertSame(Math.round(rect.left), 200, "Math.round(rect.left)", "200"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/scroll/2d.scrollPathIntoView.path.html b/tests/wpt/web-platform-tests/html/canvas/element/scroll/2d.scrollPathIntoView.path.html index 16327d52b5c..ee1f833aaf3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/scroll/2d.scrollPathIntoView.path.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/scroll/2d.scrollPathIntoView.path.html @@ -19,19 +19,18 @@ var t = async_test("scrollPathIntoView() with path argument works"); _addTest(function(canvas, ctx) { -var div = document.createElement('div'); -div.style.cssText = 'width: 200vw; height: 200vh'; -document.body.appendChild(div); -canvas.style.cssText = 'position: absolute; top: 100px; left: 200px; border: none;'; -window.scrollTo(0, 0); - -var path = new Path2D(); -path.rect(4, 8, 16, 32); -ctx.scrollPathIntoView(path); -var rect = canvas.getBoundingClientRect(); -_assertSame(Math.round(rect.top), -8, "Math.round(rect.top)", "-8"); -_assertSame(Math.round(rect.left), 200, "Math.round(rect.left)", "200"); - + var div = document.createElement('div'); + div.style.cssText = 'width: 200vw; height: 200vh'; + document.body.appendChild(div); + canvas.style.cssText = 'position: absolute; top: 100px; left: 200px; border: none;'; + window.scrollTo(0, 0); + + var path = new Path2D(); + path.rect(4, 8, 16, 32); + ctx.scrollPathIntoView(path); + var rect = canvas.getBoundingClientRect(); + _assertSame(Math.round(rect.top), -8, "Math.round(rect.top)", "-8"); + _assertSame(Math.round(rect.left), 200, "Math.round(rect.left)", "200"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/scroll/2d.scrollPathIntoView.verticalLR.html b/tests/wpt/web-platform-tests/html/canvas/element/scroll/2d.scrollPathIntoView.verticalLR.html index 14b1e30ff7d..9d09980b6f0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/scroll/2d.scrollPathIntoView.verticalLR.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/scroll/2d.scrollPathIntoView.verticalLR.html @@ -19,20 +19,19 @@ var t = async_test("scrollPathIntoView() works in vertical-lr writing mode"); _addTest(function(canvas, ctx) { -document.documentElement.style.cssText = 'writing-mode: vertical-lr'; -var div = document.createElement('div'); -div.style.cssText = 'width: 200vw; height: 200vh'; -document.body.appendChild(div); -canvas.style.cssText = 'position: absolute; top: 100px; left: 200px; border: none;'; -window.scrollTo(0, 0); - -ctx.beginPath(); -ctx.rect(4, 8, 16, 32); -ctx.scrollPathIntoView(); -var rect = canvas.getBoundingClientRect(); -_assertSame(Math.round(rect.top), 100, "Math.round(rect.top)", "100"); -_assertSame(Math.round(rect.left), -4, "Math.round(rect.left)", "-4"); - + document.documentElement.style.cssText = 'writing-mode: vertical-lr'; + var div = document.createElement('div'); + div.style.cssText = 'width: 200vw; height: 200vh'; + document.body.appendChild(div); + canvas.style.cssText = 'position: absolute; top: 100px; left: 200px; border: none;'; + window.scrollTo(0, 0); + + ctx.beginPath(); + ctx.rect(4, 8, 16, 32); + ctx.scrollPathIntoView(); + var rect = canvas.getBoundingClientRect(); + _assertSame(Math.round(rect.top), 100, "Math.round(rect.top)", "100"); + _assertSame(Math.round(rect.left), -4, "Math.round(rect.left)", "-4"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/scroll/2d.scrollPathIntoView.verticalRL.html b/tests/wpt/web-platform-tests/html/canvas/element/scroll/2d.scrollPathIntoView.verticalRL.html index cf91abe9755..8193106f8e8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/scroll/2d.scrollPathIntoView.verticalRL.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/scroll/2d.scrollPathIntoView.verticalRL.html @@ -19,22 +19,21 @@ var t = async_test("scrollPathIntoView() works in vertical-rl writing mode"); _addTest(function(canvas, ctx) { -document.documentElement.style.cssText = 'writing-mode: vertical-rl'; -var div = document.createElement('div'); -div.style.cssText = 'width: 200vw; height: 200vh'; -document.body.appendChild(div); -canvas.style.cssText = 'position: absolute; top: 100px; right: 200px; border: none;'; -window.scrollTo(0, 0); - -ctx.beginPath(); -ctx.rect(4, 8, 16, 32); -ctx.scrollPathIntoView(); -var rect = canvas.getBoundingClientRect(); -var viewportWidth = document.scrollingElement.clientWidth; -var canvasWidth = canvas.width; -_assertSame(Math.round(rect.top), 100, "Math.round(rect.top)", "100"); -_assertSame(Math.round(rect.right), viewportWidth + (canvasWidth - 4 - 16), "Math.round(rect.right)", "viewportWidth + (canvasWidth - 4 - 16)"); - + document.documentElement.style.cssText = 'writing-mode: vertical-rl'; + var div = document.createElement('div'); + div.style.cssText = 'width: 200vw; height: 200vh'; + document.body.appendChild(div); + canvas.style.cssText = 'position: absolute; top: 100px; right: 200px; border: none;'; + window.scrollTo(0, 0); + + ctx.beginPath(); + ctx.rect(4, 8, 16, 32); + ctx.scrollPathIntoView(); + var rect = canvas.getBoundingClientRect(); + var viewportWidth = document.scrollingElement.clientWidth; + var canvasWidth = canvas.width; + _assertSame(Math.round(rect.top), 100, "Math.round(rect.top)", "100"); + _assertSame(Math.round(rect.right), viewportWidth + (canvasWidth - 4 - 16), "Math.round(rect.right)", "viewportWidth + (canvasWidth - 4 - 16)"); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.order.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.order.html index 7fe6dbc133c..6c97bf7426f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.order.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.order.html @@ -19,15 +19,14 @@ var t = async_test("Transformations are applied in the right order"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.scale(2, 1); -ctx.rotate(Math.PI / 2); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, -50, 50, 50); -_assertPixel(canvas, 75,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.scale(2, 1); + ctx.rotate(Math.PI / 2); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, -50, 50, 50); + _assertPixel(canvas, 75,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.direction.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.direction.html index 756b5ee6670..0b583cd6785 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.direction.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.direction.html @@ -19,14 +19,13 @@ var t = async_test("rotate() is clockwise"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.rotate(Math.PI / 2); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, -100, 50, 100); -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.rotate(Math.PI / 2); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, -100, 50, 100); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.nonfinite.html index 93839c6427e..3e685fa7a81 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.nonfinite.html @@ -19,19 +19,18 @@ var t = async_test("rotate() with Infinity/NaN is ignored"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.translate(100, 10); -ctx.rotate(Infinity); -ctx.rotate(-Infinity); -ctx.rotate(NaN); + ctx.translate(100, 10); + ctx.rotate(Infinity); + ctx.rotate(-Infinity); + ctx.rotate(NaN); -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -10, 100, 50); - -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -10, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.radians.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.radians.html index fabf9da24f0..63f895a0de1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.radians.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.radians.html @@ -19,14 +19,13 @@ var t = async_test("rotate() uses radians"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.rotate(Math.PI); // should fail obviously if this is 3.1 degrees -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -50, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.rotate(Math.PI); // should fail obviously if this is 3.1 degrees + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -50, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.wrap.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.wrap.html index 05cb3073ee2..9b923e00084 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.wrap.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.wrap.html @@ -19,19 +19,18 @@ var t = async_test("rotate() wraps large positive values correctly"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.rotate(Math.PI * (1 + 4096)); // == pi (mod 2*pi) -// We need about pi +/- 0.001 in order to get correct-looking results -// 32-bit floats can store pi*4097 with precision 2^-10, so that should -// be safe enough on reasonable implementations -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -50, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 98,2, 0,255,0,255); -_assertPixel(canvas, 98,47, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.rotate(Math.PI * (1 + 4096)); // == pi (mod 2*pi) + // We need about pi +/- 0.001 in order to get correct-looking results + // 32-bit floats can store pi*4097 with precision 2^-10, so that should + // be safe enough on reasonable implementations + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -50, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 98,2, 0,255,0,255); + _assertPixel(canvas, 98,47, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.wrapnegative.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.wrapnegative.html index 9eae3c5214d..96894ef20e2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.wrapnegative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.wrapnegative.html @@ -19,16 +19,15 @@ var t = async_test("rotate() wraps large negative values correctly"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.rotate(-Math.PI * (1 + 4096)); -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -50, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 98,2, 0,255,0,255); -_assertPixel(canvas, 98,47, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.rotate(-Math.PI * (1 + 4096)); + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -50, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 98,2, 0,255,0,255); + _assertPixel(canvas, 98,47, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.zero.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.zero.html index 54ad6aa1385..7026ea9d1b1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.zero.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.rotate.zero.html @@ -19,14 +19,13 @@ var t = async_test("rotate() by 0 does nothing"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.rotate(0); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.rotate(0); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.basic.html index 0573702bd86..7e4b3593b19 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.basic.html @@ -19,14 +19,13 @@ var t = async_test("scale() works"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.scale(2, 4); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 50, 12.5); -_assertPixel(canvas, 90,40, 0,255,0,255); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(2, 4); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 12.5); + _assertPixel(canvas, 90,40, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.large.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.large.html index 65fa9ab8da0..ce7f6d9faef 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.large.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.large.html @@ -19,14 +19,13 @@ var t = async_test("scale() with large scale factors works"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.scale(1e5, 1e5); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 1, 1); -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(1e5, 1e5); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 1, 1); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.multiple.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.multiple.html index 5bf837ccd76..73bfbc87c18 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.multiple.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.multiple.html @@ -19,15 +19,14 @@ var t = async_test("Multiple scale()s combine"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.scale(Math.sqrt(2), Math.sqrt(2)); -ctx.scale(Math.sqrt(2), Math.sqrt(2)); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 50, 25); -_assertPixel(canvas, 90,40, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.scale(Math.sqrt(2), Math.sqrt(2)); + ctx.scale(Math.sqrt(2), Math.sqrt(2)); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 25); + _assertPixel(canvas, 90,40, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.negative.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.negative.html index e7085999a2b..a5aef69b63b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.negative.html @@ -19,23 +19,22 @@ var t = async_test("scale() with negative scale factors works"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.save(); -ctx.scale(-1, 1); -ctx.fillStyle = '#0f0'; -ctx.fillRect(-50, 0, 50, 50); -ctx.restore(); - -ctx.save(); -ctx.scale(1, -1); -ctx.fillStyle = '#0f0'; -ctx.fillRect(50, -50, 50, 50); -ctx.restore(); -_assertPixel(canvas, 25,25, 0,255,0,255); -_assertPixel(canvas, 75,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.save(); + ctx.scale(-1, 1); + ctx.fillStyle = '#0f0'; + ctx.fillRect(-50, 0, 50, 50); + ctx.restore(); + + ctx.save(); + ctx.scale(1, -1); + ctx.fillStyle = '#0f0'; + ctx.fillRect(50, -50, 50, 50); + ctx.restore(); + _assertPixel(canvas, 25,25, 0,255,0,255); + _assertPixel(canvas, 75,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.nonfinite.html index 59b15490452..c06f96eb222 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.nonfinite.html @@ -19,23 +19,22 @@ var t = async_test("scale() with Infinity/NaN is ignored"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.translate(100, 10); -ctx.scale(Infinity, 0.1); -ctx.scale(-Infinity, 0.1); -ctx.scale(NaN, 0.1); -ctx.scale(0.1, Infinity); -ctx.scale(0.1, -Infinity); -ctx.scale(0.1, NaN); -ctx.scale(Infinity, Infinity); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -10, 100, 50); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.translate(100, 10); + ctx.scale(Infinity, 0.1); + ctx.scale(-Infinity, 0.1); + ctx.scale(NaN, 0.1); + ctx.scale(0.1, Infinity); + ctx.scale(0.1, -Infinity); + ctx.scale(0.1, NaN); + ctx.scale(Infinity, Infinity); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -10, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.zero.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.zero.html index f495ee2e6a0..ae15034a194 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.zero.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.scale.zero.html @@ -19,25 +19,24 @@ var t = async_test("scale() with a scale factor of zero works"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.save(); -ctx.translate(50, 0); -ctx.scale(0, 1); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.restore(); - -ctx.save(); -ctx.translate(0, 25); -ctx.scale(1, 0); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.restore(); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.save(); + ctx.translate(50, 0); + ctx.scale(0, 1); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.restore(); + + ctx.save(); + ctx.translate(0, 25); + ctx.scale(1, 0); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.restore(); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.setTransform.multiple.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.setTransform.multiple.html index 5fa910a5b11..099831e6383 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.setTransform.multiple.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.setTransform.multiple.html @@ -19,16 +19,15 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.setTransform(1/2,0, 0,1/2, 0,0); -ctx.setTransform(); -ctx.setTransform(2,0, 0,2, 0,0); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 50, 25); -_assertPixel(canvas, 75,35, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.setTransform(1/2,0, 0,1/2, 0,0); + ctx.setTransform(); + ctx.setTransform(2,0, 0,2, 0,0); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 25); + _assertPixel(canvas, 75,35, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.setTransform.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.setTransform.nonfinite.html index fea3799a41f..019493ad162 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.setTransform.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.setTransform.nonfinite.html @@ -19,91 +19,90 @@ var t = async_test("setTransform() with Infinity/NaN is ignored"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.translate(100, 10); -ctx.setTransform(Infinity, 0, 0, 0, 0, 0); -ctx.setTransform(-Infinity, 0, 0, 0, 0, 0); -ctx.setTransform(NaN, 0, 0, 0, 0, 0); -ctx.setTransform(0, Infinity, 0, 0, 0, 0); -ctx.setTransform(0, -Infinity, 0, 0, 0, 0); -ctx.setTransform(0, NaN, 0, 0, 0, 0); -ctx.setTransform(0, 0, Infinity, 0, 0, 0); -ctx.setTransform(0, 0, -Infinity, 0, 0, 0); -ctx.setTransform(0, 0, NaN, 0, 0, 0); -ctx.setTransform(0, 0, 0, Infinity, 0, 0); -ctx.setTransform(0, 0, 0, -Infinity, 0, 0); -ctx.setTransform(0, 0, 0, NaN, 0, 0); -ctx.setTransform(0, 0, 0, 0, Infinity, 0); -ctx.setTransform(0, 0, 0, 0, -Infinity, 0); -ctx.setTransform(0, 0, 0, 0, NaN, 0); -ctx.setTransform(0, 0, 0, 0, 0, Infinity); -ctx.setTransform(0, 0, 0, 0, 0, -Infinity); -ctx.setTransform(0, 0, 0, 0, 0, NaN); -ctx.setTransform(Infinity, Infinity, 0, 0, 0, 0); -ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, 0); -ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, 0); -ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, 0); -ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, Infinity); -ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, 0); -ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, Infinity); -ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, Infinity); -ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, 0); -ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, 0); -ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, Infinity); -ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, 0); -ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, Infinity); -ctx.setTransform(Infinity, Infinity, 0, 0, 0, Infinity); -ctx.setTransform(Infinity, 0, Infinity, 0, 0, 0); -ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, 0); -ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, 0); -ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, Infinity); -ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, Infinity); -ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, 0); -ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, Infinity); -ctx.setTransform(Infinity, 0, Infinity, 0, 0, Infinity); -ctx.setTransform(Infinity, 0, 0, Infinity, 0, 0); -ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, 0); -ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, Infinity); -ctx.setTransform(Infinity, 0, 0, Infinity, 0, Infinity); -ctx.setTransform(Infinity, 0, 0, 0, Infinity, 0); -ctx.setTransform(Infinity, 0, 0, 0, Infinity, Infinity); -ctx.setTransform(Infinity, 0, 0, 0, 0, Infinity); -ctx.setTransform(0, Infinity, Infinity, 0, 0, 0); -ctx.setTransform(0, Infinity, Infinity, Infinity, 0, 0); -ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, 0); -ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.setTransform(0, Infinity, Infinity, Infinity, 0, Infinity); -ctx.setTransform(0, Infinity, Infinity, 0, Infinity, 0); -ctx.setTransform(0, Infinity, Infinity, 0, Infinity, Infinity); -ctx.setTransform(0, Infinity, Infinity, 0, 0, Infinity); -ctx.setTransform(0, Infinity, 0, Infinity, 0, 0); -ctx.setTransform(0, Infinity, 0, Infinity, Infinity, 0); -ctx.setTransform(0, Infinity, 0, Infinity, Infinity, Infinity); -ctx.setTransform(0, Infinity, 0, Infinity, 0, Infinity); -ctx.setTransform(0, Infinity, 0, 0, Infinity, 0); -ctx.setTransform(0, Infinity, 0, 0, Infinity, Infinity); -ctx.setTransform(0, Infinity, 0, 0, 0, Infinity); -ctx.setTransform(0, 0, Infinity, Infinity, 0, 0); -ctx.setTransform(0, 0, Infinity, Infinity, Infinity, 0); -ctx.setTransform(0, 0, Infinity, Infinity, Infinity, Infinity); -ctx.setTransform(0, 0, Infinity, Infinity, 0, Infinity); -ctx.setTransform(0, 0, Infinity, 0, Infinity, 0); -ctx.setTransform(0, 0, Infinity, 0, Infinity, Infinity); -ctx.setTransform(0, 0, Infinity, 0, 0, Infinity); -ctx.setTransform(0, 0, 0, Infinity, Infinity, 0); -ctx.setTransform(0, 0, 0, Infinity, Infinity, Infinity); -ctx.setTransform(0, 0, 0, Infinity, 0, Infinity); -ctx.setTransform(0, 0, 0, 0, Infinity, Infinity); + ctx.translate(100, 10); + ctx.setTransform(Infinity, 0, 0, 0, 0, 0); + ctx.setTransform(-Infinity, 0, 0, 0, 0, 0); + ctx.setTransform(NaN, 0, 0, 0, 0, 0); + ctx.setTransform(0, Infinity, 0, 0, 0, 0); + ctx.setTransform(0, -Infinity, 0, 0, 0, 0); + ctx.setTransform(0, NaN, 0, 0, 0, 0); + ctx.setTransform(0, 0, Infinity, 0, 0, 0); + ctx.setTransform(0, 0, -Infinity, 0, 0, 0); + ctx.setTransform(0, 0, NaN, 0, 0, 0); + ctx.setTransform(0, 0, 0, Infinity, 0, 0); + ctx.setTransform(0, 0, 0, -Infinity, 0, 0); + ctx.setTransform(0, 0, 0, NaN, 0, 0); + ctx.setTransform(0, 0, 0, 0, Infinity, 0); + ctx.setTransform(0, 0, 0, 0, -Infinity, 0); + ctx.setTransform(0, 0, 0, 0, NaN, 0); + ctx.setTransform(0, 0, 0, 0, 0, Infinity); + ctx.setTransform(0, 0, 0, 0, 0, -Infinity); + ctx.setTransform(0, 0, 0, 0, 0, NaN); + ctx.setTransform(Infinity, Infinity, 0, 0, 0, 0); + ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, 0); + ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, 0); + ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, 0); + ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, Infinity); + ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, 0); + ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, Infinity); + ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, 0); + ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, 0); + ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, Infinity); + ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, 0); + ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.setTransform(Infinity, Infinity, 0, 0, 0, Infinity); + ctx.setTransform(Infinity, 0, Infinity, 0, 0, 0); + ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, 0); + ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, 0); + ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, Infinity); + ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, Infinity); + ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, 0); + ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, Infinity); + ctx.setTransform(Infinity, 0, Infinity, 0, 0, Infinity); + ctx.setTransform(Infinity, 0, 0, Infinity, 0, 0); + ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, 0); + ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, Infinity); + ctx.setTransform(Infinity, 0, 0, Infinity, 0, Infinity); + ctx.setTransform(Infinity, 0, 0, 0, Infinity, 0); + ctx.setTransform(Infinity, 0, 0, 0, Infinity, Infinity); + ctx.setTransform(Infinity, 0, 0, 0, 0, Infinity); + ctx.setTransform(0, Infinity, Infinity, 0, 0, 0); + ctx.setTransform(0, Infinity, Infinity, Infinity, 0, 0); + ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, 0); + ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.setTransform(0, Infinity, Infinity, Infinity, 0, Infinity); + ctx.setTransform(0, Infinity, Infinity, 0, Infinity, 0); + ctx.setTransform(0, Infinity, Infinity, 0, Infinity, Infinity); + ctx.setTransform(0, Infinity, Infinity, 0, 0, Infinity); + ctx.setTransform(0, Infinity, 0, Infinity, 0, 0); + ctx.setTransform(0, Infinity, 0, Infinity, Infinity, 0); + ctx.setTransform(0, Infinity, 0, Infinity, Infinity, Infinity); + ctx.setTransform(0, Infinity, 0, Infinity, 0, Infinity); + ctx.setTransform(0, Infinity, 0, 0, Infinity, 0); + ctx.setTransform(0, Infinity, 0, 0, Infinity, Infinity); + ctx.setTransform(0, Infinity, 0, 0, 0, Infinity); + ctx.setTransform(0, 0, Infinity, Infinity, 0, 0); + ctx.setTransform(0, 0, Infinity, Infinity, Infinity, 0); + ctx.setTransform(0, 0, Infinity, Infinity, Infinity, Infinity); + ctx.setTransform(0, 0, Infinity, Infinity, 0, Infinity); + ctx.setTransform(0, 0, Infinity, 0, Infinity, 0); + ctx.setTransform(0, 0, Infinity, 0, Infinity, Infinity); + ctx.setTransform(0, 0, Infinity, 0, 0, Infinity); + ctx.setTransform(0, 0, 0, Infinity, Infinity, 0); + ctx.setTransform(0, 0, 0, Infinity, Infinity, Infinity); + ctx.setTransform(0, 0, 0, Infinity, 0, Infinity); + ctx.setTransform(0, 0, 0, 0, Infinity, Infinity); -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -10, 100, 50); - -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -10, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.setTransform.skewed.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.setTransform.skewed.html index e78a07897b5..f6f8655b1ed 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.setTransform.skewed.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.setTransform.skewed.html @@ -19,36 +19,35 @@ var t = async_test(""); _addTest(function(canvas, ctx) { -// Create green with a red square ring inside it -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(20, 10, 60, 30); -ctx.fillStyle = '#0f0'; -ctx.fillRect(40, 20, 20, 10); - -// Draw a skewed shape to fill that gap, to make sure it is aligned correctly -ctx.setTransform(1,4, 2,3, 5,6); -// Post-transform coordinates: -// [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]]; -// Hence pre-transform coordinates: -var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2], - [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2], - [-7.4,11.2]]; -ctx.beginPath(); -ctx.moveTo(pts[0][0], pts[0][1]); -for (var i = 0; i < pts.length; ++i) - ctx.lineTo(pts[i][0], pts[i][1]); -ctx.fill(); -_assertPixel(canvas, 21,11, 0,255,0,255); -_assertPixel(canvas, 79,11, 0,255,0,255); -_assertPixel(canvas, 21,39, 0,255,0,255); -_assertPixel(canvas, 79,39, 0,255,0,255); -_assertPixel(canvas, 39,19, 0,255,0,255); -_assertPixel(canvas, 61,19, 0,255,0,255); -_assertPixel(canvas, 39,31, 0,255,0,255); -_assertPixel(canvas, 61,31, 0,255,0,255); - + // Create green with a red square ring inside it + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(20, 10, 60, 30); + ctx.fillStyle = '#0f0'; + ctx.fillRect(40, 20, 20, 10); + + // Draw a skewed shape to fill that gap, to make sure it is aligned correctly + ctx.setTransform(1,4, 2,3, 5,6); + // Post-transform coordinates: + // [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]]; + // Hence pre-transform coordinates: + var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2], + [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2], + [-7.4,11.2]]; + ctx.beginPath(); + ctx.moveTo(pts[0][0], pts[0][1]); + for (var i = 0; i < pts.length; ++i) + ctx.lineTo(pts[i][0], pts[i][1]); + ctx.fill(); + _assertPixel(canvas, 21,11, 0,255,0,255); + _assertPixel(canvas, 79,11, 0,255,0,255); + _assertPixel(canvas, 21,39, 0,255,0,255); + _assertPixel(canvas, 79,39, 0,255,0,255); + _assertPixel(canvas, 39,19, 0,255,0,255); + _assertPixel(canvas, 61,19, 0,255,0,255); + _assertPixel(canvas, 39,31, 0,255,0,255); + _assertPixel(canvas, 61,31, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.transform.identity.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.transform.identity.html index c9742ac210c..be5de19a458 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.transform.identity.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.transform.identity.html @@ -19,14 +19,13 @@ var t = async_test("transform() with the identity matrix does nothing"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.transform(1,0, 0,1, 0,0); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.transform(1,0, 0,1, 0,0); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.transform.multiply.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.transform.multiply.html index 04e5adf4c86..1e8e4cccdf5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.transform.multiply.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.transform.multiply.html @@ -19,15 +19,14 @@ var t = async_test("transform() multiplies the CTM"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.transform(1,2, 3,4, 5,6); -ctx.transform(-2,1, 3/2,-1/2, 1,-2); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.transform(1,2, 3,4, 5,6); + ctx.transform(-2,1, 3/2,-1/2, 1,-2); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.transform.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.transform.nonfinite.html index b94da2c3818..d3fae8520ca 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.transform.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.transform.nonfinite.html @@ -19,91 +19,90 @@ var t = async_test("transform() with Infinity/NaN is ignored"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.translate(100, 10); -ctx.transform(Infinity, 0, 0, 0, 0, 0); -ctx.transform(-Infinity, 0, 0, 0, 0, 0); -ctx.transform(NaN, 0, 0, 0, 0, 0); -ctx.transform(0, Infinity, 0, 0, 0, 0); -ctx.transform(0, -Infinity, 0, 0, 0, 0); -ctx.transform(0, NaN, 0, 0, 0, 0); -ctx.transform(0, 0, Infinity, 0, 0, 0); -ctx.transform(0, 0, -Infinity, 0, 0, 0); -ctx.transform(0, 0, NaN, 0, 0, 0); -ctx.transform(0, 0, 0, Infinity, 0, 0); -ctx.transform(0, 0, 0, -Infinity, 0, 0); -ctx.transform(0, 0, 0, NaN, 0, 0); -ctx.transform(0, 0, 0, 0, Infinity, 0); -ctx.transform(0, 0, 0, 0, -Infinity, 0); -ctx.transform(0, 0, 0, 0, NaN, 0); -ctx.transform(0, 0, 0, 0, 0, Infinity); -ctx.transform(0, 0, 0, 0, 0, -Infinity); -ctx.transform(0, 0, 0, 0, 0, NaN); -ctx.transform(Infinity, Infinity, 0, 0, 0, 0); -ctx.transform(Infinity, Infinity, Infinity, 0, 0, 0); -ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, 0); -ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, 0); -ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, Infinity); -ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, 0); -ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, Infinity); -ctx.transform(Infinity, Infinity, Infinity, 0, 0, Infinity); -ctx.transform(Infinity, Infinity, 0, Infinity, 0, 0); -ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, 0); -ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.transform(Infinity, Infinity, 0, Infinity, 0, Infinity); -ctx.transform(Infinity, Infinity, 0, 0, Infinity, 0); -ctx.transform(Infinity, Infinity, 0, 0, Infinity, Infinity); -ctx.transform(Infinity, Infinity, 0, 0, 0, Infinity); -ctx.transform(Infinity, 0, Infinity, 0, 0, 0); -ctx.transform(Infinity, 0, Infinity, Infinity, 0, 0); -ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, 0); -ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, Infinity); -ctx.transform(Infinity, 0, Infinity, Infinity, 0, Infinity); -ctx.transform(Infinity, 0, Infinity, 0, Infinity, 0); -ctx.transform(Infinity, 0, Infinity, 0, Infinity, Infinity); -ctx.transform(Infinity, 0, Infinity, 0, 0, Infinity); -ctx.transform(Infinity, 0, 0, Infinity, 0, 0); -ctx.transform(Infinity, 0, 0, Infinity, Infinity, 0); -ctx.transform(Infinity, 0, 0, Infinity, Infinity, Infinity); -ctx.transform(Infinity, 0, 0, Infinity, 0, Infinity); -ctx.transform(Infinity, 0, 0, 0, Infinity, 0); -ctx.transform(Infinity, 0, 0, 0, Infinity, Infinity); -ctx.transform(Infinity, 0, 0, 0, 0, Infinity); -ctx.transform(0, Infinity, Infinity, 0, 0, 0); -ctx.transform(0, Infinity, Infinity, Infinity, 0, 0); -ctx.transform(0, Infinity, Infinity, Infinity, Infinity, 0); -ctx.transform(0, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.transform(0, Infinity, Infinity, Infinity, 0, Infinity); -ctx.transform(0, Infinity, Infinity, 0, Infinity, 0); -ctx.transform(0, Infinity, Infinity, 0, Infinity, Infinity); -ctx.transform(0, Infinity, Infinity, 0, 0, Infinity); -ctx.transform(0, Infinity, 0, Infinity, 0, 0); -ctx.transform(0, Infinity, 0, Infinity, Infinity, 0); -ctx.transform(0, Infinity, 0, Infinity, Infinity, Infinity); -ctx.transform(0, Infinity, 0, Infinity, 0, Infinity); -ctx.transform(0, Infinity, 0, 0, Infinity, 0); -ctx.transform(0, Infinity, 0, 0, Infinity, Infinity); -ctx.transform(0, Infinity, 0, 0, 0, Infinity); -ctx.transform(0, 0, Infinity, Infinity, 0, 0); -ctx.transform(0, 0, Infinity, Infinity, Infinity, 0); -ctx.transform(0, 0, Infinity, Infinity, Infinity, Infinity); -ctx.transform(0, 0, Infinity, Infinity, 0, Infinity); -ctx.transform(0, 0, Infinity, 0, Infinity, 0); -ctx.transform(0, 0, Infinity, 0, Infinity, Infinity); -ctx.transform(0, 0, Infinity, 0, 0, Infinity); -ctx.transform(0, 0, 0, Infinity, Infinity, 0); -ctx.transform(0, 0, 0, Infinity, Infinity, Infinity); -ctx.transform(0, 0, 0, Infinity, 0, Infinity); -ctx.transform(0, 0, 0, 0, Infinity, Infinity); + ctx.translate(100, 10); + ctx.transform(Infinity, 0, 0, 0, 0, 0); + ctx.transform(-Infinity, 0, 0, 0, 0, 0); + ctx.transform(NaN, 0, 0, 0, 0, 0); + ctx.transform(0, Infinity, 0, 0, 0, 0); + ctx.transform(0, -Infinity, 0, 0, 0, 0); + ctx.transform(0, NaN, 0, 0, 0, 0); + ctx.transform(0, 0, Infinity, 0, 0, 0); + ctx.transform(0, 0, -Infinity, 0, 0, 0); + ctx.transform(0, 0, NaN, 0, 0, 0); + ctx.transform(0, 0, 0, Infinity, 0, 0); + ctx.transform(0, 0, 0, -Infinity, 0, 0); + ctx.transform(0, 0, 0, NaN, 0, 0); + ctx.transform(0, 0, 0, 0, Infinity, 0); + ctx.transform(0, 0, 0, 0, -Infinity, 0); + ctx.transform(0, 0, 0, 0, NaN, 0); + ctx.transform(0, 0, 0, 0, 0, Infinity); + ctx.transform(0, 0, 0, 0, 0, -Infinity); + ctx.transform(0, 0, 0, 0, 0, NaN); + ctx.transform(Infinity, Infinity, 0, 0, 0, 0); + ctx.transform(Infinity, Infinity, Infinity, 0, 0, 0); + ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, 0); + ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, 0); + ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, Infinity); + ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, 0); + ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.transform(Infinity, Infinity, Infinity, 0, 0, Infinity); + ctx.transform(Infinity, Infinity, 0, Infinity, 0, 0); + ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, 0); + ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.transform(Infinity, Infinity, 0, Infinity, 0, Infinity); + ctx.transform(Infinity, Infinity, 0, 0, Infinity, 0); + ctx.transform(Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.transform(Infinity, Infinity, 0, 0, 0, Infinity); + ctx.transform(Infinity, 0, Infinity, 0, 0, 0); + ctx.transform(Infinity, 0, Infinity, Infinity, 0, 0); + ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, 0); + ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, Infinity); + ctx.transform(Infinity, 0, Infinity, Infinity, 0, Infinity); + ctx.transform(Infinity, 0, Infinity, 0, Infinity, 0); + ctx.transform(Infinity, 0, Infinity, 0, Infinity, Infinity); + ctx.transform(Infinity, 0, Infinity, 0, 0, Infinity); + ctx.transform(Infinity, 0, 0, Infinity, 0, 0); + ctx.transform(Infinity, 0, 0, Infinity, Infinity, 0); + ctx.transform(Infinity, 0, 0, Infinity, Infinity, Infinity); + ctx.transform(Infinity, 0, 0, Infinity, 0, Infinity); + ctx.transform(Infinity, 0, 0, 0, Infinity, 0); + ctx.transform(Infinity, 0, 0, 0, Infinity, Infinity); + ctx.transform(Infinity, 0, 0, 0, 0, Infinity); + ctx.transform(0, Infinity, Infinity, 0, 0, 0); + ctx.transform(0, Infinity, Infinity, Infinity, 0, 0); + ctx.transform(0, Infinity, Infinity, Infinity, Infinity, 0); + ctx.transform(0, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.transform(0, Infinity, Infinity, Infinity, 0, Infinity); + ctx.transform(0, Infinity, Infinity, 0, Infinity, 0); + ctx.transform(0, Infinity, Infinity, 0, Infinity, Infinity); + ctx.transform(0, Infinity, Infinity, 0, 0, Infinity); + ctx.transform(0, Infinity, 0, Infinity, 0, 0); + ctx.transform(0, Infinity, 0, Infinity, Infinity, 0); + ctx.transform(0, Infinity, 0, Infinity, Infinity, Infinity); + ctx.transform(0, Infinity, 0, Infinity, 0, Infinity); + ctx.transform(0, Infinity, 0, 0, Infinity, 0); + ctx.transform(0, Infinity, 0, 0, Infinity, Infinity); + ctx.transform(0, Infinity, 0, 0, 0, Infinity); + ctx.transform(0, 0, Infinity, Infinity, 0, 0); + ctx.transform(0, 0, Infinity, Infinity, Infinity, 0); + ctx.transform(0, 0, Infinity, Infinity, Infinity, Infinity); + ctx.transform(0, 0, Infinity, Infinity, 0, Infinity); + ctx.transform(0, 0, Infinity, 0, Infinity, 0); + ctx.transform(0, 0, Infinity, 0, Infinity, Infinity); + ctx.transform(0, 0, Infinity, 0, 0, Infinity); + ctx.transform(0, 0, 0, Infinity, Infinity, 0); + ctx.transform(0, 0, 0, Infinity, Infinity, Infinity); + ctx.transform(0, 0, 0, Infinity, 0, Infinity); + ctx.transform(0, 0, 0, 0, Infinity, Infinity); -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -10, 100, 50); - -_assertPixel(canvas, 50,25, 0,255,0,255); + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -10, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.transform.skewed.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.transform.skewed.html index 35cf997eb0a..c69756bc1d9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.transform.skewed.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.transform.skewed.html @@ -19,36 +19,35 @@ var t = async_test("transform() with skewy matrix transforms correctly"); _addTest(function(canvas, ctx) { -// Create green with a red square ring inside it -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(20, 10, 60, 30); -ctx.fillStyle = '#0f0'; -ctx.fillRect(40, 20, 20, 10); - -// Draw a skewed shape to fill that gap, to make sure it is aligned correctly -ctx.transform(1,4, 2,3, 5,6); -// Post-transform coordinates: -// [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]]; -// Hence pre-transform coordinates: -var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2], - [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2], - [-7.4,11.2]]; -ctx.beginPath(); -ctx.moveTo(pts[0][0], pts[0][1]); -for (var i = 0; i < pts.length; ++i) - ctx.lineTo(pts[i][0], pts[i][1]); -ctx.fill(); -_assertPixel(canvas, 21,11, 0,255,0,255); -_assertPixel(canvas, 79,11, 0,255,0,255); -_assertPixel(canvas, 21,39, 0,255,0,255); -_assertPixel(canvas, 79,39, 0,255,0,255); -_assertPixel(canvas, 39,19, 0,255,0,255); -_assertPixel(canvas, 61,19, 0,255,0,255); -_assertPixel(canvas, 39,31, 0,255,0,255); -_assertPixel(canvas, 61,31, 0,255,0,255); - + // Create green with a red square ring inside it + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(20, 10, 60, 30); + ctx.fillStyle = '#0f0'; + ctx.fillRect(40, 20, 20, 10); + + // Draw a skewed shape to fill that gap, to make sure it is aligned correctly + ctx.transform(1,4, 2,3, 5,6); + // Post-transform coordinates: + // [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]]; + // Hence pre-transform coordinates: + var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2], + [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2], + [-7.4,11.2]]; + ctx.beginPath(); + ctx.moveTo(pts[0][0], pts[0][1]); + for (var i = 0; i < pts.length; ++i) + ctx.lineTo(pts[i][0], pts[i][1]); + ctx.fill(); + _assertPixel(canvas, 21,11, 0,255,0,255); + _assertPixel(canvas, 79,11, 0,255,0,255); + _assertPixel(canvas, 21,39, 0,255,0,255); + _assertPixel(canvas, 79,39, 0,255,0,255); + _assertPixel(canvas, 39,19, 0,255,0,255); + _assertPixel(canvas, 61,19, 0,255,0,255); + _assertPixel(canvas, 39,31, 0,255,0,255); + _assertPixel(canvas, 61,31, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.translate.basic.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.translate.basic.html index 967d2d27614..189a1544b60 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.translate.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.translate.basic.html @@ -19,14 +19,13 @@ var t = async_test("translate() works"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.translate(100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -50, 100, 50); -_assertPixel(canvas, 90,40, 0,255,0,255); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.translate(100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -50, 100, 50); + _assertPixel(canvas, 90,40, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.translate.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.translate.nonfinite.html index 83a8ebf7ba8..0857693aff9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.translate.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/transformations/2d.transformation.translate.nonfinite.html @@ -19,23 +19,22 @@ var t = async_test("translate() with Infinity/NaN is ignored"); _addTest(function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.translate(100, 10); -ctx.translate(Infinity, 0.1); -ctx.translate(-Infinity, 0.1); -ctx.translate(NaN, 0.1); -ctx.translate(0.1, Infinity); -ctx.translate(0.1, -Infinity); -ctx.translate(0.1, NaN); -ctx.translate(Infinity, Infinity); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -10, 100, 50); - -_assertPixel(canvas, 50,25, 0,255,0,255); - + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.translate(100, 10); + ctx.translate(Infinity, 0.1); + ctx.translate(-Infinity, 0.1); + ctx.translate(NaN, 0.1); + ctx.translate(0.1, Infinity); + ctx.translate(0.1, -Infinity); + ctx.translate(0.1, NaN); + ctx.translate(Infinity, Infinity); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -10, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/video/2d.video.invalid.html b/tests/wpt/web-platform-tests/html/canvas/element/video/2d.video.invalid.html index 49062f02cc0..22b4e054f8a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/video/2d.video.invalid.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/video/2d.video.invalid.html @@ -19,12 +19,11 @@ var t = async_test("Verify test doesn't crash with invalid video."); _addTest(function(canvas, ctx) { -var v = document.createElement('video'); -v.play(); -// Test is deliberately not waiting for the 'playing' event to fire. -ctx.createPattern(v, 'repeat-x'); -ctx.drawImage(v, 0, 0); - + var v = document.createElement('video'); + v.play(); + // Test is deliberately not waiting for the 'playing' event to fire. + ctx.createPattern(v, 'repeat-x'); + ctx.drawImage(v, 0, 0); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.fillText.html b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.fillText.html index 5c1a6008755..9c3d1b33747 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.fillText.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.fillText.html @@ -19,40 +19,39 @@ var t = async_test("Test if fillText can be used with a solid display-p3 color"); _addTest(function(canvas, ctx) { -deferTest(); + deferTest(); -const fullRedInP3 = [255, 0, 0, 255]; -const sRGBRedInP3 = [234, 51, 35, 255]; + const fullRedInP3 = [255, 0, 0, 255]; + const sRGBRedInP3 = [234, 51, 35, 255]; -canvas.width = 100; -canvas.height = 100; + canvas.width = 100; + canvas.height = 100; -let f = new FontFace("Ahem", "url(/fonts/Ahem.ttf)"); -document.fonts.add(f); -f.load().then(function() { - t.step(function() { - ctx.font = "40px Ahem"; + let f = new FontFace("Ahem", "url(/fonts/Ahem.ttf)"); + document.fonts.add(f); + f.load().then(function() { + t.step(function() { + ctx.font = "40px Ahem"; - ctx.fillStyle = "#f00"; - ctx.fillText("A", 0, 50); + ctx.fillStyle = "#f00"; + ctx.fillText("A", 0, 50); - ctx.fillStyle = "black"; - ctx.fillStyle = "color(display-p3 100% 0 0)"; - ctx.fillText("A", 50, 50); + ctx.fillStyle = "black"; + ctx.fillStyle = "color(display-p3 100% 0 0)"; + ctx.fillText("A", 50, 50); - let pixels = ctx.getImageData(0, 0, canvas.width, canvas.height, { colorSpace: "display-p3" }).data; - let pixelAt = function(x, y) { - let offset = (y * canvas.width + x) * 4; - return [pixels[offset], pixels[offset + 1], pixels[offset + 2], pixels[offset + 3]]; - }; + let pixels = ctx.getImageData(0, 0, canvas.width, canvas.height, { colorSpace: "display-p3" }).data; + let pixelAt = function(x, y) { + let offset = (y * canvas.width + x) * 4; + return [pixels[offset], pixels[offset + 1], pixels[offset + 2], pixels[offset + 3]]; + }; - assert_array_equals(pixelAt(25, 25), sRGBRedInP3); - assert_array_equals(pixelAt(75, 25), fullRedInP3); - - t.done(); - }); -}); + assert_array_equals(pixelAt(25, 25), sRGBRedInP3); + assert_array_equals(pixelAt(75, 25), fullRedInP3); + t.done(); + }); + }); }, {colorSpace: "display-p3"}); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.fillText.shadow.html b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.fillText.shadow.html index 3bb74c6ae4a..cc459fb2cdf 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.fillText.shadow.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.fillText.shadow.html @@ -19,44 +19,43 @@ var t = async_test("Test if fillText can be used with a display-p3 shadow color"); _addTest(function(canvas, ctx) { -deferTest(); - -const fullRedInP3 = [255, 0, 0, 255]; -const sRGBRedInP3 = [234, 51, 35, 255]; - -canvas.width = 100; -canvas.height = 100; - -let f = new FontFace("Ahem", "url(/fonts/Ahem.ttf)"); -document.fonts.add(f); -f.load().then(function() { - t.step(function() { - ctx.font = "40px Ahem"; - - ctx.fillStyle = "black"; - ctx.shadowBlur = 4; - ctx.shadowOffsetX = 0; - ctx.shadowOffsetY = 50; - ctx.shadowColor = "#f00"; - ctx.fillText("A", 0, 0); - - ctx.shadowColor = "black"; - ctx.shadowColor = "color(display-p3 100% 0 0)"; - ctx.fillText("A", 50, 0); - - let pixels = ctx.getImageData(0, 0, canvas.width, canvas.height, { colorSpace: "display-p3" }).data; - let pixelAt = function(x, y) { - let offset = (y * canvas.width + x) * 4; - return [pixels[offset], pixels[offset + 1], pixels[offset + 2], pixels[offset + 3]]; - }; - - assert_array_equals(pixelAt(25, 25), sRGBRedInP3); - assert_array_equals(pixelAt(75, 25), fullRedInP3); - - t.done(); - }); -}); - + deferTest(); + + const fullRedInP3 = [255, 0, 0, 255]; + const sRGBRedInP3 = [234, 51, 35, 255]; + + canvas.width = 100; + canvas.height = 100; + + let f = new FontFace("Ahem", "url(/fonts/Ahem.ttf)"); + document.fonts.add(f); + f.load().then(function() { + t.step(function() { + ctx.font = "40px Ahem"; + + ctx.fillStyle = "black"; + ctx.shadowBlur = 4; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 50; + ctx.shadowColor = "#f00"; + ctx.fillText("A", 0, 0); + + ctx.shadowColor = "black"; + ctx.shadowColor = "color(display-p3 100% 0 0)"; + ctx.fillText("A", 50, 0); + + let pixels = ctx.getImageData(0, 0, canvas.width, canvas.height, { colorSpace: "display-p3" }).data; + let pixelAt = function(x, y) { + let offset = (y * canvas.width + x) * 4; + return [pixels[offset], pixels[offset + 1], pixels[offset + 2], pixels[offset + 3]]; + }; + + assert_array_equals(pixelAt(25, 25), sRGBRedInP3); + assert_array_equals(pixelAt(75, 25), fullRedInP3); + + t.done(); + }); + }); }, {colorSpace: "display-p3"}); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.strokeText.html b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.strokeText.html index c38084a4449..626a41b49b4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.strokeText.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.strokeText.html @@ -19,41 +19,40 @@ var t = async_test("Test if strokeText can be used with a solid display-p3 color"); _addTest(function(canvas, ctx) { -deferTest(); + deferTest(); -const fullRedInP3 = [255, 0, 0, 255]; -const sRGBRedInP3 = [234, 51, 35, 255]; + const fullRedInP3 = [255, 0, 0, 255]; + const sRGBRedInP3 = [234, 51, 35, 255]; -canvas.width = 100; -canvas.height = 100; + canvas.width = 100; + canvas.height = 100; -let f = new FontFace("Ahem", "url(/fonts/Ahem.ttf)"); -document.fonts.add(f); -f.load().then(function() { - t.step(function() { - ctx.font = "40px Ahem"; + let f = new FontFace("Ahem", "url(/fonts/Ahem.ttf)"); + document.fonts.add(f); + f.load().then(function() { + t.step(function() { + ctx.font = "40px Ahem"; - ctx.strokeStyle = "#f00"; - ctx.lineWidth = 20; - ctx.strokeText("A", 0, 50); + ctx.strokeStyle = "#f00"; + ctx.lineWidth = 20; + ctx.strokeText("A", 0, 50); - ctx.strokeStyle = "black"; - ctx.strokeStyle = "color(display-p3 100% 0 0)"; - ctx.strokeText("A", 50, 50); + ctx.strokeStyle = "black"; + ctx.strokeStyle = "color(display-p3 100% 0 0)"; + ctx.strokeText("A", 50, 50); - let pixels = ctx.getImageData(0, 0, canvas.width, canvas.height, { colorSpace: "display-p3" }).data; - let pixelAt = function(x, y) { - let offset = (y * canvas.width + x) * 4; - return [pixels[offset], pixels[offset + 1], pixels[offset + 2], pixels[offset + 3]]; - }; + let pixels = ctx.getImageData(0, 0, canvas.width, canvas.height, { colorSpace: "display-p3" }).data; + let pixelAt = function(x, y) { + let offset = (y * canvas.width + x) * 4; + return [pixels[offset], pixels[offset + 1], pixels[offset + 2], pixels[offset + 3]]; + }; - assert_array_equals(pixelAt(25, 25), sRGBRedInP3); - assert_array_equals(pixelAt(75, 25), fullRedInP3); - - t.done(); - }); -}); + assert_array_equals(pixelAt(25, 25), sRGBRedInP3); + assert_array_equals(pixelAt(75, 25), fullRedInP3); + t.done(); + }); + }); }, {colorSpace: "display-p3"}); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.to.p3.html b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.to.p3.html index 063012f2826..a03f49740f1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.to.p3.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.to.p3.html @@ -19,20 +19,19 @@ var t = async_test("test getImageData with display-p3 and uint8 from display p3 uint8 canvas"); _addTest(function(canvas, ctx) { -var color_style = 'rgb(50, 100, 150)'; -// [0.24304, 0.38818, 0.57227, 1.0] * 255 = [62, 99, 146, 255] -var pixel_expected = [62, 99, 146, 255]; -var epsilon = 2; -ctx.fillStyle = color_style; -ctx.fillRect(0, 0, 10, 10); - -var pixel = ctx.getImageData(5, 5, 1, 1, {colorSpace: "display-p3", storageFormat: "uint8"}).data; -_assertSame(pixel.length, pixel_expected.length, "pixel.length", "pixel_expected.length"); -assert_approx_equals(pixel[0], pixel_expected[0], 2); -assert_approx_equals(pixel[1], pixel_expected[1], 2); -assert_approx_equals(pixel[2], pixel_expected[2], 2); -assert_approx_equals(pixel[3], pixel_expected[3], 2); - + var color_style = 'rgb(50, 100, 150)'; + // [0.24304, 0.38818, 0.57227, 1.0] * 255 = [62, 99, 146, 255] + var pixel_expected = [62, 99, 146, 255]; + var epsilon = 2; + ctx.fillStyle = color_style; + ctx.fillRect(0, 0, 10, 10); + + var pixel = ctx.getImageData(5, 5, 1, 1, {colorSpace: "display-p3", storageFormat: "uint8"}).data; + _assertSame(pixel.length, pixel_expected.length, "pixel.length", "pixel_expected.length"); + assert_approx_equals(pixel[0], pixel_expected[0], 2); + assert_approx_equals(pixel[1], pixel_expected[1], 2); + assert_approx_equals(pixel[2], pixel_expected[2], 2); + assert_approx_equals(pixel[3], pixel_expected[3], 2); }, {colorSpace: "display-p3"}); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.to.srgb.html b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.to.srgb.html index 2cbeaf3b9b0..0433ae38c72 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.to.srgb.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.to.srgb.html @@ -19,19 +19,18 @@ var t = async_test("test getImageData with srsb and uint8 from display p3 uint8 canvas"); _addTest(function(canvas, ctx) { -var color_style = 'rgb(50, 100, 150)'; -var pixel_expected = [50, 100, 150, 255]; -var epsilon = 2; -ctx.fillStyle = color_style; -ctx.fillRect(0, 0, 10, 10); - -var pixel = ctx.getImageData(5, 5, 1, 1, {colorSpace: "srgb", storageFormat: "uint8"}).data; -_assertSame(pixel.length, pixel_expected.length, "pixel.length", "pixel_expected.length"); -assert_approx_equals(pixel[0], pixel_expected[0], 2); -assert_approx_equals(pixel[1], pixel_expected[1], 2); -assert_approx_equals(pixel[2], pixel_expected[2], 2); -assert_approx_equals(pixel[3], pixel_expected[3], 2); - + var color_style = 'rgb(50, 100, 150)'; + var pixel_expected = [50, 100, 150, 255]; + var epsilon = 2; + ctx.fillStyle = color_style; + ctx.fillRect(0, 0, 10, 10); + + var pixel = ctx.getImageData(5, 5, 1, 1, {colorSpace: "srgb", storageFormat: "uint8"}).data; + _assertSame(pixel.length, pixel_expected.length, "pixel.length", "pixel_expected.length"); + assert_approx_equals(pixel[0], pixel_expected[0], 2); + assert_approx_equals(pixel[1], pixel_expected[1], 2); + assert_approx_equals(pixel[2], pixel_expected[2], 2); + assert_approx_equals(pixel[3], pixel_expected[3], 2); }, {colorSpace: "display-p3"}); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toBlob.p3.canvas.html b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toBlob.p3.canvas.html index ef954e4fbbe..1a44af20a63 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toBlob.p3.canvas.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toBlob.p3.canvas.html @@ -19,32 +19,31 @@ var t = async_test("test if toblob returns p3 data from p3 color space canvas"); _addTest(function(canvas, ctx) { -ctx.fillStyle = "rgba(155, 27, 27, 1)"; -ctx.fillRect(0, 0, 1, 1); -ctx.fillStyle = "rgba(27, 155, 27, 0)"; -ctx.fillRect(1, 0, 1, 1); -ctx.fillStyle = "rgba(27, 27, 155, 0.5)"; -ctx.fillRect(0, 1, 1, 1); -ctx.fillStyle = "rgba(27, 27, 27, 0.5)"; -ctx.fillRect(1, 1, 1, 1); -expectedPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; - -var image = new Image(); -image.onload = t.step_func_done(function() { - var dstCanvas = document.createElement("canvas"); - dstCanvas.width = 2; - dstCanvas.height = 2; - var ctx = dstCanvas.getContext('2d', {colorSpace: "display-p3"}); - ctx.drawImage(image, 0, 0); - var actualPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; - assert_array_approx_equals(actualPixels, expectedPixels, 2); -}); - -canvas.toBlob(function(blob) { - var urlCreator = window.URL || window.webkitURL; - image.src = urlCreator.createObjectURL(blob); -}, 'image/png', 1); - + ctx.fillStyle = "rgba(155, 27, 27, 1)"; + ctx.fillRect(0, 0, 1, 1); + ctx.fillStyle = "rgba(27, 155, 27, 0)"; + ctx.fillRect(1, 0, 1, 1); + ctx.fillStyle = "rgba(27, 27, 155, 0.5)"; + ctx.fillRect(0, 1, 1, 1); + ctx.fillStyle = "rgba(27, 27, 27, 0.5)"; + ctx.fillRect(1, 1, 1, 1); + expectedPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; + + var image = new Image(); + image.onload = t.step_func_done(function() { + var dstCanvas = document.createElement("canvas"); + dstCanvas.width = 2; + dstCanvas.height = 2; + var ctx = dstCanvas.getContext('2d', {colorSpace: "display-p3"}); + ctx.drawImage(image, 0, 0); + var actualPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; + assert_array_approx_equals(actualPixels, expectedPixels, 2); + }); + + canvas.toBlob(function(blob) { + var urlCreator = window.URL || window.webkitURL; + image.src = urlCreator.createObjectURL(blob); + }, 'image/png', 1); }, {colorSpace: "display-p3"}); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toBlob.with.putImageData.html b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toBlob.with.putImageData.html index 609310e1c68..a53de722593 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toBlob.with.putImageData.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toBlob.with.putImageData.html @@ -19,38 +19,37 @@ var t = async_test("Use putImageData to put some p3 data in canvas and test if toBlob returns the same data"); _addTest(function(canvas, ctx) { -canvas.width = 2; -canvas.height = 2; - -// Create an ImageData using createImageData and populate its data array. -var image_data = ctx.createImageData(canvas.width, canvas.height, {colorSpace: "display-p3"}); -var color_data = [[255, 100, 150, 1.0], [255, 100, 150, 0.5], - [255, 100, 150, 0.5], [255, 100, 150, 0]]; -var data = image_data.data; -for (var i = 0; i < data.length / 4; ++i) { - data[4*i + 0] = color_data[i][0]; - data[4*i + 1] = color_data[i][1]; - data[4*i + 2] = color_data[i][2]; - data[4*i + 3] = color_data[i][3]; -} -ctx.putImageData(image_data, 0, 0); -expectedPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; - -var image = new Image(); -image.onload = t.step_func_done(function() { - var dstCanvas = document.createElement("canvas"); - dstCanvas.width = 2; - dstCanvas.height = 2; - var ctx = dstCanvas.getContext('2d', {colorSpace: "display-p3"}); - ctx.drawImage(image, 0, 0); - var actualPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; - assert_array_approx_equals(actualPixels, expectedPixels, 2); -}); -canvas.toBlob(function(blob) { - var urlCreator = window.URL || window.webkitURL; - image.src = urlCreator.createObjectURL(blob); -}, 'image/png', 1); - + canvas.width = 2; + canvas.height = 2; + + // Create an ImageData using createImageData and populate its data array. + var image_data = ctx.createImageData(canvas.width, canvas.height, {colorSpace: "display-p3"}); + var color_data = [[255, 100, 150, 1.0], [255, 100, 150, 0.5], + [255, 100, 150, 0.5], [255, 100, 150, 0]]; + var data = image_data.data; + for (var i = 0; i < data.length / 4; ++i) { + data[4*i + 0] = color_data[i][0]; + data[4*i + 1] = color_data[i][1]; + data[4*i + 2] = color_data[i][2]; + data[4*i + 3] = color_data[i][3]; + } + ctx.putImageData(image_data, 0, 0); + expectedPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; + + var image = new Image(); + image.onload = t.step_func_done(function() { + var dstCanvas = document.createElement("canvas"); + dstCanvas.width = 2; + dstCanvas.height = 2; + var ctx = dstCanvas.getContext('2d', {colorSpace: "display-p3"}); + ctx.drawImage(image, 0, 0); + var actualPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; + assert_array_approx_equals(actualPixels, expectedPixels, 2); + }); + canvas.toBlob(function(blob) { + var urlCreator = window.URL || window.webkitURL; + image.src = urlCreator.createObjectURL(blob); + }, 'image/png', 1); }, {colorSpace: "display-p3"}); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toDataURL.jpeg.p3.canvas.html b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toDataURL.jpeg.p3.canvas.html index b07a0d645d3..e0986cb8e8a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toDataURL.jpeg.p3.canvas.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toDataURL.jpeg.p3.canvas.html @@ -19,28 +19,27 @@ var t = async_test("test if toDataURL('image/jpeg') returns p3 data from canvas with p3 color space"); _addTest(function(canvas, ctx) { -ctx.fillStyle = "rgba(155, 27, 27, 1)"; -ctx.fillRect(0, 0, 1, 1); -ctx.fillStyle = "rgba(27, 155, 27, 0)"; -ctx.fillRect(1, 0, 1, 1); -ctx.fillStyle = "rgba(27, 27, 155, 0.5)"; -ctx.fillRect(0, 1, 1, 1); -ctx.fillStyle = "rgba(27, 27, 27, 0.5)"; -ctx.fillRect(1, 1, 1, 1); -expectedPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; - -var image = new Image(); -image.onload = t.step_func_done(function() { - var dstCanvas = document.createElement("canvas"); - dstCanvas.width = 2; - dstCanvas.height = 2; - var ctx = dstCanvas.getContext('2d', {colorSpace: "display-p3"}); - ctx.drawImage(image, 0, 0); - var actualPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; - assert_array_approx_equals(actualPixels, expectedPixels, 2); -}); -image.src = canvas.toDataURL("image/jpeg"); - + ctx.fillStyle = "rgba(155, 27, 27, 1)"; + ctx.fillRect(0, 0, 1, 1); + ctx.fillStyle = "rgba(27, 155, 27, 0)"; + ctx.fillRect(1, 0, 1, 1); + ctx.fillStyle = "rgba(27, 27, 155, 0.5)"; + ctx.fillRect(0, 1, 1, 1); + ctx.fillStyle = "rgba(27, 27, 27, 0.5)"; + ctx.fillRect(1, 1, 1, 1); + expectedPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; + + var image = new Image(); + image.onload = t.step_func_done(function() { + var dstCanvas = document.createElement("canvas"); + dstCanvas.width = 2; + dstCanvas.height = 2; + var ctx = dstCanvas.getContext('2d', {colorSpace: "display-p3"}); + ctx.drawImage(image, 0, 0); + var actualPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; + assert_array_approx_equals(actualPixels, expectedPixels, 2); + }); + image.src = canvas.toDataURL("image/jpeg"); }, {colorSpace: "display-p3"}); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toDataURL.p3.canvas.html b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toDataURL.p3.canvas.html index 38b64298314..94ba7039803 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toDataURL.p3.canvas.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toDataURL.p3.canvas.html @@ -19,28 +19,27 @@ var t = async_test("test if toDataURL returns p3 data from canvas with p3 color space"); _addTest(function(canvas, ctx) { -ctx.fillStyle = "rgba(155, 27, 27, 1)"; -ctx.fillRect(0, 0, 1, 1); -ctx.fillStyle = "rgba(27, 155, 27, 0)"; -ctx.fillRect(1, 0, 1, 1); -ctx.fillStyle = "rgba(27, 27, 155, 0.5)"; -ctx.fillRect(0, 1, 1, 1); -ctx.fillStyle = "rgba(27, 27, 27, 0.5)"; -ctx.fillRect(1, 1, 1, 1); -expectedPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; - -var image = new Image(); -image.onload = t.step_func_done(function() { - var dstCanvas = document.createElement("canvas"); - dstCanvas.width = 2; - dstCanvas.height = 2; - var ctx = dstCanvas.getContext('2d', {colorSpace: "display-p3"}); - ctx.drawImage(image, 0, 0); - var actualPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; - assert_array_approx_equals(actualPixels, expectedPixels, 2); -}); -image.src = canvas.toDataURL(); - + ctx.fillStyle = "rgba(155, 27, 27, 1)"; + ctx.fillRect(0, 0, 1, 1); + ctx.fillStyle = "rgba(27, 155, 27, 0)"; + ctx.fillRect(1, 0, 1, 1); + ctx.fillStyle = "rgba(27, 27, 155, 0.5)"; + ctx.fillRect(0, 1, 1, 1); + ctx.fillStyle = "rgba(27, 27, 27, 0.5)"; + ctx.fillRect(1, 1, 1, 1); + expectedPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; + + var image = new Image(); + image.onload = t.step_func_done(function() { + var dstCanvas = document.createElement("canvas"); + dstCanvas.width = 2; + dstCanvas.height = 2; + var ctx = dstCanvas.getContext('2d', {colorSpace: "display-p3"}); + ctx.drawImage(image, 0, 0); + var actualPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; + assert_array_approx_equals(actualPixels, expectedPixels, 2); + }); + image.src = canvas.toDataURL(); }, {colorSpace: "display-p3"}); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toDataURL.with.putImageData.html b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toDataURL.with.putImageData.html index 7eda499e73e..58d0718ebad 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toDataURL.with.putImageData.html +++ b/tests/wpt/web-platform-tests/html/canvas/element/wide-gamut-canvas/2d.color.space.p3.toDataURL.with.putImageData.html @@ -19,35 +19,34 @@ var t = async_test("Use putImageData to put some p3 data in canvas and test if toDataURL returns the same data"); _addTest(function(canvas, ctx) { -canvas.width = 2; -canvas.height = 2; - -// Create an ImageData using createImageData and populate its data array. -var image_data = ctx.createImageData(canvas.width, canvas.height, {colorSpace: "display-p3"}); -var color_data = [[255, 100, 150, 1.0], [255, 100, 150, 0.5], - [255, 100, 150, 0.5], [255, 100, 150, 0]]; -var data = image_data.data; -for (var i = 0; i < data.length / 4; ++i) { - data[4*i + 0] = color_data[i][0]; - data[4*i + 1] = color_data[i][1]; - data[4*i + 2] = color_data[i][2]; - data[4*i + 3] = color_data[i][3]; -} -ctx.putImageData(image_data, 0, 0); -expectedPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; - -var image = new Image(); -image.onload = t.step_func_done(function() { - var dstCanvas = document.createElement("canvas"); - dstCanvas.width = 2; - dstCanvas.height = 2; - var ctx = dstCanvas.getContext('2d', {colorSpace: "display-p3"}); - ctx.drawImage(image, 0, 0); - var actualPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; - assert_array_approx_equals(actualPixels, expectedPixels, 2); -}); -image.src = canvas.toDataURL(); - + canvas.width = 2; + canvas.height = 2; + + // Create an ImageData using createImageData and populate its data array. + var image_data = ctx.createImageData(canvas.width, canvas.height, {colorSpace: "display-p3"}); + var color_data = [[255, 100, 150, 1.0], [255, 100, 150, 0.5], + [255, 100, 150, 0.5], [255, 100, 150, 0]]; + var data = image_data.data; + for (var i = 0; i < data.length / 4; ++i) { + data[4*i + 0] = color_data[i][0]; + data[4*i + 1] = color_data[i][1]; + data[4*i + 2] = color_data[i][2]; + data[4*i + 3] = color_data[i][3]; + } + ctx.putImageData(image_data, 0, 0); + expectedPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; + + var image = new Image(); + image.onload = t.step_func_done(function() { + var dstCanvas = document.createElement("canvas"); + dstCanvas.width = 2; + dstCanvas.height = 2; + var ctx = dstCanvas.getContext('2d', {colorSpace: "display-p3"}); + ctx.drawImage(image, 0, 0); + var actualPixels = ctx.getImageData(0, 0, 2, 2, {colorSpace: "display-p3"}).data; + assert_array_approx_equals(actualPixels, expectedPixels, 2); + }); + image.src = canvas.toDataURL(); }, {colorSpace: "display-p3"}); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvas.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvas.html index 90825d29d24..c096253e270 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvas.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvas.html @@ -15,23 +15,22 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var offscreenCanvas2 = new OffscreenCanvas(100, 50); -var ctx2 = offscreenCanvas2.getContext('2d'); -ctx2.fillStyle = '#f00'; -ctx2.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations -ctx.drawImage(offscreenCanvas2, 0, 0); -_assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); -})(canvas, ctx); -t.done(); + var offscreenCanvas2 = new OffscreenCanvas(100, 50); + var ctx2 = offscreenCanvas2.getContext('2d'); + ctx2.fillStyle = '#f00'; + ctx2.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvas.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvas.worker.js index fe644f2ca3e..ede4733a831 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvas.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvas.worker.js @@ -13,19 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var offscreenCanvas2 = new OffscreenCanvas(100, 50); -var ctx2 = offscreenCanvas2.getContext('2d'); -ctx2.fillStyle = '#f00'; -ctx2.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations -ctx.drawImage(offscreenCanvas2, 0, 0); -_assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var offscreenCanvas2 = new OffscreenCanvas(100, 50); + var ctx2 = offscreenCanvas2.getContext('2d'); + ctx2.fillStyle = '#f00'; + ctx2.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvascopy.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvascopy.html index 15db07d6c1e..2eb06556eff 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvascopy.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvascopy.html @@ -15,24 +15,22 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var offscreenCanvas2 = new OffscreenCanvas(100, 50); -var ctx2 = offscreenCanvas2.getContext('2d'); -ctx2.fillStyle = '#0f0'; -ctx2.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalCompositeOperation = 'copy' -ctx.globalAlpha = 0.51; -ctx.drawImage(offscreenCanvas2, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,130, 2); -})(canvas, ctx); -t.done(); + var offscreenCanvas2 = new OffscreenCanvas(100, 50); + var ctx2 = offscreenCanvas2.getContext('2d'); + ctx2.fillStyle = '#0f0'; + ctx2.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'copy' + ctx.globalAlpha = 0.51; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,130, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvascopy.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvascopy.worker.js index e0ef84a78b4..f61859d2310 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvascopy.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvascopy.worker.js @@ -13,20 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var offscreenCanvas2 = new OffscreenCanvas(100, 50); -var ctx2 = offscreenCanvas2.getContext('2d'); -ctx2.fillStyle = '#0f0'; -ctx2.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalCompositeOperation = 'copy' -ctx.globalAlpha = 0.51; -ctx.drawImage(offscreenCanvas2, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,130, 2); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var offscreenCanvas2 = new OffscreenCanvas(100, 50); + var ctx2 = offscreenCanvas2.getContext('2d'); + ctx2.fillStyle = '#0f0'; + ctx2.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'copy' + ctx.globalAlpha = 0.51; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,130, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvaspattern.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvaspattern.html index f6ce643bc8a..cbfe1110922 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvaspattern.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvaspattern.html @@ -15,24 +15,23 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var offscreenCanvas2 = new OffscreenCanvas(100, 50); -var ctx2 = offscreenCanvas2.getContext('2d'); -ctx2.fillStyle = '#f00'; -ctx2.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = ctx.createPattern(offscreenCanvas2, 'no-repeat'); -ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); -})(canvas, ctx); -t.done(); + var offscreenCanvas2 = new OffscreenCanvas(100, 50); + var ctx2 = offscreenCanvas2.getContext('2d'); + ctx2.fillStyle = '#f00'; + ctx2.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = ctx.createPattern(offscreenCanvas2, 'no-repeat'); + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvaspattern.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvaspattern.worker.js index 2fb494d054a..7ecd568fae8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvaspattern.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.canvaspattern.worker.js @@ -13,20 +13,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var offscreenCanvas2 = new OffscreenCanvas(100, 50); -var ctx2 = offscreenCanvas2.getContext('2d'); -ctx2.fillStyle = '#f00'; -ctx2.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = ctx.createPattern(offscreenCanvas2, 'no-repeat'); -ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var offscreenCanvas2 = new OffscreenCanvas(100, 50); + var ctx2 = offscreenCanvas2.getContext('2d'); + ctx2.fillStyle = '#f00'; + ctx2.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = ctx.createPattern(offscreenCanvas2, 'no-repeat'); + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.default.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.default.html index 3d6983f90ce..57c3745d4e1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.default.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.default.html @@ -15,15 +15,13 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -_assertSame(ctx.globalAlpha, 1.0, "ctx.globalAlpha", "1.0"); -})(canvas, ctx); -t.done(); + _assertSame(ctx.globalAlpha, 1.0, "ctx.globalAlpha", "1.0"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.default.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.default.worker.js index 921c401551e..8acbd6a37fc 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.default.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.default.worker.js @@ -13,11 +13,10 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -_assertSame(ctx.globalAlpha, 1.0, "ctx.globalAlpha", "1.0"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + _assertSame(ctx.globalAlpha, 1.0, "ctx.globalAlpha", "1.0"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.fill.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.fill.html index f2410facc07..7b31db198e5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.fill.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.fill.html @@ -15,20 +15,19 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.fill.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.fill.worker.js index f354773bf46..3ea8aa7ebee 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.fill.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.fill.worker.js @@ -13,16 +13,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.image.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.image.html index cd7ee9cf2a5..4590a2ea1fe 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.image.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.image.html @@ -10,32 +10,21 @@ <script> -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); - }); -}); -})(canvas, ctx); -t.done(); + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); -}); +}, ""); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.image.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.image.worker.js index 1c804a3961e..20953417ccf 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.image.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.image.worker.js @@ -6,30 +6,21 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); - }); -}); -t.done(); - -}); + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); + t.done(); +}, ""); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.imagepattern.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.imagepattern.html index af1ca48e9d8..2fcbca84d21 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.imagepattern.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.imagepattern.html @@ -10,33 +10,22 @@ <script> -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); - createImageBitmap(blob) - .then(bitmap => { - ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); - ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations - ctx.fillRect(0, 0, 100, 50); - _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); - }); -}); -})(canvas, ctx); -t.done(); + ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); -}); +}, ""); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.imagepattern.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.imagepattern.worker.js index 58ef4f3b9dc..c6ab163b65b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.imagepattern.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.imagepattern.worker.js @@ -6,31 +6,22 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); - createImageBitmap(blob) - .then(bitmap => { - ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); - ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations - ctx.fillRect(0, 0, 100, 50); - _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); - }); -}); -t.done(); - -}); + ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); + t.done(); +}, ""); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.invalid.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.invalid.html index a4149ced9f2..9bcf85f1c45 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.invalid.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.invalid.html @@ -15,22 +15,22 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.globalAlpha = 0.5; -var a = ctx.globalAlpha; // might not be exactly 0.5, if it is rounded/quantised, so remember for future comparisons -ctx.globalAlpha = Infinity; -_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); -ctx.globalAlpha = -Infinity; -_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); -ctx.globalAlpha = NaN; -_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); -})(canvas, ctx); -t.done(); + ctx.globalAlpha = 0.5; + // This may not set it to exactly 0.5 if it is rounded/quantised, so + // remember for future comparisons. + var a = ctx.globalAlpha; + ctx.globalAlpha = Infinity; + _assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); + ctx.globalAlpha = -Infinity; + _assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); + ctx.globalAlpha = NaN; + _assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.invalid.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.invalid.worker.js index 88f017dec7d..4ca577ad440 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.invalid.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.invalid.worker.js @@ -13,18 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.globalAlpha = 0.5; -var a = ctx.globalAlpha; // might not be exactly 0.5, if it is rounded/quantised, so remember for future comparisons -ctx.globalAlpha = Infinity; -_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); -ctx.globalAlpha = -Infinity; -_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); -ctx.globalAlpha = NaN; -_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.globalAlpha = 0.5; + // This may not set it to exactly 0.5 if it is rounded/quantised, so + // remember for future comparisons. + var a = ctx.globalAlpha; + ctx.globalAlpha = Infinity; + _assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); + ctx.globalAlpha = -Infinity; + _assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); + ctx.globalAlpha = NaN; + _assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.range.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.range.html index 05736827be7..c064a41cbd9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.range.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.range.html @@ -15,24 +15,25 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.globalAlpha = 0.5; -var a = ctx.globalAlpha; // might not be exactly 0.5, if it is rounded/quantised, so remember for future comparisons -ctx.globalAlpha = 1.1; -_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); -ctx.globalAlpha = -0.1; -_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); -ctx.globalAlpha = 0; -_assertSame(ctx.globalAlpha, 0, "ctx.globalAlpha", "0"); -ctx.globalAlpha = 1; -_assertSame(ctx.globalAlpha, 1, "ctx.globalAlpha", "1"); -})(canvas, ctx); -t.done(); + ctx.globalAlpha = 0.5; + // This may not set it to exactly 0.5 if it is rounded/quantised, so + // remember for future comparisons. + var a = ctx.globalAlpha; + _assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); + ctx.globalAlpha = 1.1; + _assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); + ctx.globalAlpha = -0.1; + _assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); + ctx.globalAlpha = 0; + _assertSame(ctx.globalAlpha, 0, "ctx.globalAlpha", "0"); + ctx.globalAlpha = 1; + _assertSame(ctx.globalAlpha, 1, "ctx.globalAlpha", "1"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.range.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.range.worker.js index cfd08366654..76ea8199098 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.range.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.range.worker.js @@ -13,20 +13,22 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.globalAlpha = 0.5; -var a = ctx.globalAlpha; // might not be exactly 0.5, if it is rounded/quantised, so remember for future comparisons -ctx.globalAlpha = 1.1; -_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); -ctx.globalAlpha = -0.1; -_assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); -ctx.globalAlpha = 0; -_assertSame(ctx.globalAlpha, 0, "ctx.globalAlpha", "0"); -ctx.globalAlpha = 1; -_assertSame(ctx.globalAlpha, 1, "ctx.globalAlpha", "1"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.globalAlpha = 0.5; + // This may not set it to exactly 0.5 if it is rounded/quantised, so + // remember for future comparisons. + var a = ctx.globalAlpha; + _assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); + ctx.globalAlpha = 1.1; + _assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); + ctx.globalAlpha = -0.1; + _assertSame(ctx.globalAlpha, a, "ctx.globalAlpha", "a"); + ctx.globalAlpha = 0; + _assertSame(ctx.globalAlpha, 0, "ctx.globalAlpha", "0"); + ctx.globalAlpha = 1; + _assertSame(ctx.globalAlpha, 1, "ctx.globalAlpha", "1"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.casesensitive.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.casesensitive.html index f70fad638c2..f21b92f83e3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.casesensitive.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.casesensitive.html @@ -15,17 +15,15 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'Source-over'; -_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); -})(canvas, ctx); -t.done(); + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'Source-over'; + _assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.casesensitive.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.casesensitive.worker.js index b6f7adacb94..db1b54f5efe 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.casesensitive.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.casesensitive.worker.js @@ -13,13 +13,12 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'Source-over'; -_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'Source-over'; + _assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.clear.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.clear.html index 0ffbc9eb2e6..02496b6d89c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.clear.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.clear.html @@ -15,17 +15,15 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'clear'; -_assertSame(ctx.globalCompositeOperation, 'clear', "ctx.globalCompositeOperation", "'clear'"); -})(canvas, ctx); -t.done(); + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'clear'; + _assertSame(ctx.globalCompositeOperation, 'clear', "ctx.globalCompositeOperation", "'clear'"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.clear.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.clear.worker.js index e911da20232..947dd16c5f9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.clear.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.clear.worker.js @@ -13,13 +13,12 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'clear'; -_assertSame(ctx.globalCompositeOperation, 'clear', "ctx.globalCompositeOperation", "'clear'"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'clear'; + _assertSame(ctx.globalCompositeOperation, 'clear', "ctx.globalCompositeOperation", "'clear'"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.darker.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.darker.html index f4240b4e6e1..29dc039157c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.darker.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.darker.html @@ -15,17 +15,15 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'darker'; -_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); -})(canvas, ctx); -t.done(); + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'darker'; + _assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.darker.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.darker.worker.js index c90d4828e42..528f6b93d94 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.darker.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.darker.worker.js @@ -13,13 +13,12 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'darker'; -_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'darker'; + _assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.default.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.default.html index b18d17b585a..106c0e73f4b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.default.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.default.html @@ -15,15 +15,13 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -_assertSame(ctx.globalCompositeOperation, 'source-over', "ctx.globalCompositeOperation", "'source-over'"); -})(canvas, ctx); -t.done(); + _assertSame(ctx.globalCompositeOperation, 'source-over', "ctx.globalCompositeOperation", "'source-over'"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.default.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.default.worker.js index 691c153ea7a..ffdb75ad75a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.default.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.default.worker.js @@ -13,11 +13,10 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -_assertSame(ctx.globalCompositeOperation, 'source-over', "ctx.globalCompositeOperation", "'source-over'"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + _assertSame(ctx.globalCompositeOperation, 'source-over', "ctx.globalCompositeOperation", "'source-over'"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.get.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.get.html index ff12aa593e2..1ade1a4e549 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.get.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.get.html @@ -15,22 +15,20 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var modes = ['source-atop', 'source-in', 'source-out', 'source-over', - 'destination-atop', 'destination-in', 'destination-out', 'destination-over', - 'lighter', 'copy', 'xor']; -for (var i = 0; i < modes.length; ++i) -{ - ctx.globalCompositeOperation = modes[i]; - _assertSame(ctx.globalCompositeOperation, modes[i], "ctx.globalCompositeOperation", "modes[\""+(i)+"\"]"); -} -})(canvas, ctx); -t.done(); + var modes = ['source-atop', 'source-in', 'source-out', 'source-over', + 'destination-atop', 'destination-in', 'destination-out', 'destination-over', + 'lighter', 'copy', 'xor']; + for (var i = 0; i < modes.length; ++i) + { + ctx.globalCompositeOperation = modes[i]; + _assertSame(ctx.globalCompositeOperation, modes[i], "ctx.globalCompositeOperation", "modes[\""+(i)+"\"]"); + } + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.get.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.get.worker.js index 9009536ef7e..a266f1d537d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.get.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.get.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var modes = ['source-atop', 'source-in', 'source-out', 'source-over', - 'destination-atop', 'destination-in', 'destination-out', 'destination-over', - 'lighter', 'copy', 'xor']; -for (var i = 0; i < modes.length; ++i) -{ - ctx.globalCompositeOperation = modes[i]; - _assertSame(ctx.globalCompositeOperation, modes[i], "ctx.globalCompositeOperation", "modes[\""+(i)+"\"]"); -} -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var modes = ['source-atop', 'source-in', 'source-out', 'source-over', + 'destination-atop', 'destination-in', 'destination-out', 'destination-over', + 'lighter', 'copy', 'xor']; + for (var i = 0; i < modes.length; ++i) + { + ctx.globalCompositeOperation = modes[i]; + _assertSame(ctx.globalCompositeOperation, modes[i], "ctx.globalCompositeOperation", "modes[\""+(i)+"\"]"); + } + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.highlight.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.highlight.html index 175d7184bad..08def9a516b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.highlight.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.highlight.html @@ -15,17 +15,15 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'highlight'; -_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); -})(canvas, ctx); -t.done(); + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'highlight'; + _assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.highlight.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.highlight.worker.js index 234893aac7e..800c4605e62 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.highlight.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.highlight.worker.js @@ -13,13 +13,12 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'highlight'; -_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'highlight'; + _assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.nullsuffix.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.nullsuffix.html index 6572003dc3b..f021d40b53e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.nullsuffix.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.nullsuffix.html @@ -15,17 +15,15 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'source-over\0'; -_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); -})(canvas, ctx); -t.done(); + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'source-over\0'; + _assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.nullsuffix.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.nullsuffix.worker.js index ee3266e18af..1c1d5124a34 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.nullsuffix.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.nullsuffix.worker.js @@ -13,13 +13,12 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'source-over\0'; -_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'source-over\0'; + _assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.over.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.over.html index 950ca3d687b..df934336c62 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.over.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.over.html @@ -15,17 +15,15 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'over'; -_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); -})(canvas, ctx); -t.done(); + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'over'; + _assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.over.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.over.worker.js index 97a4209c838..f75a462e935 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.over.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.over.worker.js @@ -13,13 +13,12 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'over'; -_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'over'; + _assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.unrecognised.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.unrecognised.html index 31a4639056c..c649102cc71 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.unrecognised.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.unrecognised.html @@ -15,17 +15,15 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'nonexistent'; -_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); -})(canvas, ctx); -t.done(); + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'nonexistent'; + _assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.unrecognised.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.unrecognised.worker.js index d02e9f1aa76..23a6630e82a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.unrecognised.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/compositing/2d.composite.operation.unrecognised.worker.js @@ -13,13 +13,12 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.globalCompositeOperation = 'xor'; -ctx.globalCompositeOperation = 'nonexistent'; -_assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.globalCompositeOperation = 'xor'; + ctx.globalCompositeOperation = 'nonexistent'; + _assertSame(ctx.globalCompositeOperation, 'xor', "ctx.globalCompositeOperation", "'xor'"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.html index 6846bd89477..e754e6c6ba9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.html @@ -15,50 +15,48 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -_assertSame(ctx.save(), undefined, "ctx.save()", "undefined"); -_assertSame(ctx.restore(), undefined, "ctx.restore()", "undefined"); -_assertSame(ctx.scale(1, 1), undefined, "ctx.scale(1, 1)", "undefined"); -_assertSame(ctx.rotate(0), undefined, "ctx.rotate(0)", "undefined"); -_assertSame(ctx.translate(0, 0), undefined, "ctx.translate(0, 0)", "undefined"); -if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) - _assertSame(ctx.transform(1, 0, 0, 1, 0, 0), undefined, "ctx.transform(1, 0, 0, 1, 0, 0)", "undefined"); -} -if (ctx.setTransform) { - _assertSame(ctx.setTransform(1, 0, 0, 1, 0, 0), undefined, "ctx.setTransform(1, 0, 0, 1, 0, 0)", "undefined"); - _assertSame(ctx.setTransform(), undefined, "ctx.setTransform()", "undefined"); -} -_assertSame(ctx.clearRect(0, 0, 0, 0), undefined, "ctx.clearRect(0, 0, 0, 0)", "undefined"); -_assertSame(ctx.fillRect(0, 0, 0, 0), undefined, "ctx.fillRect(0, 0, 0, 0)", "undefined"); -_assertSame(ctx.strokeRect(0, 0, 0, 0), undefined, "ctx.strokeRect(0, 0, 0, 0)", "undefined"); -_assertSame(ctx.beginPath(), undefined, "ctx.beginPath()", "undefined"); -_assertSame(ctx.closePath(), undefined, "ctx.closePath()", "undefined"); -_assertSame(ctx.moveTo(0, 0), undefined, "ctx.moveTo(0, 0)", "undefined"); -_assertSame(ctx.lineTo(0, 0), undefined, "ctx.lineTo(0, 0)", "undefined"); -_assertSame(ctx.quadraticCurveTo(0, 0, 0, 0), undefined, "ctx.quadraticCurveTo(0, 0, 0, 0)", "undefined"); -_assertSame(ctx.bezierCurveTo(0, 0, 0, 0, 0, 0), undefined, "ctx.bezierCurveTo(0, 0, 0, 0, 0, 0)", "undefined"); -_assertSame(ctx.arcTo(0, 0, 0, 0, 1), undefined, "ctx.arcTo(0, 0, 0, 0, 1)", "undefined"); -_assertSame(ctx.rect(0, 0, 0, 0), undefined, "ctx.rect(0, 0, 0, 0)", "undefined"); -_assertSame(ctx.arc(0, 0, 1, 0, 0, true), undefined, "ctx.arc(0, 0, 1, 0, 0, true)", "undefined"); -_assertSame(ctx.fill(), undefined, "ctx.fill()", "undefined"); -_assertSame(ctx.stroke(), undefined, "ctx.stroke()", "undefined"); -_assertSame(ctx.clip(), undefined, "ctx.clip()", "undefined"); -if (ctx.fillText) { - _assertSame(ctx.fillText('test', 0, 0), undefined, "ctx.fillText('test', 0, 0)", "undefined"); - _assertSame(ctx.strokeText('test', 0, 0), undefined, "ctx.strokeText('test', 0, 0)", "undefined"); -} -if (ctx.putImageData) { - _assertSame(ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0), undefined, "ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0)", "undefined"); -} -_assertSame(ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0), undefined, "ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0)", "undefined"); -_assertSame(ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white'), undefined, "ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white')", "undefined"); -})(canvas, ctx); -t.done(); + _assertSame(ctx.save(), undefined, "ctx.save()", "undefined"); + _assertSame(ctx.restore(), undefined, "ctx.restore()", "undefined"); + _assertSame(ctx.scale(1, 1), undefined, "ctx.scale(1, 1)", "undefined"); + _assertSame(ctx.rotate(0), undefined, "ctx.rotate(0)", "undefined"); + _assertSame(ctx.translate(0, 0), undefined, "ctx.translate(0, 0)", "undefined"); + if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) + _assertSame(ctx.transform(1, 0, 0, 1, 0, 0), undefined, "ctx.transform(1, 0, 0, 1, 0, 0)", "undefined"); + } + if (ctx.setTransform) { + _assertSame(ctx.setTransform(1, 0, 0, 1, 0, 0), undefined, "ctx.setTransform(1, 0, 0, 1, 0, 0)", "undefined"); + _assertSame(ctx.setTransform(), undefined, "ctx.setTransform()", "undefined"); + } + _assertSame(ctx.clearRect(0, 0, 0, 0), undefined, "ctx.clearRect(0, 0, 0, 0)", "undefined"); + _assertSame(ctx.fillRect(0, 0, 0, 0), undefined, "ctx.fillRect(0, 0, 0, 0)", "undefined"); + _assertSame(ctx.strokeRect(0, 0, 0, 0), undefined, "ctx.strokeRect(0, 0, 0, 0)", "undefined"); + _assertSame(ctx.beginPath(), undefined, "ctx.beginPath()", "undefined"); + _assertSame(ctx.closePath(), undefined, "ctx.closePath()", "undefined"); + _assertSame(ctx.moveTo(0, 0), undefined, "ctx.moveTo(0, 0)", "undefined"); + _assertSame(ctx.lineTo(0, 0), undefined, "ctx.lineTo(0, 0)", "undefined"); + _assertSame(ctx.quadraticCurveTo(0, 0, 0, 0), undefined, "ctx.quadraticCurveTo(0, 0, 0, 0)", "undefined"); + _assertSame(ctx.bezierCurveTo(0, 0, 0, 0, 0, 0), undefined, "ctx.bezierCurveTo(0, 0, 0, 0, 0, 0)", "undefined"); + _assertSame(ctx.arcTo(0, 0, 0, 0, 1), undefined, "ctx.arcTo(0, 0, 0, 0, 1)", "undefined"); + _assertSame(ctx.rect(0, 0, 0, 0), undefined, "ctx.rect(0, 0, 0, 0)", "undefined"); + _assertSame(ctx.arc(0, 0, 1, 0, 0, true), undefined, "ctx.arc(0, 0, 1, 0, 0, true)", "undefined"); + _assertSame(ctx.fill(), undefined, "ctx.fill()", "undefined"); + _assertSame(ctx.stroke(), undefined, "ctx.stroke()", "undefined"); + _assertSame(ctx.clip(), undefined, "ctx.clip()", "undefined"); + if (ctx.fillText) { + _assertSame(ctx.fillText('test', 0, 0), undefined, "ctx.fillText('test', 0, 0)", "undefined"); + _assertSame(ctx.strokeText('test', 0, 0), undefined, "ctx.strokeText('test', 0, 0)", "undefined"); + } + if (ctx.putImageData) { + _assertSame(ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0), undefined, "ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0)", "undefined"); + } + _assertSame(ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0), undefined, "ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0)", "undefined"); + _assertSame(ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white'), undefined, "ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white')", "undefined"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.worker.js index 8d6ddc894f6..b16a39fd3c9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.basics.worker.js @@ -13,46 +13,45 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -_assertSame(ctx.save(), undefined, "ctx.save()", "undefined"); -_assertSame(ctx.restore(), undefined, "ctx.restore()", "undefined"); -_assertSame(ctx.scale(1, 1), undefined, "ctx.scale(1, 1)", "undefined"); -_assertSame(ctx.rotate(0), undefined, "ctx.rotate(0)", "undefined"); -_assertSame(ctx.translate(0, 0), undefined, "ctx.translate(0, 0)", "undefined"); -if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) - _assertSame(ctx.transform(1, 0, 0, 1, 0, 0), undefined, "ctx.transform(1, 0, 0, 1, 0, 0)", "undefined"); -} -if (ctx.setTransform) { - _assertSame(ctx.setTransform(1, 0, 0, 1, 0, 0), undefined, "ctx.setTransform(1, 0, 0, 1, 0, 0)", "undefined"); - _assertSame(ctx.setTransform(), undefined, "ctx.setTransform()", "undefined"); -} -_assertSame(ctx.clearRect(0, 0, 0, 0), undefined, "ctx.clearRect(0, 0, 0, 0)", "undefined"); -_assertSame(ctx.fillRect(0, 0, 0, 0), undefined, "ctx.fillRect(0, 0, 0, 0)", "undefined"); -_assertSame(ctx.strokeRect(0, 0, 0, 0), undefined, "ctx.strokeRect(0, 0, 0, 0)", "undefined"); -_assertSame(ctx.beginPath(), undefined, "ctx.beginPath()", "undefined"); -_assertSame(ctx.closePath(), undefined, "ctx.closePath()", "undefined"); -_assertSame(ctx.moveTo(0, 0), undefined, "ctx.moveTo(0, 0)", "undefined"); -_assertSame(ctx.lineTo(0, 0), undefined, "ctx.lineTo(0, 0)", "undefined"); -_assertSame(ctx.quadraticCurveTo(0, 0, 0, 0), undefined, "ctx.quadraticCurveTo(0, 0, 0, 0)", "undefined"); -_assertSame(ctx.bezierCurveTo(0, 0, 0, 0, 0, 0), undefined, "ctx.bezierCurveTo(0, 0, 0, 0, 0, 0)", "undefined"); -_assertSame(ctx.arcTo(0, 0, 0, 0, 1), undefined, "ctx.arcTo(0, 0, 0, 0, 1)", "undefined"); -_assertSame(ctx.rect(0, 0, 0, 0), undefined, "ctx.rect(0, 0, 0, 0)", "undefined"); -_assertSame(ctx.arc(0, 0, 1, 0, 0, true), undefined, "ctx.arc(0, 0, 1, 0, 0, true)", "undefined"); -_assertSame(ctx.fill(), undefined, "ctx.fill()", "undefined"); -_assertSame(ctx.stroke(), undefined, "ctx.stroke()", "undefined"); -_assertSame(ctx.clip(), undefined, "ctx.clip()", "undefined"); -if (ctx.fillText) { - _assertSame(ctx.fillText('test', 0, 0), undefined, "ctx.fillText('test', 0, 0)", "undefined"); - _assertSame(ctx.strokeText('test', 0, 0), undefined, "ctx.strokeText('test', 0, 0)", "undefined"); -} -if (ctx.putImageData) { - _assertSame(ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0), undefined, "ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0)", "undefined"); -} -_assertSame(ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0), undefined, "ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0)", "undefined"); -_assertSame(ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white'), undefined, "ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white')", "undefined"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + _assertSame(ctx.save(), undefined, "ctx.save()", "undefined"); + _assertSame(ctx.restore(), undefined, "ctx.restore()", "undefined"); + _assertSame(ctx.scale(1, 1), undefined, "ctx.scale(1, 1)", "undefined"); + _assertSame(ctx.rotate(0), undefined, "ctx.rotate(0)", "undefined"); + _assertSame(ctx.translate(0, 0), undefined, "ctx.translate(0, 0)", "undefined"); + if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) + _assertSame(ctx.transform(1, 0, 0, 1, 0, 0), undefined, "ctx.transform(1, 0, 0, 1, 0, 0)", "undefined"); + } + if (ctx.setTransform) { + _assertSame(ctx.setTransform(1, 0, 0, 1, 0, 0), undefined, "ctx.setTransform(1, 0, 0, 1, 0, 0)", "undefined"); + _assertSame(ctx.setTransform(), undefined, "ctx.setTransform()", "undefined"); + } + _assertSame(ctx.clearRect(0, 0, 0, 0), undefined, "ctx.clearRect(0, 0, 0, 0)", "undefined"); + _assertSame(ctx.fillRect(0, 0, 0, 0), undefined, "ctx.fillRect(0, 0, 0, 0)", "undefined"); + _assertSame(ctx.strokeRect(0, 0, 0, 0), undefined, "ctx.strokeRect(0, 0, 0, 0)", "undefined"); + _assertSame(ctx.beginPath(), undefined, "ctx.beginPath()", "undefined"); + _assertSame(ctx.closePath(), undefined, "ctx.closePath()", "undefined"); + _assertSame(ctx.moveTo(0, 0), undefined, "ctx.moveTo(0, 0)", "undefined"); + _assertSame(ctx.lineTo(0, 0), undefined, "ctx.lineTo(0, 0)", "undefined"); + _assertSame(ctx.quadraticCurveTo(0, 0, 0, 0), undefined, "ctx.quadraticCurveTo(0, 0, 0, 0)", "undefined"); + _assertSame(ctx.bezierCurveTo(0, 0, 0, 0, 0, 0), undefined, "ctx.bezierCurveTo(0, 0, 0, 0, 0, 0)", "undefined"); + _assertSame(ctx.arcTo(0, 0, 0, 0, 1), undefined, "ctx.arcTo(0, 0, 0, 0, 1)", "undefined"); + _assertSame(ctx.rect(0, 0, 0, 0), undefined, "ctx.rect(0, 0, 0, 0)", "undefined"); + _assertSame(ctx.arc(0, 0, 1, 0, 0, true), undefined, "ctx.arc(0, 0, 1, 0, 0, true)", "undefined"); + _assertSame(ctx.fill(), undefined, "ctx.fill()", "undefined"); + _assertSame(ctx.stroke(), undefined, "ctx.stroke()", "undefined"); + _assertSame(ctx.clip(), undefined, "ctx.clip()", "undefined"); + if (ctx.fillText) { + _assertSame(ctx.fillText('test', 0, 0), undefined, "ctx.fillText('test', 0, 0)", "undefined"); + _assertSame(ctx.strokeText('test', 0, 0), undefined, "ctx.strokeText('test', 0, 0)", "undefined"); + } + if (ctx.putImageData) { + _assertSame(ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0), undefined, "ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0)", "undefined"); + } + _assertSame(ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0), undefined, "ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0)", "undefined"); + _assertSame(ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white'), undefined, "ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white')", "undefined"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.html index e6930c0ac5f..fe28a68e902 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.html @@ -15,129 +15,127 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.scale(); }); -assert_throws_js(TypeError, function() { ctx.scale(1); }); -assert_throws_js(TypeError, function() { ctx.rotate(); }); -assert_throws_js(TypeError, function() { ctx.translate(); }); -assert_throws_js(TypeError, function() { ctx.translate(0); }); -if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) - assert_throws_js(TypeError, function() { ctx.transform(); }); - assert_throws_js(TypeError, function() { ctx.transform(1); }); - assert_throws_js(TypeError, function() { ctx.transform(1, 0); }); - assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0); }); - assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1); }); - assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1, 0); }); -} -if (ctx.setTransform) { - assert_throws_js(TypeError, function() { ctx.setTransform(1); }); - assert_throws_js(TypeError, function() { ctx.setTransform(1, 0); }); - assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0); }); - assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1); }); - assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1, 0); }); -} -assert_throws_js(TypeError, function() { ctx.createLinearGradient(); }); -assert_throws_js(TypeError, function() { ctx.createLinearGradient(0); }); -assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0); }); -assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1); }); -assert_throws_js(TypeError, function() { ctx.createRadialGradient(); }); -assert_throws_js(TypeError, function() { ctx.createRadialGradient(0); }); -assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0); }); -assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1); }); -assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0); }); -assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.createPattern(canvas); }); -assert_throws_js(TypeError, function() { ctx.clearRect(); }); -assert_throws_js(TypeError, function() { ctx.clearRect(0); }); -assert_throws_js(TypeError, function() { ctx.clearRect(0, 0); }); -assert_throws_js(TypeError, function() { ctx.clearRect(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.fillRect(); }); -assert_throws_js(TypeError, function() { ctx.fillRect(0); }); -assert_throws_js(TypeError, function() { ctx.fillRect(0, 0); }); -assert_throws_js(TypeError, function() { ctx.fillRect(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.strokeRect(); }); -assert_throws_js(TypeError, function() { ctx.strokeRect(0); }); -assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0); }); -assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.moveTo(); }); -assert_throws_js(TypeError, function() { ctx.moveTo(0); }); -assert_throws_js(TypeError, function() { ctx.lineTo(); }); -assert_throws_js(TypeError, function() { ctx.lineTo(0); }); -assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(); }); -assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0); }); -assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0); }); -assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.bezierCurveTo(); }); -assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0); }); -assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0); }); -assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.arcTo(); }); -assert_throws_js(TypeError, function() { ctx.arcTo(0); }); -assert_throws_js(TypeError, function() { ctx.arcTo(0, 0); }); -assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.rect(); }); -assert_throws_js(TypeError, function() { ctx.rect(0); }); -assert_throws_js(TypeError, function() { ctx.rect(0, 0); }); -assert_throws_js(TypeError, function() { ctx.rect(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.arc(); }); -assert_throws_js(TypeError, function() { ctx.arc(0); }); -assert_throws_js(TypeError, function() { ctx.arc(0, 0); }); -assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1); }); -assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1, 0); }); -// (6th argument to arc is optional) -if (ctx.isPointInPath) { - assert_throws_js(TypeError, function() { ctx.isPointInPath(); }); - assert_throws_js(TypeError, function() { ctx.isPointInPath(0); }); -} -if (ctx.drawFocusRing) { - assert_throws_js(TypeError, function() { ctx.drawFocusRing(); }); - assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas); }); - assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas, 0); }); -} -if (ctx.fillText) { - assert_throws_js(TypeError, function() { ctx.fillText(); }); - assert_throws_js(TypeError, function() { ctx.fillText('test'); }); - assert_throws_js(TypeError, function() { ctx.fillText('test', 0); }); - assert_throws_js(TypeError, function() { ctx.strokeText(); }); - assert_throws_js(TypeError, function() { ctx.strokeText('test'); }); - assert_throws_js(TypeError, function() { ctx.strokeText('test', 0); }); - assert_throws_js(TypeError, function() { ctx.measureText(); }); -} -assert_throws_js(TypeError, function() { ctx.drawImage(); }); -assert_throws_js(TypeError, function() { ctx.drawImage(canvas); }); -assert_throws_js(TypeError, function() { ctx.drawImage(canvas, 0); }); -// TODO: n >= 3 args on drawImage could be either a valid overload, -// or too few for another overload, or too many for another -// overload - what should happen? -if (ctx.createImageData) { - assert_throws_js(TypeError, function() { ctx.createImageData(); }); - assert_throws_js(TypeError, function() { ctx.createImageData(1); }); -} -if (ctx.getImageData) { - assert_throws_js(TypeError, function() { ctx.getImageData(); }); - assert_throws_js(TypeError, function() { ctx.getImageData(0); }); - assert_throws_js(TypeError, function() { ctx.getImageData(0, 0); }); - assert_throws_js(TypeError, function() { ctx.getImageData(0, 0, 1); }); -} -if (ctx.putImageData) { - var imgdata = ctx.getImageData(0, 0, 1, 1); - assert_throws_js(TypeError, function() { ctx.putImageData(); }); - assert_throws_js(TypeError, function() { ctx.putImageData(imgdata); }); - assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0); }); -} -var g = ctx.createLinearGradient(0, 0, 0, 0); -assert_throws_js(TypeError, function() { g.addColorStop(); }); -assert_throws_js(TypeError, function() { g.addColorStop(0); }); -})(canvas, ctx); -t.done(); + assert_throws_js(TypeError, function() { ctx.scale(); }); + assert_throws_js(TypeError, function() { ctx.scale(1); }); + assert_throws_js(TypeError, function() { ctx.rotate(); }); + assert_throws_js(TypeError, function() { ctx.translate(); }); + assert_throws_js(TypeError, function() { ctx.translate(0); }); + if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) + assert_throws_js(TypeError, function() { ctx.transform(); }); + assert_throws_js(TypeError, function() { ctx.transform(1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1, 0); }); + } + if (ctx.setTransform) { + assert_throws_js(TypeError, function() { ctx.setTransform(1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1, 0); }); + } + assert_throws_js(TypeError, function() { ctx.createLinearGradient(); }); + assert_throws_js(TypeError, function() { ctx.createLinearGradient(0); }); + assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0); }); + assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.createRadialGradient(); }); + assert_throws_js(TypeError, function() { ctx.createRadialGradient(0); }); + assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0); }); + assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0); }); + assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.createPattern(canvas); }); + assert_throws_js(TypeError, function() { ctx.clearRect(); }); + assert_throws_js(TypeError, function() { ctx.clearRect(0); }); + assert_throws_js(TypeError, function() { ctx.clearRect(0, 0); }); + assert_throws_js(TypeError, function() { ctx.clearRect(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.fillRect(); }); + assert_throws_js(TypeError, function() { ctx.fillRect(0); }); + assert_throws_js(TypeError, function() { ctx.fillRect(0, 0); }); + assert_throws_js(TypeError, function() { ctx.fillRect(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.strokeRect(); }); + assert_throws_js(TypeError, function() { ctx.strokeRect(0); }); + assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0); }); + assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.moveTo(); }); + assert_throws_js(TypeError, function() { ctx.moveTo(0); }); + assert_throws_js(TypeError, function() { ctx.lineTo(); }); + assert_throws_js(TypeError, function() { ctx.lineTo(0); }); + assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(); }); + assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0); }); + assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0); }); + assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.bezierCurveTo(); }); + assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0); }); + assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0); }); + assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.arcTo(); }); + assert_throws_js(TypeError, function() { ctx.arcTo(0); }); + assert_throws_js(TypeError, function() { ctx.arcTo(0, 0); }); + assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.rect(); }); + assert_throws_js(TypeError, function() { ctx.rect(0); }); + assert_throws_js(TypeError, function() { ctx.rect(0, 0); }); + assert_throws_js(TypeError, function() { ctx.rect(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.arc(); }); + assert_throws_js(TypeError, function() { ctx.arc(0); }); + assert_throws_js(TypeError, function() { ctx.arc(0, 0); }); + assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1, 0); }); + // (6th argument to arc is optional) + if (ctx.isPointInPath) { + assert_throws_js(TypeError, function() { ctx.isPointInPath(); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(0); }); + } + if (ctx.drawFocusRing) { + assert_throws_js(TypeError, function() { ctx.drawFocusRing(); }); + assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas); }); + assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas, 0); }); + } + if (ctx.fillText) { + assert_throws_js(TypeError, function() { ctx.fillText(); }); + assert_throws_js(TypeError, function() { ctx.fillText('test'); }); + assert_throws_js(TypeError, function() { ctx.fillText('test', 0); }); + assert_throws_js(TypeError, function() { ctx.strokeText(); }); + assert_throws_js(TypeError, function() { ctx.strokeText('test'); }); + assert_throws_js(TypeError, function() { ctx.strokeText('test', 0); }); + assert_throws_js(TypeError, function() { ctx.measureText(); }); + } + assert_throws_js(TypeError, function() { ctx.drawImage(); }); + assert_throws_js(TypeError, function() { ctx.drawImage(canvas); }); + assert_throws_js(TypeError, function() { ctx.drawImage(canvas, 0); }); + // TODO: n >= 3 args on drawImage could be either a valid overload, + // or too few for another overload, or too many for another + // overload - what should happen? + if (ctx.createImageData) { + assert_throws_js(TypeError, function() { ctx.createImageData(); }); + assert_throws_js(TypeError, function() { ctx.createImageData(1); }); + } + if (ctx.getImageData) { + assert_throws_js(TypeError, function() { ctx.getImageData(); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0, 1); }); + } + if (ctx.putImageData) { + var imgdata = ctx.getImageData(0, 0, 1, 1); + assert_throws_js(TypeError, function() { ctx.putImageData(); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0); }); + } + var g = ctx.createLinearGradient(0, 0, 0, 0); + assert_throws_js(TypeError, function() { g.addColorStop(); }); + assert_throws_js(TypeError, function() { g.addColorStop(0); }); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.worker.js index fe1b111f05b..f249fcb881a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/conformance-requirements/2d.conformance.requirements.missingargs.worker.js @@ -13,125 +13,124 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -assert_throws_js(TypeError, function() { ctx.scale(); }); -assert_throws_js(TypeError, function() { ctx.scale(1); }); -assert_throws_js(TypeError, function() { ctx.rotate(); }); -assert_throws_js(TypeError, function() { ctx.translate(); }); -assert_throws_js(TypeError, function() { ctx.translate(0); }); -if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) - assert_throws_js(TypeError, function() { ctx.transform(); }); - assert_throws_js(TypeError, function() { ctx.transform(1); }); - assert_throws_js(TypeError, function() { ctx.transform(1, 0); }); - assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0); }); - assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1); }); - assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1, 0); }); -} -if (ctx.setTransform) { - assert_throws_js(TypeError, function() { ctx.setTransform(1); }); - assert_throws_js(TypeError, function() { ctx.setTransform(1, 0); }); - assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0); }); - assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1); }); - assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1, 0); }); -} -assert_throws_js(TypeError, function() { ctx.createLinearGradient(); }); -assert_throws_js(TypeError, function() { ctx.createLinearGradient(0); }); -assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0); }); -assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1); }); -assert_throws_js(TypeError, function() { ctx.createRadialGradient(); }); -assert_throws_js(TypeError, function() { ctx.createRadialGradient(0); }); -assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0); }); -assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1); }); -assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0); }); -assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.createPattern(canvas); }); -assert_throws_js(TypeError, function() { ctx.clearRect(); }); -assert_throws_js(TypeError, function() { ctx.clearRect(0); }); -assert_throws_js(TypeError, function() { ctx.clearRect(0, 0); }); -assert_throws_js(TypeError, function() { ctx.clearRect(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.fillRect(); }); -assert_throws_js(TypeError, function() { ctx.fillRect(0); }); -assert_throws_js(TypeError, function() { ctx.fillRect(0, 0); }); -assert_throws_js(TypeError, function() { ctx.fillRect(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.strokeRect(); }); -assert_throws_js(TypeError, function() { ctx.strokeRect(0); }); -assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0); }); -assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.moveTo(); }); -assert_throws_js(TypeError, function() { ctx.moveTo(0); }); -assert_throws_js(TypeError, function() { ctx.lineTo(); }); -assert_throws_js(TypeError, function() { ctx.lineTo(0); }); -assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(); }); -assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0); }); -assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0); }); -assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.bezierCurveTo(); }); -assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0); }); -assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0); }); -assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.arcTo(); }); -assert_throws_js(TypeError, function() { ctx.arcTo(0); }); -assert_throws_js(TypeError, function() { ctx.arcTo(0, 0); }); -assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.rect(); }); -assert_throws_js(TypeError, function() { ctx.rect(0); }); -assert_throws_js(TypeError, function() { ctx.rect(0, 0); }); -assert_throws_js(TypeError, function() { ctx.rect(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.arc(); }); -assert_throws_js(TypeError, function() { ctx.arc(0); }); -assert_throws_js(TypeError, function() { ctx.arc(0, 0); }); -assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1); }); -assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1, 0); }); -// (6th argument to arc is optional) -if (ctx.isPointInPath) { - assert_throws_js(TypeError, function() { ctx.isPointInPath(); }); - assert_throws_js(TypeError, function() { ctx.isPointInPath(0); }); -} -if (ctx.drawFocusRing) { - assert_throws_js(TypeError, function() { ctx.drawFocusRing(); }); - assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas); }); - assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas, 0); }); -} -if (ctx.fillText) { - assert_throws_js(TypeError, function() { ctx.fillText(); }); - assert_throws_js(TypeError, function() { ctx.fillText('test'); }); - assert_throws_js(TypeError, function() { ctx.fillText('test', 0); }); - assert_throws_js(TypeError, function() { ctx.strokeText(); }); - assert_throws_js(TypeError, function() { ctx.strokeText('test'); }); - assert_throws_js(TypeError, function() { ctx.strokeText('test', 0); }); - assert_throws_js(TypeError, function() { ctx.measureText(); }); -} -assert_throws_js(TypeError, function() { ctx.drawImage(); }); -assert_throws_js(TypeError, function() { ctx.drawImage(canvas); }); -assert_throws_js(TypeError, function() { ctx.drawImage(canvas, 0); }); -// TODO: n >= 3 args on drawImage could be either a valid overload, -// or too few for another overload, or too many for another -// overload - what should happen? -if (ctx.createImageData) { - assert_throws_js(TypeError, function() { ctx.createImageData(); }); - assert_throws_js(TypeError, function() { ctx.createImageData(1); }); -} -if (ctx.getImageData) { - assert_throws_js(TypeError, function() { ctx.getImageData(); }); - assert_throws_js(TypeError, function() { ctx.getImageData(0); }); - assert_throws_js(TypeError, function() { ctx.getImageData(0, 0); }); - assert_throws_js(TypeError, function() { ctx.getImageData(0, 0, 1); }); -} -if (ctx.putImageData) { - var imgdata = ctx.getImageData(0, 0, 1, 1); - assert_throws_js(TypeError, function() { ctx.putImageData(); }); - assert_throws_js(TypeError, function() { ctx.putImageData(imgdata); }); - assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0); }); -} -var g = ctx.createLinearGradient(0, 0, 0, 0); -assert_throws_js(TypeError, function() { g.addColorStop(); }); -assert_throws_js(TypeError, function() { g.addColorStop(0); }); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + assert_throws_js(TypeError, function() { ctx.scale(); }); + assert_throws_js(TypeError, function() { ctx.scale(1); }); + assert_throws_js(TypeError, function() { ctx.rotate(); }); + assert_throws_js(TypeError, function() { ctx.translate(); }); + assert_throws_js(TypeError, function() { ctx.translate(0); }); + if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) + assert_throws_js(TypeError, function() { ctx.transform(); }); + assert_throws_js(TypeError, function() { ctx.transform(1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1, 0); }); + } + if (ctx.setTransform) { + assert_throws_js(TypeError, function() { ctx.setTransform(1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1, 0); }); + } + assert_throws_js(TypeError, function() { ctx.createLinearGradient(); }); + assert_throws_js(TypeError, function() { ctx.createLinearGradient(0); }); + assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0); }); + assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.createRadialGradient(); }); + assert_throws_js(TypeError, function() { ctx.createRadialGradient(0); }); + assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0); }); + assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0); }); + assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.createPattern(canvas); }); + assert_throws_js(TypeError, function() { ctx.clearRect(); }); + assert_throws_js(TypeError, function() { ctx.clearRect(0); }); + assert_throws_js(TypeError, function() { ctx.clearRect(0, 0); }); + assert_throws_js(TypeError, function() { ctx.clearRect(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.fillRect(); }); + assert_throws_js(TypeError, function() { ctx.fillRect(0); }); + assert_throws_js(TypeError, function() { ctx.fillRect(0, 0); }); + assert_throws_js(TypeError, function() { ctx.fillRect(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.strokeRect(); }); + assert_throws_js(TypeError, function() { ctx.strokeRect(0); }); + assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0); }); + assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.moveTo(); }); + assert_throws_js(TypeError, function() { ctx.moveTo(0); }); + assert_throws_js(TypeError, function() { ctx.lineTo(); }); + assert_throws_js(TypeError, function() { ctx.lineTo(0); }); + assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(); }); + assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0); }); + assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0); }); + assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.bezierCurveTo(); }); + assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0); }); + assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0); }); + assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.arcTo(); }); + assert_throws_js(TypeError, function() { ctx.arcTo(0); }); + assert_throws_js(TypeError, function() { ctx.arcTo(0, 0); }); + assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.rect(); }); + assert_throws_js(TypeError, function() { ctx.rect(0); }); + assert_throws_js(TypeError, function() { ctx.rect(0, 0); }); + assert_throws_js(TypeError, function() { ctx.rect(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.arc(); }); + assert_throws_js(TypeError, function() { ctx.arc(0); }); + assert_throws_js(TypeError, function() { ctx.arc(0, 0); }); + assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1, 0); }); + // (6th argument to arc is optional) + if (ctx.isPointInPath) { + assert_throws_js(TypeError, function() { ctx.isPointInPath(); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(0); }); + } + if (ctx.drawFocusRing) { + assert_throws_js(TypeError, function() { ctx.drawFocusRing(); }); + assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas); }); + assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas, 0); }); + } + if (ctx.fillText) { + assert_throws_js(TypeError, function() { ctx.fillText(); }); + assert_throws_js(TypeError, function() { ctx.fillText('test'); }); + assert_throws_js(TypeError, function() { ctx.fillText('test', 0); }); + assert_throws_js(TypeError, function() { ctx.strokeText(); }); + assert_throws_js(TypeError, function() { ctx.strokeText('test'); }); + assert_throws_js(TypeError, function() { ctx.strokeText('test', 0); }); + assert_throws_js(TypeError, function() { ctx.measureText(); }); + } + assert_throws_js(TypeError, function() { ctx.drawImage(); }); + assert_throws_js(TypeError, function() { ctx.drawImage(canvas); }); + assert_throws_js(TypeError, function() { ctx.drawImage(canvas, 0); }); + // TODO: n >= 3 args on drawImage could be either a valid overload, + // or too few for another overload, or too many for another + // overload - what should happen? + if (ctx.createImageData) { + assert_throws_js(TypeError, function() { ctx.createImageData(); }); + assert_throws_js(TypeError, function() { ctx.createImageData(1); }); + } + if (ctx.getImageData) { + assert_throws_js(TypeError, function() { ctx.getImageData(); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0, 1); }); + } + if (ctx.putImageData) { + var imgdata = ctx.getImageData(0, 0, 1, 1); + assert_throws_js(TypeError, function() { ctx.putImageData(); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0); }); + } + var g = ctx.createLinearGradient(0, 0, 0, 0); + assert_throws_js(TypeError, function() { g.addColorStop(); }); + assert_throws_js(TypeError, function() { g.addColorStop(0); }); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.html index a371d91431b..7f1f66654d4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.3arg</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,51 +10,28 @@ <script> -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -var promise1 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/red.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; -}); -var promise2 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/green.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; -}); -Promise.all([promise1, promise2]).then(function(response1, response2) { - var promise3 = createImageBitmap(response1); - var promise4 = createImageBitmap(response2); - Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { - ctx.drawImage(bitmap2, 0, 0); - ctx.drawImage(bitmap1, -100, 0); - ctx.drawImage(bitmap1, 100, 0); - ctx.drawImage(bitmap1, 0, -50); - ctx.drawImage(bitmap1, 0, 50); - _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - }, t_fail); -}).then(t_pass, t_fail); -})(canvas, ctx); - -}); +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.drawImage(bitmap_green, 0, 0); + ctx.drawImage(bitmap_red, -100, 0); + ctx.drawImage(bitmap_red, 100, 0); + ctx.drawImage(bitmap_red, 0, -50); + ctx.drawImage(bitmap_red, 0, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + +}, ""); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.worker.js index 22cb3653e41..b2f860bc606 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.3arg // Description: @@ -7,49 +6,28 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -var promise1 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/red.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; -}); -var promise2 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/green.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; -}); -Promise.all([promise1, promise2]).then(function(response1, response2) { - var promise3 = createImageBitmap(response1); - var promise4 = createImageBitmap(response2); - Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { - ctx.drawImage(bitmap2, 0, 0); - ctx.drawImage(bitmap1, -100, 0); - ctx.drawImage(bitmap1, 100, 0); - ctx.drawImage(bitmap1, 0, -50); - ctx.drawImage(bitmap1, 0, 50); - _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - }, t_fail); -}).then(t_pass, t_fail); + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); -}); + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.drawImage(bitmap_green, 0, 0); + ctx.drawImage(bitmap_red, -100, 0); + ctx.drawImage(bitmap_red, 100, 0); + ctx.drawImage(bitmap_red, 0, -50); + ctx.drawImage(bitmap_red, 0, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + t.done(); +}, ""); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.html index 18ae25d829c..f7bf0568c4c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.5arg</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,52 +10,29 @@ <script> -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -var promise1 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/red.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; -}); -var promise2 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/green.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; -}); -Promise.all([promise1, promise2]).then(function(response1, response2) { - var promise3 = createImageBitmap(response1); - var promise4 = createImageBitmap(response2); - Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { - ctx.drawImage(bitmap2, 50, 0, 50, 50); - ctx.drawImage(bitmap1, 0, 0, 50, 50); - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 50, 50); - _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - }, t_fail); -}).then(t_pass, t_fail); -})(canvas, ctx); - -}); +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.drawImage(bitmap_green, 50, 0, 50, 50); + ctx.drawImage(bitmap_red, 0, 0, 50, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + +}, ""); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.worker.js index 3906a5a00b3..f725acf0118 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.5arg // Description: @@ -7,50 +6,29 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -var promise1 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/red.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; -}); -var promise2 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/green.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; -}); -Promise.all([promise1, promise2]).then(function(response1, response2) { - var promise3 = createImageBitmap(response1); - var promise4 = createImageBitmap(response2); - Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { - ctx.drawImage(bitmap2, 50, 0, 50, 50); - ctx.drawImage(bitmap1, 0, 0, 50, 50); - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 50, 50); - _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - }, t_fail); -}).then(t_pass, t_fail); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); -}); + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.drawImage(bitmap_green, 50, 0, 50, 50); + ctx.drawImage(bitmap_red, 0, 0, 50, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + t.done(); +}, ""); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.html index 508376cd60c..47e442e23eb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.9arg.basic</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,33 +10,22 @@ <script> -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/green.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, 50); - _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - }); -}); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/green.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + +}, ""); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.worker.js index 36770f779be..b2d6f7d860d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.9arg.basic // Description: @@ -7,31 +6,22 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/green.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, 50); - _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - }); -}); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/green.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + t.done(); +}, ""); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.html index 079a57ddbc1..5e0f3f10881 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.9arg.destpos</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,53 +10,28 @@ <script> -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -var promise1 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/red.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; -}); -var promise2 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/green.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; -}); -Promise.all([promise1, promise2]).then(function(response1, response2) { - var promise3 = createImageBitmap(response1); - var promise4 = createImageBitmap(response2); - Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { - ctx.drawImage(bitmap2, 0, 0, 100, 50, 0, 0, 100, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, -100, 0, 100, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, 100, 0, 100, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, -50, 100, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, 50, 100, 50); - _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - }, t_fail); -}).then(t_pass, t_fail); -})(canvas, ctx); - -}); +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.drawImage(bitmap_green, 0, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap_green, 0, 0, 100, 50, -100, 0, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 100, 0, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, -50, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, 50, 100, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + +}, ""); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.worker.js index 81fdae81df6..380d526f9b4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.9arg.destpos // Description: @@ -7,51 +6,28 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -var promise1 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/red.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; -}); -var promise2 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/green.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; -}); -Promise.all([promise1, promise2]).then(function(response1, response2) { - var promise3 = createImageBitmap(response1); - var promise4 = createImageBitmap(response2); - Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { - ctx.drawImage(bitmap2, 0, 0, 100, 50, 0, 0, 100, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, -100, 0, 100, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, 100, 0, 100, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, -50, 100, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, 50, 100, 50); - _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - }, t_fail); -}).then(t_pass, t_fail); + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); -}); + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.drawImage(bitmap_green, 0, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap_green, 0, 0, 100, 50, -100, 0, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 100, 0, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, -50, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, 50, 100, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + t.done(); +}, ""); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.html index 1996227c352..93b587a44ff 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.9arg.destsize</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,53 +10,30 @@ <script> -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -var promise1 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/red.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; -}); -var promise2 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/green.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; -}); -Promise.all([promise1, promise2]).then(function(response1, response2) { - var promise3 = createImageBitmap(response1); - var promise4 = createImageBitmap(response2); - Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { - ctx.drawImage(bitmap2, 1, 1, 1, 1, 0, 0, 100, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, -50, 0, 50, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, 100, 0, 50, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, -25, 100, 25); - ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, 50, 100, 25); - _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - }, t_fail); -}).then(t_pass, t_fail); -})(canvas, ctx); - -}); +promise_test(async t => { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.drawImage(bitmap_green, 1, 1, 1, 1, 0, 0, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, -50, 0, 50, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 100, 0, 50, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, -25, 100, 25); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, 50, 100, 25); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + +}, ""); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.worker.js index 60fea26afe3..76e3e8baaf1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.9arg.destsize // Description: @@ -7,51 +6,30 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -var promise1 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/red.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; -}); -var promise2 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/green.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; -}); -Promise.all([promise1, promise2]).then(function(response1, response2) { - var promise3 = createImageBitmap(response1); - var promise4 = createImageBitmap(response2); - Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { - ctx.drawImage(bitmap2, 1, 1, 1, 1, 0, 0, 100, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, -50, 0, 50, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, 100, 0, 50, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, -25, 100, 25); - ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, 50, 100, 25); - _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - }, t_fail); -}).then(t_pass, t_fail); + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); -}); + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.drawImage(bitmap_green, 1, 1, 1, 1, 0, 0, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, -50, 0, 50, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 100, 0, 50, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, -25, 100, 25); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, 50, 100, 25); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + t.done(); +}, ""); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.html index 4742fa21220..e822ab43fa7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.9arg.sourcepos</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,33 +10,21 @@ <script> -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/rgrg-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 140, 20, 100, 50, 0, 0, 100, 50); - _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - }); -}); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/rgrg-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 140, 20, 100, 50, 0, 0, 100, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); -}); +}, ""); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.worker.js index 2780240bd88..d3525435fa1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.9arg.sourcepos // Description: @@ -7,31 +6,21 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/rgrg-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 140, 20, 100, 50, 0, 0, 100, 50); - _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - }); -}); -t.done(); - -}); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/rgrg-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 140, 20, 100, 50, 0, 0, 100, 50); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + t.done(); +}, ""); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.html index fd1c853b88a..b99ca587683 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.9arg.sourcesize</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,40 +10,28 @@ <script> -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/rgrg-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0, 256, 256, 0, 0, 100, 50); - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 51, 26); - ctx.fillRect(49, 24, 51, 26); - _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 20,20, 0,255,0,255, 2); - _assertPixelApprox(canvas, 80,20, 0,255,0,255, 2); - _assertPixelApprox(canvas, 20,30, 0,255,0,255, 2); - _assertPixelApprox(canvas, 80,30, 0,255,0,255, 2); - }); -}); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/rgrg-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 0, 0, 256, 256, 0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 51, 26); + ctx.fillRect(49, 24, 51, 26); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 20,20, 0,255,0,255, 2); + _assertPixelApprox(canvas, 80,20, 0,255,0,255, 2); + _assertPixelApprox(canvas, 20,30, 0,255,0,255, 2); + _assertPixelApprox(canvas, 80,30, 0,255,0,255, 2); -}); +}, ""); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.worker.js index 2bb379e7ebb..aa15efb7059 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.9arg.sourcesize // Description: @@ -7,38 +6,28 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/rgrg-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0, 256, 256, 0, 0, 100, 50); - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 51, 26); - ctx.fillRect(49, 24, 51, 26); - _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); - _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - _assertPixelApprox(canvas, 20,20, 0,255,0,255, 2); - _assertPixelApprox(canvas, 80,20, 0,255,0,255, 2); - _assertPixelApprox(canvas, 20,30, 0,255,0,255, 2); - _assertPixelApprox(canvas, 80,30, 0,255,0,255, 2); - }); -}); -t.done(); - -}); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/rgrg-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 0, 0, 256, 256, 0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 51, 26); + ctx.fillRect(49, 24, 51, 26); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 20,20, 0,255,0,255, 2); + _assertPixelApprox(canvas, 80,20, 0,255,0,255, 2); + _assertPixelApprox(canvas, 20,30, 0,255,0,255, 2); + _assertPixelApprox(canvas, 80,30, 0,255,0,255, 2); + t.done(); +}, ""); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.html index 77134adfac5..a95f3ece7a2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.alpha</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,31 +10,20 @@ <script> -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalAlpha = 0; -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalAlpha = 0; + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + +}, ""); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.worker.js index 07d8d9288df..958a2431b6d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.alpha // Description: @@ -7,29 +6,20 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalAlpha = 0; -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalAlpha = 0; + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); +}, ""); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.animated.poster.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.animated.poster.html index 2b33b7dd2d7..eccf14bfd04 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.animated.poster.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.animated.poster.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.animated.poster</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,28 +10,17 @@ <script> -var t = async_test("drawImage() of an APNG draws the poster frame"); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -fetch('anim-poster-gr.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); -})(canvas, ctx); -t.done(); + const response = await fetch('/images/anim-poster-gr.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + +}, "drawImage() of an APNG draws the poster frame"); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.animated.poster.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.animated.poster.worker.js index 5f246feb260..542c9382f64 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.animated.poster.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.animated.poster.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.animated.poster // Description:drawImage() of an APNG draws the poster frame @@ -7,26 +6,17 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test("drawImage() of an APNG draws the poster frame"); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -fetch('anim-poster-gr.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); -t.done(); + const response = await fetch('/images/anim-poster-gr.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); +}, "drawImage() of an APNG draws the poster frame"); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.html index d9890f3057b..a2afa05f01e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.broken</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,30 +10,15 @@ <script> -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -fetch('/images/broken.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); -})(canvas, ctx); -t.done(); + const response = await fetch('/images/broken.png'); + const blob = await response.blob(); -}); + await promise_rejects_dom(t, 'InvalidStateError', createImageBitmap(blob), 'The source image could not be decoded.'); + +}, ""); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.worker.js index 51560c443db..dc695b5459e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.broken // Description: @@ -7,28 +6,15 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -fetch('/images/broken.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); -t.done(); + const response = await fetch('/images/broken.png'); + const blob = await response.blob(); -}); + await promise_rejects_dom(t, 'InvalidStateError', createImageBitmap(blob), 'The source image could not be decoded.'); + t.done(); +}, ""); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.canvas.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.canvas.html index dc144cb6f9d..e5eeedea6ec 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.canvas.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.canvas.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.canvas</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -16,24 +15,22 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var offscreenCanvas2 = new OffscreenCanvas(100, 50); -var ctx2 = offscreenCanvas2.getContext('2d'); -ctx2.fillStyle = '#0f0'; -ctx2.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.drawImage(offscreenCanvas2, 0, 0); -_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); -})(canvas, ctx); -t.done(); + var offscreenCanvas2 = new OffscreenCanvas(100, 50); + var ctx2 = offscreenCanvas2.getContext('2d'); + ctx2.fillStyle = '#0f0'; + ctx2.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.canvas.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.canvas.worker.js index da01a86ba05..1f18cd77230 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.canvas.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.canvas.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.canvas // Description: @@ -14,20 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var offscreenCanvas2 = new OffscreenCanvas(100, 50); -var ctx2 = offscreenCanvas2.getContext('2d'); -ctx2.fillStyle = '#0f0'; -ctx2.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.drawImage(offscreenCanvas2, 0, 0); -_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var offscreenCanvas2 = new OffscreenCanvas(100, 50); + var ctx2 = offscreenCanvas2.getContext('2d'); + ctx2.fillStyle = '#0f0'; + ctx2.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.drawImage(offscreenCanvas2, 0, 0); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.html index 994f601651d..a828039b7be 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.clip</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,36 +10,25 @@ <script> -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.rect(-10, -10, 1, 1); -ctx.clip(); -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.rect(-10, -10, 1, 1); - ctx.clip(); - ctx.drawImage(document.getElementById('red.png'), 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.rect(-10, -10, 1, 1); + ctx.clip(); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.rect(-10, -10, 1, 1); + ctx.clip(); + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + +}, ""); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.worker.js index 1a462aff681..fea2a7bac70 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.clip // Description: @@ -7,34 +6,25 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.rect(-10, -10, 1, 1); -ctx.clip(); -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.rect(-10, -10, 1, 1); - ctx.clip(); - ctx.drawImage(document.getElementById('red.png'), 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.rect(-10, -10, 1, 1); + ctx.clip(); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.rect(-10, -10, 1, 1); + ctx.clip(); + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); +}, ""); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.html index b4bc6f39ce9..b32b5a12ed9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.composite</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,31 +10,20 @@ <script> -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalCompositeOperation = 'destination-over'; -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'destination-over'; + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + +}, ""); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.worker.js index f6d4a5d284a..0b17673b689 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.composite // Description: @@ -7,29 +6,20 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalCompositeOperation = 'destination-over'; -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'destination-over'; + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); +}, ""); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.html index 98ca580e591..e201082e35c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.floatsource</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,28 +10,16 @@ <script> -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 10.1, 10.1, 0.1, 0.1, 0, 0, 100, 50); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); -})(canvas, ctx); -t.done(); + const response = await fetch('/images/green.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 10.1, 10.1, 0.1, 0.1, 0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -}); +}, ""); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.worker.js index 7206099837d..1efc17d04d0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.floatsource // Description: @@ -7,26 +6,16 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 10.1, 10.1, 0.1, 0.1, 0, 0, 100, 50); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); -t.done(); - -}); + const response = await fetch('/images/green.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 10.1, 10.1, 0.1, 0.1, 0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); +}, ""); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.html index bfe2a9c96f6..3e43a772c65 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.negativedest</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,40 +10,28 @@ <script> -var t = async_test("Negative destination width/height represents the correct rectangle"); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/ggrr-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 100, 78, 50, 50, 0, 50, 50, -50); - ctx.drawImage(bitmap, 100, 128, 50, -50, 100, 50, -50, -50); - _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); - _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - }); -}); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/ggrr-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 100, 78, 50, 50, 0, 50, 50, -50); + ctx.drawImage(bitmap, 100, 128, 50, -50, 100, 50, -50, -50); + _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); -}); +}, "Negative destination width/height represents the correct rectangle"); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.worker.js index aebbb34b3ed..ce5cf5efadc 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.negativedest // Description:Negative destination width/height represents the correct rectangle @@ -7,38 +6,28 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test("Negative destination width/height represents the correct rectangle"); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/ggrr-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 100, 78, 50, 50, 0, 50, 50, -50); - ctx.drawImage(bitmap, 100, 128, 50, -50, 100, 50, -50, -50); - _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); - _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - }); -}); -t.done(); - -}); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/ggrr-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 100, 78, 50, 50, 0, 50, 50, -50); + ctx.drawImage(bitmap, 100, 128, 50, -50, 100, 50, -50, -50); + _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + t.done(); +}, "Negative destination width/height represents the correct rectangle"); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.html index 46c571f1539..347b634cfd9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.negativedir</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,40 +10,28 @@ <script> -var t = async_test("Negative dimensions do not affect the direction of the image"); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/ggrr-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 178, 50, -100, 0, 0, 50, 100); - ctx.drawImage(bitmap, 0, 78, 50, 100, 50, 100, 50, -100); - _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); - _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - }); -}); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/ggrr-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 0, 178, 50, -100, 0, 0, 50, 100); + ctx.drawImage(bitmap, 0, 78, 50, 100, 50, 100, 50, -100); + _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); -}); +}, "Negative dimensions do not affect the direction of the image"); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.worker.js index 4bfb5433b86..c82b9ba1bec 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.negativedir // Description:Negative dimensions do not affect the direction of the image @@ -7,38 +6,28 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test("Negative dimensions do not affect the direction of the image"); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/ggrr-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 178, 50, -100, 0, 0, 50, 100); - ctx.drawImage(bitmap, 0, 78, 50, 100, 50, 100, 50, -100); - _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); - _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - }); -}); -t.done(); - -}); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/ggrr-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 0, 178, 50, -100, 0, 0, 50, 100); + ctx.drawImage(bitmap, 0, 78, 50, 100, 50, 100, 50, -100); + _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + t.done(); +}, "Negative dimensions do not affect the direction of the image"); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.html index 4e60d7e5e91..3e18725720b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.negativesource</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,40 +10,28 @@ <script> -var t = async_test("Negative source width/height represents the correct rectangle"); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/ggrr-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 100, 78, -100, 50, 0, 0, 50, 50); - ctx.drawImage(bitmap, 100, 128, -100, -50, 50, 0, 50, 50); - _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); - _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - }); -}); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/ggrr-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 100, 78, -100, 50, 0, 0, 50, 50); + ctx.drawImage(bitmap, 100, 128, -100, -50, 50, 0, 50, 50); + _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); -}); +}, "Negative source width/height represents the correct rectangle"); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.worker.js index 6d0bec1a1db..f92d15774d7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.negativesource // Description:Negative source width/height represents the correct rectangle @@ -7,38 +6,28 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test("Negative source width/height represents the correct rectangle"); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/ggrr-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 100, 78, -100, 50, 0, 0, 50, 50); - ctx.drawImage(bitmap, 100, 128, -100, -50, 50, 0, 50, 50); - _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); - _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); - _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); - _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - }); -}); -t.done(); - -}); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/ggrr-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 100, 78, -100, 50, 0, 0, 50, 50); + ctx.drawImage(bitmap, 100, 128, -100, -50, 50, 0, 50, 50); + _assertPixelApprox(canvas, 1,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 48,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,1, 0,255,0,255, 2); + _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + t.done(); +}, "Negative source width/height represents the correct rectangle"); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.html index dc932df3cd0..93dccd3d4e2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.nonfinite</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,330 +10,319 @@ <script> -var t = async_test("drawImage() with Infinity/NaN is ignored"); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/redtransparent.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, Infinity, 0); -ctx.drawImage(bitmap, -Infinity, 0); -ctx.drawImage(bitmap, NaN, 0); -ctx.drawImage(bitmap, 0, Infinity); -ctx.drawImage(bitmap, 0, -Infinity); -ctx.drawImage(bitmap, 0, NaN); -ctx.drawImage(bitmap, Infinity, Infinity); - ctx.drawImage(bitmap, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, -Infinity, 0, 100, 50); -ctx.drawImage(bitmap, NaN, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, -Infinity, 100, 50); -ctx.drawImage(bitmap, 0, NaN, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, -Infinity, 50); -ctx.drawImage(bitmap, 0, 0, NaN, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, -Infinity); -ctx.drawImage(bitmap, 0, 0, 100, NaN); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity); - ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, -Infinity, 0, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, NaN, 0, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, -Infinity, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, NaN, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, -Infinity, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, NaN, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, -Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, NaN, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, -Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, NaN, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, -Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, NaN, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, -Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, NaN, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, -Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, NaN); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, Infinity, Infinity); - _assertPixel(canvas, 50,25, 0,255,0,255); - }); -}); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/redtransparent.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.drawImage(bitmap, Infinity, 0); + ctx.drawImage(bitmap, -Infinity, 0); + ctx.drawImage(bitmap, NaN, 0); + ctx.drawImage(bitmap, 0, Infinity); + ctx.drawImage(bitmap, 0, -Infinity); + ctx.drawImage(bitmap, 0, NaN); + ctx.drawImage(bitmap, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, -Infinity, 0, 100, 50); + ctx.drawImage(bitmap, NaN, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, -Infinity, 100, 50); + ctx.drawImage(bitmap, 0, NaN, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, -Infinity, 50); + ctx.drawImage(bitmap, 0, 0, NaN, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, -Infinity); + ctx.drawImage(bitmap, 0, 0, 100, NaN); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, -Infinity, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, NaN, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, -Infinity, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, NaN, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, -Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, NaN, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, -Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, NaN, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, -Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, NaN, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, -Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, NaN, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, -Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, NaN, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, -Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, NaN); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, Infinity, Infinity); + _assertPixel(canvas, 50,25, 0,255,0,255); + +}, "drawImage() with Infinity/NaN is ignored"); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.worker.js index 7dee1805806..a56f09e0b2d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.nonfinite // Description:drawImage() with Infinity/NaN is ignored @@ -7,328 +6,319 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test("drawImage() with Infinity/NaN is ignored"); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/redtransparent.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, Infinity, 0); -ctx.drawImage(bitmap, -Infinity, 0); -ctx.drawImage(bitmap, NaN, 0); -ctx.drawImage(bitmap, 0, Infinity); -ctx.drawImage(bitmap, 0, -Infinity); -ctx.drawImage(bitmap, 0, NaN); -ctx.drawImage(bitmap, Infinity, Infinity); - ctx.drawImage(bitmap, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, -Infinity, 0, 100, 50); -ctx.drawImage(bitmap, NaN, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, -Infinity, 100, 50); -ctx.drawImage(bitmap, 0, NaN, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, -Infinity, 50); -ctx.drawImage(bitmap, 0, 0, NaN, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, -Infinity); -ctx.drawImage(bitmap, 0, 0, 100, NaN); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity); - ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, -Infinity, 0, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, NaN, 0, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, -Infinity, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, NaN, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, -Infinity, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, NaN, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, -Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, NaN, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, -Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, NaN, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, -Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, NaN, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, -Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, NaN, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, -Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, NaN); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, 100, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, Infinity, 50); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, Infinity, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, 100, Infinity); -ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, Infinity, Infinity); - _assertPixel(canvas, 50,25, 0,255,0,255); - }); -}); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/redtransparent.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.drawImage(bitmap, Infinity, 0); + ctx.drawImage(bitmap, -Infinity, 0); + ctx.drawImage(bitmap, NaN, 0); + ctx.drawImage(bitmap, 0, Infinity); + ctx.drawImage(bitmap, 0, -Infinity); + ctx.drawImage(bitmap, 0, NaN); + ctx.drawImage(bitmap, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, -Infinity, 0, 100, 50); + ctx.drawImage(bitmap, NaN, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, -Infinity, 100, 50); + ctx.drawImage(bitmap, 0, NaN, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, -Infinity, 50); + ctx.drawImage(bitmap, 0, 0, NaN, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, -Infinity); + ctx.drawImage(bitmap, 0, 0, 100, NaN); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, -Infinity, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, NaN, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, -Infinity, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, NaN, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, -Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, NaN, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, -Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, NaN, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, -Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, NaN, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, -Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, NaN, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, -Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, NaN, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, -Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, NaN); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, Infinity, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, Infinity, 100, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, Infinity, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, Infinity, 0, 100, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, Infinity, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, Infinity, 100, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, Infinity, 50, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, Infinity, 0, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, 100, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, Infinity, 0, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, Infinity, 50); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, Infinity, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, 100, Infinity); + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, Infinity, Infinity); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); +}, "drawImage() with Infinity/NaN is ignored"); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.html index fc167879786..1182baec3b1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.nowrap</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,32 +10,21 @@ <script> -var t = async_test("Stretched images do not get pixels wrapping around the edges"); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/redtransparent.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, -1950, 0, 2000, 50); - _assertPixelApprox(canvas, 45,25, 0,255,0,255, 2); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - _assertPixelApprox(canvas, 55,25, 0,255,0,255, 2); - }); -}); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/redtransparent.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.drawImage(bitmap, -1950, 0, 2000, 50); + _assertPixelApprox(canvas, 45,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 55,25, 0,255,0,255, 2); + +}, "Stretched images do not get pixels wrapping around the edges"); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.worker.js index 539c6bf9772..47a77834c05 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.nowrap // Description:Stretched images do not get pixels wrapping around the edges @@ -7,30 +6,21 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test("Stretched images do not get pixels wrapping around the edges"); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/redtransparent.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, -1950, 0, 2000, 50); - _assertPixelApprox(canvas, 45,25, 0,255,0,255, 2); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - _assertPixelApprox(canvas, 55,25, 0,255,0,255, 2); - }); -}); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/redtransparent.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.drawImage(bitmap, -1950, 0, 2000, 50); + _assertPixelApprox(canvas, 45,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 55,25, 0,255,0,255, 2); + t.done(); +}, "Stretched images do not get pixels wrapping around the edges"); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.null.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.null.html index 76c86b1b4af..7a8338b3530 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.null.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.null.html @@ -15,15 +15,13 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.drawImage(null, 0, 0); }); -})(canvas, ctx); -t.done(); + assert_throws_js(TypeError, function() { ctx.drawImage(null, 0, 0); }); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.null.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.null.worker.js index 792dc6ef41c..329abd22215 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.null.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.null.worker.js @@ -13,11 +13,10 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -assert_throws_js(TypeError, function() { ctx.drawImage(null, 0, 0); }); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + assert_throws_js(TypeError, function() { ctx.drawImage(null, 0, 0); }); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.html index 3977880de19..063353c11f3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.path</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,31 +10,20 @@ <script> -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.rect(0, 0, 100, 50); -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - ctx.fill(); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.rect(0, 0, 100, 50); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.drawImage(bitmap, 0, 0); + ctx.fill(); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + +}, ""); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.worker.js index 5132aa994f1..3259ff02580 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.path // Description: @@ -7,29 +6,20 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.rect(0, 0, 100, 50); -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - ctx.fill(); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.rect(0, 0, 100, 50); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.drawImage(bitmap, 0, 0); + ctx.fill(); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); +}, ""); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.1.html index 9e1777974c5..c5e51c27726 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.1.html @@ -15,24 +15,22 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 50, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(50, 0, 50, 50); -ctx.drawImage(canvas, 50, 0); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(50, 0, 50, 50); + ctx.drawImage(canvas, 50, 0); -_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); -})(canvas, ctx); -t.done(); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.1.worker.js index 01d47cb334e..a9af88d13a6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.1.worker.js @@ -13,20 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 50, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(50, 0, 50, 50); -ctx.drawImage(canvas, 50, 0); - -_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(50, 0, 50, 50); + ctx.drawImage(canvas, 50, 0); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.2.html index f522d4822d3..ac674769663 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.2.html @@ -15,26 +15,24 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 1, 100, 49); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 1); -ctx.drawImage(canvas, 0, 1); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 2); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 1, 100, 49); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 1); + ctx.drawImage(canvas, 0, 1); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 2); -_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); -})(canvas, ctx); -t.done(); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.2.worker.js index 61a02c87a67..802d2d8c529 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.self.2.worker.js @@ -13,22 +13,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 1, 100, 49); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 1); -ctx.drawImage(canvas, 0, 1); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 2); - -_assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); -_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); -_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 1, 100, 49); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 1); + ctx.drawImage(canvas, 0, 1); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 2); + _assertPixelApprox(canvas, 0,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); + _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); + _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.svg.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.svg.html index d5317dd0063..50aeabd286d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.svg.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.svg.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.svg</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,28 +10,26 @@ <script> -var t = async_test("drawImage() of an SVG image"); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -fetch('/images/green.svg') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.svg'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; + }); + promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); }); -}); -})(canvas, ctx); -t.done(); + }); -}); +}, "drawImage() of an SVG image"); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.svg.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.svg.worker.js index fda62017c26..a15371db39d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.svg.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.svg.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.svg // Description:drawImage() of an SVG image @@ -7,26 +6,26 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test("drawImage() of an SVG image"); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -fetch('/images/green.svg') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.svg'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; + }); + promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); }); -}); -t.done(); - -}); + }); + t.done(); +}, "drawImage() of an SVG image"); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.html index bdbdb393cf8..ca148c1a685 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.transform</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,31 +10,20 @@ <script> -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.translate(100, 0); -fetch('red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.translate(100, 0); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + +}, ""); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.worker.js index a42f2785164..4a4cd07be95 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.transform // Description: @@ -7,29 +6,20 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test(""); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.translate(100, 0); -fetch('red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); -}); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.translate(100, 0); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); -}); + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); +}, ""); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.wrongtype.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.wrongtype.html index 5ea4234aa18..96906e8fc37 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.wrongtype.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.wrongtype.html @@ -15,17 +15,15 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.drawImage(undefined, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.drawImage(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.drawImage("", 0, 0); }); -})(canvas, ctx); -t.done(); + assert_throws_js(TypeError, function() { ctx.drawImage(undefined, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.drawImage(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.drawImage("", 0, 0); }); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.wrongtype.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.wrongtype.worker.js index 9a52628c610..176e418d64a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.wrongtype.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.wrongtype.worker.js @@ -13,13 +13,12 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -assert_throws_js(TypeError, function() { ctx.drawImage(undefined, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.drawImage(0, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.drawImage("", 0, 0); }); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + assert_throws_js(TypeError, function() { ctx.drawImage(undefined, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.drawImage(0, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.drawImage("", 0, 0); }); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.html index 5cb758c2b9b..a30c3007307 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.zerocanvas</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -16,24 +15,22 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var offscreenCanvas2 = new OffscreenCanvas(0, 10); -assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(offscreenCanvas2, 0, 0); }); + var offscreenCanvas2 = new OffscreenCanvas(0, 10); + assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(offscreenCanvas2, 0, 0); }); -offscreenCanvas2.width = 10; -offscreenCanvas2.height = 0; -assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(offscreenCanvas2, 0, 0); }); + offscreenCanvas2.width = 10; + offscreenCanvas2.height = 0; + assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(offscreenCanvas2, 0, 0); }); -offscreenCanvas2.width = 0; -offscreenCanvas2.height = 0; -assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(offscreenCanvas2, 0, 0); }); -})(canvas, ctx); -t.done(); + offscreenCanvas2.width = 0; + offscreenCanvas2.height = 0; + assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(offscreenCanvas2, 0, 0); }); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.worker.js index 5f3764b1574..41346ad3288 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerocanvas.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.zerocanvas // Description: @@ -14,20 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -var offscreenCanvas2 = new OffscreenCanvas(0, 10); -assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(offscreenCanvas2, 0, 0); }); + var offscreenCanvas2 = new OffscreenCanvas(0, 10); + assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(offscreenCanvas2, 0, 0); }); -offscreenCanvas2.width = 10; -offscreenCanvas2.height = 0; -assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(offscreenCanvas2, 0, 0); }); - -offscreenCanvas2.width = 0; -offscreenCanvas2.height = 0; -assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(offscreenCanvas2, 0, 0); }); -t.done(); + offscreenCanvas2.width = 10; + offscreenCanvas2.height = 0; + assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(offscreenCanvas2, 0, 0); }); + offscreenCanvas2.width = 0; + offscreenCanvas2.height = 0; + assert_throws_dom("INVALID_STATE_ERR", function() { ctx.drawImage(offscreenCanvas2, 0, 0); }); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.html index bdd68d20080..0239c5356da 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.zerosource</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,33 +10,20 @@ <script> -var t = async_test("drawImage with zero-sized source rectangle draws nothing without exception"); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -const red = async () => await createImageBitmap(await (await fetch("/images/red.png")).blob()); -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 10, 10, 0, 1, 0, 0, 100, 50); - ctx.drawImage(bitmap, 10, 10, 1, 0, 0, 0, 100, 50); - ctx.drawImage(bitmap, 10, 10, 0, 0, 0, 0, 100, 50); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); - }); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 10, 10, 0, 1, 0, 0, 100, 50); + ctx.drawImage(bitmap, 10, 10, 1, 0, 0, 0, 100, 50); + ctx.drawImage(bitmap, 10, 10, 0, 0, 0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -}); +}, "drawImage with zero-sized source rectangle draws nothing without exception"); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.html index 5a0d4fcda29..4941d37347f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.html @@ -1,7 +1,6 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>OffscreenCanvas test: 2d.drawImage.zerosource.image</title> -<meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/html/canvas/resources/canvas-tests.js"></script> @@ -11,32 +10,28 @@ <script> -var t = async_test("drawImage with zero-sized source rectangle from image draws nothing without exception"); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(async function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/red-zerowidth.svg') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0, 100, 50); - ctx.drawImage(bitmap, 0, 0, 100, 50); - ctx.drawImage(bitmap, 0, 0, 100, 50); - _assertPixel(canvas, 50,25, 0,255,0,255); - }); -}); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red-zerowidth.svg'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; + }); + promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + }); + }); -}); +}, "drawImage with zero-sized source rectangle from image draws nothing without exception"); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.worker.js index 729e0e97a4c..a3182c9b73f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.zerosource.image // Description:drawImage with zero-sized source rectangle from image draws nothing without exception @@ -7,30 +6,28 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test("drawImage with zero-sized source rectangle from image draws nothing without exception"); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -fetch('/images/red-zerowidth.svg') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0, 100, 50); - ctx.drawImage(bitmap, 0, 0, 100, 50); - ctx.drawImage(bitmap, 0, 0, 100, 50); - _assertPixel(canvas, 50,25, 0,255,0,255); - }); -}); -t.done(); - -}); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red-zerowidth.svg'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; + }); + promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + }); + }); + t.done(); +}, "drawImage with zero-sized source rectangle from image draws nothing without exception"); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.worker.js index 2655e3e91f5..a80bfff5621 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.worker.js @@ -1,4 +1,3 @@ -// META: timeout=long // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.drawImage.zerosource // Description:drawImage with zero-sized source rectangle draws nothing without exception @@ -7,31 +6,20 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test("drawImage with zero-sized source rectangle draws nothing without exception"); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { +promise_test(async t => { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -const red = async () => await createImageBitmap(await (await fetch("/images/red.png")).blob()); -fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 10, 10, 0, 1, 0, 0, 100, 50); - ctx.drawImage(bitmap, 10, 10, 1, 0, 0, 0, 100, 50); - ctx.drawImage(bitmap, 10, 10, 0, 0, 0, 0, 100, 50); - _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - }); - }); -t.done(); - -}); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 10, 10, 0, 1, 0, 0, 100, 50); + ctx.drawImage(bitmap, 10, 10, 1, 0, 0, 0, 100, 50); + ctx.drawImage(bitmap, 10, 10, 0, 0, 0, 0, 100, 50); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); +}, "drawImage with zero-sized source rectangle draws nothing without exception"); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.basic.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.basic.html index 6975dda5bcb..02a9cb37ca4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.basic.html @@ -15,18 +15,16 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.clearRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,0,0,0); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.clearRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,0,0,0); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.basic.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.basic.worker.js index 5908ecca85b..8f3a7e46dee 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.basic.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.basic.worker.js @@ -13,14 +13,13 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.clearRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,0,0,0); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.clearRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,0,0,0); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.clip.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.clip.html index 4d67a5fadc6..2f0f1716011 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.clip.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.clip.html @@ -15,23 +15,21 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(0, 0, 16, 16); -ctx.clip(); -ctx.clearRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 16, 16); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.rect(0, 0, 16, 16); + ctx.clip(); + ctx.clearRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 16, 16); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.clip.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.clip.worker.js index 7fb5791cc9a..3d3caedbb1a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.clip.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.clip.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(0, 0, 16, 16); -ctx.clip(); -ctx.clearRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 16, 16); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.rect(0, 0, 16, 16); + ctx.clip(); + ctx.clearRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 16, 16); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalalpha.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalalpha.html index f5c0e52c02e..45875c52702 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalalpha.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalalpha.html @@ -15,19 +15,17 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalAlpha = 0.1; -ctx.clearRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,0,0,0); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalAlpha = 0.1; + ctx.clearRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,0,0,0); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalalpha.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalalpha.worker.js index 885e389ba52..1b07b66cb38 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalalpha.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalalpha.worker.js @@ -13,15 +13,14 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalAlpha = 0.1; -ctx.clearRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,0,0,0); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalAlpha = 0.1; + ctx.clearRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,0,0,0); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalcomposite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalcomposite.html index f46245a6fd2..b57be641ca3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalcomposite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalcomposite.html @@ -15,19 +15,17 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalCompositeOperation = 'destination-atop'; -ctx.clearRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,0,0,0); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'destination-atop'; + ctx.clearRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,0,0,0); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalcomposite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalcomposite.worker.js index a31962f73e0..e8c1c9b27c8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalcomposite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.globalcomposite.worker.js @@ -13,15 +13,14 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.globalCompositeOperation = 'destination-atop'; -ctx.clearRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,0,0,0); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.globalCompositeOperation = 'destination-atop'; + ctx.clearRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,0,0,0); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.negative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.negative.html index ff96d1f0782..12126dfe87e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.negative.html @@ -15,24 +15,22 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.clearRect(0, 0, 50, 25); -ctx.clearRect(100, 0, -50, 25); -ctx.clearRect(0, 50, 50, -25); -ctx.clearRect(100, 50, -50, -25); -_assertPixel(canvas, 25,12, 0,0,0,0); -_assertPixel(canvas, 75,12, 0,0,0,0); -_assertPixel(canvas, 25,37, 0,0,0,0); -_assertPixel(canvas, 75,37, 0,0,0,0); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.clearRect(0, 0, 50, 25); + ctx.clearRect(100, 0, -50, 25); + ctx.clearRect(0, 50, 50, -25); + ctx.clearRect(100, 50, -50, -25); + _assertPixel(canvas, 25,12, 0,0,0,0); + _assertPixel(canvas, 75,12, 0,0,0,0); + _assertPixel(canvas, 25,37, 0,0,0,0); + _assertPixel(canvas, 75,37, 0,0,0,0); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.negative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.negative.worker.js index c7390550b8a..62846aec8e7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.negative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.negative.worker.js @@ -13,20 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.clearRect(0, 0, 50, 25); -ctx.clearRect(100, 0, -50, 25); -ctx.clearRect(0, 50, 50, -25); -ctx.clearRect(100, 50, -50, -25); -_assertPixel(canvas, 25,12, 0,0,0,0); -_assertPixel(canvas, 75,12, 0,0,0,0); -_assertPixel(canvas, 25,37, 0,0,0,0); -_assertPixel(canvas, 75,37, 0,0,0,0); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.clearRect(0, 0, 50, 25); + ctx.clearRect(100, 0, -50, 25); + ctx.clearRect(0, 50, 50, -25); + ctx.clearRect(100, 50, -50, -25); + _assertPixel(canvas, 25,12, 0,0,0,0); + _assertPixel(canvas, 75,12, 0,0,0,0); + _assertPixel(canvas, 25,37, 0,0,0,0); + _assertPixel(canvas, 75,37, 0,0,0,0); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.nonfinite.html index 24aa769bdd7..33278341468 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.nonfinite.html @@ -15,40 +15,38 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.clearRect(Infinity, 0, 100, 50); -ctx.clearRect(-Infinity, 0, 100, 50); -ctx.clearRect(NaN, 0, 100, 50); -ctx.clearRect(0, Infinity, 100, 50); -ctx.clearRect(0, -Infinity, 100, 50); -ctx.clearRect(0, NaN, 100, 50); -ctx.clearRect(0, 0, Infinity, 50); -ctx.clearRect(0, 0, -Infinity, 50); -ctx.clearRect(0, 0, NaN, 50); -ctx.clearRect(0, 0, 100, Infinity); -ctx.clearRect(0, 0, 100, -Infinity); -ctx.clearRect(0, 0, 100, NaN); -ctx.clearRect(Infinity, Infinity, 100, 50); -ctx.clearRect(Infinity, Infinity, Infinity, 50); -ctx.clearRect(Infinity, Infinity, Infinity, Infinity); -ctx.clearRect(Infinity, Infinity, 100, Infinity); -ctx.clearRect(Infinity, 0, Infinity, 50); -ctx.clearRect(Infinity, 0, Infinity, Infinity); -ctx.clearRect(Infinity, 0, 100, Infinity); -ctx.clearRect(0, Infinity, Infinity, 50); -ctx.clearRect(0, Infinity, Infinity, Infinity); -ctx.clearRect(0, Infinity, 100, Infinity); -ctx.clearRect(0, 0, Infinity, Infinity); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.clearRect(Infinity, 0, 100, 50); + ctx.clearRect(-Infinity, 0, 100, 50); + ctx.clearRect(NaN, 0, 100, 50); + ctx.clearRect(0, Infinity, 100, 50); + ctx.clearRect(0, -Infinity, 100, 50); + ctx.clearRect(0, NaN, 100, 50); + ctx.clearRect(0, 0, Infinity, 50); + ctx.clearRect(0, 0, -Infinity, 50); + ctx.clearRect(0, 0, NaN, 50); + ctx.clearRect(0, 0, 100, Infinity); + ctx.clearRect(0, 0, 100, -Infinity); + ctx.clearRect(0, 0, 100, NaN); + ctx.clearRect(Infinity, Infinity, 100, 50); + ctx.clearRect(Infinity, Infinity, Infinity, 50); + ctx.clearRect(Infinity, Infinity, Infinity, Infinity); + ctx.clearRect(Infinity, Infinity, 100, Infinity); + ctx.clearRect(Infinity, 0, Infinity, 50); + ctx.clearRect(Infinity, 0, Infinity, Infinity); + ctx.clearRect(Infinity, 0, 100, Infinity); + ctx.clearRect(0, Infinity, Infinity, 50); + ctx.clearRect(0, Infinity, Infinity, Infinity); + ctx.clearRect(0, Infinity, 100, Infinity); + ctx.clearRect(0, 0, Infinity, Infinity); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.nonfinite.worker.js index e4dc952200d..e2525df3be8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.nonfinite.worker.js @@ -13,36 +13,35 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.clearRect(Infinity, 0, 100, 50); -ctx.clearRect(-Infinity, 0, 100, 50); -ctx.clearRect(NaN, 0, 100, 50); -ctx.clearRect(0, Infinity, 100, 50); -ctx.clearRect(0, -Infinity, 100, 50); -ctx.clearRect(0, NaN, 100, 50); -ctx.clearRect(0, 0, Infinity, 50); -ctx.clearRect(0, 0, -Infinity, 50); -ctx.clearRect(0, 0, NaN, 50); -ctx.clearRect(0, 0, 100, Infinity); -ctx.clearRect(0, 0, 100, -Infinity); -ctx.clearRect(0, 0, 100, NaN); -ctx.clearRect(Infinity, Infinity, 100, 50); -ctx.clearRect(Infinity, Infinity, Infinity, 50); -ctx.clearRect(Infinity, Infinity, Infinity, Infinity); -ctx.clearRect(Infinity, Infinity, 100, Infinity); -ctx.clearRect(Infinity, 0, Infinity, 50); -ctx.clearRect(Infinity, 0, Infinity, Infinity); -ctx.clearRect(Infinity, 0, 100, Infinity); -ctx.clearRect(0, Infinity, Infinity, 50); -ctx.clearRect(0, Infinity, Infinity, Infinity); -ctx.clearRect(0, Infinity, 100, Infinity); -ctx.clearRect(0, 0, Infinity, Infinity); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.clearRect(Infinity, 0, 100, 50); + ctx.clearRect(-Infinity, 0, 100, 50); + ctx.clearRect(NaN, 0, 100, 50); + ctx.clearRect(0, Infinity, 100, 50); + ctx.clearRect(0, -Infinity, 100, 50); + ctx.clearRect(0, NaN, 100, 50); + ctx.clearRect(0, 0, Infinity, 50); + ctx.clearRect(0, 0, -Infinity, 50); + ctx.clearRect(0, 0, NaN, 50); + ctx.clearRect(0, 0, 100, Infinity); + ctx.clearRect(0, 0, 100, -Infinity); + ctx.clearRect(0, 0, 100, NaN); + ctx.clearRect(Infinity, Infinity, 100, 50); + ctx.clearRect(Infinity, Infinity, Infinity, 50); + ctx.clearRect(Infinity, Infinity, Infinity, Infinity); + ctx.clearRect(Infinity, Infinity, 100, Infinity); + ctx.clearRect(Infinity, 0, Infinity, 50); + ctx.clearRect(Infinity, 0, Infinity, Infinity); + ctx.clearRect(Infinity, 0, 100, Infinity); + ctx.clearRect(0, Infinity, Infinity, 50); + ctx.clearRect(0, Infinity, Infinity, Infinity); + ctx.clearRect(0, Infinity, 100, Infinity); + ctx.clearRect(0, 0, Infinity, Infinity); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.path.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.path.html index e9716c9e594..25ad954d067 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.path.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.path.html @@ -15,20 +15,18 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.rect(0, 0, 100, 50); -ctx.clearRect(0, 0, 16, 16); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.rect(0, 0, 100, 50); + ctx.clearRect(0, 0, 16, 16); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.path.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.path.worker.js index eee973df5a3..40f51f9f0e0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.path.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.path.worker.js @@ -13,16 +13,15 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.rect(0, 0, 100, 50); -ctx.clearRect(0, 0, 16, 16); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.rect(0, 0, 100, 50); + ctx.clearRect(0, 0, 16, 16); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.shadow.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.shadow.html index 904dfe9cd9d..3b3e41c19c6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.shadow.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.shadow.html @@ -15,22 +15,20 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.shadowColor = '#f00'; -ctx.shadowBlur = 0; -ctx.shadowOffsetX = 0; -ctx.shadowOffsetY = 50; -ctx.clearRect(0, -50, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.shadowColor = '#f00'; + ctx.shadowBlur = 0; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 50; + ctx.clearRect(0, -50, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.shadow.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.shadow.worker.js index 74ac17c1d2f..a1ec8ac7ae4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.shadow.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.shadow.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.shadowColor = '#f00'; -ctx.shadowBlur = 0; -ctx.shadowOffsetX = 0; -ctx.shadowOffsetY = 50; -ctx.clearRect(0, -50, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.shadowColor = '#f00'; + ctx.shadowBlur = 0; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 50; + ctx.clearRect(0, -50, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.transform.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.transform.html index a2ce63be0d7..8208b6f657e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.transform.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.transform.html @@ -15,20 +15,18 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.scale(10, 10); -ctx.translate(0, 5); -ctx.clearRect(0, -5, 10, 5); -_assertPixel(canvas, 50,25, 0,0,0,0); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(10, 10); + ctx.translate(0, 5); + ctx.clearRect(0, -5, 10, 5); + _assertPixel(canvas, 50,25, 0,0,0,0); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.transform.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.transform.worker.js index 8b76d4e0ae9..f176f3da8ac 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.transform.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.transform.worker.js @@ -13,16 +13,15 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.scale(10, 10); -ctx.translate(0, 5); -ctx.clearRect(0, -5, 10, 5); -_assertPixel(canvas, 50,25, 0,0,0,0); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(10, 10); + ctx.translate(0, 5); + ctx.clearRect(0, -5, 10, 5); + _assertPixel(canvas, 50,25, 0,0,0,0); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.zero.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.zero.html index aaebbede940..461c318d241 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.zero.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.zero.html @@ -15,20 +15,18 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.clearRect(0, 0, 100, 0); -ctx.clearRect(0, 0, 0, 50); -ctx.clearRect(0, 0, 0, 0); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.clearRect(0, 0, 100, 0); + ctx.clearRect(0, 0, 0, 50); + ctx.clearRect(0, 0, 0, 0); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.zero.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.zero.worker.js index 24c1c4253f8..b6f42551a2e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.zero.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.clearRect.zero.worker.js @@ -13,16 +13,15 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.clearRect(0, 0, 100, 0); -ctx.clearRect(0, 0, 0, 50); -ctx.clearRect(0, 0, 0, 0); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.clearRect(0, 0, 100, 0); + ctx.clearRect(0, 0, 0, 50); + ctx.clearRect(0, 0, 0, 0); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.basic.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.basic.html index 6d8e6c62f74..3e65472b834 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.basic.html @@ -15,17 +15,15 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.basic.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.basic.worker.js index 3a42a2a13b1..69918278e4d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.basic.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.basic.worker.js @@ -13,13 +13,12 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.clip.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.clip.html index 5f38614713a..3b26960e246 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.clip.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.clip.html @@ -15,24 +15,22 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(0, 0, 16, 16); -ctx.clip(); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 16, 16); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.rect(0, 0, 16, 16); + ctx.clip(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 16, 16); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.clip.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.clip.worker.js index 926821ac96d..890b31e342f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.clip.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.clip.worker.js @@ -13,20 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(0, 0, 16, 16); -ctx.clip(); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 16, 16); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.rect(0, 0, 16, 16); + ctx.clip(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 16, 16); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.negative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.negative.html index 7e59325ff37..2a1942811f5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.negative.html @@ -15,25 +15,23 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 50, 25); -ctx.fillRect(100, 0, -50, 25); -ctx.fillRect(0, 50, 50, -25); -ctx.fillRect(100, 50, -50, -25); -_assertPixel(canvas, 25,12, 0,255,0,255); -_assertPixel(canvas, 75,12, 0,255,0,255); -_assertPixel(canvas, 25,37, 0,255,0,255); -_assertPixel(canvas, 75,37, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 25); + ctx.fillRect(100, 0, -50, 25); + ctx.fillRect(0, 50, 50, -25); + ctx.fillRect(100, 50, -50, -25); + _assertPixel(canvas, 25,12, 0,255,0,255); + _assertPixel(canvas, 75,12, 0,255,0,255); + _assertPixel(canvas, 25,37, 0,255,0,255); + _assertPixel(canvas, 75,37, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.negative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.negative.worker.js index b868dec9ff6..5df1652331a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.negative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.negative.worker.js @@ -13,21 +13,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 50, 25); -ctx.fillRect(100, 0, -50, 25); -ctx.fillRect(0, 50, 50, -25); -ctx.fillRect(100, 50, -50, -25); -_assertPixel(canvas, 25,12, 0,255,0,255); -_assertPixel(canvas, 75,12, 0,255,0,255); -_assertPixel(canvas, 25,37, 0,255,0,255); -_assertPixel(canvas, 75,37, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 25); + ctx.fillRect(100, 0, -50, 25); + ctx.fillRect(0, 50, 50, -25); + ctx.fillRect(100, 50, -50, -25); + _assertPixel(canvas, 25,12, 0,255,0,255); + _assertPixel(canvas, 75,12, 0,255,0,255); + _assertPixel(canvas, 25,37, 0,255,0,255); + _assertPixel(canvas, 75,37, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.nonfinite.html index e5b5be1344f..e44a9d4b78a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.nonfinite.html @@ -15,41 +15,39 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(Infinity, 0, 100, 50); -ctx.fillRect(-Infinity, 0, 100, 50); -ctx.fillRect(NaN, 0, 100, 50); -ctx.fillRect(0, Infinity, 100, 50); -ctx.fillRect(0, -Infinity, 100, 50); -ctx.fillRect(0, NaN, 100, 50); -ctx.fillRect(0, 0, Infinity, 50); -ctx.fillRect(0, 0, -Infinity, 50); -ctx.fillRect(0, 0, NaN, 50); -ctx.fillRect(0, 0, 100, Infinity); -ctx.fillRect(0, 0, 100, -Infinity); -ctx.fillRect(0, 0, 100, NaN); -ctx.fillRect(Infinity, Infinity, 100, 50); -ctx.fillRect(Infinity, Infinity, Infinity, 50); -ctx.fillRect(Infinity, Infinity, Infinity, Infinity); -ctx.fillRect(Infinity, Infinity, 100, Infinity); -ctx.fillRect(Infinity, 0, Infinity, 50); -ctx.fillRect(Infinity, 0, Infinity, Infinity); -ctx.fillRect(Infinity, 0, 100, Infinity); -ctx.fillRect(0, Infinity, Infinity, 50); -ctx.fillRect(0, Infinity, Infinity, Infinity); -ctx.fillRect(0, Infinity, 100, Infinity); -ctx.fillRect(0, 0, Infinity, Infinity); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(Infinity, 0, 100, 50); + ctx.fillRect(-Infinity, 0, 100, 50); + ctx.fillRect(NaN, 0, 100, 50); + ctx.fillRect(0, Infinity, 100, 50); + ctx.fillRect(0, -Infinity, 100, 50); + ctx.fillRect(0, NaN, 100, 50); + ctx.fillRect(0, 0, Infinity, 50); + ctx.fillRect(0, 0, -Infinity, 50); + ctx.fillRect(0, 0, NaN, 50); + ctx.fillRect(0, 0, 100, Infinity); + ctx.fillRect(0, 0, 100, -Infinity); + ctx.fillRect(0, 0, 100, NaN); + ctx.fillRect(Infinity, Infinity, 100, 50); + ctx.fillRect(Infinity, Infinity, Infinity, 50); + ctx.fillRect(Infinity, Infinity, Infinity, Infinity); + ctx.fillRect(Infinity, Infinity, 100, Infinity); + ctx.fillRect(Infinity, 0, Infinity, 50); + ctx.fillRect(Infinity, 0, Infinity, Infinity); + ctx.fillRect(Infinity, 0, 100, Infinity); + ctx.fillRect(0, Infinity, Infinity, 50); + ctx.fillRect(0, Infinity, Infinity, Infinity); + ctx.fillRect(0, Infinity, 100, Infinity); + ctx.fillRect(0, 0, Infinity, Infinity); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.nonfinite.worker.js index 418250e4bf9..bc0170918c5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.nonfinite.worker.js @@ -13,37 +13,36 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(Infinity, 0, 100, 50); -ctx.fillRect(-Infinity, 0, 100, 50); -ctx.fillRect(NaN, 0, 100, 50); -ctx.fillRect(0, Infinity, 100, 50); -ctx.fillRect(0, -Infinity, 100, 50); -ctx.fillRect(0, NaN, 100, 50); -ctx.fillRect(0, 0, Infinity, 50); -ctx.fillRect(0, 0, -Infinity, 50); -ctx.fillRect(0, 0, NaN, 50); -ctx.fillRect(0, 0, 100, Infinity); -ctx.fillRect(0, 0, 100, -Infinity); -ctx.fillRect(0, 0, 100, NaN); -ctx.fillRect(Infinity, Infinity, 100, 50); -ctx.fillRect(Infinity, Infinity, Infinity, 50); -ctx.fillRect(Infinity, Infinity, Infinity, Infinity); -ctx.fillRect(Infinity, Infinity, 100, Infinity); -ctx.fillRect(Infinity, 0, Infinity, 50); -ctx.fillRect(Infinity, 0, Infinity, Infinity); -ctx.fillRect(Infinity, 0, 100, Infinity); -ctx.fillRect(0, Infinity, Infinity, 50); -ctx.fillRect(0, Infinity, Infinity, Infinity); -ctx.fillRect(0, Infinity, 100, Infinity); -ctx.fillRect(0, 0, Infinity, Infinity); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(Infinity, 0, 100, 50); + ctx.fillRect(-Infinity, 0, 100, 50); + ctx.fillRect(NaN, 0, 100, 50); + ctx.fillRect(0, Infinity, 100, 50); + ctx.fillRect(0, -Infinity, 100, 50); + ctx.fillRect(0, NaN, 100, 50); + ctx.fillRect(0, 0, Infinity, 50); + ctx.fillRect(0, 0, -Infinity, 50); + ctx.fillRect(0, 0, NaN, 50); + ctx.fillRect(0, 0, 100, Infinity); + ctx.fillRect(0, 0, 100, -Infinity); + ctx.fillRect(0, 0, 100, NaN); + ctx.fillRect(Infinity, Infinity, 100, 50); + ctx.fillRect(Infinity, Infinity, Infinity, 50); + ctx.fillRect(Infinity, Infinity, Infinity, Infinity); + ctx.fillRect(Infinity, Infinity, 100, Infinity); + ctx.fillRect(Infinity, 0, Infinity, 50); + ctx.fillRect(Infinity, 0, Infinity, Infinity); + ctx.fillRect(Infinity, 0, 100, Infinity); + ctx.fillRect(0, Infinity, Infinity, 50); + ctx.fillRect(0, Infinity, Infinity, Infinity); + ctx.fillRect(0, Infinity, 100, Infinity); + ctx.fillRect(0, 0, Infinity, Infinity); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.path.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.path.html index 2f83eec2051..bcf7ee5a97a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.path.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.path.html @@ -15,21 +15,19 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.beginPath(); -ctx.rect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 16, 16); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.beginPath(); + ctx.rect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 16, 16); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.path.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.path.worker.js index 0200fc568ee..ddbfc4a96d1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.path.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.path.worker.js @@ -13,17 +13,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.beginPath(); -ctx.rect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 16, 16); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.beginPath(); + ctx.rect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 16, 16); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.shadow.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.shadow.html index f4dd0b2194b..8a8e38070c6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.shadow.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.shadow.html @@ -15,22 +15,20 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.shadowColor = '#0f0'; -ctx.shadowBlur = 0; -ctx.shadowOffsetX = 0; -ctx.shadowOffsetY = 50; -ctx.fillRect(0, -50, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.shadowColor = '#0f0'; + ctx.shadowBlur = 0; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 50; + ctx.fillRect(0, -50, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.shadow.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.shadow.worker.js index dea83df9aae..ff4ef0ca2db 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.shadow.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.shadow.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.shadowColor = '#0f0'; -ctx.shadowBlur = 0; -ctx.shadowOffsetX = 0; -ctx.shadowOffsetY = 50; -ctx.fillRect(0, -50, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.shadowColor = '#0f0'; + ctx.shadowBlur = 0; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 50; + ctx.fillRect(0, -50, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.transform.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.transform.html index 900a5a720c4..19cb6ac77a1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.transform.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.transform.html @@ -15,19 +15,17 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.scale(10, 10); -ctx.translate(0, 5); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, -5, 10, 5); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.scale(10, 10); + ctx.translate(0, 5); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, -5, 10, 5); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.transform.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.transform.worker.js index 8d0cb83c1bf..a7f328955b5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.transform.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.transform.worker.js @@ -13,15 +13,14 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.scale(10, 10); -ctx.translate(0, 5); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, -5, 10, 5); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.scale(10, 10); + ctx.translate(0, 5); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, -5, 10, 5); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.zero.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.zero.html index 509b9b6eb49..3ec78ba18a8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.zero.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.zero.html @@ -15,21 +15,19 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 0); -ctx.fillRect(0, 0, 0, 50); -ctx.fillRect(0, 0, 0, 0); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 0); + ctx.fillRect(0, 0, 0, 50); + ctx.fillRect(0, 0, 0, 0); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.zero.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.zero.worker.js index 48ee67ae748..a310d3ff28a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.zero.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.fillRect.zero.worker.js @@ -13,17 +13,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 0); -ctx.fillRect(0, 0, 0, 50); -ctx.fillRect(0, 0, 0, 0); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 0); + ctx.fillRect(0, 0, 0, 50); + ctx.fillRect(0, 0, 0, 0); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.basic.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.basic.html index 581c3884206..79cc3934b4d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.basic.html @@ -15,18 +15,16 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.strokeRect(25, 24, 50, 2); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.strokeRect(25, 24, 50, 2); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.basic.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.basic.worker.js index 304fc5ba843..de7b13c8f9b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.basic.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.basic.worker.js @@ -13,14 +13,13 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.strokeRect(25, 24, 50, 2); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.strokeRect(25, 24, 50, 2); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.clip.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.clip.html index 646be33af1b..9990f2761ef 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.clip.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.clip.html @@ -15,25 +15,23 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(0, 0, 16, 16); -ctx.clip(); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.strokeRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 16, 16); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.rect(0, 0, 16, 16); + ctx.clip(); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.strokeRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 16, 16); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.clip.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.clip.worker.js index d5a50443d3a..f70a421f1e8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.clip.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.clip.worker.js @@ -13,21 +13,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(0, 0, 16, 16); -ctx.clip(); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.strokeRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 16, 16); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.rect(0, 0, 16, 16); + ctx.clip(); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.strokeRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 16, 16); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalalpha.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalalpha.html index a3e6af9b5cb..efc532f33f3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalalpha.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalalpha.html @@ -15,19 +15,17 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.globalAlpha = 0; -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.strokeRect(25, 24, 50, 2); -_assertPixel(canvas, 50,25, 0,0,0,0); -})(canvas, ctx); -t.done(); + ctx.globalAlpha = 0; + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.strokeRect(25, 24, 50, 2); + _assertPixel(canvas, 50,25, 0,0,0,0); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalalpha.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalalpha.worker.js index 2556f656681..2f938b38486 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalalpha.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalalpha.worker.js @@ -13,15 +13,14 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.globalAlpha = 0; -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.strokeRect(25, 24, 50, 2); -_assertPixel(canvas, 50,25, 0,0,0,0); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.globalAlpha = 0; + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.strokeRect(25, 24, 50, 2); + _assertPixel(canvas, 50,25, 0,0,0,0); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalcomposite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalcomposite.html index fb4b4a199e0..4532604c9a3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalcomposite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalcomposite.html @@ -15,19 +15,17 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.globalCompositeOperation = 'source-in'; -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.strokeRect(25, 24, 50, 2); -_assertPixel(canvas, 50,25, 0,0,0,0); -})(canvas, ctx); -t.done(); + ctx.globalCompositeOperation = 'source-in'; + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.strokeRect(25, 24, 50, 2); + _assertPixel(canvas, 50,25, 0,0,0,0); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalcomposite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalcomposite.worker.js index 7c9859c7fb3..9de70c15a0c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalcomposite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.globalcomposite.worker.js @@ -13,15 +13,14 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.globalCompositeOperation = 'source-in'; -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.strokeRect(25, 24, 50, 2); -_assertPixel(canvas, 50,25, 0,0,0,0); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.globalCompositeOperation = 'source-in'; + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.strokeRect(25, 24, 50, 2); + _assertPixel(canvas, 50,25, 0,0,0,0); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.negative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.negative.html index 3d34371f8a7..13af38e565b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.negative.html @@ -15,26 +15,24 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 25; -ctx.strokeRect(12, 12, 26, 1); -ctx.strokeRect(88, 12, -26, 1); -ctx.strokeRect(12, 38, 26, -1); -ctx.strokeRect(88, 38, -26, -1); -_assertPixel(canvas, 25,12, 0,255,0,255); -_assertPixel(canvas, 75,12, 0,255,0,255); -_assertPixel(canvas, 25,37, 0,255,0,255); -_assertPixel(canvas, 75,37, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 25; + ctx.strokeRect(12, 12, 26, 1); + ctx.strokeRect(88, 12, -26, 1); + ctx.strokeRect(12, 38, 26, -1); + ctx.strokeRect(88, 38, -26, -1); + _assertPixel(canvas, 25,12, 0,255,0,255); + _assertPixel(canvas, 75,12, 0,255,0,255); + _assertPixel(canvas, 25,37, 0,255,0,255); + _assertPixel(canvas, 75,37, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.negative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.negative.worker.js index c80a44680ca..bc2aa0434ba 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.negative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.negative.worker.js @@ -13,22 +13,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 25; -ctx.strokeRect(12, 12, 26, 1); -ctx.strokeRect(88, 12, -26, 1); -ctx.strokeRect(12, 38, 26, -1); -ctx.strokeRect(88, 38, -26, -1); -_assertPixel(canvas, 25,12, 0,255,0,255); -_assertPixel(canvas, 75,12, 0,255,0,255); -_assertPixel(canvas, 25,37, 0,255,0,255); -_assertPixel(canvas, 75,37, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 25; + ctx.strokeRect(12, 12, 26, 1); + ctx.strokeRect(88, 12, -26, 1); + ctx.strokeRect(12, 38, 26, -1); + ctx.strokeRect(88, 38, -26, -1); + _assertPixel(canvas, 25,12, 0,255,0,255); + _assertPixel(canvas, 75,12, 0,255,0,255); + _assertPixel(canvas, 25,37, 0,255,0,255); + _assertPixel(canvas, 75,37, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.nonfinite.html index 808522830ac..63937974649 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.nonfinite.html @@ -15,42 +15,40 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 150; -ctx.strokeRect(Infinity, 0, 100, 50); -ctx.strokeRect(-Infinity, 0, 100, 50); -ctx.strokeRect(NaN, 0, 100, 50); -ctx.strokeRect(0, Infinity, 100, 50); -ctx.strokeRect(0, -Infinity, 100, 50); -ctx.strokeRect(0, NaN, 100, 50); -ctx.strokeRect(0, 0, Infinity, 50); -ctx.strokeRect(0, 0, -Infinity, 50); -ctx.strokeRect(0, 0, NaN, 50); -ctx.strokeRect(0, 0, 100, Infinity); -ctx.strokeRect(0, 0, 100, -Infinity); -ctx.strokeRect(0, 0, 100, NaN); -ctx.strokeRect(Infinity, Infinity, 100, 50); -ctx.strokeRect(Infinity, Infinity, Infinity, 50); -ctx.strokeRect(Infinity, Infinity, Infinity, Infinity); -ctx.strokeRect(Infinity, Infinity, 100, Infinity); -ctx.strokeRect(Infinity, 0, Infinity, 50); -ctx.strokeRect(Infinity, 0, Infinity, Infinity); -ctx.strokeRect(Infinity, 0, 100, Infinity); -ctx.strokeRect(0, Infinity, Infinity, 50); -ctx.strokeRect(0, Infinity, Infinity, Infinity); -ctx.strokeRect(0, Infinity, 100, Infinity); -ctx.strokeRect(0, 0, Infinity, Infinity); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 150; + ctx.strokeRect(Infinity, 0, 100, 50); + ctx.strokeRect(-Infinity, 0, 100, 50); + ctx.strokeRect(NaN, 0, 100, 50); + ctx.strokeRect(0, Infinity, 100, 50); + ctx.strokeRect(0, -Infinity, 100, 50); + ctx.strokeRect(0, NaN, 100, 50); + ctx.strokeRect(0, 0, Infinity, 50); + ctx.strokeRect(0, 0, -Infinity, 50); + ctx.strokeRect(0, 0, NaN, 50); + ctx.strokeRect(0, 0, 100, Infinity); + ctx.strokeRect(0, 0, 100, -Infinity); + ctx.strokeRect(0, 0, 100, NaN); + ctx.strokeRect(Infinity, Infinity, 100, 50); + ctx.strokeRect(Infinity, Infinity, Infinity, 50); + ctx.strokeRect(Infinity, Infinity, Infinity, Infinity); + ctx.strokeRect(Infinity, Infinity, 100, Infinity); + ctx.strokeRect(Infinity, 0, Infinity, 50); + ctx.strokeRect(Infinity, 0, Infinity, Infinity); + ctx.strokeRect(Infinity, 0, 100, Infinity); + ctx.strokeRect(0, Infinity, Infinity, 50); + ctx.strokeRect(0, Infinity, Infinity, Infinity); + ctx.strokeRect(0, Infinity, 100, Infinity); + ctx.strokeRect(0, 0, Infinity, Infinity); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.nonfinite.worker.js index 4c1bc4c609d..1878e54c5f1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.nonfinite.worker.js @@ -13,38 +13,37 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 150; -ctx.strokeRect(Infinity, 0, 100, 50); -ctx.strokeRect(-Infinity, 0, 100, 50); -ctx.strokeRect(NaN, 0, 100, 50); -ctx.strokeRect(0, Infinity, 100, 50); -ctx.strokeRect(0, -Infinity, 100, 50); -ctx.strokeRect(0, NaN, 100, 50); -ctx.strokeRect(0, 0, Infinity, 50); -ctx.strokeRect(0, 0, -Infinity, 50); -ctx.strokeRect(0, 0, NaN, 50); -ctx.strokeRect(0, 0, 100, Infinity); -ctx.strokeRect(0, 0, 100, -Infinity); -ctx.strokeRect(0, 0, 100, NaN); -ctx.strokeRect(Infinity, Infinity, 100, 50); -ctx.strokeRect(Infinity, Infinity, Infinity, 50); -ctx.strokeRect(Infinity, Infinity, Infinity, Infinity); -ctx.strokeRect(Infinity, Infinity, 100, Infinity); -ctx.strokeRect(Infinity, 0, Infinity, 50); -ctx.strokeRect(Infinity, 0, Infinity, Infinity); -ctx.strokeRect(Infinity, 0, 100, Infinity); -ctx.strokeRect(0, Infinity, Infinity, 50); -ctx.strokeRect(0, Infinity, Infinity, Infinity); -ctx.strokeRect(0, Infinity, 100, Infinity); -ctx.strokeRect(0, 0, Infinity, Infinity); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 150; + ctx.strokeRect(Infinity, 0, 100, 50); + ctx.strokeRect(-Infinity, 0, 100, 50); + ctx.strokeRect(NaN, 0, 100, 50); + ctx.strokeRect(0, Infinity, 100, 50); + ctx.strokeRect(0, -Infinity, 100, 50); + ctx.strokeRect(0, NaN, 100, 50); + ctx.strokeRect(0, 0, Infinity, 50); + ctx.strokeRect(0, 0, -Infinity, 50); + ctx.strokeRect(0, 0, NaN, 50); + ctx.strokeRect(0, 0, 100, Infinity); + ctx.strokeRect(0, 0, 100, -Infinity); + ctx.strokeRect(0, 0, 100, NaN); + ctx.strokeRect(Infinity, Infinity, 100, 50); + ctx.strokeRect(Infinity, Infinity, Infinity, 50); + ctx.strokeRect(Infinity, Infinity, Infinity, Infinity); + ctx.strokeRect(Infinity, Infinity, 100, Infinity); + ctx.strokeRect(Infinity, 0, Infinity, 50); + ctx.strokeRect(Infinity, 0, Infinity, Infinity); + ctx.strokeRect(Infinity, 0, 100, Infinity); + ctx.strokeRect(0, Infinity, Infinity, 50); + ctx.strokeRect(0, Infinity, Infinity, Infinity); + ctx.strokeRect(0, Infinity, 100, Infinity); + ctx.strokeRect(0, 0, Infinity, Infinity); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.path.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.path.html index b7a99256572..da8e903f9c9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.path.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.path.html @@ -15,22 +15,20 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.beginPath(); -ctx.rect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 5; -ctx.strokeRect(0, 0, 16, 16); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.beginPath(); + ctx.rect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 5; + ctx.strokeRect(0, 0, 16, 16); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.path.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.path.worker.js index 436bd03107d..839b973b171 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.path.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.path.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.beginPath(); -ctx.rect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 5; -ctx.strokeRect(0, 0, 16, 16); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.beginPath(); + ctx.rect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 5; + ctx.strokeRect(0, 0, 16, 16); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.shadow.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.shadow.html index 769a6b19318..2adf24e2b56 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.shadow.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.shadow.html @@ -15,25 +15,23 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.shadowColor = '#0f0'; -ctx.shadowBlur = 0; -ctx.shadowOffsetX = 0; -ctx.shadowOffsetY = 50; -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.strokeRect(0, -75, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.shadowColor = '#0f0'; + ctx.shadowBlur = 0; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 50; + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.strokeRect(0, -75, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.shadow.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.shadow.worker.js index 13beb42ff09..36b34550162 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.shadow.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.shadow.worker.js @@ -13,21 +13,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.shadowColor = '#0f0'; -ctx.shadowBlur = 0; -ctx.shadowOffsetX = 0; -ctx.shadowOffsetY = 50; -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.strokeRect(0, -75, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.shadowColor = '#0f0'; + ctx.shadowBlur = 0; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 50; + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.strokeRect(0, -75, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.transform.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.transform.html index 08148a5cb27..214ea140234 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.transform.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.transform.html @@ -15,20 +15,18 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.scale(10, 10); -ctx.translate(0, 5); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 5; -ctx.strokeRect(2.5, -2.6, 5, 0.2); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.scale(10, 10); + ctx.translate(0, 5); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 5; + ctx.strokeRect(2.5, -2.6, 5, 0.2); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.transform.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.transform.worker.js index 5958cf14069..43aab18533f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.transform.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.transform.worker.js @@ -13,16 +13,15 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.scale(10, 10); -ctx.translate(0, 5); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 5; -ctx.strokeRect(2.5, -2.6, 5, 0.2); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.scale(10, 10); + ctx.translate(0, 5); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 5; + ctx.strokeRect(2.5, -2.6, 5, 0.2); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.1.html index 52d0964ab38..2c63913fca2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.1.html @@ -15,18 +15,16 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 250; -ctx.strokeRect(50, 25, 0, 0); -_assertPixel(canvas, 50,25, 0,0,0,0); -})(canvas, ctx); -t.done(); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 250; + ctx.strokeRect(50, 25, 0, 0); + _assertPixel(canvas, 50,25, 0,0,0,0); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.1.worker.js index be3da7c88a8..115017b3bf5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.1.worker.js @@ -13,14 +13,13 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 250; -ctx.strokeRect(50, 25, 0, 0); -_assertPixel(canvas, 50,25, 0,0,0,0); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 250; + ctx.strokeRect(50, 25, 0, 0); + _assertPixel(canvas, 50,25, 0,0,0,0); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.2.html index 42b50187daf..16bddea7ee3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.2.html @@ -15,20 +15,18 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 250; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; -ctx.strokeRect(50, 25, 0, 0); -_assertPixel(canvas, 50,25, 0,0,0,0); -})(canvas, ctx); -t.done(); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 250; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; + ctx.strokeRect(50, 25, 0, 0); + _assertPixel(canvas, 50,25, 0,0,0,0); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.2.worker.js index ab24ad34127..973ebec44a0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.2.worker.js @@ -13,16 +13,15 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 250; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; -ctx.strokeRect(50, 25, 0, 0); -_assertPixel(canvas, 50,25, 0,0,0,0); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 250; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; + ctx.strokeRect(50, 25, 0, 0); + _assertPixel(canvas, 50,25, 0,0,0,0); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.3.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.3.html index b5e6bddb6fd..8bf3e043dbe 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.3.html @@ -15,18 +15,16 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.strokeRect(0, 25, 100, 0); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.strokeRect(0, 25, 100, 0); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.3.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.3.worker.js index d9b365f7e80..2612e54fdb5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.3.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.3.worker.js @@ -13,14 +13,13 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.strokeRect(0, 25, 100, 0); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.strokeRect(0, 25, 100, 0); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.4.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.4.html index a07d9370378..87aeaf7c135 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.4.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.4.html @@ -15,19 +15,17 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 250; -ctx.lineCap = 'round'; -ctx.strokeRect(100, 25, 100, 0); -_assertPixel(canvas, 50,25, 0,0,0,0); -})(canvas, ctx); -t.done(); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 250; + ctx.lineCap = 'round'; + ctx.strokeRect(100, 25, 100, 0); + _assertPixel(canvas, 50,25, 0,0,0,0); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.4.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.4.worker.js index 23513a47507..3cec2063132 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.4.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.4.worker.js @@ -13,15 +13,14 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 250; -ctx.lineCap = 'round'; -ctx.strokeRect(100, 25, 100, 0); -_assertPixel(canvas, 50,25, 0,0,0,0); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 250; + ctx.lineCap = 'round'; + ctx.strokeRect(100, 25, 100, 0); + _assertPixel(canvas, 50,25, 0,0,0,0); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.5.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.5.html index 363c27d680d..e03e7aa1182 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.5.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.5.html @@ -15,19 +15,17 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 250; -ctx.lineJoin = 'round'; -ctx.strokeRect(100, 25, 100, 0); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 250; + ctx.lineJoin = 'round'; + ctx.strokeRect(100, 25, 100, 0); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.5.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.5.worker.js index 0ef9e677254..8591409705f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.5.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/drawing-rectangles-to-the-canvas/2d.strokeRect.zero.5.worker.js @@ -13,15 +13,14 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 250; -ctx.lineJoin = 'round'; -ctx.strokeRect(100, 25, 100, 0); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 250; + ctx.lineJoin = 'round'; + ctx.strokeRect(100, 25, 100, 0); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html index f5332780c82..63f23bc1f71 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html @@ -15,20 +15,18 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur'}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: undefined}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 'foo'}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: [1,2]}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: NaN}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: {}}); }); -})(canvas, ctx); -t.done(); + assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur'}); }); + assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: undefined}); }); + assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 'foo'}); }); + assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: [1,2]}); }); + assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: NaN}); }); + assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: {}}); }); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.worker.js index 61f10308801..9a2baad6aba 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.worker.js @@ -13,16 +13,15 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur'}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: undefined}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 'foo'}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: [1,2]}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: NaN}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: {}}); }); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur'}); }); + assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: undefined}); }); + assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 'foo'}); }); + assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: [1,2]}); }); + assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: NaN}); }); + assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: {}}); }); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html index f3dd3037bb7..778d9fb2f80 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html @@ -15,57 +15,55 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: 'foo'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: null}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 'a']}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, Infinity]}); }); -ctx.fillStyle = '#f00'; -ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 0}); -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 10,10, 255,0,0,255, 2); -ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 90}); -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 10,10, 0,91,0,255, 2); -ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 180}); -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 10,10, 0,109,109,255, 2); -ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 270}); -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 10,10, 109,18,255,255, 2); -ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'saturate', values: 0.5}); -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 10,10, 155,27,27,255, 2); -ctx.clearRect(0, 0, 100, 50); -ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'luminanceToAlpha'}); -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 10,10, 0,0,0,54, 2); -ctx.filter = new CanvasFilter({filter: 'colorMatrix', values: [ - 0, 0, 0, 0, 0, - 1, 1, 1, 1, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0 -]}); -ctx.fillRect(0, 0, 50, 25); -ctx.fillStyle = '#0f0'; -ctx.fillRect(50, 0, 50, 25); -ctx.fillStyle = '#00f'; -ctx.fillRect(0, 25, 50, 25); -ctx.fillStyle = '#fff'; -ctx.fillRect(50, 25, 50, 25); -_assertPixelApprox(canvas, 10,10, 0,255,0,255, 2); -_assertPixelApprox(canvas, 60,10, 0,255,0,255, 2); -_assertPixelApprox(canvas, 10,30, 0,255,0,255, 2); -_assertPixelApprox(canvas, 60,30, 0,255,0,255, 2); -})(canvas, ctx); -t.done(); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: undefined}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: 'foo'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: null}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 'a']}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, Infinity]}); }); + ctx.fillStyle = '#f00'; + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 0}); + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 10,10, 255,0,0,255, 2); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 90}); + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 10,10, 0,91,0,255, 2); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 180}); + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 10,10, 0,109,109,255, 2); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 270}); + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 10,10, 109,18,255,255, 2); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'saturate', values: 0.5}); + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 10,10, 155,27,27,255, 2); + ctx.clearRect(0, 0, 100, 50); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'luminanceToAlpha'}); + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 10,10, 0,0,0,54, 2); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', values: [ + 0, 0, 0, 0, 0, + 1, 1, 1, 1, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0 + ]}); + ctx.fillRect(0, 0, 50, 25); + ctx.fillStyle = '#0f0'; + ctx.fillRect(50, 0, 50, 25); + ctx.fillStyle = '#00f'; + ctx.fillRect(0, 25, 50, 25); + ctx.fillStyle = '#fff'; + ctx.fillRect(50, 25, 50, 25); + _assertPixelApprox(canvas, 10,10, 0,255,0,255, 2); + _assertPixelApprox(canvas, 60,10, 0,255,0,255, 2); + _assertPixelApprox(canvas, 10,30, 0,255,0,255, 2); + _assertPixelApprox(canvas, 60,30, 0,255,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.worker.js index 19d57b61e53..ff5a6711306 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.worker.js @@ -13,53 +13,52 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: 'foo'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: null}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 'a']}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, Infinity]}); }); -ctx.fillStyle = '#f00'; -ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 0}); -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 10,10, 255,0,0,255, 2); -ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 90}); -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 10,10, 0,91,0,255, 2); -ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 180}); -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 10,10, 0,109,109,255, 2); -ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 270}); -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 10,10, 109,18,255,255, 2); -ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'saturate', values: 0.5}); -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 10,10, 155,27,27,255, 2); -ctx.clearRect(0, 0, 100, 50); -ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'luminanceToAlpha'}); -ctx.fillRect(0, 0, 100, 50); -_assertPixelApprox(canvas, 10,10, 0,0,0,54, 2); -ctx.filter = new CanvasFilter({filter: 'colorMatrix', values: [ - 0, 0, 0, 0, 0, - 1, 1, 1, 1, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0 -]}); -ctx.fillRect(0, 0, 50, 25); -ctx.fillStyle = '#0f0'; -ctx.fillRect(50, 0, 50, 25); -ctx.fillStyle = '#00f'; -ctx.fillRect(0, 25, 50, 25); -ctx.fillStyle = '#fff'; -ctx.fillRect(50, 25, 50, 25); -_assertPixelApprox(canvas, 10,10, 0,255,0,255, 2); -_assertPixelApprox(canvas, 60,10, 0,255,0,255, 2); -_assertPixelApprox(canvas, 10,30, 0,255,0,255, 2); -_assertPixelApprox(canvas, 60,30, 0,255,0,255, 2); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: undefined}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: 'foo'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: null}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 'a']}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, Infinity]}); }); + ctx.fillStyle = '#f00'; + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 0}); + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 10,10, 255,0,0,255, 2); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 90}); + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 10,10, 0,91,0,255, 2); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 180}); + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 10,10, 0,109,109,255, 2); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 270}); + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 10,10, 109,18,255,255, 2); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'saturate', values: 0.5}); + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 10,10, 155,27,27,255, 2); + ctx.clearRect(0, 0, 100, 50); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'luminanceToAlpha'}); + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 10,10, 0,0,0,54, 2); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', values: [ + 0, 0, 0, 0, 0, + 1, 1, 1, 1, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0 + ]}); + ctx.fillRect(0, 0, 50, 25); + ctx.fillStyle = '#0f0'; + ctx.fillRect(50, 0, 50, 25); + ctx.fillStyle = '#00f'; + ctx.fillRect(0, 25, 50, 25); + ctx.fillStyle = '#fff'; + ctx.fillRect(50, 25, 50, 25); + _assertPixelApprox(canvas, 10,10, 0,255,0,255, 2); + _assertPixelApprox(canvas, 60,10, 0,255,0,255, 2); + _assertPixelApprox(canvas, 10,30, 0,255,0,255, 2); + _assertPixelApprox(canvas, 60,30, 0,255,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html index dd6fc9ee5ff..e91fc5502e0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html @@ -15,55 +15,53 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement -function getTransformedValue(C, V) { - // Get the right interval - const n = V.length; - const k = C == 1 ? n - 1 : Math.floor(C * n); - return V[k]; -} + // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement + function getTransformedValue(C, V) { + // Get the right interval + const n = V.length; + const k = C == 1 ? n - 1 : Math.floor(C * n); + return V[k]; + } -function getColor(inputColor, tableValues) { - const result = [0, 0, 0]; - for (const i in inputColor) { - const C = inputColor[i]/255; - const Cprime = getTransformedValue(C, tableValues[i]); - result[i] = Math.max(0, Math.min(1, Cprime)) * 255; - } - return result; -} + function getColor(inputColor, tableValues) { + const result = [0, 0, 0]; + for (const i in inputColor) { + const C = inputColor[i]/255; + const Cprime = getTransformedValue(C, tableValues[i]); + result[i] = Math.max(0, Math.min(1, Cprime)) * 255; + } + return result; + } -tableValuesR = [0, 0, 1, 1]; -tableValuesG = [2, 0, 0.5, 3]; -tableValuesB = [1, -1, 5, 0]; -ctx.filter = new CanvasFilter({filter: 'componentTransfer', - funcR: {type: 'discrete', tableValues: tableValuesR}, - funcG: {type: 'discrete', tableValues: tableValuesG}, - funcB: {type: 'discrete', tableValues: tableValuesB}, -}); + tableValuesR = [0, 0, 1, 1]; + tableValuesG = [2, 0, 0.5, 3]; + tableValuesB = [1, -1, 5, 0]; + ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'discrete', tableValues: tableValuesR}, + funcG: {type: 'discrete', tableValues: tableValuesG}, + funcB: {type: 'discrete', tableValues: tableValuesB}, + }); -const inputColors = [ - [255, 255, 255], - [0, 0, 0], - [127, 0, 34], - [252, 186, 3], - [50, 68, 87], -]; + const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], + ]; -for (const color of inputColors) { - let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]); - ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; - ctx.fillRect(0, 0, 10, 10); - _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); -} -})(canvas, ctx); -t.done(); + for (const color of inputColors) { + let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); + } + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.worker.js index 79a5cd2475c..0a7752bf135 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.worker.js @@ -13,51 +13,50 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement -function getTransformedValue(C, V) { - // Get the right interval - const n = V.length; - const k = C == 1 ? n - 1 : Math.floor(C * n); - return V[k]; -} - -function getColor(inputColor, tableValues) { - const result = [0, 0, 0]; - for (const i in inputColor) { - const C = inputColor[i]/255; - const Cprime = getTransformedValue(C, tableValues[i]); - result[i] = Math.max(0, Math.min(1, Cprime)) * 255; - } - return result; -} - -tableValuesR = [0, 0, 1, 1]; -tableValuesG = [2, 0, 0.5, 3]; -tableValuesB = [1, -1, 5, 0]; -ctx.filter = new CanvasFilter({filter: 'componentTransfer', - funcR: {type: 'discrete', tableValues: tableValuesR}, - funcG: {type: 'discrete', tableValues: tableValuesG}, - funcB: {type: 'discrete', tableValues: tableValuesB}, -}); - -const inputColors = [ - [255, 255, 255], - [0, 0, 0], - [127, 0, 34], - [252, 186, 3], - [50, 68, 87], -]; - -for (const color of inputColors) { - let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]); - ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; - ctx.fillRect(0, 0, 10, 10); - _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); -} -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement + function getTransformedValue(C, V) { + // Get the right interval + const n = V.length; + const k = C == 1 ? n - 1 : Math.floor(C * n); + return V[k]; + } + + function getColor(inputColor, tableValues) { + const result = [0, 0, 0]; + for (const i in inputColor) { + const C = inputColor[i]/255; + const Cprime = getTransformedValue(C, tableValues[i]); + result[i] = Math.max(0, Math.min(1, Cprime)) * 255; + } + return result; + } + + tableValuesR = [0, 0, 1, 1]; + tableValuesG = [2, 0, 0.5, 3]; + tableValuesB = [1, -1, 5, 0]; + ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'discrete', tableValues: tableValuesR}, + funcG: {type: 'discrete', tableValues: tableValuesG}, + funcB: {type: 'discrete', tableValues: tableValuesB}, + }); + + const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], + ]; + + for (const color of inputColors) { + let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); + } + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html index f2a9fcfd49a..6fa1244a1db 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html @@ -15,46 +15,44 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement -function getColor(inputColor, amplitude, exponent, offset) { - return [ - Math.max(0, Math.min(1, Math.pow(inputColor[0]/255, exponent[0]) * amplitude[0] + offset[0])) * 255, - Math.max(0, Math.min(1, Math.pow(inputColor[1]/255, exponent[1]) * amplitude[1] + offset[1])) * 255, - Math.max(0, Math.min(1, Math.pow(inputColor[2]/255, exponent[2]) * amplitude[2] + offset[2])) * 255, - ]; -} - -const amplitudes = [2, 1.1, 0.5]; -const exponents = [5, 3, 1]; -const offsets = [0.25, 0, 0.5]; -ctx.filter = new CanvasFilter({filter: 'componentTransfer', - funcR: {type: 'gamma', amplitude: amplitudes[0], exponent: exponents[0], offset: offsets[0]}, - funcG: {type: 'gamma', amplitude: amplitudes[1], exponent: exponents[1], offset: offsets[1]}, - funcB: {type: 'gamma', amplitude: amplitudes[2], exponent: exponents[2], offset: offsets[2]}, -}); - -const inputColors = [ - [255, 255, 255], - [0, 0, 0], - [127, 0, 34], - [252, 186, 3], - [50, 68, 87], -]; - -for (const color of inputColors) { - let outputColor = getColor(color, amplitudes, exponents, offsets); - ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; - ctx.fillRect(0, 0, 10, 10); - _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); -} -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement + function getColor(inputColor, amplitude, exponent, offset) { + return [ + Math.max(0, Math.min(1, Math.pow(inputColor[0]/255, exponent[0]) * amplitude[0] + offset[0])) * 255, + Math.max(0, Math.min(1, Math.pow(inputColor[1]/255, exponent[1]) * amplitude[1] + offset[1])) * 255, + Math.max(0, Math.min(1, Math.pow(inputColor[2]/255, exponent[2]) * amplitude[2] + offset[2])) * 255, + ]; + } + + const amplitudes = [2, 1.1, 0.5]; + const exponents = [5, 3, 1]; + const offsets = [0.25, 0, 0.5]; + ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'gamma', amplitude: amplitudes[0], exponent: exponents[0], offset: offsets[0]}, + funcG: {type: 'gamma', amplitude: amplitudes[1], exponent: exponents[1], offset: offsets[1]}, + funcB: {type: 'gamma', amplitude: amplitudes[2], exponent: exponents[2], offset: offsets[2]}, + }); + + const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], + ]; + + for (const color of inputColors) { + let outputColor = getColor(color, amplitudes, exponents, offsets); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); + } + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.worker.js index a36fa19a5ef..0a72055afb7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.worker.js @@ -13,42 +13,41 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement -function getColor(inputColor, amplitude, exponent, offset) { - return [ - Math.max(0, Math.min(1, Math.pow(inputColor[0]/255, exponent[0]) * amplitude[0] + offset[0])) * 255, - Math.max(0, Math.min(1, Math.pow(inputColor[1]/255, exponent[1]) * amplitude[1] + offset[1])) * 255, - Math.max(0, Math.min(1, Math.pow(inputColor[2]/255, exponent[2]) * amplitude[2] + offset[2])) * 255, - ]; -} - -const amplitudes = [2, 1.1, 0.5]; -const exponents = [5, 3, 1]; -const offsets = [0.25, 0, 0.5]; -ctx.filter = new CanvasFilter({filter: 'componentTransfer', - funcR: {type: 'gamma', amplitude: amplitudes[0], exponent: exponents[0], offset: offsets[0]}, - funcG: {type: 'gamma', amplitude: amplitudes[1], exponent: exponents[1], offset: offsets[1]}, - funcB: {type: 'gamma', amplitude: amplitudes[2], exponent: exponents[2], offset: offsets[2]}, -}); - -const inputColors = [ - [255, 255, 255], - [0, 0, 0], - [127, 0, 34], - [252, 186, 3], - [50, 68, 87], -]; - -for (const color of inputColors) { - let outputColor = getColor(color, amplitudes, exponents, offsets); - ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; - ctx.fillRect(0, 0, 10, 10); - _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); -} -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement + function getColor(inputColor, amplitude, exponent, offset) { + return [ + Math.max(0, Math.min(1, Math.pow(inputColor[0]/255, exponent[0]) * amplitude[0] + offset[0])) * 255, + Math.max(0, Math.min(1, Math.pow(inputColor[1]/255, exponent[1]) * amplitude[1] + offset[1])) * 255, + Math.max(0, Math.min(1, Math.pow(inputColor[2]/255, exponent[2]) * amplitude[2] + offset[2])) * 255, + ]; + } + + const amplitudes = [2, 1.1, 0.5]; + const exponents = [5, 3, 1]; + const offsets = [0.25, 0, 0.5]; + ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'gamma', amplitude: amplitudes[0], exponent: exponents[0], offset: offsets[0]}, + funcG: {type: 'gamma', amplitude: amplitudes[1], exponent: exponents[1], offset: offsets[1]}, + funcB: {type: 'gamma', amplitude: amplitudes[2], exponent: exponents[2], offset: offsets[2]}, + }); + + const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], + ]; + + for (const color of inputColors) { + let outputColor = getColor(color, amplitudes, exponents, offsets); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); + } + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html index 33aae01eb05..552402c556b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html @@ -15,33 +15,31 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.filter = new CanvasFilter({filter: 'componentTransfer', - funcR: {type: 'identity'}, - funcG: {type: 'identity'}, - funcB: {type: 'identity'}, -}); - -const inputColors = [ - [255, 255, 255], - [0, 0, 0], - [127, 0, 34], - [252, 186, 3], - [50, 68, 87], -]; - -for (const color of inputColors) { - ctx.fillStyle = `rgba(${color[0]}, ${color[1]}, ${color[2]}, 1)`, - ctx.fillRect(0, 0, 10, 10); - _assertPixel(canvas, 5, 5, color[0],color[1],color[2],255); -} -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'identity'}, + funcG: {type: 'identity'}, + funcB: {type: 'identity'}, + }); + + const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], + ]; + + for (const color of inputColors) { + ctx.fillStyle = `rgba(${color[0]}, ${color[1]}, ${color[2]}, 1)`, + ctx.fillRect(0, 0, 10, 10); + _assertPixel(canvas, 5, 5, color[0],color[1],color[2],255); + } + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.worker.js index 7236c7087a1..861f86beb7a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.worker.js @@ -13,29 +13,28 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.filter = new CanvasFilter({filter: 'componentTransfer', - funcR: {type: 'identity'}, - funcG: {type: 'identity'}, - funcB: {type: 'identity'}, -}); - -const inputColors = [ - [255, 255, 255], - [0, 0, 0], - [127, 0, 34], - [252, 186, 3], - [50, 68, 87], -]; + ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'identity'}, + funcG: {type: 'identity'}, + funcB: {type: 'identity'}, + }); -for (const color of inputColors) { - ctx.fillStyle = `rgba(${color[0]}, ${color[1]}, ${color[2]}, 1)`, - ctx.fillRect(0, 0, 10, 10); - _assertPixel(canvas, 5, 5, color[0],color[1],color[2],255); -} -t.done(); + const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], + ]; + for (const color of inputColors) { + ctx.fillStyle = `rgba(${color[0]}, ${color[1]}, ${color[2]}, 1)`, + ctx.fillRect(0, 0, 10, 10); + _assertPixel(canvas, 5, 5, color[0],color[1],color[2],255); + } + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html index 23731a1286c..3d842ab5b44 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html @@ -15,45 +15,43 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement -function getColor(inputColor, slopes, intercepts) { - return [ - Math.max(0, Math.min(1, inputColor[0]/255 * slopes[0] + intercepts[0])) * 255, - Math.max(0, Math.min(1, inputColor[1]/255 * slopes[1] + intercepts[1])) * 255, - Math.max(0, Math.min(1, inputColor[2]/255 * slopes[2] + intercepts[2])) * 255, - ]; -} - -const slopes = [0.5, 1.2, -0.2]; -const intercepts = [0.25, 0, 0.5]; -ctx.filter = new CanvasFilter({filter: 'componentTransfer', - funcR: {type: 'linear', slope: slopes[0], intercept: intercepts[0]}, - funcG: {type: 'linear', slope: slopes[1], intercept: intercepts[1]}, - funcB: {type: 'linear', slope: slopes[2], intercept: intercepts[2]}, -}); - -const inputColors = [ - [255, 255, 255], - [0, 0, 0], - [127, 0, 34], - [252, 186, 3], - [50, 68, 87], -]; - -for (const color of inputColors) { - let outputColor = getColor(color, slopes, intercepts); - ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; - ctx.fillRect(0, 0, 10, 10); - _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); -} -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement + function getColor(inputColor, slopes, intercepts) { + return [ + Math.max(0, Math.min(1, inputColor[0]/255 * slopes[0] + intercepts[0])) * 255, + Math.max(0, Math.min(1, inputColor[1]/255 * slopes[1] + intercepts[1])) * 255, + Math.max(0, Math.min(1, inputColor[2]/255 * slopes[2] + intercepts[2])) * 255, + ]; + } + + const slopes = [0.5, 1.2, -0.2]; + const intercepts = [0.25, 0, 0.5]; + ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'linear', slope: slopes[0], intercept: intercepts[0]}, + funcG: {type: 'linear', slope: slopes[1], intercept: intercepts[1]}, + funcB: {type: 'linear', slope: slopes[2], intercept: intercepts[2]}, + }); + + const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], + ]; + + for (const color of inputColors) { + let outputColor = getColor(color, slopes, intercepts); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); + } + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.worker.js index 9a4499d4d6b..a3a8240906a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.worker.js @@ -13,41 +13,40 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement -function getColor(inputColor, slopes, intercepts) { - return [ - Math.max(0, Math.min(1, inputColor[0]/255 * slopes[0] + intercepts[0])) * 255, - Math.max(0, Math.min(1, inputColor[1]/255 * slopes[1] + intercepts[1])) * 255, - Math.max(0, Math.min(1, inputColor[2]/255 * slopes[2] + intercepts[2])) * 255, - ]; -} - -const slopes = [0.5, 1.2, -0.2]; -const intercepts = [0.25, 0, 0.5]; -ctx.filter = new CanvasFilter({filter: 'componentTransfer', - funcR: {type: 'linear', slope: slopes[0], intercept: intercepts[0]}, - funcG: {type: 'linear', slope: slopes[1], intercept: intercepts[1]}, - funcB: {type: 'linear', slope: slopes[2], intercept: intercepts[2]}, -}); - -const inputColors = [ - [255, 255, 255], - [0, 0, 0], - [127, 0, 34], - [252, 186, 3], - [50, 68, 87], -]; - -for (const color of inputColors) { - let outputColor = getColor(color, slopes, intercepts); - ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; - ctx.fillRect(0, 0, 10, 10); - _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); -} -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement + function getColor(inputColor, slopes, intercepts) { + return [ + Math.max(0, Math.min(1, inputColor[0]/255 * slopes[0] + intercepts[0])) * 255, + Math.max(0, Math.min(1, inputColor[1]/255 * slopes[1] + intercepts[1])) * 255, + Math.max(0, Math.min(1, inputColor[2]/255 * slopes[2] + intercepts[2])) * 255, + ]; + } + + const slopes = [0.5, 1.2, -0.2]; + const intercepts = [0.25, 0, 0.5]; + ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'linear', slope: slopes[0], intercept: intercepts[0]}, + funcG: {type: 'linear', slope: slopes[1], intercept: intercepts[1]}, + funcB: {type: 'linear', slope: slopes[2], intercept: intercepts[2]}, + }); + + const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], + ]; + + for (const color of inputColors) { + let outputColor = getColor(color, slopes, intercepts); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); + } + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html index c11e6adb910..caef1eaef33 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html @@ -15,55 +15,53 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement -function getTransformedValue(C, V) { - // Get the right interval - const n = V.length - 1; - const k = C == 1 ? n - 1 : Math.floor(C * n); - return V[k] + (C - k/n) * n * (V[k + 1] - V[k]); -} + // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement + function getTransformedValue(C, V) { + // Get the right interval + const n = V.length - 1; + const k = C == 1 ? n - 1 : Math.floor(C * n); + return V[k] + (C - k/n) * n * (V[k + 1] - V[k]); + } -function getColor(inputColor, tableValues) { - const result = [0, 0, 0]; - for (const i in inputColor) { - const C = inputColor[i]/255; - const Cprime = getTransformedValue(C, tableValues[i]); - result[i] = Math.max(0, Math.min(1, Cprime)) * 255; - } - return result; -} + function getColor(inputColor, tableValues) { + const result = [0, 0, 0]; + for (const i in inputColor) { + const C = inputColor[i]/255; + const Cprime = getTransformedValue(C, tableValues[i]); + result[i] = Math.max(0, Math.min(1, Cprime)) * 255; + } + return result; + } -tableValuesR = [0, 0, 1, 1]; -tableValuesG = [2, 0, 0.5, 3]; -tableValuesB = [1, -1, 5, 0]; -ctx.filter = new CanvasFilter({filter: 'componentTransfer', - funcR: {type: 'table', tableValues: tableValuesR}, - funcG: {type: 'table', tableValues: tableValuesG}, - funcB: {type: 'table', tableValues: tableValuesB}, -}); + tableValuesR = [0, 0, 1, 1]; + tableValuesG = [2, 0, 0.5, 3]; + tableValuesB = [1, -1, 5, 0]; + ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'table', tableValues: tableValuesR}, + funcG: {type: 'table', tableValues: tableValuesG}, + funcB: {type: 'table', tableValues: tableValuesB}, + }); -const inputColors = [ - [255, 255, 255], - [0, 0, 0], - [127, 0, 34], - [252, 186, 3], - [50, 68, 87], -]; + const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], + ]; -for (const color of inputColors) { - let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]); - ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; - ctx.fillRect(0, 0, 10, 10); - _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); -} -})(canvas, ctx); -t.done(); + for (const color of inputColors) { + let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); + } + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.worker.js index 8ff791d3bb9..d23534a0145 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.worker.js @@ -13,51 +13,50 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -// From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement -function getTransformedValue(C, V) { - // Get the right interval - const n = V.length - 1; - const k = C == 1 ? n - 1 : Math.floor(C * n); - return V[k] + (C - k/n) * n * (V[k + 1] - V[k]); -} - -function getColor(inputColor, tableValues) { - const result = [0, 0, 0]; - for (const i in inputColor) { - const C = inputColor[i]/255; - const Cprime = getTransformedValue(C, tableValues[i]); - result[i] = Math.max(0, Math.min(1, Cprime)) * 255; - } - return result; -} - -tableValuesR = [0, 0, 1, 1]; -tableValuesG = [2, 0, 0.5, 3]; -tableValuesB = [1, -1, 5, 0]; -ctx.filter = new CanvasFilter({filter: 'componentTransfer', - funcR: {type: 'table', tableValues: tableValuesR}, - funcG: {type: 'table', tableValues: tableValuesG}, - funcB: {type: 'table', tableValues: tableValuesB}, -}); - -const inputColors = [ - [255, 255, 255], - [0, 0, 0], - [127, 0, 34], - [252, 186, 3], - [50, 68, 87], -]; - -for (const color of inputColors) { - let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]); - ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; - ctx.fillRect(0, 0, 10, 10); - _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); -} -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement + function getTransformedValue(C, V) { + // Get the right interval + const n = V.length - 1; + const k = C == 1 ? n - 1 : Math.floor(C * n); + return V[k] + (C - k/n) * n * (V[k + 1] - V[k]); + } + + function getColor(inputColor, tableValues) { + const result = [0, 0, 0]; + for (const i in inputColor) { + const C = inputColor[i]/255; + const Cprime = getTransformedValue(C, tableValues[i]); + result[i] = Math.max(0, Math.min(1, Cprime)) * 255; + } + return result; + } + + tableValuesR = [0, 0, 1, 1]; + tableValuesG = [2, 0, 0.5, 3]; + tableValuesB = [1, -1, 5, 0]; + ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'table', tableValues: tableValuesR}, + funcG: {type: 'table', tableValues: tableValuesG}, + funcB: {type: 'table', tableValues: tableValuesB}, + }); + + const inputColors = [ + [255, 255, 255], + [0, 0, 0], + [127, 0, 34], + [252, 186, 3], + [50, 68, 87], + ]; + + for (const color of inputColors) { + let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]); + ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`; + ctx.fillRect(0, 0, 10, 10); + _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2); + } + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html index c4b6df8e0db..fed21c695c9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html @@ -15,31 +15,29 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', divisor: 2}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: null}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: 1}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0]]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 'a'], [0]]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], 0]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0, Infinity]]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: []}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1, 2, 3, 4]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], []]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 2], []]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], [1, 2]]}); }); -// This should not throw an error -ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[]]}); -ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1]]}); -})(canvas, ctx); -t.done(); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', divisor: 2}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: null}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: 1}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0]]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 'a'], [0]]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], 0]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0, Infinity]]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: []}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1, 2, 3, 4]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], []]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 2], []]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], [1, 2]]}); }); + // This should not throw an error + ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[]]}); + ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1]]}); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.worker.js index f7e616e7a63..02efed9496b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.worker.js @@ -13,27 +13,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', divisor: 2}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: null}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: 1}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0]]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 'a'], [0]]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], 0]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0, Infinity]]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: []}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1, 2, 3, 4]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], []]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 2], []]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], [1, 2]]}); }); -// This should not throw an error -ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[]]}); -ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1]]}); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', divisor: 2}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: null}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: 1}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0]]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 'a'], [0]]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], 0]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0, Infinity]]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: []}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1, 2, 3, 4]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], []]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 2], []]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], [1, 2]]}); }); + // This should not throw an error + ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[]]}); + ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1]]}); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html index e124341e441..4cd0dc8e1cb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html @@ -15,112 +15,110 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -// dx -_assert(new CanvasFilter({filter: 'dropShadow', dx: 10}), "new CanvasFilter({filter: 'dropShadow', dx: 10})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: -1}), "new CanvasFilter({filter: 'dropShadow', dx: -1})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: 0.5}), "new CanvasFilter({filter: 'dropShadow', dx: 0.5})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: null}), "new CanvasFilter({filter: 'dropShadow', dx: null})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: true}), "new CanvasFilter({filter: 'dropShadow', dx: true})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: false}), "new CanvasFilter({filter: 'dropShadow', dx: false})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: []}), "new CanvasFilter({filter: 'dropShadow', dx: []})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: [20]}), "new CanvasFilter({filter: 'dropShadow', dx: [\""+(20)+"\"]})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: '30'}), "new CanvasFilter({filter: 'dropShadow', dx: '30'})"); -// dy -_assert(new CanvasFilter({filter: 'dropShadow', dy: 10}), "new CanvasFilter({filter: 'dropShadow', dy: 10})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: -1}), "new CanvasFilter({filter: 'dropShadow', dy: -1})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: 0.5}), "new CanvasFilter({filter: 'dropShadow', dy: 0.5})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: null}), "new CanvasFilter({filter: 'dropShadow', dy: null})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: true}), "new CanvasFilter({filter: 'dropShadow', dy: true})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: false}), "new CanvasFilter({filter: 'dropShadow', dy: false})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: []}), "new CanvasFilter({filter: 'dropShadow', dy: []})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: [20]}), "new CanvasFilter({filter: 'dropShadow', dy: [\""+(20)+"\"]})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: '30'}), "new CanvasFilter({filter: 'dropShadow', dy: '30'})"); -// floodOpacity -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: 10}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: 10})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: -1}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: -1})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: 0.5}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: 0.5})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: null}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: null})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: true}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: true})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: false}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: false})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: []}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: []})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: [20]}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: [\""+(20)+"\"]})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: '30'}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: '30'})"); -// stdDeviation -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: 10}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: 10})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: -1}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: -1})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: 0.5}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: 0.5})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: null}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: null})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: true}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: true})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: false}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: false})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: []}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: []})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [20]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [\""+(20)+"\"]})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: '30'}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: '30'})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [10, -1]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [10, -1]})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [0.5, null]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [0.5, null]})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [true, false]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [true, false]})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [[], [20]]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [[], [\""+(20)+"\"]]})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: ['30', ['40']]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: ['30', ['40']]})"); -// floodColor -_assert(new CanvasFilter({filter: 'dropShadow', floodColor: 'red'}), "new CanvasFilter({filter: 'dropShadow', floodColor: 'red'})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodColor: 'canvas'}), "new CanvasFilter({filter: 'dropShadow', floodColor: 'canvas'})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'}), "new CanvasFilter({filter: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodColor: '#aabbccdd'}), "new CanvasFilter({filter: 'dropShadow', floodColor: '#aabbccdd'})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodColor: '#abcd'}), "new CanvasFilter({filter: 'dropShadow', floodColor: '#abcd'})"); + // dx + _assert(new CanvasFilter({filter: 'dropShadow', dx: 10}), "new CanvasFilter({filter: 'dropShadow', dx: 10})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: -1}), "new CanvasFilter({filter: 'dropShadow', dx: -1})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: 0.5}), "new CanvasFilter({filter: 'dropShadow', dx: 0.5})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: null}), "new CanvasFilter({filter: 'dropShadow', dx: null})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: true}), "new CanvasFilter({filter: 'dropShadow', dx: true})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: false}), "new CanvasFilter({filter: 'dropShadow', dx: false})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: []}), "new CanvasFilter({filter: 'dropShadow', dx: []})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: [20]}), "new CanvasFilter({filter: 'dropShadow', dx: [\""+(20)+"\"]})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: '30'}), "new CanvasFilter({filter: 'dropShadow', dx: '30'})"); + // dy + _assert(new CanvasFilter({filter: 'dropShadow', dy: 10}), "new CanvasFilter({filter: 'dropShadow', dy: 10})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: -1}), "new CanvasFilter({filter: 'dropShadow', dy: -1})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: 0.5}), "new CanvasFilter({filter: 'dropShadow', dy: 0.5})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: null}), "new CanvasFilter({filter: 'dropShadow', dy: null})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: true}), "new CanvasFilter({filter: 'dropShadow', dy: true})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: false}), "new CanvasFilter({filter: 'dropShadow', dy: false})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: []}), "new CanvasFilter({filter: 'dropShadow', dy: []})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: [20]}), "new CanvasFilter({filter: 'dropShadow', dy: [\""+(20)+"\"]})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: '30'}), "new CanvasFilter({filter: 'dropShadow', dy: '30'})"); + // floodOpacity + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: 10}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: 10})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: -1}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: -1})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: 0.5}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: 0.5})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: null}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: null})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: true}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: true})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: false}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: false})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: []}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: []})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: [20]}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: [\""+(20)+"\"]})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: '30'}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: '30'})"); + // stdDeviation + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: 10}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: 10})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: -1}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: -1})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: 0.5}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: 0.5})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: null}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: null})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: true}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: true})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: false}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: false})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: []}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: []})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [20]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [\""+(20)+"\"]})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: '30'}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: '30'})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [10, -1]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [10, -1]})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [0.5, null]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [0.5, null]})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [true, false]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [true, false]})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [[], [20]]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [[], [\""+(20)+"\"]]})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: ['30', ['40']]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: ['30', ['40']]})"); + // floodColor + _assert(new CanvasFilter({filter: 'dropShadow', floodColor: 'red'}), "new CanvasFilter({filter: 'dropShadow', floodColor: 'red'})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodColor: 'canvas'}), "new CanvasFilter({filter: 'dropShadow', floodColor: 'canvas'})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'}), "new CanvasFilter({filter: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodColor: '#aabbccdd'}), "new CanvasFilter({filter: 'dropShadow', floodColor: '#aabbccdd'})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodColor: '#abcd'}), "new CanvasFilter({filter: 'dropShadow', floodColor: '#abcd'})"); -// dx -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: NaN}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: -Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: 'test'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: {}}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: [1, 2]}); }); -// dy -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: NaN}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: -Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: 'test'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: {}}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: [1, 2]}); }); -// floodOpacity -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: NaN}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: -Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: 'test'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: {}}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: [1, 2]}); }); -// stdDeviation -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: NaN}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: -Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: 'test'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: {}}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, 2, 3]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, NaN]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, Infinity]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, -Infinity]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, undefined]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, 'test']}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, {}]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, [2, 3]]}); }); -// floodColor -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: 'test'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: 'rgba(NaN, 3, 2, 1)'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: 10}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: null}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: NaN}); }); -})(canvas, ctx); -t.done(); + // dx + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: NaN}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: -Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: undefined}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: 'test'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: {}}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: [1, 2]}); }); + // dy + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: NaN}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: -Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: undefined}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: 'test'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: {}}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: [1, 2]}); }); + // floodOpacity + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: NaN}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: -Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: undefined}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: 'test'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: {}}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: [1, 2]}); }); + // stdDeviation + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: NaN}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: -Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: undefined}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: 'test'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: {}}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, 2, 3]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, NaN]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, Infinity]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, -Infinity]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, undefined]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, 'test']}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, {}]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, [2, 3]]}); }); + // floodColor + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: 'test'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: 'rgba(NaN, 3, 2, 1)'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: 10}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: undefined}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: null}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: NaN}); }); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.worker.js index ac3f98ab235..9c30e5633aa 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.worker.js @@ -13,108 +13,107 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -// dx -_assert(new CanvasFilter({filter: 'dropShadow', dx: 10}), "new CanvasFilter({filter: 'dropShadow', dx: 10})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: -1}), "new CanvasFilter({filter: 'dropShadow', dx: -1})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: 0.5}), "new CanvasFilter({filter: 'dropShadow', dx: 0.5})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: null}), "new CanvasFilter({filter: 'dropShadow', dx: null})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: true}), "new CanvasFilter({filter: 'dropShadow', dx: true})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: false}), "new CanvasFilter({filter: 'dropShadow', dx: false})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: []}), "new CanvasFilter({filter: 'dropShadow', dx: []})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: [20]}), "new CanvasFilter({filter: 'dropShadow', dx: [\""+(20)+"\"]})"); -_assert(new CanvasFilter({filter: 'dropShadow', dx: '30'}), "new CanvasFilter({filter: 'dropShadow', dx: '30'})"); -// dy -_assert(new CanvasFilter({filter: 'dropShadow', dy: 10}), "new CanvasFilter({filter: 'dropShadow', dy: 10})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: -1}), "new CanvasFilter({filter: 'dropShadow', dy: -1})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: 0.5}), "new CanvasFilter({filter: 'dropShadow', dy: 0.5})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: null}), "new CanvasFilter({filter: 'dropShadow', dy: null})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: true}), "new CanvasFilter({filter: 'dropShadow', dy: true})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: false}), "new CanvasFilter({filter: 'dropShadow', dy: false})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: []}), "new CanvasFilter({filter: 'dropShadow', dy: []})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: [20]}), "new CanvasFilter({filter: 'dropShadow', dy: [\""+(20)+"\"]})"); -_assert(new CanvasFilter({filter: 'dropShadow', dy: '30'}), "new CanvasFilter({filter: 'dropShadow', dy: '30'})"); -// floodOpacity -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: 10}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: 10})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: -1}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: -1})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: 0.5}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: 0.5})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: null}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: null})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: true}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: true})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: false}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: false})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: []}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: []})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: [20]}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: [\""+(20)+"\"]})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: '30'}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: '30'})"); -// stdDeviation -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: 10}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: 10})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: -1}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: -1})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: 0.5}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: 0.5})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: null}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: null})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: true}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: true})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: false}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: false})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: []}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: []})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [20]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [\""+(20)+"\"]})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: '30'}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: '30'})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [10, -1]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [10, -1]})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [0.5, null]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [0.5, null]})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [true, false]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [true, false]})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [[], [20]]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [[], [\""+(20)+"\"]]})"); -_assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: ['30', ['40']]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: ['30', ['40']]})"); -// floodColor -_assert(new CanvasFilter({filter: 'dropShadow', floodColor: 'red'}), "new CanvasFilter({filter: 'dropShadow', floodColor: 'red'})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodColor: 'canvas'}), "new CanvasFilter({filter: 'dropShadow', floodColor: 'canvas'})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'}), "new CanvasFilter({filter: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodColor: '#aabbccdd'}), "new CanvasFilter({filter: 'dropShadow', floodColor: '#aabbccdd'})"); -_assert(new CanvasFilter({filter: 'dropShadow', floodColor: '#abcd'}), "new CanvasFilter({filter: 'dropShadow', floodColor: '#abcd'})"); - -// dx -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: NaN}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: -Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: 'test'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: {}}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: [1, 2]}); }); -// dy -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: NaN}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: -Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: 'test'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: {}}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: [1, 2]}); }); -// floodOpacity -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: NaN}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: -Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: 'test'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: {}}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: [1, 2]}); }); -// stdDeviation -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: NaN}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: -Infinity}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: 'test'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: {}}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, 2, 3]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, NaN]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, Infinity]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, -Infinity]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, undefined]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, 'test']}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, {}]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, [2, 3]]}); }); -// floodColor -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: 'test'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: 'rgba(NaN, 3, 2, 1)'}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: 10}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: null}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: NaN}); }); -t.done(); + // dx + _assert(new CanvasFilter({filter: 'dropShadow', dx: 10}), "new CanvasFilter({filter: 'dropShadow', dx: 10})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: -1}), "new CanvasFilter({filter: 'dropShadow', dx: -1})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: 0.5}), "new CanvasFilter({filter: 'dropShadow', dx: 0.5})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: null}), "new CanvasFilter({filter: 'dropShadow', dx: null})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: true}), "new CanvasFilter({filter: 'dropShadow', dx: true})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: false}), "new CanvasFilter({filter: 'dropShadow', dx: false})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: []}), "new CanvasFilter({filter: 'dropShadow', dx: []})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: [20]}), "new CanvasFilter({filter: 'dropShadow', dx: [\""+(20)+"\"]})"); + _assert(new CanvasFilter({filter: 'dropShadow', dx: '30'}), "new CanvasFilter({filter: 'dropShadow', dx: '30'})"); + // dy + _assert(new CanvasFilter({filter: 'dropShadow', dy: 10}), "new CanvasFilter({filter: 'dropShadow', dy: 10})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: -1}), "new CanvasFilter({filter: 'dropShadow', dy: -1})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: 0.5}), "new CanvasFilter({filter: 'dropShadow', dy: 0.5})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: null}), "new CanvasFilter({filter: 'dropShadow', dy: null})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: true}), "new CanvasFilter({filter: 'dropShadow', dy: true})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: false}), "new CanvasFilter({filter: 'dropShadow', dy: false})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: []}), "new CanvasFilter({filter: 'dropShadow', dy: []})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: [20]}), "new CanvasFilter({filter: 'dropShadow', dy: [\""+(20)+"\"]})"); + _assert(new CanvasFilter({filter: 'dropShadow', dy: '30'}), "new CanvasFilter({filter: 'dropShadow', dy: '30'})"); + // floodOpacity + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: 10}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: 10})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: -1}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: -1})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: 0.5}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: 0.5})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: null}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: null})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: true}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: true})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: false}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: false})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: []}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: []})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: [20]}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: [\""+(20)+"\"]})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodOpacity: '30'}), "new CanvasFilter({filter: 'dropShadow', floodOpacity: '30'})"); + // stdDeviation + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: 10}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: 10})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: -1}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: -1})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: 0.5}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: 0.5})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: null}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: null})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: true}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: true})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: false}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: false})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: []}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: []})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [20]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [\""+(20)+"\"]})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: '30'}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: '30'})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [10, -1]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [10, -1]})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [0.5, null]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [0.5, null]})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [true, false]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [true, false]})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: [[], [20]]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: [[], [\""+(20)+"\"]]})"); + _assert(new CanvasFilter({filter: 'dropShadow', stdDeviation: ['30', ['40']]}), "new CanvasFilter({filter: 'dropShadow', stdDeviation: ['30', ['40']]})"); + // floodColor + _assert(new CanvasFilter({filter: 'dropShadow', floodColor: 'red'}), "new CanvasFilter({filter: 'dropShadow', floodColor: 'red'})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodColor: 'canvas'}), "new CanvasFilter({filter: 'dropShadow', floodColor: 'canvas'})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'}), "new CanvasFilter({filter: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodColor: '#aabbccdd'}), "new CanvasFilter({filter: 'dropShadow', floodColor: '#aabbccdd'})"); + _assert(new CanvasFilter({filter: 'dropShadow', floodColor: '#abcd'}), "new CanvasFilter({filter: 'dropShadow', floodColor: '#abcd'})"); + // dx + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: NaN}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: -Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: undefined}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: 'test'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: {}}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dx: [1, 2]}); }); + // dy + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: NaN}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: -Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: undefined}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: 'test'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: {}}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', dy: [1, 2]}); }); + // floodOpacity + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: NaN}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: -Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: undefined}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: 'test'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: {}}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodOpacity: [1, 2]}); }); + // stdDeviation + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: NaN}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: -Infinity}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: undefined}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: 'test'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: {}}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, 2, 3]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, NaN]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, Infinity]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, -Infinity]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, undefined]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, 'test']}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, {}]}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', stdDeviation: [1, [2, 3]]}); }); + // floodColor + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: 'test'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: 'rgba(NaN, 3, 2, 1)'}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: 10}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: undefined}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: null}); }); + assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'dropShadow', floodColor: NaN}); }); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.html index 4d80dddf007..6b80005308d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.html @@ -15,35 +15,33 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -_assert(ctx.filter == 'none', "ctx.filter == 'none'"); -ctx.filter = 'blur(5px)'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); -_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); -ctx.filter = new CanvasFilter([ - {filter: 'gaussianBlur', stdDeviation: 5}, - {filter: 'gaussianBlur', stdDeviation: 10} -]); -_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); -var canvas2 = new OffscreenCanvas(100, 50); -var ctx2 = canvas2.getContext('2d'); -ctx2.filter = ctx.filter; -_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); -ctx.filter = 'blur(5px)'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = 'none'; -_assert(ctx.filter == 'none', "ctx.filter == 'none'"); -ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); -ctx.filter = 'this string is not a filter and should do nothing'; -_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); -})(canvas, ctx); -t.done(); + _assert(ctx.filter == 'none', "ctx.filter == 'none'"); + ctx.filter = 'blur(5px)'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); + _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); + ctx.filter = new CanvasFilter([ + {filter: 'gaussianBlur', stdDeviation: 5}, + {filter: 'gaussianBlur', stdDeviation: 10} + ]); + _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); + var canvas2 = new OffscreenCanvas(100, 50); + var ctx2 = canvas2.getContext('2d'); + ctx2.filter = ctx.filter; + _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); + ctx.filter = 'blur(5px)'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = 'none'; + _assert(ctx.filter == 'none', "ctx.filter == 'none'"); + ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); + ctx.filter = 'this string is not a filter and should do nothing'; + _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.worker.js index 48c4a0448d9..8e2e794c39c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.worker.js @@ -13,31 +13,30 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -_assert(ctx.filter == 'none', "ctx.filter == 'none'"); -ctx.filter = 'blur(5px)'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); -_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); -ctx.filter = new CanvasFilter([ - {filter: 'gaussianBlur', stdDeviation: 5}, - {filter: 'gaussianBlur', stdDeviation: 10} -]); -_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); -var canvas2 = new OffscreenCanvas(100, 50); -var ctx2 = canvas2.getContext('2d'); -ctx2.filter = ctx.filter; -_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); -ctx.filter = 'blur(5px)'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = 'none'; -_assert(ctx.filter == 'none', "ctx.filter == 'none'"); -ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); -ctx.filter = 'this string is not a filter and should do nothing'; -_assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + _assert(ctx.filter == 'none', "ctx.filter == 'none'"); + ctx.filter = 'blur(5px)'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); + _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); + ctx.filter = new CanvasFilter([ + {filter: 'gaussianBlur', stdDeviation: 5}, + {filter: 'gaussianBlur', stdDeviation: 10} + ]); + _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); + var canvas2 = new OffscreenCanvas(100, 50); + var ctx2 = canvas2.getContext('2d'); + ctx2.filter = ctx.filter; + _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); + ctx.filter = 'blur(5px)'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = 'none'; + _assert(ctx.filter == 'none', "ctx.filter == 'none'"); + ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); + ctx.filter = 'this string is not a filter and should do nothing'; + _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html index 2ed61e66d03..6392659c947 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html @@ -15,118 +15,116 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -const errorTestCases = [ - {baseFrequency: {}}, - {baseFrequency: -1}, - {baseFrequency: [0, -1]}, - {baseFrequency: NaN}, - {baseFrequency: Infinity}, - {baseFrequency: undefined}, - {baseFrequency: -Infinity}, - {baseFrequency: 'test'}, - - {numOctaves: {}}, - {numOctaves: -1}, - {numOctaves: NaN}, - {numOctaves: Infinity}, - {numOctaves: undefined}, - {numOctaves: -Infinity}, - {numOctaves: [1, 1]}, - {numOctaves: 'test'}, - - {seed: {}}, - {seed: NaN}, - {seed: Infinity}, - {seed: undefined}, - {seed: -Infinity}, - {seed: [1, 1]}, - {seed: 'test'}, - - {stitchTiles: {}}, - {stitchTiles: NaN}, - {stitchTiles: Infinity}, - {stitchTiles: undefined}, - {stitchTiles: -Infinity}, - {stitchTiles: [1, 1]}, - {stitchTiles: 'test'}, - {stitchTiles: null}, - {stitchTiles: []}, - {stitchTiles: [10]}, - {stitchTiles: 30}, - {stitchTiles: false}, - {stitchTiles: true}, - {stitchTiles: '10'}, - {stitchTiles: -1}, - - {type: {}}, - {type: NaN}, - {type: Infinity}, - {type: undefined}, - {type: -Infinity}, - {type: [1, 1]}, - {type: 'test'}, - {type: null}, - {type: []}, - {type: [10]}, - {type: 30}, - {type: false}, - {type: true}, - {type: '10'}, - {type: -1}, -] - -// null and [] = 0 when parsed as number -const workingTestCases = [ - {baseFrequency: null}, - {baseFrequency: []}, - {baseFrequency: [10]}, - {baseFrequency: [10, 3]}, - {baseFrequency: 30}, - {baseFrequency: false}, - {baseFrequency: true}, - {baseFrequency: '10'}, - - {numOctaves: null}, - {numOctaves: []}, - {numOctaves: [10]}, - {numOctaves: 30}, - {numOctaves: false}, - {numOctaves: true}, - {numOctaves: '10'}, - - {seed: null}, - {seed: []}, - {seed: [10]}, - {seed: 30}, - {seed: false}, - {seed: true}, - {seed: '10'}, - {seed: -1}, - - {stitchTiles: 'stitch'}, - {stitchTiles: 'noStitch'}, - - {type: 'fractalNoise'}, - {type: 'turbulence'}, -] - -for (testCase of errorTestCases) { - const filterOptions = {...{filter: 'turbulence'}, ...testCase}; - assert_throws_js(TypeError, function() { new CanvasFilter(filterOptions); }); -} - -for (testCase of workingTestCases) { - const filterOptions = {...{filter: 'turbulence'}, ...testCase}; - _assert(new CanvasFilter(filterOptions) != null, "new CanvasFilter(filterOptions) != null"); -} -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + const errorTestCases = [ + {baseFrequency: {}}, + {baseFrequency: -1}, + {baseFrequency: [0, -1]}, + {baseFrequency: NaN}, + {baseFrequency: Infinity}, + {baseFrequency: undefined}, + {baseFrequency: -Infinity}, + {baseFrequency: 'test'}, + + {numOctaves: {}}, + {numOctaves: -1}, + {numOctaves: NaN}, + {numOctaves: Infinity}, + {numOctaves: undefined}, + {numOctaves: -Infinity}, + {numOctaves: [1, 1]}, + {numOctaves: 'test'}, + + {seed: {}}, + {seed: NaN}, + {seed: Infinity}, + {seed: undefined}, + {seed: -Infinity}, + {seed: [1, 1]}, + {seed: 'test'}, + + {stitchTiles: {}}, + {stitchTiles: NaN}, + {stitchTiles: Infinity}, + {stitchTiles: undefined}, + {stitchTiles: -Infinity}, + {stitchTiles: [1, 1]}, + {stitchTiles: 'test'}, + {stitchTiles: null}, + {stitchTiles: []}, + {stitchTiles: [10]}, + {stitchTiles: 30}, + {stitchTiles: false}, + {stitchTiles: true}, + {stitchTiles: '10'}, + {stitchTiles: -1}, + + {type: {}}, + {type: NaN}, + {type: Infinity}, + {type: undefined}, + {type: -Infinity}, + {type: [1, 1]}, + {type: 'test'}, + {type: null}, + {type: []}, + {type: [10]}, + {type: 30}, + {type: false}, + {type: true}, + {type: '10'}, + {type: -1}, + ] + + // null and [] = 0 when parsed as number + const workingTestCases = [ + {baseFrequency: null}, + {baseFrequency: []}, + {baseFrequency: [10]}, + {baseFrequency: [10, 3]}, + {baseFrequency: 30}, + {baseFrequency: false}, + {baseFrequency: true}, + {baseFrequency: '10'}, + + {numOctaves: null}, + {numOctaves: []}, + {numOctaves: [10]}, + {numOctaves: 30}, + {numOctaves: false}, + {numOctaves: true}, + {numOctaves: '10'}, + + {seed: null}, + {seed: []}, + {seed: [10]}, + {seed: 30}, + {seed: false}, + {seed: true}, + {seed: '10'}, + {seed: -1}, + + {stitchTiles: 'stitch'}, + {stitchTiles: 'noStitch'}, + + {type: 'fractalNoise'}, + {type: 'turbulence'}, + ] + + for (testCase of errorTestCases) { + const filterOptions = {...{filter: 'turbulence'}, ...testCase}; + assert_throws_js(TypeError, function() { new CanvasFilter(filterOptions); }); + } + + for (testCase of workingTestCases) { + const filterOptions = {...{filter: 'turbulence'}, ...testCase}; + _assert(new CanvasFilter(filterOptions) != null, "new CanvasFilter(filterOptions) != null"); + } + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.worker.js index 1bed65ad156..82f4ace5069 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.worker.js @@ -13,114 +13,113 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -const errorTestCases = [ - {baseFrequency: {}}, - {baseFrequency: -1}, - {baseFrequency: [0, -1]}, - {baseFrequency: NaN}, - {baseFrequency: Infinity}, - {baseFrequency: undefined}, - {baseFrequency: -Infinity}, - {baseFrequency: 'test'}, - - {numOctaves: {}}, - {numOctaves: -1}, - {numOctaves: NaN}, - {numOctaves: Infinity}, - {numOctaves: undefined}, - {numOctaves: -Infinity}, - {numOctaves: [1, 1]}, - {numOctaves: 'test'}, - - {seed: {}}, - {seed: NaN}, - {seed: Infinity}, - {seed: undefined}, - {seed: -Infinity}, - {seed: [1, 1]}, - {seed: 'test'}, - - {stitchTiles: {}}, - {stitchTiles: NaN}, - {stitchTiles: Infinity}, - {stitchTiles: undefined}, - {stitchTiles: -Infinity}, - {stitchTiles: [1, 1]}, - {stitchTiles: 'test'}, - {stitchTiles: null}, - {stitchTiles: []}, - {stitchTiles: [10]}, - {stitchTiles: 30}, - {stitchTiles: false}, - {stitchTiles: true}, - {stitchTiles: '10'}, - {stitchTiles: -1}, - - {type: {}}, - {type: NaN}, - {type: Infinity}, - {type: undefined}, - {type: -Infinity}, - {type: [1, 1]}, - {type: 'test'}, - {type: null}, - {type: []}, - {type: [10]}, - {type: 30}, - {type: false}, - {type: true}, - {type: '10'}, - {type: -1}, -] - -// null and [] = 0 when parsed as number -const workingTestCases = [ - {baseFrequency: null}, - {baseFrequency: []}, - {baseFrequency: [10]}, - {baseFrequency: [10, 3]}, - {baseFrequency: 30}, - {baseFrequency: false}, - {baseFrequency: true}, - {baseFrequency: '10'}, - - {numOctaves: null}, - {numOctaves: []}, - {numOctaves: [10]}, - {numOctaves: 30}, - {numOctaves: false}, - {numOctaves: true}, - {numOctaves: '10'}, - - {seed: null}, - {seed: []}, - {seed: [10]}, - {seed: 30}, - {seed: false}, - {seed: true}, - {seed: '10'}, - {seed: -1}, - - {stitchTiles: 'stitch'}, - {stitchTiles: 'noStitch'}, - - {type: 'fractalNoise'}, - {type: 'turbulence'}, -] - -for (testCase of errorTestCases) { - const filterOptions = {...{filter: 'turbulence'}, ...testCase}; - assert_throws_js(TypeError, function() { new CanvasFilter(filterOptions); }); -} - -for (testCase of workingTestCases) { - const filterOptions = {...{filter: 'turbulence'}, ...testCase}; - _assert(new CanvasFilter(filterOptions) != null, "new CanvasFilter(filterOptions) != null"); -} -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + const errorTestCases = [ + {baseFrequency: {}}, + {baseFrequency: -1}, + {baseFrequency: [0, -1]}, + {baseFrequency: NaN}, + {baseFrequency: Infinity}, + {baseFrequency: undefined}, + {baseFrequency: -Infinity}, + {baseFrequency: 'test'}, + + {numOctaves: {}}, + {numOctaves: -1}, + {numOctaves: NaN}, + {numOctaves: Infinity}, + {numOctaves: undefined}, + {numOctaves: -Infinity}, + {numOctaves: [1, 1]}, + {numOctaves: 'test'}, + + {seed: {}}, + {seed: NaN}, + {seed: Infinity}, + {seed: undefined}, + {seed: -Infinity}, + {seed: [1, 1]}, + {seed: 'test'}, + + {stitchTiles: {}}, + {stitchTiles: NaN}, + {stitchTiles: Infinity}, + {stitchTiles: undefined}, + {stitchTiles: -Infinity}, + {stitchTiles: [1, 1]}, + {stitchTiles: 'test'}, + {stitchTiles: null}, + {stitchTiles: []}, + {stitchTiles: [10]}, + {stitchTiles: 30}, + {stitchTiles: false}, + {stitchTiles: true}, + {stitchTiles: '10'}, + {stitchTiles: -1}, + + {type: {}}, + {type: NaN}, + {type: Infinity}, + {type: undefined}, + {type: -Infinity}, + {type: [1, 1]}, + {type: 'test'}, + {type: null}, + {type: []}, + {type: [10]}, + {type: 30}, + {type: false}, + {type: true}, + {type: '10'}, + {type: -1}, + ] + + // null and [] = 0 when parsed as number + const workingTestCases = [ + {baseFrequency: null}, + {baseFrequency: []}, + {baseFrequency: [10]}, + {baseFrequency: [10, 3]}, + {baseFrequency: 30}, + {baseFrequency: false}, + {baseFrequency: true}, + {baseFrequency: '10'}, + + {numOctaves: null}, + {numOctaves: []}, + {numOctaves: [10]}, + {numOctaves: 30}, + {numOctaves: false}, + {numOctaves: true}, + {numOctaves: '10'}, + + {seed: null}, + {seed: []}, + {seed: [10]}, + {seed: 30}, + {seed: false}, + {seed: true}, + {seed: '10'}, + {seed: -1}, + + {stitchTiles: 'stitch'}, + {stitchTiles: 'noStitch'}, + + {type: 'fractalNoise'}, + {type: 'turbulence'}, + ] + + for (testCase of errorTestCases) { + const filterOptions = {...{filter: 'turbulence'}, ...testCase}; + assert_throws_js(TypeError, function() { new CanvasFilter(filterOptions); }); + } + + for (testCase of workingTestCases) { + const filterOptions = {...{filter: 'turbulence'}, ...testCase}; + _assert(new CanvasFilter(filterOptions) != null, "new CanvasFilter(filterOptions) != null"); + } + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.value.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.value.html index 2267c9aa811..5594174cf6e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.value.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.value.html @@ -15,44 +15,42 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -_assert(ctx.filter == 'none', "ctx.filter == 'none'"); -ctx.filter = 'blur(5px)'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.save(); -ctx.filter = 'none'; -_assert(ctx.filter == 'none', "ctx.filter == 'none'"); -ctx.restore(); -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); - -ctx.filter = 'blur(10)'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = 'blur 10px'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); - -ctx.filter = 'inherit'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = 'initial'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = 'unset'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); - -ctx.filter = ''; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = null; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = undefined; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); - -ctx.filter = 'blur( 5px)'; -assert_equals(ctx.filter, 'blur( 5px)'); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + _assert(ctx.filter == 'none', "ctx.filter == 'none'"); + ctx.filter = 'blur(5px)'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.save(); + ctx.filter = 'none'; + _assert(ctx.filter == 'none', "ctx.filter == 'none'"); + ctx.restore(); + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + + ctx.filter = 'blur(10)'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = 'blur 10px'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + + ctx.filter = 'inherit'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = 'initial'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = 'unset'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + + ctx.filter = ''; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = null; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = undefined; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + + ctx.filter = 'blur( 5px)'; + assert_equals(ctx.filter, 'blur( 5px)'); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.value.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.value.worker.js index 01403f398c6..2308315b63b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.value.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/filters/2d.filter.value.worker.js @@ -13,40 +13,39 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -_assert(ctx.filter == 'none', "ctx.filter == 'none'"); -ctx.filter = 'blur(5px)'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.save(); -ctx.filter = 'none'; -_assert(ctx.filter == 'none', "ctx.filter == 'none'"); -ctx.restore(); -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); - -ctx.filter = 'blur(10)'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = 'blur 10px'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); - -ctx.filter = 'inherit'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = 'initial'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = 'unset'; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); - -ctx.filter = ''; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = null; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = undefined; -_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); - -ctx.filter = 'blur( 5px)'; -assert_equals(ctx.filter, 'blur( 5px)'); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + _assert(ctx.filter == 'none', "ctx.filter == 'none'"); + ctx.filter = 'blur(5px)'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.save(); + ctx.filter = 'none'; + _assert(ctx.filter == 'none', "ctx.filter == 'none'"); + ctx.restore(); + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + + ctx.filter = 'blur(10)'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = 'blur 10px'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + + ctx.filter = 'inherit'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = 'initial'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = 'unset'; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + + ctx.filter = ''; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = null; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + ctx.filter = undefined; + _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); + + ctx.filter = 'blur( 5px)'; + assert_equals(ctx.filter, 'blur( 5px)'); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha-expected.html index 72d97c663f8..0666e3098a7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha-expected.html @@ -21,6 +21,7 @@ canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.blending-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.blending-expected.html new file mode 100644 index 00000000000..8a450275889 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.blending-expected.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.alpha.blending</title> +<h1>2d.layer.global-states.alpha.blending</h1> +<p class="desc">Checks that layers correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'multiply'; + + canvas2 = document.createElement("canvas"); + ctx2 = canvas2.getContext("2d"); + + ctx2.globalCompositeOperation = 'screen'; + ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; + ctx2.fillRect(50, 50, 75, 50); + ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; + ctx2.fillRect(70, 70, 75, 50); + + ctx.drawImage(canvas2, 0, 0); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.globalcompositeoperation.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.blending.html index b3ce2285dc9..bb7dd933372 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.globalcompositeoperation.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.blending.html @@ -1,8 +1,8 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<link rel="match" href="2d.layer.global-states.filter.globalcompositeoperation-expected.html"> -<title>Canvas test: 2d.layer.global-states.filter.globalcompositeoperation</title> -<h1>2d.layer.global-states.filter.globalcompositeoperation</h1> +<link rel="match" href="2d.layer.global-states.alpha.blending-expected.html"> +<title>Canvas test: 2d.layer.global-states.alpha.blending</title> +<h1>2d.layer.global-states.alpha.blending</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -17,11 +17,15 @@ circle.arc(90, 90, 45, 0, 2 * Math.PI); ctx.fill(circle); - ctx.globalCompositeOperation = 'source-in'; - ctx.filter = 'drop-shadow(-9px 9px 0px #e81)'; + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'multiply'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.blending.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.blending.shadow-expected.html new file mode 100644 index 00000000000..d7ba158d161 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.blending.shadow-expected.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.alpha.blending.shadow</title> +<h1>2d.layer.global-states.alpha.blending.shadow</h1> +<p class="desc">Checks that layers correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'multiply'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + canvas2 = document.createElement("canvas"); + ctx2 = canvas2.getContext("2d"); + + ctx2.globalCompositeOperation = 'screen'; + ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; + ctx2.fillRect(50, 50, 75, 50); + ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; + ctx2.fillRect(70, 70, 75, 50); + + ctx.drawImage(canvas2, 0, 0); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.blending.shadow.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.blending.shadow.html new file mode 100644 index 00000000000..70b32e43395 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.blending.shadow.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.alpha.blending.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.alpha.blending.shadow</title> +<h1>2d.layer.global-states.alpha.blending.shadow</h1> +<p class="desc">Checks that layers correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const offscreen_canvas = new OffscreenCanvas(200, 200); + const ctx = offscreen_canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'multiply'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer(); + + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 255, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const canvas = document.getElementById("canvas"); + canvas.getContext('2d').drawImage(offscreen_canvas, 0, 0); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.blending.shadow.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.blending.shadow.w.html new file mode 100644 index 00000000000..45932d4cd5d --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.blending.shadow.w.html @@ -0,0 +1,55 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<html class="reftest-wait"> +<link rel="match" href="2d.layer.global-states.alpha.blending.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.alpha.blending.shadow</title> +<h1>2d.layer.global-states.alpha.blending.shadow</h1> +<p class="desc">Checks that layers correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script id='myWorker' type='text/worker'> + self.onmessage = function(e) { + const oc = new OffscreenCanvas(200, 200); + const ctx = oc.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'multiply'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer(); + + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 255, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const bitmap = oc.transferToImageBitmap(); + self.postMessage(bitmap, bitmap); + }; +</script> +<script> + const blob = new Blob([document.getElementById('myWorker').textContent]); + const worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + const outputCtx = document.getElementById("canvas").getContext('2d'); + outputCtx.drawImage(msg.data, 0, 0); + document.documentElement.classList.remove("reftest-wait"); + }); + worker.postMessage(null); +</script> +</html> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.filter.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.blending.w.html index 177bae4e32d..ff33fc45052 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.filter.w.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.blending.w.html @@ -1,9 +1,9 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <html class="reftest-wait"> -<link rel="match" href="2d.layer.global-states.alpha.filter-expected.html"> -<title>Canvas test: 2d.layer.global-states.alpha.filter</title> -<h1>2d.layer.global-states.alpha.filter</h1> +<link rel="match" href="2d.layer.global-states.alpha.blending-expected.html"> +<title>Canvas test: 2d.layer.global-states.alpha.blending</title> +<h1>2d.layer.global-states.alpha.blending</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -20,10 +20,14 @@ ctx.fill(circle); ctx.globalAlpha = 0.6; - ctx.filter = 'drop-shadow(-9px 9px 0px #e81)'; + ctx.globalCompositeOperation = 'multiply'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.globalcompositeoperation-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.composite-expected.html index 12fc31209ac..951049e638c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter.globalcompositeoperation-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.composite-expected.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<title>Canvas test: 2d.layer.global-states.filter.globalcompositeoperation</title> -<h1>2d.layer.global-states.filter.globalcompositeoperation</h1> +<title>Canvas test: 2d.layer.global-states.alpha.composite</title> +<h1>2d.layer.global-states.alpha.composite</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -16,12 +16,13 @@ circle.arc(90, 90, 45, 0, 2 * Math.PI); ctx.fill(circle); + ctx.globalAlpha = 0.6; ctx.globalCompositeOperation = 'source-in'; - ctx.filter = 'drop-shadow(-9px 9px 0px #e81)'; canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.filter.globalcompositeoperation.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.composite.html index 88d339fb1b1..21582189b1d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.filter.globalcompositeoperation.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.composite.html @@ -1,8 +1,8 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<link rel="match" href="2d.layer.global-states.alpha.filter.globalcompositeoperation-expected.html"> -<title>Canvas test: 2d.layer.global-states.alpha.filter.globalcompositeoperation</title> -<h1>2d.layer.global-states.alpha.filter.globalcompositeoperation</h1> +<link rel="match" href="2d.layer.global-states.alpha.composite-expected.html"> +<title>Canvas test: 2d.layer.global-states.alpha.composite</title> +<h1>2d.layer.global-states.alpha.composite</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -19,10 +19,13 @@ ctx.globalAlpha = 0.6; ctx.globalCompositeOperation = 'source-in'; - ctx.filter = 'drop-shadow(-9px 9px 0px #e81)'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.composite.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.composite.shadow-expected.html new file mode 100644 index 00000000000..a669a2271e9 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.composite.shadow-expected.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.alpha.composite.shadow</title> +<h1>2d.layer.global-states.alpha.composite.shadow</h1> +<p class="desc">Checks that layers correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'source-in'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + canvas2 = document.createElement("canvas"); + ctx2 = canvas2.getContext("2d"); + + ctx2.globalCompositeOperation = 'screen'; + ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; + ctx2.fillRect(50, 50, 75, 50); + ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; + ctx2.fillRect(70, 70, 75, 50); + + ctx.drawImage(canvas2, 0, 0); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.composite.shadow.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.composite.shadow.html new file mode 100644 index 00000000000..bb3d886b54f --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.composite.shadow.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.alpha.composite.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.alpha.composite.shadow</title> +<h1>2d.layer.global-states.alpha.composite.shadow</h1> +<p class="desc">Checks that layers correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const offscreen_canvas = new OffscreenCanvas(200, 200); + const ctx = offscreen_canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'source-in'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer(); + + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 255, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const canvas = document.getElementById("canvas"); + canvas.getContext('2d').drawImage(offscreen_canvas, 0, 0); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.composite.shadow.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.composite.shadow.w.html new file mode 100644 index 00000000000..592f92921b8 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.composite.shadow.w.html @@ -0,0 +1,55 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<html class="reftest-wait"> +<link rel="match" href="2d.layer.global-states.alpha.composite.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.alpha.composite.shadow</title> +<h1>2d.layer.global-states.alpha.composite.shadow</h1> +<p class="desc">Checks that layers correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script id='myWorker' type='text/worker'> + self.onmessage = function(e) { + const oc = new OffscreenCanvas(200, 200); + const ctx = oc.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'source-in'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer(); + + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 255, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const bitmap = oc.transferToImageBitmap(); + self.postMessage(bitmap, bitmap); + }; +</script> +<script> + const blob = new Blob([document.getElementById('myWorker').textContent]); + const worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + const outputCtx = document.getElementById("canvas").getContext('2d'); + outputCtx.drawImage(msg.data, 0, 0); + document.documentElement.classList.remove("reftest-wait"); + }); + worker.postMessage(null); +</script> +</html> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.filter.globalcompositeoperation.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.composite.w.html index a95085ca894..2359e92790f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.filter.globalcompositeoperation.w.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.composite.w.html @@ -1,9 +1,9 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <html class="reftest-wait"> -<link rel="match" href="2d.layer.global-states.alpha.filter.globalcompositeoperation-expected.html"> -<title>Canvas test: 2d.layer.global-states.alpha.filter.globalcompositeoperation</title> -<h1>2d.layer.global-states.alpha.filter.globalcompositeoperation</h1> +<link rel="match" href="2d.layer.global-states.alpha.composite-expected.html"> +<title>Canvas test: 2d.layer.global-states.alpha.composite</title> +<h1>2d.layer.global-states.alpha.composite</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -21,10 +21,13 @@ ctx.globalAlpha = 0.6; ctx.globalCompositeOperation = 'source-in'; - ctx.filter = 'drop-shadow(-9px 9px 0px #e81)'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.html index 7064f47b20a..67a8ae60249 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.html @@ -21,6 +21,10 @@ ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.shadow-expected.html index 9daefc377bd..206eb750139 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.shadow-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.shadow-expected.html @@ -19,11 +19,12 @@ ctx.globalAlpha = 0.5; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'orange'; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.shadow.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.shadow.html index afbbac881e7..a67f5872f78 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.shadow.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.shadow.html @@ -20,10 +20,14 @@ ctx.globalAlpha = 0.5; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'orange'; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.shadow.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.shadow.w.html index 9e0e7099340..35df72aabcd 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.shadow.w.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.shadow.w.html @@ -22,10 +22,14 @@ ctx.globalAlpha = 0.5; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'orange'; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.w.html index 59d528b2099..2db6b64738c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.w.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.w.html @@ -23,6 +23,10 @@ ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.blending-expected.html index cff8783b392..33fdf46a287 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.filter-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.blending-expected.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<title>Canvas test: 2d.layer.global-states.filter</title> -<h1>2d.layer.global-states.filter</h1> +<title>Canvas test: 2d.layer.global-states.blending</title> +<h1>2d.layer.global-states.blending</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -16,11 +16,12 @@ circle.arc(90, 90, 45, 0, 2 * Math.PI); ctx.fill(circle); - ctx.filter = 'sepia(1) opacity(30%)'; + ctx.globalCompositeOperation = 'multiply'; canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.filter.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.blending.html index e8d3d5691bb..6bcfd2854a6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.filter.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.blending.html @@ -1,8 +1,8 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<link rel="match" href="2d.layer.global-states.alpha.filter-expected.html"> -<title>Canvas test: 2d.layer.global-states.alpha.filter</title> -<h1>2d.layer.global-states.alpha.filter</h1> +<link rel="match" href="2d.layer.global-states.blending-expected.html"> +<title>Canvas test: 2d.layer.global-states.blending</title> +<h1>2d.layer.global-states.blending</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -17,11 +17,14 @@ circle.arc(90, 90, 45, 0, 2 * Math.PI); ctx.fill(circle); - ctx.globalAlpha = 0.6; - ctx.filter = 'drop-shadow(-9px 9px 0px #e81)'; + ctx.globalCompositeOperation = 'multiply'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.filter.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.blending.shadow-expected.html index 857db7ba991..02275c8cc21 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.alpha.filter.shadow-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.blending.shadow-expected.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<title>Canvas test: 2d.layer.global-states.alpha.filter.shadow</title> -<h1>2d.layer.global-states.alpha.filter.shadow</h1> +<title>Canvas test: 2d.layer.global-states.blending.shadow</title> +<h1>2d.layer.global-states.blending.shadow</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -16,15 +16,15 @@ circle.arc(90, 90, 45, 0, 2 * Math.PI); ctx.fill(circle); - ctx.globalAlpha = 0.5; - ctx.filter = 'sepia(0.5) drop-shadow(5px 5px 0px #81e)'; + ctx.globalCompositeOperation = 'multiply'; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'orange'; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.filter.shadow.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.blending.shadow.html index 07d5d793791..f1e9b7d23a3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.filter.shadow.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.blending.shadow.html @@ -1,9 +1,8 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<link rel="match" href="2d.layer.global-states.alpha.filter.shadow-expected.html"> -<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-5824"> -<title>Canvas test: 2d.layer.global-states.alpha.filter.shadow</title> -<h1>2d.layer.global-states.alpha.filter.shadow</h1> +<link rel="match" href="2d.layer.global-states.blending.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.blending.shadow</title> +<h1>2d.layer.global-states.blending.shadow</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -18,14 +17,17 @@ circle.arc(90, 90, 45, 0, 2 * Math.PI); ctx.fill(circle); - ctx.globalAlpha = 0.5; - ctx.filter = 'sepia(0.5) drop-shadow(5px 5px 0px #81e)'; + ctx.globalCompositeOperation = 'multiply'; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'orange'; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.filter.shadow.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.blending.shadow.w.html index 40039c247d6..1d22e94f6f9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.alpha.filter.shadow.w.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.blending.shadow.w.html @@ -1,10 +1,9 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <html class="reftest-wait"> -<link rel="match" href="2d.layer.global-states.alpha.filter.shadow-expected.html"> -<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-5824"> -<title>Canvas test: 2d.layer.global-states.alpha.filter.shadow</title> -<h1>2d.layer.global-states.alpha.filter.shadow</h1> +<link rel="match" href="2d.layer.global-states.blending.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.blending.shadow</title> +<h1>2d.layer.global-states.blending.shadow</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -20,14 +19,17 @@ circle.arc(90, 90, 45, 0, 2 * Math.PI); ctx.fill(circle); - ctx.globalAlpha = 0.5; - ctx.filter = 'sepia(0.5) drop-shadow(5px 5px 0px #81e)'; + ctx.globalCompositeOperation = 'multiply'; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'orange'; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.blending.w.html index 08e6c253562..227c72b80ac 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.w.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.blending.w.html @@ -1,9 +1,9 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <html class="reftest-wait"> -<link rel="match" href="2d.layer.global-states.filter-expected.html"> -<title>Canvas test: 2d.layer.global-states.filter</title> -<h1>2d.layer.global-states.filter</h1> +<link rel="match" href="2d.layer.global-states.blending-expected.html"> +<title>Canvas test: 2d.layer.global-states.blending</title> +<h1>2d.layer.global-states.blending</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -19,10 +19,14 @@ circle.arc(90, 90, 45, 0, 2 * Math.PI); ctx.fill(circle); - ctx.filter = 'sepia(1) opacity(30%)'; + ctx.globalCompositeOperation = 'multiply'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.globalcompositeoperation-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.composite-expected.html index 7e2e021b552..ed7669c4cfa 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.globalcompositeoperation-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.composite-expected.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<title>Canvas test: 2d.layer.global-states.globalcompositeoperation</title> -<h1>2d.layer.global-states.globalcompositeoperation</h1> +<title>Canvas test: 2d.layer.global-states.composite</title> +<h1>2d.layer.global-states.composite</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -21,6 +21,7 @@ canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.globalcompositeoperation.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.composite.html index 1be83170f11..9d4d1dce8a4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.globalcompositeoperation.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.composite.html @@ -1,8 +1,8 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<link rel="match" href="2d.layer.global-states.globalcompositeoperation-expected.html"> -<title>Canvas test: 2d.layer.global-states.globalcompositeoperation</title> -<h1>2d.layer.global-states.globalcompositeoperation</h1> +<link rel="match" href="2d.layer.global-states.composite-expected.html"> +<title>Canvas test: 2d.layer.global-states.composite</title> +<h1>2d.layer.global-states.composite</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -21,6 +21,10 @@ ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.composite.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.composite.shadow-expected.html new file mode 100644 index 00000000000..e380cccab82 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.composite.shadow-expected.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.composite.shadow</title> +<h1>2d.layer.global-states.composite.shadow</h1> +<p class="desc">Checks that layers correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'source-in'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + canvas2 = document.createElement("canvas"); + ctx2 = canvas2.getContext("2d"); + + ctx2.globalCompositeOperation = 'screen'; + ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; + ctx2.fillRect(50, 50, 75, 50); + ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; + ctx2.fillRect(70, 70, 75, 50); + + ctx.drawImage(canvas2, 0, 0); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.composite.shadow.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.composite.shadow.html new file mode 100644 index 00000000000..9ad39065c6a --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.composite.shadow.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.composite.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.composite.shadow</title> +<h1>2d.layer.global-states.composite.shadow</h1> +<p class="desc">Checks that layers correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const offscreen_canvas = new OffscreenCanvas(200, 200); + const ctx = offscreen_canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'source-in'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer(); + + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 255, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const canvas = document.getElementById("canvas"); + canvas.getContext('2d').drawImage(offscreen_canvas, 0, 0); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.globalcompositeoperation.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.composite.shadow.w.html index 6d21ffb8157..b45c9d3aadc 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.globalcompositeoperation.w.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.composite.shadow.w.html @@ -1,9 +1,9 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <html class="reftest-wait"> -<link rel="match" href="2d.layer.global-states.filter.globalcompositeoperation-expected.html"> -<title>Canvas test: 2d.layer.global-states.filter.globalcompositeoperation</title> -<h1>2d.layer.global-states.filter.globalcompositeoperation</h1> +<link rel="match" href="2d.layer.global-states.composite.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.composite.shadow</title> +<h1>2d.layer.global-states.composite.shadow</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -20,10 +20,16 @@ ctx.fill(circle); ctx.globalCompositeOperation = 'source-in'; - ctx.filter = 'drop-shadow(-9px 9px 0px #e81)'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.globalcompositeoperation.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.composite.w.html index 7757aa5d8a9..66493889b20 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.globalcompositeoperation.w.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.composite.w.html @@ -1,9 +1,9 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <html class="reftest-wait"> -<link rel="match" href="2d.layer.global-states.globalcompositeoperation-expected.html"> -<title>Canvas test: 2d.layer.global-states.globalcompositeoperation</title> -<h1>2d.layer.global-states.globalcompositeoperation</h1> +<link rel="match" href="2d.layer.global-states.composite-expected.html"> +<title>Canvas test: 2d.layer.global-states.composite</title> +<h1>2d.layer.global-states.composite</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -23,6 +23,10 @@ ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter-expected.html deleted file mode 100644 index cff8783b392..00000000000 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter-expected.html +++ /dev/null @@ -1,30 +0,0 @@ -<!DOCTYPE html> -<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<title>Canvas test: 2d.layer.global-states.filter</title> -<h1>2d.layer.global-states.filter</h1> -<p class="desc">Checks that layers correctly use global render states.</p> -<canvas id="canvas" width="200" height="200"> - <p class="fallback">FAIL (fallback content)</p> -</canvas> -<script> - const canvas = document.getElementById("canvas"); - const ctx = canvas.getContext('2d'); - - ctx.fillStyle = 'rgba(0, 0, 255, 1)'; - - var circle = new Path2D(); - circle.arc(90, 90, 45, 0, 2 * Math.PI); - ctx.fill(circle); - - ctx.filter = 'sepia(1) opacity(30%)'; - - canvas2 = document.createElement("canvas"); - ctx2 = canvas2.getContext("2d"); - - ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; - ctx2.fillRect(50, 50, 75, 50); - ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; - ctx2.fillRect(70, 70, 75, 50); - - ctx.drawImage(canvas2, 0, 0); -</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha-expected.html new file mode 100644 index 00000000000..f304700feb3 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha-expected.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.alpha</title> +<h1>2d.layer.global-states.filter.alpha</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending-expected.html new file mode 100644 index 00000000000..7c91ce42293 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending-expected.html @@ -0,0 +1,51 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.alpha.blending</title> +<h1>2d.layer.global-states.filter.alpha.blending</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'multiply'; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.html new file mode 100644 index 00000000000..37d0e3dd1c5 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.alpha.blending-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.alpha.blending</title> +<h1>2d.layer.global-states.filter.alpha.blending</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const offscreen_canvas = new OffscreenCanvas(200, 200); + const ctx = offscreen_canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'multiply'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const canvas = document.getElementById("canvas"); + canvas.getContext('2d').drawImage(offscreen_canvas, 0, 0); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.shadow-expected.html new file mode 100644 index 00000000000..d9c93719b99 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.shadow-expected.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.alpha.blending.shadow</title> +<h1>2d.layer.global-states.filter.alpha.blending.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'multiply'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.shadow.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.shadow.html new file mode 100644 index 00000000000..93278cb5aa3 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.shadow.html @@ -0,0 +1,44 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.alpha.blending.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.alpha.blending.shadow</title> +<h1>2d.layer.global-states.filter.alpha.blending.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const offscreen_canvas = new OffscreenCanvas(200, 200); + const ctx = offscreen_canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'multiply'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const canvas = document.getElementById("canvas"); + canvas.getContext('2d').drawImage(offscreen_canvas, 0, 0); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.shadow.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.shadow.w.html new file mode 100644 index 00000000000..783693f2c14 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.shadow.w.html @@ -0,0 +1,58 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<html class="reftest-wait"> +<link rel="match" href="2d.layer.global-states.filter.alpha.blending.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.alpha.blending.shadow</title> +<h1>2d.layer.global-states.filter.alpha.blending.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script id='myWorker' type='text/worker'> + self.onmessage = function(e) { + const oc = new OffscreenCanvas(200, 200); + const ctx = oc.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'multiply'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const bitmap = oc.transferToImageBitmap(); + self.postMessage(bitmap, bitmap); + }; +</script> +<script> + const blob = new Blob([document.getElementById('myWorker').textContent]); + const worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + const outputCtx = document.getElementById("canvas").getContext('2d'); + outputCtx.drawImage(msg.data, 0, 0); + document.documentElement.classList.remove("reftest-wait"); + }); + worker.postMessage(null); +</script> +</html> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.w.html new file mode 100644 index 00000000000..53533e4ece6 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.w.html @@ -0,0 +1,55 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<html class="reftest-wait"> +<link rel="match" href="2d.layer.global-states.filter.alpha.blending-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.alpha.blending</title> +<h1>2d.layer.global-states.filter.alpha.blending</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script id='myWorker' type='text/worker'> + self.onmessage = function(e) { + const oc = new OffscreenCanvas(200, 200); + const ctx = oc.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'multiply'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const bitmap = oc.transferToImageBitmap(); + self.postMessage(bitmap, bitmap); + }; +</script> +<script> + const blob = new Blob([document.getElementById('myWorker').textContent]); + const worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + const outputCtx = document.getElementById("canvas").getContext('2d'); + outputCtx.drawImage(msg.data, 0, 0); + document.documentElement.classList.remove("reftest-wait"); + }); + worker.postMessage(null); +</script> +</html> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite-expected.html new file mode 100644 index 00000000000..8e0d98648ea --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite-expected.html @@ -0,0 +1,51 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.alpha.composite</title> +<h1>2d.layer.global-states.filter.alpha.composite</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'source-in'; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.html new file mode 100644 index 00000000000..f0af85f8f51 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.alpha.composite-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.alpha.composite</title> +<h1>2d.layer.global-states.filter.alpha.composite</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const offscreen_canvas = new OffscreenCanvas(200, 200); + const ctx = offscreen_canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'source-in'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const canvas = document.getElementById("canvas"); + canvas.getContext('2d').drawImage(offscreen_canvas, 0, 0); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.shadow-expected.html new file mode 100644 index 00000000000..26d13a4cae9 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.shadow-expected.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.alpha.composite.shadow</title> +<h1>2d.layer.global-states.filter.alpha.composite.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'source-in'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.shadow.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.shadow.html new file mode 100644 index 00000000000..46cd28b6c2b --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.shadow.html @@ -0,0 +1,44 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.alpha.composite.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.alpha.composite.shadow</title> +<h1>2d.layer.global-states.filter.alpha.composite.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const offscreen_canvas = new OffscreenCanvas(200, 200); + const ctx = offscreen_canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'source-in'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const canvas = document.getElementById("canvas"); + canvas.getContext('2d').drawImage(offscreen_canvas, 0, 0); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.shadow.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.shadow.w.html new file mode 100644 index 00000000000..044b75927b3 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.shadow.w.html @@ -0,0 +1,58 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<html class="reftest-wait"> +<link rel="match" href="2d.layer.global-states.filter.alpha.composite.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.alpha.composite.shadow</title> +<h1>2d.layer.global-states.filter.alpha.composite.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script id='myWorker' type='text/worker'> + self.onmessage = function(e) { + const oc = new OffscreenCanvas(200, 200); + const ctx = oc.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'source-in'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const bitmap = oc.transferToImageBitmap(); + self.postMessage(bitmap, bitmap); + }; +</script> +<script> + const blob = new Blob([document.getElementById('myWorker').textContent]); + const worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + const outputCtx = document.getElementById("canvas").getContext('2d'); + outputCtx.drawImage(msg.data, 0, 0); + document.documentElement.classList.remove("reftest-wait"); + }); + worker.postMessage(null); +</script> +</html> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.w.html new file mode 100644 index 00000000000..be25ca66b16 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.w.html @@ -0,0 +1,55 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<html class="reftest-wait"> +<link rel="match" href="2d.layer.global-states.filter.alpha.composite-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.alpha.composite</title> +<h1>2d.layer.global-states.filter.alpha.composite</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script id='myWorker' type='text/worker'> + self.onmessage = function(e) { + const oc = new OffscreenCanvas(200, 200); + const ctx = oc.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'source-in'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const bitmap = oc.transferToImageBitmap(); + self.postMessage(bitmap, bitmap); + }; +</script> +<script> + const blob = new Blob([document.getElementById('myWorker').textContent]); + const worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + const outputCtx = document.getElementById("canvas").getContext('2d'); + outputCtx.drawImage(msg.data, 0, 0); + document.documentElement.classList.remove("reftest-wait"); + }); + worker.postMessage(null); +</script> +</html> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.html new file mode 100644 index 00000000000..6567094376b --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.alpha-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.alpha</title> +<h1>2d.layer.global-states.filter.alpha</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const offscreen_canvas = new OffscreenCanvas(200, 200); + const ctx = offscreen_canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const canvas = document.getElementById("canvas"); + canvas.getContext('2d').drawImage(offscreen_canvas, 0, 0); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow-expected.html new file mode 100644 index 00000000000..9cc735fd42c --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow-expected.html @@ -0,0 +1,53 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.alpha.shadow</title> +<h1>2d.layer.global-states.filter.alpha.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.5; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.html new file mode 100644 index 00000000000..3059bf306cd --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.alpha.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.alpha.shadow</title> +<h1>2d.layer.global-states.filter.alpha.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const offscreen_canvas = new OffscreenCanvas(200, 200); + const ctx = offscreen_canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.5; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const canvas = document.getElementById("canvas"); + canvas.getContext('2d').drawImage(offscreen_canvas, 0, 0); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.w.html new file mode 100644 index 00000000000..a481073ccfc --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.w.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<html class="reftest-wait"> +<link rel="match" href="2d.layer.global-states.filter.alpha.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.alpha.shadow</title> +<h1>2d.layer.global-states.filter.alpha.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script id='myWorker' type='text/worker'> + self.onmessage = function(e) { + const oc = new OffscreenCanvas(200, 200); + const ctx = oc.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.5; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const bitmap = oc.transferToImageBitmap(); + self.postMessage(bitmap, bitmap); + }; +</script> +<script> + const blob = new Blob([document.getElementById('myWorker').textContent]); + const worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + const outputCtx = document.getElementById("canvas").getContext('2d'); + outputCtx.drawImage(msg.data, 0, 0); + document.documentElement.classList.remove("reftest-wait"); + }); + worker.postMessage(null); +</script> +</html> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.w.html new file mode 100644 index 00000000000..b5d81078899 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.w.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<html class="reftest-wait"> +<link rel="match" href="2d.layer.global-states.filter.alpha-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.alpha</title> +<h1>2d.layer.global-states.filter.alpha</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script id='myWorker' type='text/worker'> + self.onmessage = function(e) { + const oc = new OffscreenCanvas(200, 200); + const ctx = oc.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalAlpha = 0.6; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const bitmap = oc.transferToImageBitmap(); + self.postMessage(bitmap, bitmap); + }; +</script> +<script> + const blob = new Blob([document.getElementById('myWorker').textContent]); + const worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + const outputCtx = document.getElementById("canvas").getContext('2d'); + outputCtx.drawImage(msg.data, 0, 0); + document.documentElement.classList.remove("reftest-wait"); + }); + worker.postMessage(null); +</script> +</html> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.blending-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.blending-expected.html new file mode 100644 index 00000000000..f81dcf72dc2 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.blending-expected.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.blending</title> +<h1>2d.layer.global-states.filter.blending</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'multiply'; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.blending.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.blending.html new file mode 100644 index 00000000000..a574e829328 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.blending.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.blending-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.blending</title> +<h1>2d.layer.global-states.filter.blending</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const offscreen_canvas = new OffscreenCanvas(200, 200); + const ctx = offscreen_canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'multiply'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const canvas = document.getElementById("canvas"); + canvas.getContext('2d').drawImage(offscreen_canvas, 0, 0); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.blending.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.blending.shadow-expected.html new file mode 100644 index 00000000000..a48485f7e8a --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.blending.shadow-expected.html @@ -0,0 +1,53 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.blending.shadow</title> +<h1>2d.layer.global-states.filter.blending.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'multiply'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.blending.shadow.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.blending.shadow.html new file mode 100644 index 00000000000..4bdf80337f8 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.blending.shadow.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.blending.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.blending.shadow</title> +<h1>2d.layer.global-states.filter.blending.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const offscreen_canvas = new OffscreenCanvas(200, 200); + const ctx = offscreen_canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'multiply'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const canvas = document.getElementById("canvas"); + canvas.getContext('2d').drawImage(offscreen_canvas, 0, 0); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.blending.shadow.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.blending.shadow.w.html new file mode 100644 index 00000000000..23cd4e834b0 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.blending.shadow.w.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<html class="reftest-wait"> +<link rel="match" href="2d.layer.global-states.filter.blending.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.blending.shadow</title> +<h1>2d.layer.global-states.filter.blending.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script id='myWorker' type='text/worker'> + self.onmessage = function(e) { + const oc = new OffscreenCanvas(200, 200); + const ctx = oc.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'multiply'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const bitmap = oc.transferToImageBitmap(); + self.postMessage(bitmap, bitmap); + }; +</script> +<script> + const blob = new Blob([document.getElementById('myWorker').textContent]); + const worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + const outputCtx = document.getElementById("canvas").getContext('2d'); + outputCtx.drawImage(msg.data, 0, 0); + document.documentElement.classList.remove("reftest-wait"); + }); + worker.postMessage(null); +</script> +</html> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.blending.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.blending.w.html new file mode 100644 index 00000000000..bd7a51d8987 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.blending.w.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<html class="reftest-wait"> +<link rel="match" href="2d.layer.global-states.filter.blending-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.blending</title> +<h1>2d.layer.global-states.filter.blending</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script id='myWorker' type='text/worker'> + self.onmessage = function(e) { + const oc = new OffscreenCanvas(200, 200); + const ctx = oc.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'multiply'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const bitmap = oc.transferToImageBitmap(); + self.postMessage(bitmap, bitmap); + }; +</script> +<script> + const blob = new Blob([document.getElementById('myWorker').textContent]); + const worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + const outputCtx = document.getElementById("canvas").getContext('2d'); + outputCtx.drawImage(msg.data, 0, 0); + document.documentElement.classList.remove("reftest-wait"); + }); + worker.postMessage(null); +</script> +</html> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.composite-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.composite-expected.html new file mode 100644 index 00000000000..97e85a1593b --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.composite-expected.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.composite</title> +<h1>2d.layer.global-states.filter.composite</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'source-in'; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.composite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.composite.html new file mode 100644 index 00000000000..663a953a29e --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.composite.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.composite-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.composite</title> +<h1>2d.layer.global-states.filter.composite</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const offscreen_canvas = new OffscreenCanvas(200, 200); + const ctx = offscreen_canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'source-in'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const canvas = document.getElementById("canvas"); + canvas.getContext('2d').drawImage(offscreen_canvas, 0, 0); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.composite.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.composite.shadow-expected.html new file mode 100644 index 00000000000..79191ee3910 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.composite.shadow-expected.html @@ -0,0 +1,53 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.composite.shadow</title> +<h1>2d.layer.global-states.filter.composite.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'source-in'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.composite.shadow.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.composite.shadow.html new file mode 100644 index 00000000000..52ad8646f01 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.composite.shadow.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.composite.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.composite.shadow</title> +<h1>2d.layer.global-states.filter.composite.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const offscreen_canvas = new OffscreenCanvas(200, 200); + const ctx = offscreen_canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'source-in'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const canvas = document.getElementById("canvas"); + canvas.getContext('2d').drawImage(offscreen_canvas, 0, 0); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.composite.shadow.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.composite.shadow.w.html new file mode 100644 index 00000000000..bf7139edce6 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.composite.shadow.w.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<html class="reftest-wait"> +<link rel="match" href="2d.layer.global-states.filter.composite.shadow-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.composite.shadow</title> +<h1>2d.layer.global-states.filter.composite.shadow</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script id='myWorker' type='text/worker'> + self.onmessage = function(e) { + const oc = new OffscreenCanvas(200, 200); + const ctx = oc.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'source-in'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const bitmap = oc.transferToImageBitmap(); + self.postMessage(bitmap, bitmap); + }; +</script> +<script> + const blob = new Blob([document.getElementById('myWorker').textContent]); + const worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + const outputCtx = document.getElementById("canvas").getContext('2d'); + outputCtx.drawImage(msg.data, 0, 0); + document.documentElement.classList.remove("reftest-wait"); + }); + worker.postMessage(null); +</script> +</html> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.composite.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.composite.w.html new file mode 100644 index 00000000000..1f30d1e5644 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.composite.w.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<html class="reftest-wait"> +<link rel="match" href="2d.layer.global-states.filter.composite-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.composite</title> +<h1>2d.layer.global-states.filter.composite</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script id='myWorker' type='text/worker'> + self.onmessage = function(e) { + const oc = new OffscreenCanvas(200, 200); + const ctx = oc.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + ctx.globalCompositeOperation = 'source-in'; + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const bitmap = oc.transferToImageBitmap(); + self.postMessage(bitmap, bitmap); + }; +</script> +<script> + const blob = new Blob([document.getElementById('myWorker').textContent]); + const worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + const outputCtx = document.getElementById("canvas").getContext('2d'); + outputCtx.drawImage(msg.data, 0, 0); + document.documentElement.classList.remove("reftest-wait"); + }); + worker.postMessage(null); +</script> +</html> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.html deleted file mode 100644 index a36a34d78e0..00000000000 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.html +++ /dev/null @@ -1,33 +0,0 @@ -<!DOCTYPE html> -<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<link rel="match" href="2d.layer.global-states.filter-expected.html"> -<title>Canvas test: 2d.layer.global-states.filter</title> -<h1>2d.layer.global-states.filter</h1> -<p class="desc">Checks that layers correctly use global render states.</p> -<canvas id="canvas" width="200" height="200"> - <p class="fallback">FAIL (fallback content)</p> -</canvas> -<script> - const offscreen_canvas = new OffscreenCanvas(200, 200); - const ctx = offscreen_canvas.getContext('2d'); - - ctx.fillStyle = 'rgba(0, 0, 255, 1)'; - - var circle = new Path2D(); - circle.arc(90, 90, 45, 0, 2 * Math.PI); - ctx.fill(circle); - - ctx.filter = 'sepia(1) opacity(30%)'; - - ctx.beginLayer(); - - ctx.fillStyle = 'rgba(225, 0, 0, 1)'; - ctx.fillRect(50, 50, 75, 50); - ctx.fillStyle = 'rgba(0, 255, 0, 1)'; - ctx.fillRect(70, 70, 75, 50); - - ctx.endLayer(); - - const canvas = document.getElementById("canvas"); - canvas.getContext('2d').drawImage(offscreen_canvas, 0, 0); -</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.no-global-states-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.no-global-states-expected.html new file mode 100644 index 00000000000..e56fe0b3602 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.no-global-states-expected.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.global-states.filter.no-global-states</title> +<h1>2d.layer.global-states.filter.no-global-states</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + // No global states. + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.no-global-states.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.no-global-states.html new file mode 100644 index 00000000000..0619faa944f --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.no-global-states.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.global-states.filter.no-global-states-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.no-global-states</title> +<h1>2d.layer.global-states.filter.no-global-states</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const offscreen_canvas = new OffscreenCanvas(200, 200); + const ctx = offscreen_canvas.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + // No global states. + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const canvas = document.getElementById("canvas"); + canvas.getContext('2d').drawImage(offscreen_canvas, 0, 0); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.no-global-states.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.no-global-states.w.html new file mode 100644 index 00000000000..3a716838200 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.no-global-states.w.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<html class="reftest-wait"> +<link rel="match" href="2d.layer.global-states.filter.no-global-states-expected.html"> +<title>Canvas test: 2d.layer.global-states.filter.no-global-states</title> +<h1>2d.layer.global-states.filter.no-global-states</h1> +<p class="desc">Checks that layers with filters correctly use global render states.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script id='myWorker' type='text/worker'> + self.onmessage = function(e) { + const oc = new OffscreenCanvas(200, 200); + const ctx = oc.getContext('2d'); + + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + // No global states. + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + + const bitmap = oc.transferToImageBitmap(); + self.postMessage(bitmap, bitmap); + }; +</script> +<script> + const blob = new Blob([document.getElementById('myWorker').textContent]); + const worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + const outputCtx = document.getElementById("canvas").getContext('2d'); + outputCtx.drawImage(msg.data, 0, 0); + document.documentElement.classList.remove("reftest-wait"); + }); + worker.postMessage(null); +</script> +</html> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.shadow-expected.html index 6ec9b02f7cb..59cf16fa87d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.shadow-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.shadow-expected.html @@ -2,7 +2,7 @@ <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <title>Canvas test: 2d.layer.global-states.filter.shadow</title> <h1>2d.layer.global-states.filter.shadow</h1> -<p class="desc">Checks that layers correctly use global render states.</p> +<p class="desc">Checks that layers with filters correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> </canvas> @@ -10,24 +10,43 @@ const canvas = document.getElementById("canvas"); const ctx = canvas.getContext('2d'); - ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; - var circle = new Path2D(); - circle.arc(90, 90, 45, 0, 2 * Math.PI); - ctx.fill(circle); + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; - ctx.filter = 'sepia(1) opacity(70%)'; - ctx.shadowOffsetX = -10; - ctx.shadowOffsetY = 10; - ctx.shadowColor = 'rgba(0,1,0,0.5)'; - - canvas2 = document.createElement("canvas"); - ctx2 = canvas2.getContext("2d"); + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); - ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; - ctx2.fillRect(50, 50, 75, 50); - ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; - ctx2.fillRect(70, 70, 75, 50); + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; - ctx.drawImage(canvas2, 0, 0); + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.shadow.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.shadow.html index 16439c60c68..69120c105e5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.shadow.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.shadow.html @@ -1,10 +1,9 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <link rel="match" href="2d.layer.global-states.filter.shadow-expected.html"> -<meta name=fuzzy content="maxDifference=0-1; totalPixels=0-49"> <title>Canvas test: 2d.layer.global-states.filter.shadow</title> <h1>2d.layer.global-states.filter.shadow</h1> -<p class="desc">Checks that layers correctly use global render states.</p> +<p class="desc">Checks that layers with filters correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> </canvas> @@ -18,16 +17,22 @@ circle.arc(90, 90, 45, 0, 2 * Math.PI); ctx.fill(circle); - ctx.filter = 'sepia(1) opacity(70%)'; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'rgba(0,1,0,0.5)'; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; - ctx.beginLayer(); + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); - ctx.fillStyle = 'rgba(225, 0, 0, 1)'; + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); - ctx.fillStyle = 'rgba(0, 255, 0, 1)'; + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; ctx.fillRect(70, 70, 75, 50); ctx.endLayer(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.shadow.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.shadow.w.html index 7abddb27c51..8a770b2911e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.shadow.w.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.shadow.w.html @@ -2,10 +2,9 @@ <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <html class="reftest-wait"> <link rel="match" href="2d.layer.global-states.filter.shadow-expected.html"> -<meta name=fuzzy content="maxDifference=0-1; totalPixels=0-49"> <title>Canvas test: 2d.layer.global-states.filter.shadow</title> <h1>2d.layer.global-states.filter.shadow</h1> -<p class="desc">Checks that layers correctly use global render states.</p> +<p class="desc">Checks that layers with filters correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> </canvas> @@ -20,16 +19,22 @@ circle.arc(90, 90, 45, 0, 2 * Math.PI); ctx.fill(circle); - ctx.filter = 'sepia(1) opacity(70%)'; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'rgba(0,1,0,0.5)'; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; - ctx.beginLayer(); + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); - ctx.fillStyle = 'rgba(225, 0, 0, 1)'; + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); - ctx.fillStyle = 'rgba(0, 255, 0, 1)'; + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; ctx.fillRect(70, 70, 75, 50); ctx.endLayer(); diff --git a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.no_global_states-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.no-global-states-expected.html index 139ff8ac944..b91a2ae8b52 100644 --- a/tests/wpt/web-platform-tests/html/canvas/element/layers/2d.layer.global-states.no_global_states-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.no-global-states-expected.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<title>Canvas test: 2d.layer.global-states.no_global_states</title> -<h1>2d.layer.global-states.no_global_states</h1> +<title>Canvas test: 2d.layer.global-states.no-global-states</title> +<h1>2d.layer.global-states.no-global-states</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -21,6 +21,7 @@ canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.no_global_states.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.no-global-states.html index 6769d47e771..022736c7b5b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.no_global_states.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.no-global-states.html @@ -1,8 +1,8 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> -<link rel="match" href="2d.layer.global-states.no_global_states-expected.html"> -<title>Canvas test: 2d.layer.global-states.no_global_states</title> -<h1>2d.layer.global-states.no_global_states</h1> +<link rel="match" href="2d.layer.global-states.no-global-states-expected.html"> +<title>Canvas test: 2d.layer.global-states.no-global-states</title> +<h1>2d.layer.global-states.no-global-states</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -21,6 +21,10 @@ ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.no_global_states.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.no-global-states.w.html index 7628d387e99..80ed4e4503d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.no_global_states.w.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.no-global-states.w.html @@ -1,9 +1,9 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <html class="reftest-wait"> -<link rel="match" href="2d.layer.global-states.no_global_states-expected.html"> -<title>Canvas test: 2d.layer.global-states.no_global_states</title> -<h1>2d.layer.global-states.no_global_states</h1> +<link rel="match" href="2d.layer.global-states.no-global-states-expected.html"> +<title>Canvas test: 2d.layer.global-states.no-global-states</title> +<h1>2d.layer.global-states.no-global-states</h1> <p class="desc">Checks that layers correctly use global render states.</p> <canvas id="canvas" width="200" height="200"> <p class="fallback">FAIL (fallback content)</p> @@ -23,6 +23,10 @@ ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.shadow-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.shadow-expected.html index 6787bdd1e50..ba56644d6c2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.shadow-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.shadow-expected.html @@ -18,11 +18,12 @@ ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'orange'; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.shadow.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.shadow.html index 87b8224f856..6402dc57607 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.shadow.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.shadow.html @@ -19,10 +19,14 @@ ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'orange'; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.shadow.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.shadow.w.html index b8d59888729..e41e7aee464 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.shadow.w.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.global-states.shadow.w.html @@ -21,10 +21,14 @@ ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'orange'; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.several-complex-expected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.several-complex-expected.html index 1944ea6d2ac..84ad6244740 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.several-complex-expected.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.several-complex-expected.html @@ -14,7 +14,6 @@ ctx.fillRect(50, 50, 95, 70); ctx.globalAlpha = 0.5; - ctx.filter = 'sepia(0.5)'; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; ctx.shadowColor = 'orange'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.several-complex.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.several-complex.html index b4b2a8da602..1d50bd4de61 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.several-complex.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.several-complex.html @@ -16,7 +16,6 @@ ctx.fillRect(50, 50, 95, 70); ctx.globalAlpha = 0.5; - ctx.filter = 'sepia(0.5)'; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; ctx.shadowColor = 'orange'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.several-complex.w.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.several-complex.w.html index 5260cc2724d..7982a8dbc4f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.several-complex.w.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/layers/2d.layer.several-complex.w.html @@ -18,7 +18,6 @@ ctx.fillRect(50, 50, 95, 70); ctx.globalAlpha = 0.5; - ctx.filter = 'sepia(0.5)'; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; ctx.shadowColor = 'orange'; diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.butt.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.butt.html index d5eb4cafb6b..145e145cb41 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.butt.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.butt.html @@ -15,49 +15,47 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineCap = 'butt'; -ctx.lineWidth = 20; - -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; -ctx.fillRect(15, 15, 20, 20); -ctx.beginPath(); -ctx.moveTo(25, 15); -ctx.lineTo(25, 35); -ctx.stroke(); - -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(75, 15); -ctx.lineTo(75, 35); -ctx.stroke(); -ctx.fillRect(65, 15, 20, 20); - -_assertPixel(canvas, 25,14, 0,255,0,255); -_assertPixel(canvas, 25,15, 0,255,0,255); -_assertPixel(canvas, 25,16, 0,255,0,255); -_assertPixel(canvas, 25,34, 0,255,0,255); -_assertPixel(canvas, 25,35, 0,255,0,255); -_assertPixel(canvas, 25,36, 0,255,0,255); - -_assertPixel(canvas, 75,14, 0,255,0,255); -_assertPixel(canvas, 75,15, 0,255,0,255); -_assertPixel(canvas, 75,16, 0,255,0,255); -_assertPixel(canvas, 75,34, 0,255,0,255); -_assertPixel(canvas, 75,35, 0,255,0,255); -_assertPixel(canvas, 75,36, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineCap = 'butt'; + ctx.lineWidth = 20; + + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + ctx.fillRect(15, 15, 20, 20); + ctx.beginPath(); + ctx.moveTo(25, 15); + ctx.lineTo(25, 35); + ctx.stroke(); + + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(75, 15); + ctx.lineTo(75, 35); + ctx.stroke(); + ctx.fillRect(65, 15, 20, 20); + + _assertPixel(canvas, 25,14, 0,255,0,255); + _assertPixel(canvas, 25,15, 0,255,0,255); + _assertPixel(canvas, 25,16, 0,255,0,255); + _assertPixel(canvas, 25,34, 0,255,0,255); + _assertPixel(canvas, 25,35, 0,255,0,255); + _assertPixel(canvas, 25,36, 0,255,0,255); + + _assertPixel(canvas, 75,14, 0,255,0,255); + _assertPixel(canvas, 75,15, 0,255,0,255); + _assertPixel(canvas, 75,16, 0,255,0,255); + _assertPixel(canvas, 75,34, 0,255,0,255); + _assertPixel(canvas, 75,35, 0,255,0,255); + _assertPixel(canvas, 75,36, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.butt.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.butt.worker.js index 3ad21e9da96..127393790cd 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.butt.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.butt.worker.js @@ -13,45 +13,44 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineCap = 'butt'; -ctx.lineWidth = 20; - -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; -ctx.fillRect(15, 15, 20, 20); -ctx.beginPath(); -ctx.moveTo(25, 15); -ctx.lineTo(25, 35); -ctx.stroke(); - -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(75, 15); -ctx.lineTo(75, 35); -ctx.stroke(); -ctx.fillRect(65, 15, 20, 20); - -_assertPixel(canvas, 25,14, 0,255,0,255); -_assertPixel(canvas, 25,15, 0,255,0,255); -_assertPixel(canvas, 25,16, 0,255,0,255); -_assertPixel(canvas, 25,34, 0,255,0,255); -_assertPixel(canvas, 25,35, 0,255,0,255); -_assertPixel(canvas, 25,36, 0,255,0,255); - -_assertPixel(canvas, 75,14, 0,255,0,255); -_assertPixel(canvas, 75,15, 0,255,0,255); -_assertPixel(canvas, 75,16, 0,255,0,255); -_assertPixel(canvas, 75,34, 0,255,0,255); -_assertPixel(canvas, 75,35, 0,255,0,255); -_assertPixel(canvas, 75,36, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineCap = 'butt'; + ctx.lineWidth = 20; + + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + ctx.fillRect(15, 15, 20, 20); + ctx.beginPath(); + ctx.moveTo(25, 15); + ctx.lineTo(25, 35); + ctx.stroke(); + + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(75, 15); + ctx.lineTo(75, 35); + ctx.stroke(); + ctx.fillRect(65, 15, 20, 20); + + _assertPixel(canvas, 25,14, 0,255,0,255); + _assertPixel(canvas, 25,15, 0,255,0,255); + _assertPixel(canvas, 25,16, 0,255,0,255); + _assertPixel(canvas, 25,34, 0,255,0,255); + _assertPixel(canvas, 25,35, 0,255,0,255); + _assertPixel(canvas, 25,36, 0,255,0,255); + + _assertPixel(canvas, 75,14, 0,255,0,255); + _assertPixel(canvas, 75,15, 0,255,0,255); + _assertPixel(canvas, 75,16, 0,255,0,255); + _assertPixel(canvas, 75,34, 0,255,0,255); + _assertPixel(canvas, 75,35, 0,255,0,255); + _assertPixel(canvas, 75,36, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.closed.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.closed.html index b26054fc162..edddeb08e7b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.closed.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.closed.html @@ -15,34 +15,32 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineJoin = 'bevel'; -ctx.lineCap = 'square'; -ctx.lineWidth = 400; - -ctx.beginPath(); -ctx.moveTo(200, 200); -ctx.lineTo(200, 1000); -ctx.lineTo(1000, 1000); -ctx.lineTo(1000, 200); -ctx.closePath(); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineJoin = 'bevel'; + ctx.lineCap = 'square'; + ctx.lineWidth = 400; + + ctx.beginPath(); + ctx.moveTo(200, 200); + ctx.lineTo(200, 1000); + ctx.lineTo(1000, 1000); + ctx.lineTo(1000, 200); + ctx.closePath(); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.closed.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.closed.worker.js index 50c81519d2e..b8357316e46 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.closed.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.closed.worker.js @@ -13,30 +13,29 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineJoin = 'bevel'; -ctx.lineCap = 'square'; -ctx.lineWidth = 400; - -ctx.beginPath(); -ctx.moveTo(200, 200); -ctx.lineTo(200, 1000); -ctx.lineTo(1000, 1000); -ctx.lineTo(1000, 200); -ctx.closePath(); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineJoin = 'bevel'; + ctx.lineCap = 'square'; + ctx.lineWidth = 400; + + ctx.beginPath(); + ctx.moveTo(200, 200); + ctx.lineTo(200, 1000); + ctx.lineTo(1000, 1000); + ctx.lineTo(1000, 200); + ctx.closePath(); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.invalid.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.invalid.html index 0570540ee39..2054bbc5155 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.invalid.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.invalid.html @@ -15,40 +15,38 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.lineCap = 'butt' -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt' + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -ctx.lineCap = 'butt'; -ctx.lineCap = 'invalid'; -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt'; + ctx.lineCap = 'invalid'; + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -ctx.lineCap = 'butt'; -ctx.lineCap = 'ROUND'; -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt'; + ctx.lineCap = 'ROUND'; + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -ctx.lineCap = 'butt'; -ctx.lineCap = 'round\0'; -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt'; + ctx.lineCap = 'round\0'; + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -ctx.lineCap = 'butt'; -ctx.lineCap = 'round '; -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt'; + ctx.lineCap = 'round '; + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -ctx.lineCap = 'butt'; -ctx.lineCap = ""; -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt'; + ctx.lineCap = ""; + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -ctx.lineCap = 'butt'; -ctx.lineCap = 'bevel'; -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -})(canvas, ctx); -t.done(); + ctx.lineCap = 'butt'; + ctx.lineCap = 'bevel'; + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.invalid.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.invalid.worker.js index bf933941023..813ceb7f669 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.invalid.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.invalid.worker.js @@ -13,36 +13,35 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.lineCap = 'butt' -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt' + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -ctx.lineCap = 'butt'; -ctx.lineCap = 'invalid'; -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt'; + ctx.lineCap = 'invalid'; + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -ctx.lineCap = 'butt'; -ctx.lineCap = 'ROUND'; -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt'; + ctx.lineCap = 'ROUND'; + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -ctx.lineCap = 'butt'; -ctx.lineCap = 'round\0'; -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt'; + ctx.lineCap = 'round\0'; + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -ctx.lineCap = 'butt'; -ctx.lineCap = 'round '; -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt'; + ctx.lineCap = 'round '; + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -ctx.lineCap = 'butt'; -ctx.lineCap = ""; -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); - -ctx.lineCap = 'butt'; -ctx.lineCap = 'bevel'; -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -t.done(); + ctx.lineCap = 'butt'; + ctx.lineCap = ""; + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt'; + ctx.lineCap = 'bevel'; + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.open.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.open.html index 54f904b4329..f26fbc686c4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.open.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.open.html @@ -15,34 +15,32 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineJoin = 'bevel'; -ctx.lineCap = 'square'; -ctx.lineWidth = 400; - -ctx.beginPath(); -ctx.moveTo(200, 200); -ctx.lineTo(200, 1000); -ctx.lineTo(1000, 1000); -ctx.lineTo(1000, 200); -ctx.lineTo(200, 200); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineJoin = 'bevel'; + ctx.lineCap = 'square'; + ctx.lineWidth = 400; + + ctx.beginPath(); + ctx.moveTo(200, 200); + ctx.lineTo(200, 1000); + ctx.lineTo(1000, 1000); + ctx.lineTo(1000, 200); + ctx.lineTo(200, 200); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.open.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.open.worker.js index ff081deb7d0..169010ac2ac 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.open.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.open.worker.js @@ -13,30 +13,29 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineJoin = 'bevel'; -ctx.lineCap = 'square'; -ctx.lineWidth = 400; - -ctx.beginPath(); -ctx.moveTo(200, 200); -ctx.lineTo(200, 1000); -ctx.lineTo(1000, 1000); -ctx.lineTo(1000, 200); -ctx.lineTo(200, 200); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineJoin = 'bevel'; + ctx.lineCap = 'square'; + ctx.lineWidth = 400; + + ctx.beginPath(); + ctx.moveTo(200, 200); + ctx.lineTo(200, 1000); + ctx.lineTo(1000, 1000); + ctx.lineTo(1000, 200); + ctx.lineTo(200, 200); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.round.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.round.html index 788675310e6..31f5ba5423c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.round.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.round.html @@ -15,65 +15,63 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -var tol = 1; // tolerance to avoid antialiasing artifacts + var tol = 1; // tolerance to avoid antialiasing artifacts -ctx.lineCap = 'round'; -ctx.lineWidth = 20; + ctx.lineCap = 'round'; + ctx.lineWidth = 20; -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(35-tol, 15); -ctx.arc(25, 15, 10-tol, 0, Math.PI, true); -ctx.arc(25, 35, 10-tol, Math.PI, 0, true); -ctx.fill(); + ctx.beginPath(); + ctx.moveTo(35-tol, 15); + ctx.arc(25, 15, 10-tol, 0, Math.PI, true); + ctx.arc(25, 35, 10-tol, Math.PI, 0, true); + ctx.fill(); -ctx.beginPath(); -ctx.moveTo(25, 15); -ctx.lineTo(25, 35); -ctx.stroke(); + ctx.beginPath(); + ctx.moveTo(25, 15); + ctx.lineTo(25, 35); + ctx.stroke(); -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(75, 15); -ctx.lineTo(75, 35); -ctx.stroke(); + ctx.beginPath(); + ctx.moveTo(75, 15); + ctx.lineTo(75, 35); + ctx.stroke(); -ctx.beginPath(); -ctx.moveTo(85+tol, 15); -ctx.arc(75, 15, 10+tol, 0, Math.PI, true); -ctx.arc(75, 35, 10+tol, Math.PI, 0, true); -ctx.fill(); + ctx.beginPath(); + ctx.moveTo(85+tol, 15); + ctx.arc(75, 15, 10+tol, 0, Math.PI, true); + ctx.arc(75, 35, 10+tol, Math.PI, 0, true); + ctx.fill(); -_assertPixel(canvas, 17,6, 0,255,0,255); -_assertPixel(canvas, 25,6, 0,255,0,255); -_assertPixel(canvas, 32,6, 0,255,0,255); -_assertPixel(canvas, 17,43, 0,255,0,255); -_assertPixel(canvas, 25,43, 0,255,0,255); -_assertPixel(canvas, 32,43, 0,255,0,255); + _assertPixel(canvas, 17,6, 0,255,0,255); + _assertPixel(canvas, 25,6, 0,255,0,255); + _assertPixel(canvas, 32,6, 0,255,0,255); + _assertPixel(canvas, 17,43, 0,255,0,255); + _assertPixel(canvas, 25,43, 0,255,0,255); + _assertPixel(canvas, 32,43, 0,255,0,255); -_assertPixel(canvas, 67,6, 0,255,0,255); -_assertPixel(canvas, 75,6, 0,255,0,255); -_assertPixel(canvas, 82,6, 0,255,0,255); -_assertPixel(canvas, 67,43, 0,255,0,255); -_assertPixel(canvas, 75,43, 0,255,0,255); -_assertPixel(canvas, 82,43, 0,255,0,255); -})(canvas, ctx); -t.done(); + _assertPixel(canvas, 67,6, 0,255,0,255); + _assertPixel(canvas, 75,6, 0,255,0,255); + _assertPixel(canvas, 82,6, 0,255,0,255); + _assertPixel(canvas, 67,43, 0,255,0,255); + _assertPixel(canvas, 75,43, 0,255,0,255); + _assertPixel(canvas, 82,43, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.round.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.round.worker.js index f03579ee54b..a8d9c1b92f8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.round.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.round.worker.js @@ -13,61 +13,60 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -var tol = 1; // tolerance to avoid antialiasing artifacts + var tol = 1; // tolerance to avoid antialiasing artifacts -ctx.lineCap = 'round'; -ctx.lineWidth = 20; + ctx.lineCap = 'round'; + ctx.lineWidth = 20; -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(35-tol, 15); -ctx.arc(25, 15, 10-tol, 0, Math.PI, true); -ctx.arc(25, 35, 10-tol, Math.PI, 0, true); -ctx.fill(); + ctx.beginPath(); + ctx.moveTo(35-tol, 15); + ctx.arc(25, 15, 10-tol, 0, Math.PI, true); + ctx.arc(25, 35, 10-tol, Math.PI, 0, true); + ctx.fill(); -ctx.beginPath(); -ctx.moveTo(25, 15); -ctx.lineTo(25, 35); -ctx.stroke(); + ctx.beginPath(); + ctx.moveTo(25, 15); + ctx.lineTo(25, 35); + ctx.stroke(); -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(75, 15); -ctx.lineTo(75, 35); -ctx.stroke(); + ctx.beginPath(); + ctx.moveTo(75, 15); + ctx.lineTo(75, 35); + ctx.stroke(); -ctx.beginPath(); -ctx.moveTo(85+tol, 15); -ctx.arc(75, 15, 10+tol, 0, Math.PI, true); -ctx.arc(75, 35, 10+tol, Math.PI, 0, true); -ctx.fill(); + ctx.beginPath(); + ctx.moveTo(85+tol, 15); + ctx.arc(75, 15, 10+tol, 0, Math.PI, true); + ctx.arc(75, 35, 10+tol, Math.PI, 0, true); + ctx.fill(); -_assertPixel(canvas, 17,6, 0,255,0,255); -_assertPixel(canvas, 25,6, 0,255,0,255); -_assertPixel(canvas, 32,6, 0,255,0,255); -_assertPixel(canvas, 17,43, 0,255,0,255); -_assertPixel(canvas, 25,43, 0,255,0,255); -_assertPixel(canvas, 32,43, 0,255,0,255); - -_assertPixel(canvas, 67,6, 0,255,0,255); -_assertPixel(canvas, 75,6, 0,255,0,255); -_assertPixel(canvas, 82,6, 0,255,0,255); -_assertPixel(canvas, 67,43, 0,255,0,255); -_assertPixel(canvas, 75,43, 0,255,0,255); -_assertPixel(canvas, 82,43, 0,255,0,255); -t.done(); + _assertPixel(canvas, 17,6, 0,255,0,255); + _assertPixel(canvas, 25,6, 0,255,0,255); + _assertPixel(canvas, 32,6, 0,255,0,255); + _assertPixel(canvas, 17,43, 0,255,0,255); + _assertPixel(canvas, 25,43, 0,255,0,255); + _assertPixel(canvas, 32,43, 0,255,0,255); + _assertPixel(canvas, 67,6, 0,255,0,255); + _assertPixel(canvas, 75,6, 0,255,0,255); + _assertPixel(canvas, 82,6, 0,255,0,255); + _assertPixel(canvas, 67,43, 0,255,0,255); + _assertPixel(canvas, 75,43, 0,255,0,255); + _assertPixel(canvas, 82,43, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.square.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.square.html index 9d4a03ecad2..0d2988877d4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.square.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.square.html @@ -15,49 +15,47 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineCap = 'square'; -ctx.lineWidth = 20; - -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; -ctx.fillRect(15, 5, 20, 40); -ctx.beginPath(); -ctx.moveTo(25, 15); -ctx.lineTo(25, 35); -ctx.stroke(); - -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(75, 15); -ctx.lineTo(75, 35); -ctx.stroke(); -ctx.fillRect(65, 5, 20, 40); - -_assertPixel(canvas, 25,4, 0,255,0,255); -_assertPixel(canvas, 25,5, 0,255,0,255); -_assertPixel(canvas, 25,6, 0,255,0,255); -_assertPixel(canvas, 25,44, 0,255,0,255); -_assertPixel(canvas, 25,45, 0,255,0,255); -_assertPixel(canvas, 25,46, 0,255,0,255); - -_assertPixel(canvas, 75,4, 0,255,0,255); -_assertPixel(canvas, 75,5, 0,255,0,255); -_assertPixel(canvas, 75,6, 0,255,0,255); -_assertPixel(canvas, 75,44, 0,255,0,255); -_assertPixel(canvas, 75,45, 0,255,0,255); -_assertPixel(canvas, 75,46, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineCap = 'square'; + ctx.lineWidth = 20; + + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + ctx.fillRect(15, 5, 20, 40); + ctx.beginPath(); + ctx.moveTo(25, 15); + ctx.lineTo(25, 35); + ctx.stroke(); + + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(75, 15); + ctx.lineTo(75, 35); + ctx.stroke(); + ctx.fillRect(65, 5, 20, 40); + + _assertPixel(canvas, 25,4, 0,255,0,255); + _assertPixel(canvas, 25,5, 0,255,0,255); + _assertPixel(canvas, 25,6, 0,255,0,255); + _assertPixel(canvas, 25,44, 0,255,0,255); + _assertPixel(canvas, 25,45, 0,255,0,255); + _assertPixel(canvas, 25,46, 0,255,0,255); + + _assertPixel(canvas, 75,4, 0,255,0,255); + _assertPixel(canvas, 75,5, 0,255,0,255); + _assertPixel(canvas, 75,6, 0,255,0,255); + _assertPixel(canvas, 75,44, 0,255,0,255); + _assertPixel(canvas, 75,45, 0,255,0,255); + _assertPixel(canvas, 75,46, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.square.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.square.worker.js index 439f100409a..6776e9891ba 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.square.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.square.worker.js @@ -13,45 +13,44 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineCap = 'square'; -ctx.lineWidth = 20; - -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; -ctx.fillRect(15, 5, 20, 40); -ctx.beginPath(); -ctx.moveTo(25, 15); -ctx.lineTo(25, 35); -ctx.stroke(); - -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(75, 15); -ctx.lineTo(75, 35); -ctx.stroke(); -ctx.fillRect(65, 5, 20, 40); - -_assertPixel(canvas, 25,4, 0,255,0,255); -_assertPixel(canvas, 25,5, 0,255,0,255); -_assertPixel(canvas, 25,6, 0,255,0,255); -_assertPixel(canvas, 25,44, 0,255,0,255); -_assertPixel(canvas, 25,45, 0,255,0,255); -_assertPixel(canvas, 25,46, 0,255,0,255); - -_assertPixel(canvas, 75,4, 0,255,0,255); -_assertPixel(canvas, 75,5, 0,255,0,255); -_assertPixel(canvas, 75,6, 0,255,0,255); -_assertPixel(canvas, 75,44, 0,255,0,255); -_assertPixel(canvas, 75,45, 0,255,0,255); -_assertPixel(canvas, 75,46, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineCap = 'square'; + ctx.lineWidth = 20; + + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + ctx.fillRect(15, 5, 20, 40); + ctx.beginPath(); + ctx.moveTo(25, 15); + ctx.lineTo(25, 35); + ctx.stroke(); + + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(75, 15); + ctx.lineTo(75, 35); + ctx.stroke(); + ctx.fillRect(65, 5, 20, 40); + + _assertPixel(canvas, 25,4, 0,255,0,255); + _assertPixel(canvas, 25,5, 0,255,0,255); + _assertPixel(canvas, 25,6, 0,255,0,255); + _assertPixel(canvas, 25,44, 0,255,0,255); + _assertPixel(canvas, 25,45, 0,255,0,255); + _assertPixel(canvas, 25,46, 0,255,0,255); + + _assertPixel(canvas, 75,4, 0,255,0,255); + _assertPixel(canvas, 75,5, 0,255,0,255); + _assertPixel(canvas, 75,6, 0,255,0,255); + _assertPixel(canvas, 75,44, 0,255,0,255); + _assertPixel(canvas, 75,45, 0,255,0,255); + _assertPixel(canvas, 75,46, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.valid.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.valid.html index 996afb37a57..6334891f563 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.valid.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.valid.html @@ -15,22 +15,20 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.lineCap = 'butt' -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt' + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -ctx.lineCap = 'round'; -_assertSame(ctx.lineCap, 'round', "ctx.lineCap", "'round'"); + ctx.lineCap = 'round'; + _assertSame(ctx.lineCap, 'round', "ctx.lineCap", "'round'"); -ctx.lineCap = 'square'; -_assertSame(ctx.lineCap, 'square', "ctx.lineCap", "'square'"); -})(canvas, ctx); -t.done(); + ctx.lineCap = 'square'; + _assertSame(ctx.lineCap, 'square', "ctx.lineCap", "'square'"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.valid.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.valid.worker.js index 52907f433ec..0010fd61dda 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.valid.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cap.valid.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.lineCap = 'butt' -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + ctx.lineCap = 'butt' + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -ctx.lineCap = 'round'; -_assertSame(ctx.lineCap, 'round', "ctx.lineCap", "'round'"); - -ctx.lineCap = 'square'; -_assertSame(ctx.lineCap, 'square', "ctx.lineCap", "'square'"); -t.done(); + ctx.lineCap = 'round'; + _assertSame(ctx.lineCap, 'round', "ctx.lineCap", "'round'"); + ctx.lineCap = 'square'; + _assertSame(ctx.lineCap, 'square', "ctx.lineCap", "'square'"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cross.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cross.html index 7c5821f2f56..83e2a758fd4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cross.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cross.html @@ -15,31 +15,29 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 200; -ctx.lineJoin = 'bevel'; - -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(110, 50); -ctx.lineTo(110, 60); -ctx.lineTo(100, 60); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 200; + ctx.lineJoin = 'bevel'; + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(110, 50); + ctx.lineTo(110, 60); + ctx.lineTo(100, 60); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cross.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cross.worker.js index e455aa6155d..5dc95c25f13 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cross.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.cross.worker.js @@ -13,27 +13,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 200; -ctx.lineJoin = 'bevel'; - -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(110, 50); -ctx.lineTo(110, 60); -ctx.lineTo(100, 60); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 200; + ctx.lineJoin = 'bevel'; + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(110, 50); + ctx.lineTo(110, 60); + ctx.lineTo(100, 60); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.defaults.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.defaults.html index e8a39c08237..7f50257288c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.defaults.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.defaults.html @@ -15,18 +15,16 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -_assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1"); -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -_assertSame(ctx.lineJoin, 'miter', "ctx.lineJoin", "'miter'"); -_assertSame(ctx.miterLimit, 10, "ctx.miterLimit", "10"); -})(canvas, ctx); -t.done(); + _assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1"); + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + _assertSame(ctx.lineJoin, 'miter', "ctx.lineJoin", "'miter'"); + _assertSame(ctx.miterLimit, 10, "ctx.miterLimit", "10"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.defaults.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.defaults.worker.js index 77116b44540..1a59b81027e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.defaults.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.defaults.worker.js @@ -13,14 +13,13 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -_assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1"); -_assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); -_assertSame(ctx.lineJoin, 'miter', "ctx.lineJoin", "'miter'"); -_assertSame(ctx.miterLimit, 10, "ctx.miterLimit", "10"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + _assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1"); + _assertSame(ctx.lineCap, 'butt', "ctx.lineCap", "'butt'"); + _assertSame(ctx.lineJoin, 'miter', "ctx.lineJoin", "'miter'"); + _assertSame(ctx.miterLimit, 10, "ctx.miterLimit", "10"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.invalid.strokestyle.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.invalid.strokestyle.html index 2554d714d92..fa67e3b3f82 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.invalid.strokestyle.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.invalid.strokestyle.html @@ -15,25 +15,23 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.strokeStyle = 'rgb(0, 255, 0)'; -ctx.strokeStyle = 'nonsense'; -ctx.lineWidth = 200; -ctx.moveTo(0,100); -ctx.lineTo(200,100); -ctx.stroke(); -var imageData = ctx.getImageData(0, 0, 200, 200); -var imgdata = imageData.data; -_assert(imgdata[4] == 0, "imgdata[\""+(4)+"\"] == 0"); -_assert(imgdata[5] == 255, "imgdata[\""+(5)+"\"] == 255"); -_assert(imgdata[6] == 0, "imgdata[\""+(6)+"\"] == 0"); -})(canvas, ctx); -t.done(); + ctx.strokeStyle = 'rgb(0, 255, 0)'; + ctx.strokeStyle = 'nonsense'; + ctx.lineWidth = 200; + ctx.moveTo(0,100); + ctx.lineTo(200,100); + ctx.stroke(); + var imageData = ctx.getImageData(0, 0, 200, 200); + var imgdata = imageData.data; + _assert(imgdata[4] == 0, "imgdata[\""+(4)+"\"] == 0"); + _assert(imgdata[5] == 255, "imgdata[\""+(5)+"\"] == 255"); + _assert(imgdata[6] == 0, "imgdata[\""+(6)+"\"] == 0"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.invalid.strokestyle.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.invalid.strokestyle.worker.js index c9f2fa3d9f2..5726b1835a4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.invalid.strokestyle.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.invalid.strokestyle.worker.js @@ -13,21 +13,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.strokeStyle = 'rgb(0, 255, 0)'; -ctx.strokeStyle = 'nonsense'; -ctx.lineWidth = 200; -ctx.moveTo(0,100); -ctx.lineTo(200,100); -ctx.stroke(); -var imageData = ctx.getImageData(0, 0, 200, 200); -var imgdata = imageData.data; -_assert(imgdata[4] == 0, "imgdata[\""+(4)+"\"] == 0"); -_assert(imgdata[5] == 255, "imgdata[\""+(5)+"\"] == 255"); -_assert(imgdata[6] == 0, "imgdata[\""+(6)+"\"] == 0"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.strokeStyle = 'rgb(0, 255, 0)'; + ctx.strokeStyle = 'nonsense'; + ctx.lineWidth = 200; + ctx.moveTo(0,100); + ctx.lineTo(200,100); + ctx.stroke(); + var imageData = ctx.getImageData(0, 0, 200, 200); + var imgdata = imageData.data; + _assert(imgdata[4] == 0, "imgdata[\""+(4)+"\"] == 0"); + _assert(imgdata[5] == 255, "imgdata[\""+(5)+"\"] == 255"); + _assert(imgdata[6] == 0, "imgdata[\""+(6)+"\"] == 0"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.bevel.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.bevel.html index b2325ad9891..70e3896281d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.bevel.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.bevel.html @@ -15,68 +15,66 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -var tol = 1; // tolerance to avoid antialiasing artifacts - -ctx.lineJoin = 'bevel'; -ctx.lineWidth = 20; - -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; - -ctx.fillRect(10, 10, 20, 20); -ctx.fillRect(20, 20, 20, 20); -ctx.beginPath(); -ctx.moveTo(30, 20); -ctx.lineTo(40-tol, 20); -ctx.lineTo(30, 10+tol); -ctx.fill(); - -ctx.beginPath(); -ctx.moveTo(10, 20); -ctx.lineTo(30, 20); -ctx.lineTo(30, 40); -ctx.stroke(); - - -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; - -ctx.beginPath(); -ctx.moveTo(60, 20); -ctx.lineTo(80, 20); -ctx.lineTo(80, 40); -ctx.stroke(); - -ctx.fillRect(60, 10, 20, 20); -ctx.fillRect(70, 20, 20, 20); -ctx.beginPath(); -ctx.moveTo(80, 20); -ctx.lineTo(90+tol, 20); -ctx.lineTo(80, 10-tol); -ctx.fill(); - -_assertPixel(canvas, 34,16, 0,255,0,255); -_assertPixel(canvas, 34,15, 0,255,0,255); -_assertPixel(canvas, 35,15, 0,255,0,255); -_assertPixel(canvas, 36,15, 0,255,0,255); -_assertPixel(canvas, 36,14, 0,255,0,255); - -_assertPixel(canvas, 84,16, 0,255,0,255); -_assertPixel(canvas, 84,15, 0,255,0,255); -_assertPixel(canvas, 85,15, 0,255,0,255); -_assertPixel(canvas, 86,15, 0,255,0,255); -_assertPixel(canvas, 86,14, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + var tol = 1; // tolerance to avoid antialiasing artifacts + + ctx.lineJoin = 'bevel'; + ctx.lineWidth = 20; + + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + + ctx.fillRect(10, 10, 20, 20); + ctx.fillRect(20, 20, 20, 20); + ctx.beginPath(); + ctx.moveTo(30, 20); + ctx.lineTo(40-tol, 20); + ctx.lineTo(30, 10+tol); + ctx.fill(); + + ctx.beginPath(); + ctx.moveTo(10, 20); + ctx.lineTo(30, 20); + ctx.lineTo(30, 40); + ctx.stroke(); + + + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + + ctx.beginPath(); + ctx.moveTo(60, 20); + ctx.lineTo(80, 20); + ctx.lineTo(80, 40); + ctx.stroke(); + + ctx.fillRect(60, 10, 20, 20); + ctx.fillRect(70, 20, 20, 20); + ctx.beginPath(); + ctx.moveTo(80, 20); + ctx.lineTo(90+tol, 20); + ctx.lineTo(80, 10-tol); + ctx.fill(); + + _assertPixel(canvas, 34,16, 0,255,0,255); + _assertPixel(canvas, 34,15, 0,255,0,255); + _assertPixel(canvas, 35,15, 0,255,0,255); + _assertPixel(canvas, 36,15, 0,255,0,255); + _assertPixel(canvas, 36,14, 0,255,0,255); + + _assertPixel(canvas, 84,16, 0,255,0,255); + _assertPixel(canvas, 84,15, 0,255,0,255); + _assertPixel(canvas, 85,15, 0,255,0,255); + _assertPixel(canvas, 86,15, 0,255,0,255); + _assertPixel(canvas, 86,14, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.bevel.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.bevel.worker.js index 87bf6a8d37c..efd884debe1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.bevel.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.bevel.worker.js @@ -13,64 +13,63 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -var tol = 1; // tolerance to avoid antialiasing artifacts - -ctx.lineJoin = 'bevel'; -ctx.lineWidth = 20; - -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; - -ctx.fillRect(10, 10, 20, 20); -ctx.fillRect(20, 20, 20, 20); -ctx.beginPath(); -ctx.moveTo(30, 20); -ctx.lineTo(40-tol, 20); -ctx.lineTo(30, 10+tol); -ctx.fill(); - -ctx.beginPath(); -ctx.moveTo(10, 20); -ctx.lineTo(30, 20); -ctx.lineTo(30, 40); -ctx.stroke(); - - -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; - -ctx.beginPath(); -ctx.moveTo(60, 20); -ctx.lineTo(80, 20); -ctx.lineTo(80, 40); -ctx.stroke(); - -ctx.fillRect(60, 10, 20, 20); -ctx.fillRect(70, 20, 20, 20); -ctx.beginPath(); -ctx.moveTo(80, 20); -ctx.lineTo(90+tol, 20); -ctx.lineTo(80, 10-tol); -ctx.fill(); - -_assertPixel(canvas, 34,16, 0,255,0,255); -_assertPixel(canvas, 34,15, 0,255,0,255); -_assertPixel(canvas, 35,15, 0,255,0,255); -_assertPixel(canvas, 36,15, 0,255,0,255); -_assertPixel(canvas, 36,14, 0,255,0,255); - -_assertPixel(canvas, 84,16, 0,255,0,255); -_assertPixel(canvas, 84,15, 0,255,0,255); -_assertPixel(canvas, 85,15, 0,255,0,255); -_assertPixel(canvas, 86,15, 0,255,0,255); -_assertPixel(canvas, 86,14, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + var tol = 1; // tolerance to avoid antialiasing artifacts + + ctx.lineJoin = 'bevel'; + ctx.lineWidth = 20; + + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + + ctx.fillRect(10, 10, 20, 20); + ctx.fillRect(20, 20, 20, 20); + ctx.beginPath(); + ctx.moveTo(30, 20); + ctx.lineTo(40-tol, 20); + ctx.lineTo(30, 10+tol); + ctx.fill(); + + ctx.beginPath(); + ctx.moveTo(10, 20); + ctx.lineTo(30, 20); + ctx.lineTo(30, 40); + ctx.stroke(); + + + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + + ctx.beginPath(); + ctx.moveTo(60, 20); + ctx.lineTo(80, 20); + ctx.lineTo(80, 40); + ctx.stroke(); + + ctx.fillRect(60, 10, 20, 20); + ctx.fillRect(70, 20, 20, 20); + ctx.beginPath(); + ctx.moveTo(80, 20); + ctx.lineTo(90+tol, 20); + ctx.lineTo(80, 10-tol); + ctx.fill(); + + _assertPixel(canvas, 34,16, 0,255,0,255); + _assertPixel(canvas, 34,15, 0,255,0,255); + _assertPixel(canvas, 35,15, 0,255,0,255); + _assertPixel(canvas, 36,15, 0,255,0,255); + _assertPixel(canvas, 36,14, 0,255,0,255); + + _assertPixel(canvas, 84,16, 0,255,0,255); + _assertPixel(canvas, 84,15, 0,255,0,255); + _assertPixel(canvas, 85,15, 0,255,0,255); + _assertPixel(canvas, 86,15, 0,255,0,255); + _assertPixel(canvas, 86,14, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.closed.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.closed.html index a999e73d0a8..60650adeb3f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.closed.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.closed.html @@ -15,33 +15,31 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineJoin = 'miter'; -ctx.lineWidth = 200; - -ctx.beginPath(); -ctx.moveTo(100, 50); -ctx.lineTo(100, 1000); -ctx.lineTo(1000, 1000); -ctx.lineTo(1000, 50); -ctx.closePath(); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineJoin = 'miter'; + ctx.lineWidth = 200; + + ctx.beginPath(); + ctx.moveTo(100, 50); + ctx.lineTo(100, 1000); + ctx.lineTo(1000, 1000); + ctx.lineTo(1000, 50); + ctx.closePath(); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.closed.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.closed.worker.js index cc7073fadba..48823119618 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.closed.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.closed.worker.js @@ -13,29 +13,28 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineJoin = 'miter'; -ctx.lineWidth = 200; - -ctx.beginPath(); -ctx.moveTo(100, 50); -ctx.lineTo(100, 1000); -ctx.lineTo(1000, 1000); -ctx.lineTo(1000, 50); -ctx.closePath(); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineJoin = 'miter'; + ctx.lineWidth = 200; + + ctx.beginPath(); + ctx.moveTo(100, 50); + ctx.lineTo(100, 1000); + ctx.lineTo(1000, 1000); + ctx.lineTo(1000, 50); + ctx.closePath(); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.invalid.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.invalid.html index f941c69e3dc..be1f7e393e6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.invalid.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.invalid.html @@ -15,40 +15,38 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.lineJoin = 'bevel' -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel' + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -ctx.lineJoin = 'bevel'; -ctx.lineJoin = 'invalid'; -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel'; + ctx.lineJoin = 'invalid'; + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -ctx.lineJoin = 'bevel'; -ctx.lineJoin = 'ROUND'; -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel'; + ctx.lineJoin = 'ROUND'; + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -ctx.lineJoin = 'bevel'; -ctx.lineJoin = 'round\0'; -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel'; + ctx.lineJoin = 'round\0'; + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -ctx.lineJoin = 'bevel'; -ctx.lineJoin = 'round '; -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel'; + ctx.lineJoin = 'round '; + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -ctx.lineJoin = 'bevel'; -ctx.lineJoin = ""; -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel'; + ctx.lineJoin = ""; + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -ctx.lineJoin = 'bevel'; -ctx.lineJoin = 'butt'; -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -})(canvas, ctx); -t.done(); + ctx.lineJoin = 'bevel'; + ctx.lineJoin = 'butt'; + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.invalid.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.invalid.worker.js index fa19bd70b0c..aa5a35c0c50 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.invalid.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.invalid.worker.js @@ -13,36 +13,35 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.lineJoin = 'bevel' -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel' + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -ctx.lineJoin = 'bevel'; -ctx.lineJoin = 'invalid'; -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel'; + ctx.lineJoin = 'invalid'; + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -ctx.lineJoin = 'bevel'; -ctx.lineJoin = 'ROUND'; -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel'; + ctx.lineJoin = 'ROUND'; + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -ctx.lineJoin = 'bevel'; -ctx.lineJoin = 'round\0'; -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel'; + ctx.lineJoin = 'round\0'; + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -ctx.lineJoin = 'bevel'; -ctx.lineJoin = 'round '; -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel'; + ctx.lineJoin = 'round '; + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -ctx.lineJoin = 'bevel'; -ctx.lineJoin = ""; -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); - -ctx.lineJoin = 'bevel'; -ctx.lineJoin = 'butt'; -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -t.done(); + ctx.lineJoin = 'bevel'; + ctx.lineJoin = ""; + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel'; + ctx.lineJoin = 'butt'; + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.miter.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.miter.html index e31ef139fb1..c26e883c40a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.miter.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.miter.html @@ -15,59 +15,57 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -ctx.lineJoin = 'miter'; -ctx.lineWidth = 20; + ctx.lineJoin = 'miter'; + ctx.lineWidth = 20; -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; -ctx.fillRect(10, 10, 30, 20); -ctx.fillRect(20, 10, 20, 30); + ctx.fillRect(10, 10, 30, 20); + ctx.fillRect(20, 10, 20, 30); -ctx.beginPath(); -ctx.moveTo(10, 20); -ctx.lineTo(30, 20); -ctx.lineTo(30, 40); -ctx.stroke(); + ctx.beginPath(); + ctx.moveTo(10, 20); + ctx.lineTo(30, 20); + ctx.lineTo(30, 40); + ctx.stroke(); -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(60, 20); -ctx.lineTo(80, 20); -ctx.lineTo(80, 40); -ctx.stroke(); + ctx.beginPath(); + ctx.moveTo(60, 20); + ctx.lineTo(80, 20); + ctx.lineTo(80, 40); + ctx.stroke(); -ctx.fillRect(60, 10, 30, 20); -ctx.fillRect(70, 10, 20, 30); + ctx.fillRect(60, 10, 30, 20); + ctx.fillRect(70, 10, 20, 30); -_assertPixel(canvas, 38,12, 0,255,0,255); -_assertPixel(canvas, 39,11, 0,255,0,255); -_assertPixel(canvas, 40,10, 0,255,0,255); -_assertPixel(canvas, 41,9, 0,255,0,255); -_assertPixel(canvas, 42,8, 0,255,0,255); + _assertPixel(canvas, 38,12, 0,255,0,255); + _assertPixel(canvas, 39,11, 0,255,0,255); + _assertPixel(canvas, 40,10, 0,255,0,255); + _assertPixel(canvas, 41,9, 0,255,0,255); + _assertPixel(canvas, 42,8, 0,255,0,255); -_assertPixel(canvas, 88,12, 0,255,0,255); -_assertPixel(canvas, 89,11, 0,255,0,255); -_assertPixel(canvas, 90,10, 0,255,0,255); -_assertPixel(canvas, 91,9, 0,255,0,255); -_assertPixel(canvas, 92,8, 0,255,0,255); -})(canvas, ctx); -t.done(); + _assertPixel(canvas, 88,12, 0,255,0,255); + _assertPixel(canvas, 89,11, 0,255,0,255); + _assertPixel(canvas, 90,10, 0,255,0,255); + _assertPixel(canvas, 91,9, 0,255,0,255); + _assertPixel(canvas, 92,8, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.miter.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.miter.worker.js index 3a3eb8f86f2..7b700001000 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.miter.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.miter.worker.js @@ -13,55 +13,54 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -ctx.lineJoin = 'miter'; -ctx.lineWidth = 20; + ctx.lineJoin = 'miter'; + ctx.lineWidth = 20; -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; -ctx.fillRect(10, 10, 30, 20); -ctx.fillRect(20, 10, 20, 30); + ctx.fillRect(10, 10, 30, 20); + ctx.fillRect(20, 10, 20, 30); -ctx.beginPath(); -ctx.moveTo(10, 20); -ctx.lineTo(30, 20); -ctx.lineTo(30, 40); -ctx.stroke(); + ctx.beginPath(); + ctx.moveTo(10, 20); + ctx.lineTo(30, 20); + ctx.lineTo(30, 40); + ctx.stroke(); -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(60, 20); -ctx.lineTo(80, 20); -ctx.lineTo(80, 40); -ctx.stroke(); + ctx.beginPath(); + ctx.moveTo(60, 20); + ctx.lineTo(80, 20); + ctx.lineTo(80, 40); + ctx.stroke(); -ctx.fillRect(60, 10, 30, 20); -ctx.fillRect(70, 10, 20, 30); + ctx.fillRect(60, 10, 30, 20); + ctx.fillRect(70, 10, 20, 30); -_assertPixel(canvas, 38,12, 0,255,0,255); -_assertPixel(canvas, 39,11, 0,255,0,255); -_assertPixel(canvas, 40,10, 0,255,0,255); -_assertPixel(canvas, 41,9, 0,255,0,255); -_assertPixel(canvas, 42,8, 0,255,0,255); - -_assertPixel(canvas, 88,12, 0,255,0,255); -_assertPixel(canvas, 89,11, 0,255,0,255); -_assertPixel(canvas, 90,10, 0,255,0,255); -_assertPixel(canvas, 91,9, 0,255,0,255); -_assertPixel(canvas, 92,8, 0,255,0,255); -t.done(); + _assertPixel(canvas, 38,12, 0,255,0,255); + _assertPixel(canvas, 39,11, 0,255,0,255); + _assertPixel(canvas, 40,10, 0,255,0,255); + _assertPixel(canvas, 41,9, 0,255,0,255); + _assertPixel(canvas, 42,8, 0,255,0,255); + _assertPixel(canvas, 88,12, 0,255,0,255); + _assertPixel(canvas, 89,11, 0,255,0,255); + _assertPixel(canvas, 90,10, 0,255,0,255); + _assertPixel(canvas, 91,9, 0,255,0,255); + _assertPixel(canvas, 92,8, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.open.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.open.html index b6a3901a9e4..d801e5c367d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.open.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.open.html @@ -15,33 +15,31 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineJoin = 'miter'; -ctx.lineWidth = 200; - -ctx.beginPath(); -ctx.moveTo(100, 50); -ctx.lineTo(100, 1000); -ctx.lineTo(1000, 1000); -ctx.lineTo(1000, 50); -ctx.lineTo(100, 50); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineJoin = 'miter'; + ctx.lineWidth = 200; + + ctx.beginPath(); + ctx.moveTo(100, 50); + ctx.lineTo(100, 1000); + ctx.lineTo(1000, 1000); + ctx.lineTo(1000, 50); + ctx.lineTo(100, 50); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.open.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.open.worker.js index 5f52b6337ad..2a1242436d4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.open.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.open.worker.js @@ -13,29 +13,28 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineJoin = 'miter'; -ctx.lineWidth = 200; - -ctx.beginPath(); -ctx.moveTo(100, 50); -ctx.lineTo(100, 1000); -ctx.lineTo(1000, 1000); -ctx.lineTo(1000, 50); -ctx.lineTo(100, 50); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineJoin = 'miter'; + ctx.lineWidth = 200; + + ctx.beginPath(); + ctx.moveTo(100, 50); + ctx.lineTo(100, 1000); + ctx.lineTo(1000, 1000); + ctx.lineTo(1000, 50); + ctx.lineTo(100, 50); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.parallel.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.parallel.html index aaba8e44328..0826406b9df 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.parallel.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.parallel.html @@ -15,30 +15,28 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 300; -ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.moveTo(-100, 25); -ctx.lineTo(0, 25); -ctx.lineTo(-100, 25); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 300; + ctx.lineJoin = 'round'; + ctx.beginPath(); + ctx.moveTo(-100, 25); + ctx.lineTo(0, 25); + ctx.lineTo(-100, 25); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.parallel.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.parallel.worker.js index d431d5e99f5..f5b67dc5a26 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.parallel.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.parallel.worker.js @@ -13,26 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 300; -ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.moveTo(-100, 25); -ctx.lineTo(0, 25); -ctx.lineTo(-100, 25); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 300; + ctx.lineJoin = 'round'; + ctx.beginPath(); + ctx.moveTo(-100, 25); + ctx.lineTo(0, 25); + ctx.lineTo(-100, 25); + ctx.stroke(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.round.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.round.html index 5f413373cb5..70f6a8e5179 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.round.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.round.html @@ -15,66 +15,64 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -var tol = 1; // tolerance to avoid antialiasing artifacts - -ctx.lineJoin = 'round'; -ctx.lineWidth = 20; - -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; - -ctx.fillRect(10, 10, 20, 20); -ctx.fillRect(20, 20, 20, 20); -ctx.beginPath(); -ctx.moveTo(30, 20); -ctx.arc(30, 20, 10-tol, 0, 2*Math.PI, true); -ctx.fill(); - -ctx.beginPath(); -ctx.moveTo(10, 20); -ctx.lineTo(30, 20); -ctx.lineTo(30, 40); -ctx.stroke(); - - -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; - -ctx.beginPath(); -ctx.moveTo(60, 20); -ctx.lineTo(80, 20); -ctx.lineTo(80, 40); -ctx.stroke(); - -ctx.fillRect(60, 10, 20, 20); -ctx.fillRect(70, 20, 20, 20); -ctx.beginPath(); -ctx.moveTo(80, 20); -ctx.arc(80, 20, 10+tol, 0, 2*Math.PI, true); -ctx.fill(); - -_assertPixel(canvas, 36,14, 0,255,0,255); -_assertPixel(canvas, 36,13, 0,255,0,255); -_assertPixel(canvas, 37,13, 0,255,0,255); -_assertPixel(canvas, 38,13, 0,255,0,255); -_assertPixel(canvas, 38,12, 0,255,0,255); - -_assertPixel(canvas, 86,14, 0,255,0,255); -_assertPixel(canvas, 86,13, 0,255,0,255); -_assertPixel(canvas, 87,13, 0,255,0,255); -_assertPixel(canvas, 88,13, 0,255,0,255); -_assertPixel(canvas, 88,12, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + var tol = 1; // tolerance to avoid antialiasing artifacts + + ctx.lineJoin = 'round'; + ctx.lineWidth = 20; + + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + + ctx.fillRect(10, 10, 20, 20); + ctx.fillRect(20, 20, 20, 20); + ctx.beginPath(); + ctx.moveTo(30, 20); + ctx.arc(30, 20, 10-tol, 0, 2*Math.PI, true); + ctx.fill(); + + ctx.beginPath(); + ctx.moveTo(10, 20); + ctx.lineTo(30, 20); + ctx.lineTo(30, 40); + ctx.stroke(); + + + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + + ctx.beginPath(); + ctx.moveTo(60, 20); + ctx.lineTo(80, 20); + ctx.lineTo(80, 40); + ctx.stroke(); + + ctx.fillRect(60, 10, 20, 20); + ctx.fillRect(70, 20, 20, 20); + ctx.beginPath(); + ctx.moveTo(80, 20); + ctx.arc(80, 20, 10+tol, 0, 2*Math.PI, true); + ctx.fill(); + + _assertPixel(canvas, 36,14, 0,255,0,255); + _assertPixel(canvas, 36,13, 0,255,0,255); + _assertPixel(canvas, 37,13, 0,255,0,255); + _assertPixel(canvas, 38,13, 0,255,0,255); + _assertPixel(canvas, 38,12, 0,255,0,255); + + _assertPixel(canvas, 86,14, 0,255,0,255); + _assertPixel(canvas, 86,13, 0,255,0,255); + _assertPixel(canvas, 87,13, 0,255,0,255); + _assertPixel(canvas, 88,13, 0,255,0,255); + _assertPixel(canvas, 88,12, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.round.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.round.worker.js index 44a847bd30c..33b135d6046 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.round.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.round.worker.js @@ -13,62 +13,61 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -var tol = 1; // tolerance to avoid antialiasing artifacts - -ctx.lineJoin = 'round'; -ctx.lineWidth = 20; - -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; - -ctx.fillRect(10, 10, 20, 20); -ctx.fillRect(20, 20, 20, 20); -ctx.beginPath(); -ctx.moveTo(30, 20); -ctx.arc(30, 20, 10-tol, 0, 2*Math.PI, true); -ctx.fill(); - -ctx.beginPath(); -ctx.moveTo(10, 20); -ctx.lineTo(30, 20); -ctx.lineTo(30, 40); -ctx.stroke(); - - -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; - -ctx.beginPath(); -ctx.moveTo(60, 20); -ctx.lineTo(80, 20); -ctx.lineTo(80, 40); -ctx.stroke(); - -ctx.fillRect(60, 10, 20, 20); -ctx.fillRect(70, 20, 20, 20); -ctx.beginPath(); -ctx.moveTo(80, 20); -ctx.arc(80, 20, 10+tol, 0, 2*Math.PI, true); -ctx.fill(); - -_assertPixel(canvas, 36,14, 0,255,0,255); -_assertPixel(canvas, 36,13, 0,255,0,255); -_assertPixel(canvas, 37,13, 0,255,0,255); -_assertPixel(canvas, 38,13, 0,255,0,255); -_assertPixel(canvas, 38,12, 0,255,0,255); - -_assertPixel(canvas, 86,14, 0,255,0,255); -_assertPixel(canvas, 86,13, 0,255,0,255); -_assertPixel(canvas, 87,13, 0,255,0,255); -_assertPixel(canvas, 88,13, 0,255,0,255); -_assertPixel(canvas, 88,12, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + var tol = 1; // tolerance to avoid antialiasing artifacts + + ctx.lineJoin = 'round'; + ctx.lineWidth = 20; + + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + + ctx.fillRect(10, 10, 20, 20); + ctx.fillRect(20, 20, 20, 20); + ctx.beginPath(); + ctx.moveTo(30, 20); + ctx.arc(30, 20, 10-tol, 0, 2*Math.PI, true); + ctx.fill(); + + ctx.beginPath(); + ctx.moveTo(10, 20); + ctx.lineTo(30, 20); + ctx.lineTo(30, 40); + ctx.stroke(); + + + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + + ctx.beginPath(); + ctx.moveTo(60, 20); + ctx.lineTo(80, 20); + ctx.lineTo(80, 40); + ctx.stroke(); + + ctx.fillRect(60, 10, 20, 20); + ctx.fillRect(70, 20, 20, 20); + ctx.beginPath(); + ctx.moveTo(80, 20); + ctx.arc(80, 20, 10+tol, 0, 2*Math.PI, true); + ctx.fill(); + + _assertPixel(canvas, 36,14, 0,255,0,255); + _assertPixel(canvas, 36,13, 0,255,0,255); + _assertPixel(canvas, 37,13, 0,255,0,255); + _assertPixel(canvas, 38,13, 0,255,0,255); + _assertPixel(canvas, 38,12, 0,255,0,255); + + _assertPixel(canvas, 86,14, 0,255,0,255); + _assertPixel(canvas, 86,13, 0,255,0,255); + _assertPixel(canvas, 87,13, 0,255,0,255); + _assertPixel(canvas, 88,13, 0,255,0,255); + _assertPixel(canvas, 88,12, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.valid.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.valid.html index 1ea992c7063..3b3935d1f71 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.valid.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.valid.html @@ -15,22 +15,20 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.lineJoin = 'bevel' -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel' + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -ctx.lineJoin = 'round'; -_assertSame(ctx.lineJoin, 'round', "ctx.lineJoin", "'round'"); + ctx.lineJoin = 'round'; + _assertSame(ctx.lineJoin, 'round', "ctx.lineJoin", "'round'"); -ctx.lineJoin = 'miter'; -_assertSame(ctx.lineJoin, 'miter', "ctx.lineJoin", "'miter'"); -})(canvas, ctx); -t.done(); + ctx.lineJoin = 'miter'; + _assertSame(ctx.lineJoin, 'miter', "ctx.lineJoin", "'miter'"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.valid.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.valid.worker.js index 407dbdd59e0..d1bdfd88456 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.valid.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.join.valid.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.lineJoin = 'bevel' -_assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); + ctx.lineJoin = 'bevel' + _assertSame(ctx.lineJoin, 'bevel', "ctx.lineJoin", "'bevel'"); -ctx.lineJoin = 'round'; -_assertSame(ctx.lineJoin, 'round', "ctx.lineJoin", "'round'"); - -ctx.lineJoin = 'miter'; -_assertSame(ctx.lineJoin, 'miter', "ctx.lineJoin", "'miter'"); -t.done(); + ctx.lineJoin = 'round'; + _assertSame(ctx.lineJoin, 'round', "ctx.lineJoin", "'round'"); + ctx.lineJoin = 'miter'; + _assertSame(ctx.lineJoin, 'miter', "ctx.lineJoin", "'miter'"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.acute.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.acute.html index db8e4f84264..587062ed12c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.acute.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.acute.html @@ -15,40 +15,38 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 200; -ctx.lineJoin = 'miter'; - -ctx.strokeStyle = '#0f0'; -ctx.miterLimit = 2.614; -ctx.beginPath(); -ctx.moveTo(100, 1000); -ctx.lineTo(100, 100); -ctx.lineTo(1000, 1000); -ctx.stroke(); - -ctx.strokeStyle = '#f00'; -ctx.miterLimit = 2.613; -ctx.beginPath(); -ctx.moveTo(100, 1000); -ctx.lineTo(100, 100); -ctx.lineTo(1000, 1000); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 200; + ctx.lineJoin = 'miter'; + + ctx.strokeStyle = '#0f0'; + ctx.miterLimit = 2.614; + ctx.beginPath(); + ctx.moveTo(100, 1000); + ctx.lineTo(100, 100); + ctx.lineTo(1000, 1000); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.miterLimit = 2.613; + ctx.beginPath(); + ctx.moveTo(100, 1000); + ctx.lineTo(100, 100); + ctx.lineTo(1000, 1000); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.acute.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.acute.worker.js index 95040d13194..0ab5c9050cd 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.acute.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.acute.worker.js @@ -13,36 +13,35 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 200; -ctx.lineJoin = 'miter'; - -ctx.strokeStyle = '#0f0'; -ctx.miterLimit = 2.614; -ctx.beginPath(); -ctx.moveTo(100, 1000); -ctx.lineTo(100, 100); -ctx.lineTo(1000, 1000); -ctx.stroke(); - -ctx.strokeStyle = '#f00'; -ctx.miterLimit = 2.613; -ctx.beginPath(); -ctx.moveTo(100, 1000); -ctx.lineTo(100, 100); -ctx.lineTo(1000, 1000); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 200; + ctx.lineJoin = 'miter'; + + ctx.strokeStyle = '#0f0'; + ctx.miterLimit = 2.614; + ctx.beginPath(); + ctx.moveTo(100, 1000); + ctx.lineTo(100, 100); + ctx.lineTo(1000, 1000); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.miterLimit = 2.613; + ctx.beginPath(); + ctx.moveTo(100, 1000); + ctx.lineTo(100, 100); + ctx.lineTo(1000, 1000); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.exceeded.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.exceeded.html index 828af67835c..1ae5c55aef5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.exceeded.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.exceeded.html @@ -15,32 +15,30 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 400; -ctx.lineJoin = 'miter'; - -ctx.strokeStyle = '#f00'; -ctx.miterLimit = 1.414; -ctx.beginPath(); -ctx.moveTo(200, 1000); -ctx.lineTo(200, 200); -ctx.lineTo(1000, 201); // slightly non-right-angle to avoid being a special case -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 400; + ctx.lineJoin = 'miter'; + + ctx.strokeStyle = '#f00'; + ctx.miterLimit = 1.414; + ctx.beginPath(); + ctx.moveTo(200, 1000); + ctx.lineTo(200, 200); + ctx.lineTo(1000, 201); // slightly non-right-angle to avoid being a special case + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.exceeded.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.exceeded.worker.js index e2b04e21f63..41c4716c889 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.exceeded.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.exceeded.worker.js @@ -13,28 +13,27 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 400; -ctx.lineJoin = 'miter'; - -ctx.strokeStyle = '#f00'; -ctx.miterLimit = 1.414; -ctx.beginPath(); -ctx.moveTo(200, 1000); -ctx.lineTo(200, 200); -ctx.lineTo(1000, 201); // slightly non-right-angle to avoid being a special case -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 400; + ctx.lineJoin = 'miter'; + + ctx.strokeStyle = '#f00'; + ctx.miterLimit = 1.414; + ctx.beginPath(); + ctx.moveTo(200, 1000); + ctx.lineTo(200, 200); + ctx.lineTo(1000, 201); // slightly non-right-angle to avoid being a special case + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.invalid.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.invalid.html index 42d5d927d76..eacd95b811b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.invalid.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.invalid.html @@ -15,48 +15,46 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.miterLimit = 1.5; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = 0; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + ctx.miterLimit = 0; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = -1; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + ctx.miterLimit = -1; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = Infinity; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + ctx.miterLimit = Infinity; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = -Infinity; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + ctx.miterLimit = -Infinity; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = NaN; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + ctx.miterLimit = NaN; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = 'string'; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + ctx.miterLimit = 'string'; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = true; -_assertSame(ctx.miterLimit, 1, "ctx.miterLimit", "1"); + ctx.miterLimit = 1.5; + ctx.miterLimit = true; + _assertSame(ctx.miterLimit, 1, "ctx.miterLimit", "1"); -ctx.miterLimit = 1.5; -ctx.miterLimit = false; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -})(canvas, ctx); -t.done(); + ctx.miterLimit = 1.5; + ctx.miterLimit = false; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.invalid.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.invalid.worker.js index dbc64d52d94..62f250670c4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.invalid.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.invalid.worker.js @@ -13,44 +13,43 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.miterLimit = 1.5; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = 0; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + ctx.miterLimit = 0; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = -1; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + ctx.miterLimit = -1; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = Infinity; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + ctx.miterLimit = Infinity; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = -Infinity; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + ctx.miterLimit = -Infinity; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = NaN; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + ctx.miterLimit = NaN; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = 'string'; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + ctx.miterLimit = 'string'; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = 1.5; -ctx.miterLimit = true; -_assertSame(ctx.miterLimit, 1, "ctx.miterLimit", "1"); - -ctx.miterLimit = 1.5; -ctx.miterLimit = false; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -t.done(); + ctx.miterLimit = 1.5; + ctx.miterLimit = true; + _assertSame(ctx.miterLimit, 1, "ctx.miterLimit", "1"); + ctx.miterLimit = 1.5; + ctx.miterLimit = false; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.lineedge.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.lineedge.html index 89f4c032554..bad3cedc0ea 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.lineedge.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.lineedge.html @@ -15,29 +15,27 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 200; -ctx.lineJoin = 'miter'; + ctx.lineWidth = 200; + ctx.lineJoin = 'miter'; -ctx.strokeStyle = '#f00'; -ctx.miterLimit = 1.414; -ctx.beginPath(); -ctx.strokeRect(100, 25, 200, 0); + ctx.strokeStyle = '#f00'; + ctx.miterLimit = 1.414; + ctx.beginPath(); + ctx.strokeRect(100, 25, 200, 0); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -})(canvas, ctx); -t.done(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.lineedge.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.lineedge.worker.js index 24f4fa30f5e..2b61bc8975b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.lineedge.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.lineedge.worker.js @@ -13,25 +13,24 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 200; -ctx.lineJoin = 'miter'; + ctx.lineWidth = 200; + ctx.lineJoin = 'miter'; -ctx.strokeStyle = '#f00'; -ctx.miterLimit = 1.414; -ctx.beginPath(); -ctx.strokeRect(100, 25, 200, 0); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + ctx.strokeStyle = '#f00'; + ctx.miterLimit = 1.414; + ctx.beginPath(); + ctx.strokeRect(100, 25, 200, 0); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.obtuse.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.obtuse.html index 69acc7e7bad..efab533fbab 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.obtuse.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.obtuse.html @@ -15,40 +15,38 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 1600; -ctx.lineJoin = 'miter'; - -ctx.strokeStyle = '#0f0'; -ctx.miterLimit = 1.083; -ctx.beginPath(); -ctx.moveTo(800, 10000); -ctx.lineTo(800, 300); -ctx.lineTo(10000, -8900); -ctx.stroke(); - -ctx.strokeStyle = '#f00'; -ctx.miterLimit = 1.082; -ctx.beginPath(); -ctx.moveTo(800, 10000); -ctx.lineTo(800, 300); -ctx.lineTo(10000, -8900); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 1600; + ctx.lineJoin = 'miter'; + + ctx.strokeStyle = '#0f0'; + ctx.miterLimit = 1.083; + ctx.beginPath(); + ctx.moveTo(800, 10000); + ctx.lineTo(800, 300); + ctx.lineTo(10000, -8900); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.miterLimit = 1.082; + ctx.beginPath(); + ctx.moveTo(800, 10000); + ctx.lineTo(800, 300); + ctx.lineTo(10000, -8900); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.obtuse.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.obtuse.worker.js index 45900dbc88a..42b1cd37b11 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.obtuse.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.obtuse.worker.js @@ -13,36 +13,35 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 1600; -ctx.lineJoin = 'miter'; - -ctx.strokeStyle = '#0f0'; -ctx.miterLimit = 1.083; -ctx.beginPath(); -ctx.moveTo(800, 10000); -ctx.lineTo(800, 300); -ctx.lineTo(10000, -8900); -ctx.stroke(); - -ctx.strokeStyle = '#f00'; -ctx.miterLimit = 1.082; -ctx.beginPath(); -ctx.moveTo(800, 10000); -ctx.lineTo(800, 300); -ctx.lineTo(10000, -8900); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 1600; + ctx.lineJoin = 'miter'; + + ctx.strokeStyle = '#0f0'; + ctx.miterLimit = 1.083; + ctx.beginPath(); + ctx.moveTo(800, 10000); + ctx.lineTo(800, 300); + ctx.lineTo(10000, -8900); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.miterLimit = 1.082; + ctx.beginPath(); + ctx.moveTo(800, 10000); + ctx.lineTo(800, 300); + ctx.lineTo(10000, -8900); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.rightangle.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.rightangle.html index 980f8a74b8b..5bb4e63230c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.rightangle.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.rightangle.html @@ -15,32 +15,30 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 400; -ctx.lineJoin = 'miter'; - -ctx.strokeStyle = '#f00'; -ctx.miterLimit = 1.414; -ctx.beginPath(); -ctx.moveTo(200, 1000); -ctx.lineTo(200, 200); -ctx.lineTo(1000, 200); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 400; + ctx.lineJoin = 'miter'; + + ctx.strokeStyle = '#f00'; + ctx.miterLimit = 1.414; + ctx.beginPath(); + ctx.moveTo(200, 1000); + ctx.lineTo(200, 200); + ctx.lineTo(1000, 200); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.rightangle.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.rightangle.worker.js index a2a07247b1e..42e995deedc 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.rightangle.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.rightangle.worker.js @@ -13,28 +13,27 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 400; -ctx.lineJoin = 'miter'; - -ctx.strokeStyle = '#f00'; -ctx.miterLimit = 1.414; -ctx.beginPath(); -ctx.moveTo(200, 1000); -ctx.lineTo(200, 200); -ctx.lineTo(1000, 200); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 400; + ctx.lineJoin = 'miter'; + + ctx.strokeStyle = '#f00'; + ctx.miterLimit = 1.414; + ctx.beginPath(); + ctx.moveTo(200, 1000); + ctx.lineTo(200, 200); + ctx.lineTo(1000, 200); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.valid.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.valid.html index 1cf07cfbb3c..3c569ea6558 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.valid.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.valid.html @@ -15,25 +15,23 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.miterLimit = 1.5; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = "1e1"; -_assertSame(ctx.miterLimit, 10, "ctx.miterLimit", "10"); + ctx.miterLimit = "1e1"; + _assertSame(ctx.miterLimit, 10, "ctx.miterLimit", "10"); -ctx.miterLimit = 1/1024; -_assertSame(ctx.miterLimit, 1/1024, "ctx.miterLimit", "1/1024"); + ctx.miterLimit = 1/1024; + _assertSame(ctx.miterLimit, 1/1024, "ctx.miterLimit", "1/1024"); -ctx.miterLimit = 1000; -_assertSame(ctx.miterLimit, 1000, "ctx.miterLimit", "1000"); -})(canvas, ctx); -t.done(); + ctx.miterLimit = 1000; + _assertSame(ctx.miterLimit, 1000, "ctx.miterLimit", "1000"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.valid.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.valid.worker.js index c71c726f126..cb0548abd08 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.valid.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.valid.worker.js @@ -13,21 +13,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.miterLimit = 1.5; -_assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); + ctx.miterLimit = 1.5; + _assertSame(ctx.miterLimit, 1.5, "ctx.miterLimit", "1.5"); -ctx.miterLimit = "1e1"; -_assertSame(ctx.miterLimit, 10, "ctx.miterLimit", "10"); + ctx.miterLimit = "1e1"; + _assertSame(ctx.miterLimit, 10, "ctx.miterLimit", "10"); -ctx.miterLimit = 1/1024; -_assertSame(ctx.miterLimit, 1/1024, "ctx.miterLimit", "1/1024"); - -ctx.miterLimit = 1000; -_assertSame(ctx.miterLimit, 1000, "ctx.miterLimit", "1000"); -t.done(); + ctx.miterLimit = 1/1024; + _assertSame(ctx.miterLimit, 1/1024, "ctx.miterLimit", "1/1024"); + ctx.miterLimit = 1000; + _assertSame(ctx.miterLimit, 1000, "ctx.miterLimit", "1000"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.within.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.within.html index 150953cf766..da87cf4a294 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.within.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.within.html @@ -15,32 +15,30 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 400; -ctx.lineJoin = 'miter'; - -ctx.strokeStyle = '#0f0'; -ctx.miterLimit = 1.416; -ctx.beginPath(); -ctx.moveTo(200, 1000); -ctx.lineTo(200, 200); -ctx.lineTo(1000, 201); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 400; + ctx.lineJoin = 'miter'; + + ctx.strokeStyle = '#0f0'; + ctx.miterLimit = 1.416; + ctx.beginPath(); + ctx.moveTo(200, 1000); + ctx.lineTo(200, 200); + ctx.lineTo(1000, 201); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.within.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.within.worker.js index c09ad957e89..1d9aacb817b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.within.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.miter.within.worker.js @@ -13,28 +13,27 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 400; -ctx.lineJoin = 'miter'; - -ctx.strokeStyle = '#0f0'; -ctx.miterLimit = 1.416; -ctx.beginPath(); -ctx.moveTo(200, 1000); -ctx.lineTo(200, 200); -ctx.lineTo(1000, 201); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 400; + ctx.lineJoin = 'miter'; + + ctx.strokeStyle = '#0f0'; + ctx.miterLimit = 1.416; + ctx.beginPath(); + ctx.moveTo(200, 1000); + ctx.lineTo(200, 200); + ctx.lineTo(1000, 201); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.union.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.union.html index 69e42b7a8d3..d3d13ece092 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.union.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.union.html @@ -15,34 +15,32 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 100; -ctx.lineCap = 'round'; - -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 24); -ctx.lineTo(100, 25); -ctx.lineTo(0, 26); -ctx.closePath(); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 25,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 25,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 24); + ctx.lineTo(100, 25); + ctx.lineTo(0, 26); + ctx.closePath(); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 25,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 25,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.union.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.union.worker.js index 02ebbfd8af0..f2c7b2c4ceb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.union.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.union.worker.js @@ -13,30 +13,29 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 100; -ctx.lineCap = 'round'; - -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 24); -ctx.lineTo(100, 25); -ctx.lineTo(0, 26); -ctx.closePath(); -ctx.stroke(); - -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 25,1, 0,255,0,255); -_assertPixel(canvas, 48,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 25,1, 0,255,0,255); -_assertPixel(canvas, 48,48, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 24); + ctx.lineTo(100, 25); + ctx.lineTo(0, 26); + ctx.closePath(); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 25,1, 0,255,0,255); + _assertPixel(canvas, 48,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 25,1, 0,255,0,255); + _assertPixel(canvas, 48,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.basic.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.basic.html index 9b087ce8d34..88e38294bfa 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.basic.html @@ -15,51 +15,49 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 20; -// Draw a green line over a red box, to check the line is not too small -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; -ctx.fillRect(15, 15, 20, 20); -ctx.beginPath(); -ctx.moveTo(25, 15); -ctx.lineTo(25, 35); -ctx.stroke(); - -// Draw a green box over a red line, to check the line is not too large -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(75, 15); -ctx.lineTo(75, 35); -ctx.stroke(); -ctx.fillRect(65, 15, 20, 20); - -_assertPixel(canvas, 14,25, 0,255,0,255); -_assertPixel(canvas, 15,25, 0,255,0,255); -_assertPixel(canvas, 16,25, 0,255,0,255); -_assertPixel(canvas, 25,25, 0,255,0,255); -_assertPixel(canvas, 34,25, 0,255,0,255); -_assertPixel(canvas, 35,25, 0,255,0,255); -_assertPixel(canvas, 36,25, 0,255,0,255); - -_assertPixel(canvas, 64,25, 0,255,0,255); -_assertPixel(canvas, 65,25, 0,255,0,255); -_assertPixel(canvas, 66,25, 0,255,0,255); -_assertPixel(canvas, 75,25, 0,255,0,255); -_assertPixel(canvas, 84,25, 0,255,0,255); -_assertPixel(canvas, 85,25, 0,255,0,255); -_assertPixel(canvas, 86,25, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 20; + // Draw a green line over a red box, to check the line is not too small + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + ctx.fillRect(15, 15, 20, 20); + ctx.beginPath(); + ctx.moveTo(25, 15); + ctx.lineTo(25, 35); + ctx.stroke(); + + // Draw a green box over a red line, to check the line is not too large + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(75, 15); + ctx.lineTo(75, 35); + ctx.stroke(); + ctx.fillRect(65, 15, 20, 20); + + _assertPixel(canvas, 14,25, 0,255,0,255); + _assertPixel(canvas, 15,25, 0,255,0,255); + _assertPixel(canvas, 16,25, 0,255,0,255); + _assertPixel(canvas, 25,25, 0,255,0,255); + _assertPixel(canvas, 34,25, 0,255,0,255); + _assertPixel(canvas, 35,25, 0,255,0,255); + _assertPixel(canvas, 36,25, 0,255,0,255); + + _assertPixel(canvas, 64,25, 0,255,0,255); + _assertPixel(canvas, 65,25, 0,255,0,255); + _assertPixel(canvas, 66,25, 0,255,0,255); + _assertPixel(canvas, 75,25, 0,255,0,255); + _assertPixel(canvas, 84,25, 0,255,0,255); + _assertPixel(canvas, 85,25, 0,255,0,255); + _assertPixel(canvas, 86,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.basic.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.basic.worker.js index d0664278979..012d9b11bd7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.basic.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.basic.worker.js @@ -13,47 +13,46 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.lineWidth = 20; -// Draw a green line over a red box, to check the line is not too small -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; -ctx.fillRect(15, 15, 20, 20); -ctx.beginPath(); -ctx.moveTo(25, 15); -ctx.lineTo(25, 35); -ctx.stroke(); - -// Draw a green box over a red line, to check the line is not too large -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(75, 15); -ctx.lineTo(75, 35); -ctx.stroke(); -ctx.fillRect(65, 15, 20, 20); - -_assertPixel(canvas, 14,25, 0,255,0,255); -_assertPixel(canvas, 15,25, 0,255,0,255); -_assertPixel(canvas, 16,25, 0,255,0,255); -_assertPixel(canvas, 25,25, 0,255,0,255); -_assertPixel(canvas, 34,25, 0,255,0,255); -_assertPixel(canvas, 35,25, 0,255,0,255); -_assertPixel(canvas, 36,25, 0,255,0,255); - -_assertPixel(canvas, 64,25, 0,255,0,255); -_assertPixel(canvas, 65,25, 0,255,0,255); -_assertPixel(canvas, 66,25, 0,255,0,255); -_assertPixel(canvas, 75,25, 0,255,0,255); -_assertPixel(canvas, 84,25, 0,255,0,255); -_assertPixel(canvas, 85,25, 0,255,0,255); -_assertPixel(canvas, 86,25, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 20; + // Draw a green line over a red box, to check the line is not too small + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + ctx.fillRect(15, 15, 20, 20); + ctx.beginPath(); + ctx.moveTo(25, 15); + ctx.lineTo(25, 35); + ctx.stroke(); + + // Draw a green box over a red line, to check the line is not too large + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(75, 15); + ctx.lineTo(75, 35); + ctx.stroke(); + ctx.fillRect(65, 15, 20, 20); + + _assertPixel(canvas, 14,25, 0,255,0,255); + _assertPixel(canvas, 15,25, 0,255,0,255); + _assertPixel(canvas, 16,25, 0,255,0,255); + _assertPixel(canvas, 25,25, 0,255,0,255); + _assertPixel(canvas, 34,25, 0,255,0,255); + _assertPixel(canvas, 35,25, 0,255,0,255); + _assertPixel(canvas, 36,25, 0,255,0,255); + + _assertPixel(canvas, 64,25, 0,255,0,255); + _assertPixel(canvas, 65,25, 0,255,0,255); + _assertPixel(canvas, 66,25, 0,255,0,255); + _assertPixel(canvas, 75,25, 0,255,0,255); + _assertPixel(canvas, 84,25, 0,255,0,255); + _assertPixel(canvas, 85,25, 0,255,0,255); + _assertPixel(canvas, 86,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.invalid.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.invalid.html index 0651b3f6a5e..481a3168229 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.invalid.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.invalid.html @@ -15,48 +15,46 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.lineWidth = 1.5; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = 0; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + ctx.lineWidth = 0; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = -1; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + ctx.lineWidth = -1; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = Infinity; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + ctx.lineWidth = Infinity; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = -Infinity; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + ctx.lineWidth = -Infinity; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = NaN; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + ctx.lineWidth = NaN; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = 'string'; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + ctx.lineWidth = 'string'; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = true; -_assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1"); + ctx.lineWidth = 1.5; + ctx.lineWidth = true; + _assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1"); -ctx.lineWidth = 1.5; -ctx.lineWidth = false; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -})(canvas, ctx); -t.done(); + ctx.lineWidth = 1.5; + ctx.lineWidth = false; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.invalid.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.invalid.worker.js index dc5e2c29263..3a10cb48e85 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.invalid.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.invalid.worker.js @@ -13,44 +13,43 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.lineWidth = 1.5; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = 0; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + ctx.lineWidth = 0; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = -1; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + ctx.lineWidth = -1; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = Infinity; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + ctx.lineWidth = Infinity; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = -Infinity; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + ctx.lineWidth = -Infinity; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = NaN; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + ctx.lineWidth = NaN; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = 'string'; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + ctx.lineWidth = 'string'; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = 1.5; -ctx.lineWidth = true; -_assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1"); - -ctx.lineWidth = 1.5; -ctx.lineWidth = false; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -t.done(); + ctx.lineWidth = 1.5; + ctx.lineWidth = true; + _assertSame(ctx.lineWidth, 1, "ctx.lineWidth", "1"); + ctx.lineWidth = 1.5; + ctx.lineWidth = false; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.scaledefault.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.scaledefault.html index 120360607f9..9ac77a9c49e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.scaledefault.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.scaledefault.html @@ -15,28 +15,26 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.scale(50, 50); -ctx.strokeStyle = '#0f0'; -ctx.moveTo(0, 0.5); -ctx.lineTo(2, 0.5); -ctx.stroke(); - -_assertPixel(canvas, 25,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 75,25, 0,255,0,255); -_assertPixel(canvas, 50,5, 0,255,0,255); -_assertPixel(canvas, 50,45, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.scale(50, 50); + ctx.strokeStyle = '#0f0'; + ctx.moveTo(0, 0.5); + ctx.lineTo(2, 0.5); + ctx.stroke(); + + _assertPixel(canvas, 25,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 75,25, 0,255,0,255); + _assertPixel(canvas, 50,5, 0,255,0,255); + _assertPixel(canvas, 50,45, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.scaledefault.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.scaledefault.worker.js index a692f4cc113..8d8089476bb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.scaledefault.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.scaledefault.worker.js @@ -13,24 +13,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.scale(50, 50); -ctx.strokeStyle = '#0f0'; -ctx.moveTo(0, 0.5); -ctx.lineTo(2, 0.5); -ctx.stroke(); - -_assertPixel(canvas, 25,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 75,25, 0,255,0,255); -_assertPixel(canvas, 50,5, 0,255,0,255); -_assertPixel(canvas, 50,45, 0,255,0,255); -t.done(); + ctx.scale(50, 50); + ctx.strokeStyle = '#0f0'; + ctx.moveTo(0, 0.5); + ctx.lineTo(2, 0.5); + ctx.stroke(); + _assertPixel(canvas, 25,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 75,25, 0,255,0,255); + _assertPixel(canvas, 50,5, 0,255,0,255); + _assertPixel(canvas, 50,45, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.transformed.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.transformed.html index d2358ba2e84..ea8f285dc42 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.transformed.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.transformed.html @@ -15,57 +15,55 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 4; -// Draw a green line over a red box, to check the line is not too small -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; -ctx.fillRect(15, 15, 20, 20); -ctx.save(); - ctx.scale(5, 1); - ctx.beginPath(); - ctx.moveTo(5, 15); - ctx.lineTo(5, 35); - ctx.stroke(); -ctx.restore(); + ctx.lineWidth = 4; + // Draw a green line over a red box, to check the line is not too small + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + ctx.fillRect(15, 15, 20, 20); + ctx.save(); + ctx.scale(5, 1); + ctx.beginPath(); + ctx.moveTo(5, 15); + ctx.lineTo(5, 35); + ctx.stroke(); + ctx.restore(); -// Draw a green box over a red line, to check the line is not too large -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; -ctx.save(); - ctx.scale(-5, 1); - ctx.beginPath(); - ctx.moveTo(-15, 15); - ctx.lineTo(-15, 35); - ctx.stroke(); -ctx.restore(); -ctx.fillRect(65, 15, 20, 20); + // Draw a green box over a red line, to check the line is not too large + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + ctx.save(); + ctx.scale(-5, 1); + ctx.beginPath(); + ctx.moveTo(-15, 15); + ctx.lineTo(-15, 35); + ctx.stroke(); + ctx.restore(); + ctx.fillRect(65, 15, 20, 20); -_assertPixel(canvas, 14,25, 0,255,0,255); -_assertPixel(canvas, 15,25, 0,255,0,255); -_assertPixel(canvas, 16,25, 0,255,0,255); -_assertPixel(canvas, 25,25, 0,255,0,255); -_assertPixel(canvas, 34,25, 0,255,0,255); -_assertPixel(canvas, 35,25, 0,255,0,255); -_assertPixel(canvas, 36,25, 0,255,0,255); + _assertPixel(canvas, 14,25, 0,255,0,255); + _assertPixel(canvas, 15,25, 0,255,0,255); + _assertPixel(canvas, 16,25, 0,255,0,255); + _assertPixel(canvas, 25,25, 0,255,0,255); + _assertPixel(canvas, 34,25, 0,255,0,255); + _assertPixel(canvas, 35,25, 0,255,0,255); + _assertPixel(canvas, 36,25, 0,255,0,255); -_assertPixel(canvas, 64,25, 0,255,0,255); -_assertPixel(canvas, 65,25, 0,255,0,255); -_assertPixel(canvas, 66,25, 0,255,0,255); -_assertPixel(canvas, 75,25, 0,255,0,255); -_assertPixel(canvas, 84,25, 0,255,0,255); -_assertPixel(canvas, 85,25, 0,255,0,255); -_assertPixel(canvas, 86,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + _assertPixel(canvas, 64,25, 0,255,0,255); + _assertPixel(canvas, 65,25, 0,255,0,255); + _assertPixel(canvas, 66,25, 0,255,0,255); + _assertPixel(canvas, 75,25, 0,255,0,255); + _assertPixel(canvas, 84,25, 0,255,0,255); + _assertPixel(canvas, 85,25, 0,255,0,255); + _assertPixel(canvas, 86,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.transformed.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.transformed.worker.js index e26e93b1e4f..67fc0a29bd4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.transformed.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.transformed.worker.js @@ -13,53 +13,52 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 4; -// Draw a green line over a red box, to check the line is not too small -ctx.fillStyle = '#f00'; -ctx.strokeStyle = '#0f0'; -ctx.fillRect(15, 15, 20, 20); -ctx.save(); - ctx.scale(5, 1); - ctx.beginPath(); - ctx.moveTo(5, 15); - ctx.lineTo(5, 35); - ctx.stroke(); -ctx.restore(); + ctx.lineWidth = 4; + // Draw a green line over a red box, to check the line is not too small + ctx.fillStyle = '#f00'; + ctx.strokeStyle = '#0f0'; + ctx.fillRect(15, 15, 20, 20); + ctx.save(); + ctx.scale(5, 1); + ctx.beginPath(); + ctx.moveTo(5, 15); + ctx.lineTo(5, 35); + ctx.stroke(); + ctx.restore(); -// Draw a green box over a red line, to check the line is not too large -ctx.fillStyle = '#0f0'; -ctx.strokeStyle = '#f00'; -ctx.save(); - ctx.scale(-5, 1); - ctx.beginPath(); - ctx.moveTo(-15, 15); - ctx.lineTo(-15, 35); - ctx.stroke(); -ctx.restore(); -ctx.fillRect(65, 15, 20, 20); + // Draw a green box over a red line, to check the line is not too large + ctx.fillStyle = '#0f0'; + ctx.strokeStyle = '#f00'; + ctx.save(); + ctx.scale(-5, 1); + ctx.beginPath(); + ctx.moveTo(-15, 15); + ctx.lineTo(-15, 35); + ctx.stroke(); + ctx.restore(); + ctx.fillRect(65, 15, 20, 20); -_assertPixel(canvas, 14,25, 0,255,0,255); -_assertPixel(canvas, 15,25, 0,255,0,255); -_assertPixel(canvas, 16,25, 0,255,0,255); -_assertPixel(canvas, 25,25, 0,255,0,255); -_assertPixel(canvas, 34,25, 0,255,0,255); -_assertPixel(canvas, 35,25, 0,255,0,255); -_assertPixel(canvas, 36,25, 0,255,0,255); - -_assertPixel(canvas, 64,25, 0,255,0,255); -_assertPixel(canvas, 65,25, 0,255,0,255); -_assertPixel(canvas, 66,25, 0,255,0,255); -_assertPixel(canvas, 75,25, 0,255,0,255); -_assertPixel(canvas, 84,25, 0,255,0,255); -_assertPixel(canvas, 85,25, 0,255,0,255); -_assertPixel(canvas, 86,25, 0,255,0,255); -t.done(); + _assertPixel(canvas, 14,25, 0,255,0,255); + _assertPixel(canvas, 15,25, 0,255,0,255); + _assertPixel(canvas, 16,25, 0,255,0,255); + _assertPixel(canvas, 25,25, 0,255,0,255); + _assertPixel(canvas, 34,25, 0,255,0,255); + _assertPixel(canvas, 35,25, 0,255,0,255); + _assertPixel(canvas, 36,25, 0,255,0,255); + _assertPixel(canvas, 64,25, 0,255,0,255); + _assertPixel(canvas, 65,25, 0,255,0,255); + _assertPixel(canvas, 66,25, 0,255,0,255); + _assertPixel(canvas, 75,25, 0,255,0,255); + _assertPixel(canvas, 84,25, 0,255,0,255); + _assertPixel(canvas, 85,25, 0,255,0,255); + _assertPixel(canvas, 86,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.valid.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.valid.html index 4a4563c4e35..813433da3f8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.valid.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.valid.html @@ -15,25 +15,23 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.lineWidth = 1.5; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = "1e1"; -_assertSame(ctx.lineWidth, 10, "ctx.lineWidth", "10"); + ctx.lineWidth = "1e1"; + _assertSame(ctx.lineWidth, 10, "ctx.lineWidth", "10"); -ctx.lineWidth = 1/1024; -_assertSame(ctx.lineWidth, 1/1024, "ctx.lineWidth", "1/1024"); + ctx.lineWidth = 1/1024; + _assertSame(ctx.lineWidth, 1/1024, "ctx.lineWidth", "1/1024"); -ctx.lineWidth = 1000; -_assertSame(ctx.lineWidth, 1000, "ctx.lineWidth", "1000"); -})(canvas, ctx); -t.done(); + ctx.lineWidth = 1000; + _assertSame(ctx.lineWidth, 1000, "ctx.lineWidth", "1000"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.valid.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.valid.worker.js index df6ee9838e8..195575f7de4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.valid.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/line-styles/2d.line.width.valid.worker.js @@ -13,21 +13,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.lineWidth = 1.5; -_assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); + ctx.lineWidth = 1.5; + _assertSame(ctx.lineWidth, 1.5, "ctx.lineWidth", "1.5"); -ctx.lineWidth = "1e1"; -_assertSame(ctx.lineWidth, 10, "ctx.lineWidth", "10"); + ctx.lineWidth = "1e1"; + _assertSame(ctx.lineWidth, 10, "ctx.lineWidth", "10"); -ctx.lineWidth = 1/1024; -_assertSame(ctx.lineWidth, 1/1024, "ctx.lineWidth", "1/1024"); - -ctx.lineWidth = 1000; -_assertSame(ctx.lineWidth, 1000, "ctx.lineWidth", "1000"); -t.done(); + ctx.lineWidth = 1/1024; + _assertSame(ctx.lineWidth, 1/1024, "ctx.lineWidth", "1/1024"); + ctx.lineWidth = 1000; + _assertSame(ctx.lineWidth, 1000, "ctx.lineWidth", "1000"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.1.html index cf358e38fc1..bdd2c7a65fe 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.1.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 0); -ctx.arc(100, 0, 150, Math.PI/2, -Math.PI, true); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 0); + ctx.arc(100, 0, 150, Math.PI/2, -Math.PI, true); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.1.worker.js index 5a1f54c4c2f..1b6a534c23b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.1.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 0); -ctx.arc(100, 0, 150, Math.PI/2, -Math.PI, true); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 0); + ctx.arc(100, 0, 150, Math.PI/2, -Math.PI, true); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.2.html index 9b3983fb370..c92e83abd7a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.2.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 0); -ctx.arc(100, 0, 150, -3*Math.PI/2, -Math.PI, true); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 0); + ctx.arc(100, 0, 150, -3*Math.PI/2, -Math.PI, true); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.2.worker.js index 15bf295b2d5..25598c959d6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.2.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 0); -ctx.arc(100, 0, 150, -3*Math.PI/2, -Math.PI, true); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 0); + ctx.arc(100, 0, 150, -3*Math.PI/2, -Math.PI, true); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.3.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.3.html index a757b31efba..86170ac8c56 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.3.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 0); -ctx.arc(100, 0, 150, (512+1/2)*Math.PI, (1024-1)*Math.PI, true); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 0); + ctx.arc(100, 0, 150, (512+1/2)*Math.PI, (1024-1)*Math.PI, true); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.3.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.3.worker.js index 646349fb99f..6841041d784 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.3.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.3.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 0); -ctx.arc(100, 0, 150, (512+1/2)*Math.PI, (1024-1)*Math.PI, true); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 0); + ctx.arc(100, 0, 150, (512+1/2)*Math.PI, (1024-1)*Math.PI, true); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.4.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.4.html index b8e4d54027d..e694b99f707 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.4.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.4.html @@ -17,21 +17,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.arc(50, 25, 60, (512+1/2)*Math.PI, (1024-1)*Math.PI, false); -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.arc(50, 25, 60, (512+1/2)*Math.PI, (1024-1)*Math.PI, false); + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.4.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.4.worker.js index 8fa2ef137d7..502175165ff 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.4.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.4.worker.js @@ -13,21 +13,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.arc(50, 25, 60, (512+1/2)*Math.PI, (1024-1)*Math.PI, false); -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.arc(50, 25, 60, (512+1/2)*Math.PI, (1024-1)*Math.PI, false); + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.5.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.5.html index f13a2e41c96..7f0d9af19f5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.5.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.5.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 0); -ctx.arc(100, 0, 150, (1024-1)*Math.PI, (512+1/2)*Math.PI, false); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 0); + ctx.arc(100, 0, 150, (1024-1)*Math.PI, (512+1/2)*Math.PI, false); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.5.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.5.worker.js index 50b23cd9ba8..aa2320a92a5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.5.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.5.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 0); -ctx.arc(100, 0, 150, (1024-1)*Math.PI, (512+1/2)*Math.PI, false); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 0); + ctx.arc(100, 0, 150, (1024-1)*Math.PI, (512+1/2)*Math.PI, false); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.6.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.6.html index 88184b8d77d..64cf6daeef8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.6.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.6.html @@ -17,21 +17,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.arc(50, 25, 60, (1024-1)*Math.PI, (512+1/2)*Math.PI, true); -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.arc(50, 25, 60, (1024-1)*Math.PI, (512+1/2)*Math.PI, true); + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.6.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.6.worker.js index 38bd40489ba..929db397d3a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.6.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.angle.6.worker.js @@ -13,21 +13,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.arc(50, 25, 60, (1024-1)*Math.PI, (512+1/2)*Math.PI, true); -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.arc(50, 25, 60, (1024-1)*Math.PI, (512+1/2)*Math.PI, true); + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.default.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.default.html index 848f20c32fa..ee42c040852 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.default.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.default.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 0); -ctx.arc(100, 0, 150, -Math.PI, Math.PI/2); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 0); + ctx.arc(100, 0, 150, -Math.PI, Math.PI/2); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.default.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.default.worker.js index c73829a0eee..da74713e4ab 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.default.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.default.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 0); -ctx.arc(100, 0, 150, -Math.PI, Math.PI/2); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 0); + ctx.arc(100, 0, 150, -Math.PI, Math.PI/2); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.empty.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.empty.html index 9098b7fe023..25414647b21 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.empty.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.empty.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.arc(200, 25, 5, 0, 2*Math.PI, true); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.arc(200, 25, 5, 0, 2*Math.PI, true); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.empty.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.empty.worker.js index 82281ea4b08..9b1fbb1a387 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.empty.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.empty.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.arc(200, 25, 5, 0, 2*Math.PI, true); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.arc(200, 25, 5, 0, 2*Math.PI, true); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.end.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.end.html index 12be27afa66..b8459053f2e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.end.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.end.html @@ -17,20 +17,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(-100, 0); -ctx.arc(-100, 0, 25, -Math.PI/2, Math.PI/2, true); -ctx.lineTo(100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(-100, 0); + ctx.arc(-100, 0, 25, -Math.PI/2, Math.PI/2, true); + ctx.lineTo(100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.end.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.end.worker.js index a2519f0bad0..963640a2735 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.end.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.end.worker.js @@ -13,20 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(-100, 0); -ctx.arc(-100, 0, 25, -Math.PI/2, Math.PI/2, true); -ctx.lineTo(100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(-100, 0); + ctx.arc(-100, 0, 25, -Math.PI/2, Math.PI/2, true); + ctx.lineTo(100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.negative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.negative.html index 77f1b07bf5c..6c81b9e0ded 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.negative.html @@ -17,11 +17,13 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.arc(0, 0, -1, 0, 0, true); }); -t.done(); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.arc(0, 0, -1, 0, 0, true); }); + var path = new Path2D(); + assert_throws_dom("INDEX_SIZE_ERR", function() { path.arc(10, 10, -5, 0, 1, false); }); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.negative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.negative.worker.js index c1abffa8e9e..b48eb984742 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.negative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.negative.worker.js @@ -13,11 +13,12 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.arc(0, 0, -1, 0, 0, true); }); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.arc(0, 0, -1, 0, 0, true); }); + var path = new Path2D(); + assert_throws_dom("INDEX_SIZE_ERR", function() { path.arc(10, 10, -5, 0, 1, false); }); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.nonempty.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.nonempty.html index 542940435af..4d9ebe6d874 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.nonempty.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.nonempty.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arc(200, 25, 5, 0, 2*Math.PI, true); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arc(200, 25, 5, 0, 2*Math.PI, true); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.nonempty.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.nonempty.worker.js index 1d7de774868..af6b4c98538 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.nonempty.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.nonempty.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arc(200, 25, 5, 0, 2*Math.PI, true); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arc(200, 25, 5, 0, 2*Math.PI, true); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.nonfinite.html index c65af631b54..b347a1e27ad 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.nonfinite.html @@ -17,61 +17,61 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.arc(Infinity, 0, 50, 0, 2*Math.PI, true); -ctx.arc(-Infinity, 0, 50, 0, 2*Math.PI, true); -ctx.arc(NaN, 0, 50, 0, 2*Math.PI, true); -ctx.arc(0, Infinity, 50, 0, 2*Math.PI, true); -ctx.arc(0, -Infinity, 50, 0, 2*Math.PI, true); -ctx.arc(0, NaN, 50, 0, 2*Math.PI, true); -ctx.arc(0, 0, Infinity, 0, 2*Math.PI, true); -ctx.arc(0, 0, -Infinity, 0, 2*Math.PI, true); -ctx.arc(0, 0, NaN, 0, 2*Math.PI, true); -ctx.arc(0, 0, 50, Infinity, 2*Math.PI, true); -ctx.arc(0, 0, 50, -Infinity, 2*Math.PI, true); -ctx.arc(0, 0, 50, NaN, 2*Math.PI, true); -ctx.arc(0, 0, 50, 0, Infinity, true); -ctx.arc(0, 0, 50, 0, -Infinity, true); -ctx.arc(0, 0, 50, 0, NaN, true); -ctx.arc(Infinity, Infinity, 50, 0, 2*Math.PI, true); -ctx.arc(Infinity, Infinity, Infinity, 0, 2*Math.PI, true); -ctx.arc(Infinity, Infinity, Infinity, Infinity, 2*Math.PI, true); -ctx.arc(Infinity, Infinity, Infinity, Infinity, Infinity, true); -ctx.arc(Infinity, Infinity, Infinity, 0, Infinity, true); -ctx.arc(Infinity, Infinity, 50, Infinity, 2*Math.PI, true); -ctx.arc(Infinity, Infinity, 50, Infinity, Infinity, true); -ctx.arc(Infinity, Infinity, 50, 0, Infinity, true); -ctx.arc(Infinity, 0, Infinity, 0, 2*Math.PI, true); -ctx.arc(Infinity, 0, Infinity, Infinity, 2*Math.PI, true); -ctx.arc(Infinity, 0, Infinity, Infinity, Infinity, true); -ctx.arc(Infinity, 0, Infinity, 0, Infinity, true); -ctx.arc(Infinity, 0, 50, Infinity, 2*Math.PI, true); -ctx.arc(Infinity, 0, 50, Infinity, Infinity, true); -ctx.arc(Infinity, 0, 50, 0, Infinity, true); -ctx.arc(0, Infinity, Infinity, 0, 2*Math.PI, true); -ctx.arc(0, Infinity, Infinity, Infinity, 2*Math.PI, true); -ctx.arc(0, Infinity, Infinity, Infinity, Infinity, true); -ctx.arc(0, Infinity, Infinity, 0, Infinity, true); -ctx.arc(0, Infinity, 50, Infinity, 2*Math.PI, true); -ctx.arc(0, Infinity, 50, Infinity, Infinity, true); -ctx.arc(0, Infinity, 50, 0, Infinity, true); -ctx.arc(0, 0, Infinity, Infinity, 2*Math.PI, true); -ctx.arc(0, 0, Infinity, Infinity, Infinity, true); -ctx.arc(0, 0, Infinity, 0, Infinity, true); -ctx.arc(0, 0, 50, Infinity, Infinity, true); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.arc(Infinity, 0, 50, 0, 2*Math.PI, true); + ctx.arc(-Infinity, 0, 50, 0, 2*Math.PI, true); + ctx.arc(NaN, 0, 50, 0, 2*Math.PI, true); + ctx.arc(0, Infinity, 50, 0, 2*Math.PI, true); + ctx.arc(0, -Infinity, 50, 0, 2*Math.PI, true); + ctx.arc(0, NaN, 50, 0, 2*Math.PI, true); + ctx.arc(0, 0, Infinity, 0, 2*Math.PI, true); + ctx.arc(0, 0, -Infinity, 0, 2*Math.PI, true); + ctx.arc(0, 0, NaN, 0, 2*Math.PI, true); + ctx.arc(0, 0, 50, Infinity, 2*Math.PI, true); + ctx.arc(0, 0, 50, -Infinity, 2*Math.PI, true); + ctx.arc(0, 0, 50, NaN, 2*Math.PI, true); + ctx.arc(0, 0, 50, 0, Infinity, true); + ctx.arc(0, 0, 50, 0, -Infinity, true); + ctx.arc(0, 0, 50, 0, NaN, true); + ctx.arc(Infinity, Infinity, 50, 0, 2*Math.PI, true); + ctx.arc(Infinity, Infinity, Infinity, 0, 2*Math.PI, true); + ctx.arc(Infinity, Infinity, Infinity, Infinity, 2*Math.PI, true); + ctx.arc(Infinity, Infinity, Infinity, Infinity, Infinity, true); + ctx.arc(Infinity, Infinity, Infinity, 0, Infinity, true); + ctx.arc(Infinity, Infinity, 50, Infinity, 2*Math.PI, true); + ctx.arc(Infinity, Infinity, 50, Infinity, Infinity, true); + ctx.arc(Infinity, Infinity, 50, 0, Infinity, true); + ctx.arc(Infinity, 0, Infinity, 0, 2*Math.PI, true); + ctx.arc(Infinity, 0, Infinity, Infinity, 2*Math.PI, true); + ctx.arc(Infinity, 0, Infinity, Infinity, Infinity, true); + ctx.arc(Infinity, 0, Infinity, 0, Infinity, true); + ctx.arc(Infinity, 0, 50, Infinity, 2*Math.PI, true); + ctx.arc(Infinity, 0, 50, Infinity, Infinity, true); + ctx.arc(Infinity, 0, 50, 0, Infinity, true); + ctx.arc(0, Infinity, Infinity, 0, 2*Math.PI, true); + ctx.arc(0, Infinity, Infinity, Infinity, 2*Math.PI, true); + ctx.arc(0, Infinity, Infinity, Infinity, Infinity, true); + ctx.arc(0, Infinity, Infinity, 0, Infinity, true); + ctx.arc(0, Infinity, 50, Infinity, 2*Math.PI, true); + ctx.arc(0, Infinity, 50, Infinity, Infinity, true); + ctx.arc(0, Infinity, 50, 0, Infinity, true); + ctx.arc(0, 0, Infinity, Infinity, 2*Math.PI, true); + ctx.arc(0, 0, Infinity, Infinity, Infinity, true); + ctx.arc(0, 0, Infinity, 0, Infinity, true); + ctx.arc(0, 0, 50, Infinity, Infinity, true); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.nonfinite.worker.js index f83dcf1080d..50ff560e349 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.nonfinite.worker.js @@ -13,61 +13,60 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.arc(Infinity, 0, 50, 0, 2*Math.PI, true); -ctx.arc(-Infinity, 0, 50, 0, 2*Math.PI, true); -ctx.arc(NaN, 0, 50, 0, 2*Math.PI, true); -ctx.arc(0, Infinity, 50, 0, 2*Math.PI, true); -ctx.arc(0, -Infinity, 50, 0, 2*Math.PI, true); -ctx.arc(0, NaN, 50, 0, 2*Math.PI, true); -ctx.arc(0, 0, Infinity, 0, 2*Math.PI, true); -ctx.arc(0, 0, -Infinity, 0, 2*Math.PI, true); -ctx.arc(0, 0, NaN, 0, 2*Math.PI, true); -ctx.arc(0, 0, 50, Infinity, 2*Math.PI, true); -ctx.arc(0, 0, 50, -Infinity, 2*Math.PI, true); -ctx.arc(0, 0, 50, NaN, 2*Math.PI, true); -ctx.arc(0, 0, 50, 0, Infinity, true); -ctx.arc(0, 0, 50, 0, -Infinity, true); -ctx.arc(0, 0, 50, 0, NaN, true); -ctx.arc(Infinity, Infinity, 50, 0, 2*Math.PI, true); -ctx.arc(Infinity, Infinity, Infinity, 0, 2*Math.PI, true); -ctx.arc(Infinity, Infinity, Infinity, Infinity, 2*Math.PI, true); -ctx.arc(Infinity, Infinity, Infinity, Infinity, Infinity, true); -ctx.arc(Infinity, Infinity, Infinity, 0, Infinity, true); -ctx.arc(Infinity, Infinity, 50, Infinity, 2*Math.PI, true); -ctx.arc(Infinity, Infinity, 50, Infinity, Infinity, true); -ctx.arc(Infinity, Infinity, 50, 0, Infinity, true); -ctx.arc(Infinity, 0, Infinity, 0, 2*Math.PI, true); -ctx.arc(Infinity, 0, Infinity, Infinity, 2*Math.PI, true); -ctx.arc(Infinity, 0, Infinity, Infinity, Infinity, true); -ctx.arc(Infinity, 0, Infinity, 0, Infinity, true); -ctx.arc(Infinity, 0, 50, Infinity, 2*Math.PI, true); -ctx.arc(Infinity, 0, 50, Infinity, Infinity, true); -ctx.arc(Infinity, 0, 50, 0, Infinity, true); -ctx.arc(0, Infinity, Infinity, 0, 2*Math.PI, true); -ctx.arc(0, Infinity, Infinity, Infinity, 2*Math.PI, true); -ctx.arc(0, Infinity, Infinity, Infinity, Infinity, true); -ctx.arc(0, Infinity, Infinity, 0, Infinity, true); -ctx.arc(0, Infinity, 50, Infinity, 2*Math.PI, true); -ctx.arc(0, Infinity, 50, Infinity, Infinity, true); -ctx.arc(0, Infinity, 50, 0, Infinity, true); -ctx.arc(0, 0, Infinity, Infinity, 2*Math.PI, true); -ctx.arc(0, 0, Infinity, Infinity, Infinity, true); -ctx.arc(0, 0, Infinity, 0, Infinity, true); -ctx.arc(0, 0, 50, Infinity, Infinity, true); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.arc(Infinity, 0, 50, 0, 2*Math.PI, true); + ctx.arc(-Infinity, 0, 50, 0, 2*Math.PI, true); + ctx.arc(NaN, 0, 50, 0, 2*Math.PI, true); + ctx.arc(0, Infinity, 50, 0, 2*Math.PI, true); + ctx.arc(0, -Infinity, 50, 0, 2*Math.PI, true); + ctx.arc(0, NaN, 50, 0, 2*Math.PI, true); + ctx.arc(0, 0, Infinity, 0, 2*Math.PI, true); + ctx.arc(0, 0, -Infinity, 0, 2*Math.PI, true); + ctx.arc(0, 0, NaN, 0, 2*Math.PI, true); + ctx.arc(0, 0, 50, Infinity, 2*Math.PI, true); + ctx.arc(0, 0, 50, -Infinity, 2*Math.PI, true); + ctx.arc(0, 0, 50, NaN, 2*Math.PI, true); + ctx.arc(0, 0, 50, 0, Infinity, true); + ctx.arc(0, 0, 50, 0, -Infinity, true); + ctx.arc(0, 0, 50, 0, NaN, true); + ctx.arc(Infinity, Infinity, 50, 0, 2*Math.PI, true); + ctx.arc(Infinity, Infinity, Infinity, 0, 2*Math.PI, true); + ctx.arc(Infinity, Infinity, Infinity, Infinity, 2*Math.PI, true); + ctx.arc(Infinity, Infinity, Infinity, Infinity, Infinity, true); + ctx.arc(Infinity, Infinity, Infinity, 0, Infinity, true); + ctx.arc(Infinity, Infinity, 50, Infinity, 2*Math.PI, true); + ctx.arc(Infinity, Infinity, 50, Infinity, Infinity, true); + ctx.arc(Infinity, Infinity, 50, 0, Infinity, true); + ctx.arc(Infinity, 0, Infinity, 0, 2*Math.PI, true); + ctx.arc(Infinity, 0, Infinity, Infinity, 2*Math.PI, true); + ctx.arc(Infinity, 0, Infinity, Infinity, Infinity, true); + ctx.arc(Infinity, 0, Infinity, 0, Infinity, true); + ctx.arc(Infinity, 0, 50, Infinity, 2*Math.PI, true); + ctx.arc(Infinity, 0, 50, Infinity, Infinity, true); + ctx.arc(Infinity, 0, 50, 0, Infinity, true); + ctx.arc(0, Infinity, Infinity, 0, 2*Math.PI, true); + ctx.arc(0, Infinity, Infinity, Infinity, 2*Math.PI, true); + ctx.arc(0, Infinity, Infinity, Infinity, Infinity, true); + ctx.arc(0, Infinity, Infinity, 0, Infinity, true); + ctx.arc(0, Infinity, 50, Infinity, 2*Math.PI, true); + ctx.arc(0, Infinity, 50, Infinity, Infinity, true); + ctx.arc(0, Infinity, 50, 0, Infinity, true); + ctx.arc(0, 0, Infinity, Infinity, 2*Math.PI, true); + ctx.arc(0, 0, Infinity, Infinity, Infinity, true); + ctx.arc(0, 0, Infinity, 0, Infinity, true); + ctx.arc(0, 0, 50, Infinity, Infinity, true); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.1.html index 3b0aed390f5..bf8a6f1f915 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.1.html @@ -17,37 +17,38 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.scale(2, 0.5); -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.arc(25, 50, 56, 0, 2*Math.PI, false); -ctx.fill(); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(-25, 50); -ctx.arc(-25, 50, 24, 0, 2*Math.PI, false); -ctx.moveTo(75, 50); -ctx.arc(75, 50, 24, 0, 2*Math.PI, false); -ctx.moveTo(25, -25); -ctx.arc(25, -25, 24, 0, 2*Math.PI, false); -ctx.moveTo(25, 125); -ctx.arc(25, 125, 24, 0, 2*Math.PI, false); -ctx.fill(); -_assertPixel(canvas, 0,0, 0,255,0,255); -_assertPixel(canvas, 50,0, 0,255,0,255); -_assertPixel(canvas, 99,0, 0,255,0,255); -_assertPixel(canvas, 0,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 99,25, 0,255,0,255); -_assertPixel(canvas, 0,49, 0,255,0,255); -_assertPixel(canvas, 50,49, 0,255,0,255); -_assertPixel(canvas, 99,49, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(2, 0.5); + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.arc(25, 50, 56, 0, 2*Math.PI, false); + ctx.fill(); + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(-25, 50); + ctx.arc(-25, 50, 24, 0, 2*Math.PI, false); + ctx.moveTo(75, 50); + ctx.arc(75, 50, 24, 0, 2*Math.PI, false); + ctx.moveTo(25, -25); + ctx.arc(25, -25, 24, 0, 2*Math.PI, false); + ctx.moveTo(25, 125); + ctx.arc(25, 125, 24, 0, 2*Math.PI, false); + ctx.fill(); + + _assertPixel(canvas, 0,0, 0,255,0,255); + _assertPixel(canvas, 50,0, 0,255,0,255); + _assertPixel(canvas, 99,0, 0,255,0,255); + _assertPixel(canvas, 0,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 99,25, 0,255,0,255); + _assertPixel(canvas, 0,49, 0,255,0,255); + _assertPixel(canvas, 50,49, 0,255,0,255); + _assertPixel(canvas, 99,49, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.1.worker.js index ec300985c8a..5d9619a920f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.1.worker.js @@ -13,37 +13,37 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.scale(2, 0.5); -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.arc(25, 50, 56, 0, 2*Math.PI, false); -ctx.fill(); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(-25, 50); -ctx.arc(-25, 50, 24, 0, 2*Math.PI, false); -ctx.moveTo(75, 50); -ctx.arc(75, 50, 24, 0, 2*Math.PI, false); -ctx.moveTo(25, -25); -ctx.arc(25, -25, 24, 0, 2*Math.PI, false); -ctx.moveTo(25, 125); -ctx.arc(25, 125, 24, 0, 2*Math.PI, false); -ctx.fill(); -_assertPixel(canvas, 0,0, 0,255,0,255); -_assertPixel(canvas, 50,0, 0,255,0,255); -_assertPixel(canvas, 99,0, 0,255,0,255); -_assertPixel(canvas, 0,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 99,25, 0,255,0,255); -_assertPixel(canvas, 0,49, 0,255,0,255); -_assertPixel(canvas, 50,49, 0,255,0,255); -_assertPixel(canvas, 99,49, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(2, 0.5); + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.arc(25, 50, 56, 0, 2*Math.PI, false); + ctx.fill(); + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(-25, 50); + ctx.arc(-25, 50, 24, 0, 2*Math.PI, false); + ctx.moveTo(75, 50); + ctx.arc(75, 50, 24, 0, 2*Math.PI, false); + ctx.moveTo(25, -25); + ctx.arc(25, -25, 24, 0, 2*Math.PI, false); + ctx.moveTo(25, 125); + ctx.arc(25, 125, 24, 0, 2*Math.PI, false); + ctx.fill(); + _assertPixel(canvas, 0,0, 0,255,0,255); + _assertPixel(canvas, 50,0, 0,255,0,255); + _assertPixel(canvas, 99,0, 0,255,0,255); + _assertPixel(canvas, 0,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 99,25, 0,255,0,255); + _assertPixel(canvas, 0,49, 0,255,0,255); + _assertPixel(canvas, 50,49, 0,255,0,255); + _assertPixel(canvas, 99,49, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.2.html index f6822f8203f..95376882cd3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.2.html @@ -17,27 +17,28 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.scale(100, 100); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 1.2; -ctx.beginPath(); -ctx.arc(0, 0, 0.6, 0, Math.PI/2, false); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 50,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 98,25, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 50,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(100, 100); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 1.2; + ctx.beginPath(); + ctx.arc(0, 0, 0.6, 0, Math.PI/2, false); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 50,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 98,25, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 50,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.2.worker.js index d946f7f0fee..c655dad30f8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.scale.2.worker.js @@ -13,27 +13,27 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.scale(100, 100); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 1.2; -ctx.beginPath(); -ctx.arc(0, 0, 0.6, 0, Math.PI/2, false); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 50,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 98,25, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 50,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(100, 100); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 1.2; + ctx.beginPath(); + ctx.arc(0, 0, 0.6, 0, Math.PI/2, false); + ctx.stroke(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 50,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 98,25, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 50,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.1.html index 9e8803a102d..624b307af72 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.1.html @@ -17,22 +17,22 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 200; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.arc(100, 50, 25, 0, -Math.PI/2, true); -ctx.stroke(); -ctx.beginPath(); -ctx.arc(0, 0, 25, 0, -Math.PI/2, true); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 200; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.arc(100, 50, 25, 0, -Math.PI/2, true); + ctx.stroke(); + ctx.beginPath(); + ctx.arc(0, 0, 25, 0, -Math.PI/2, true); + ctx.stroke(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.1.worker.js index 84cb983f1aa..6c77dbd5b19 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.1.worker.js @@ -13,22 +13,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 200; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.arc(100, 50, 25, 0, -Math.PI/2, true); -ctx.stroke(); -ctx.beginPath(); -ctx.arc(0, 0, 25, 0, -Math.PI/2, true); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 200; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.arc(100, 50, 25, 0, -Math.PI/2, true); + ctx.stroke(); + ctx.beginPath(); + ctx.arc(0, 0, 25, 0, -Math.PI/2, true); + ctx.stroke(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.2.html index f2118ef29b8..b49aa2437aa 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.2.html @@ -17,26 +17,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 180; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.arc(-50, 50, 25, 0, -Math.PI/2, true); -ctx.stroke(); -ctx.beginPath(); -ctx.arc(100, 0, 25, 0, -Math.PI/2, true); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,10, 0,255,0,255); -_assertPixel(canvas, 97,1, 0,255,0,255); -_assertPixel(canvas, 97,2, 0,255,0,255); -_assertPixel(canvas, 97,3, 0,255,0,255); -_assertPixel(canvas, 2,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 180; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.arc(-50, 50, 25, 0, -Math.PI/2, true); + ctx.stroke(); + ctx.beginPath(); + ctx.arc(100, 0, 25, 0, -Math.PI/2, true); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,10, 0,255,0,255); + _assertPixel(canvas, 97,1, 0,255,0,255); + _assertPixel(canvas, 97,2, 0,255,0,255); + _assertPixel(canvas, 97,3, 0,255,0,255); + _assertPixel(canvas, 2,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.2.worker.js index be7f13aee7e..2bbdacd46de 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.selfintersect.2.worker.js @@ -13,26 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 180; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.arc(-50, 50, 25, 0, -Math.PI/2, true); -ctx.stroke(); -ctx.beginPath(); -ctx.arc(100, 0, 25, 0, -Math.PI/2, true); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,10, 0,255,0,255); -_assertPixel(canvas, 97,1, 0,255,0,255); -_assertPixel(canvas, 97,2, 0,255,0,255); -_assertPixel(canvas, 97,3, 0,255,0,255); -_assertPixel(canvas, 2,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 180; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.arc(-50, 50, 25, 0, -Math.PI/2, true); + ctx.stroke(); + ctx.beginPath(); + ctx.arc(100, 0, 25, 0, -Math.PI/2, true); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,10, 0,255,0,255); + _assertPixel(canvas, 97,1, 0,255,0,255); + _assertPixel(canvas, 97,2, 0,255,0,255); + _assertPixel(canvas, 97,3, 0,255,0,255); + _assertPixel(canvas, 2,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.1.html index 42242536e2b..ceb3cb380cb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.1.html @@ -17,23 +17,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.arc(50, 50, 50, 0, Math.PI, false); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 20,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.arc(50, 50, 50, 0, Math.PI, false); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 20,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.1.worker.js index b41863bfb7b..e1058ae96dc 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.1.worker.js @@ -13,23 +13,22 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.arc(50, 50, 50, 0, Math.PI, false); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 20,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.arc(50, 50, 50, 0, Math.PI, false); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 20,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.2.html index 1e33a024163..a39fd039476 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.2.html @@ -17,23 +17,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 100; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.arc(50, 50, 50, 0, Math.PI, true); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 20,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 100; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.arc(50, 50, 50, 0, Math.PI, true); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 20,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.2.worker.js index d5d6cb7b7e3..d444d9b04eb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.2.worker.js @@ -13,23 +13,22 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 100; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.arc(50, 50, 50, 0, Math.PI, true); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 20,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 100; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.arc(50, 50, 50, 0, Math.PI, true); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 20,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.3.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.3.html index b90284e5798..853814aef21 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.3.html @@ -17,22 +17,22 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 100; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.arc(0, 50, 50, 0, -Math.PI/2, false); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 100; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.arc(0, 50, 50, 0, -Math.PI/2, false); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.3.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.3.worker.js index 5d0cf805399..b8008e778b0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.3.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.3.worker.js @@ -13,22 +13,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 100; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.arc(0, 50, 50, 0, -Math.PI/2, false); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 100; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.arc(0, 50, 50, 0, -Math.PI/2, false); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.4.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.4.html index dce9547a6b4..e6221947dff 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.4.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.4.html @@ -17,22 +17,22 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 150; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.arc(-50, 50, 100, 0, -Math.PI/2, true); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 150; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.arc(-50, 50, 100, 0, -Math.PI/2, true); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.4.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.4.worker.js index 8bd028b0bd1..9174641c20d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.4.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.4.worker.js @@ -13,22 +13,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 150; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.arc(-50, 50, 100, 0, -Math.PI/2, true); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 150; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.arc(-50, 50, 100, 0, -Math.PI/2, true); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.5.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.5.html index bd7e54af3b9..968a1c58c08 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.5.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.5.html @@ -17,22 +17,22 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 200; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.arc(300, 0, 100, 0, 5*Math.PI, false); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 200; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.arc(300, 0, 100, 0, 5*Math.PI, false); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.5.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.5.worker.js index 0584590afb3..7f40e4341ab 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.5.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.shape.5.worker.js @@ -13,22 +13,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 200; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.arc(300, 0, 100, 0, 5*Math.PI, false); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 200; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.arc(300, 0, 100, 0, 5*Math.PI, false); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.1.html index ddf200c88b5..ced1207a9b3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.1.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, true); -ctx.stroke(); -_assertPixel(canvas, 50,20, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, true); + ctx.stroke(); + _assertPixel(canvas, 50,20, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.1.worker.js index c56d25c70ba..e9abf086e0c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.1.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, true); -ctx.stroke(); -_assertPixel(canvas, 50,20, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, true); + ctx.stroke(); + _assertPixel(canvas, 50,20, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.2.html index 0a9e0c782a6..4948b10f2fa 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.2.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, false); -ctx.stroke(); -_assertPixel(canvas, 50,20, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, false); + ctx.stroke(); + _assertPixel(canvas, 50,20, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.2.worker.js index 5db75de2a26..5e9c51e5e3f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.2.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, false); -ctx.stroke(); -_assertPixel(canvas, 50,20, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, false); + ctx.stroke(); + _assertPixel(canvas, 50,20, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.3.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.3.html index df1e45480d4..c4036fc06e7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.3.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, true); -ctx.stroke(); -_assertPixel(canvas, 50,20, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, true); + ctx.stroke(); + _assertPixel(canvas, 50,20, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.3.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.3.worker.js index 0c984884c9a..ad72fbd0aff 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.3.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.3.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, true); -ctx.stroke(); -_assertPixel(canvas, 50,20, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, true); + ctx.stroke(); + _assertPixel(canvas, 50,20, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.4.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.4.html index 8afa122c7c2..392f00e652f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.4.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.4.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, false); -ctx.stroke(); -_assertPixel(canvas, 50,20, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, false); + ctx.stroke(); + _assertPixel(canvas, 50,20, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.4.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.4.worker.js index 3158528f657..15d799209c3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.4.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.twopie.4.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, false); -ctx.stroke(); -_assertPixel(canvas, 50,20, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, false); + ctx.stroke(); + _assertPixel(canvas, 50,20, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.1.html index f26162f2238..5757ab3ddf7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.1.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.arc(50, 25, 50, 0, 0, true); -ctx.stroke(); -_assertPixel(canvas, 50,20, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.arc(50, 25, 50, 0, 0, true); + ctx.stroke(); + _assertPixel(canvas, 50,20, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.1.worker.js index efb137a92af..5a6d35f6915 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.1.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.arc(50, 25, 50, 0, 0, true); -ctx.stroke(); -_assertPixel(canvas, 50,20, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.arc(50, 25, 50, 0, 0, true); + ctx.stroke(); + _assertPixel(canvas, 50,20, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.2.html index f2eda4b8a2d..69f8472443a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.2.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.arc(50, 25, 50, 0, 0, false); -ctx.stroke(); -_assertPixel(canvas, 50,20, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.arc(50, 25, 50, 0, 0, false); + ctx.stroke(); + _assertPixel(canvas, 50,20, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.2.worker.js index 28f4f3759af..a285462fc06 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zero.2.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.arc(50, 25, 50, 0, 0, false); -ctx.stroke(); -_assertPixel(canvas, 50,20, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.arc(50, 25, 50, 0, 0, false); + ctx.stroke(); + _assertPixel(canvas, 50,20, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zeroradius.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zeroradius.html index 2d56e369b89..7303b7dc1c6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zeroradius.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zeroradius.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00' -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arc(200, 25, 0, 0, Math.PI, true); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00' + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arc(200, 25, 0, 0, Math.PI, true); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zeroradius.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zeroradius.worker.js index c57046ab94d..183acc1bbbb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zeroradius.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arc.zeroradius.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00' -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arc(200, 25, 0, 0, Math.PI, true); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00' + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arc(200, 25, 0, 0, Math.PI, true); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.1.html index 58b26356991..e7558d628fb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.1.html @@ -17,27 +17,30 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(0, 25, 50, 1000, 1); -ctx.lineTo(100, 25); -ctx.stroke(); -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.arcTo(50, 25, 100, 25, 1); -ctx.stroke(); -_assertPixel(canvas, 50,1, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 50,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(0, 25, 50, 1000, 1); + ctx.lineTo(100, 25); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.arcTo(50, 25, 100, 25, 1); + ctx.stroke(); + + _assertPixel(canvas, 50,1, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 50,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.1.worker.js index 44926712fcf..80a74c6d911 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.1.worker.js @@ -13,27 +13,29 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(0, 25, 50, 1000, 1); -ctx.lineTo(100, 25); -ctx.stroke(); -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.arcTo(50, 25, 100, 25, 1); -ctx.stroke(); -_assertPixel(canvas, 50,1, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 50,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(0, 25, 50, 1000, 1); + ctx.lineTo(100, 25); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.arcTo(50, 25, 100, 25, 1); + ctx.stroke(); + + _assertPixel(canvas, 50,1, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 50,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.2.html index d85e310c852..18ac31524d1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.2.html @@ -17,19 +17,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(100, 25, 100, 25, 1); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(100, 25, 100, 25, 1); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.2.worker.js index c8b336a494e..a35ffe6977a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.coincide.2.worker.js @@ -13,19 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(100, 25, 100, 25, 1); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(100, 25, 100, 25, 1); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.1.html index 5531ca62ae0..b9bcc7b2380 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.1.html @@ -17,24 +17,27 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(100, 25, 200, 25, 1); -ctx.stroke(); -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(-100, 25); -ctx.arcTo(0, 25, 100, 25, 1); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(100, 25, 200, 25, 1); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(-100, 25); + ctx.arcTo(0, 25, 100, 25, 1); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.1.worker.js index 3864a311db3..a814b1af070 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.1.worker.js @@ -13,24 +13,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(100, 25, 200, 25, 1); -ctx.stroke(); -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(-100, 25); -ctx.arcTo(0, 25, 100, 25, 1); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(100, 25, 200, 25, 1); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(-100, 25); + ctx.arcTo(0, 25, 100, 25, 1); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.2.html index a78d626ef0a..f51a7af206a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.2.html @@ -17,24 +17,27 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(100, 25, 10, 25, 1); -ctx.stroke(); -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 25); -ctx.arcTo(200, 25, 110, 25, 1); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(100, 25, 10, 25, 1); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 25); + ctx.arcTo(200, 25, 110, 25, 1); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.2.worker.js index 6f4c2aa8c65..ba9a75ed4e6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.2.worker.js @@ -13,24 +13,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(100, 25, 10, 25, 1); -ctx.stroke(); -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 25); -ctx.arcTo(200, 25, 110, 25, 1); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(100, 25, 10, 25, 1); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 25); + ctx.arcTo(200, 25, 110, 25, 1); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.3.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.3.html index f2d52e42417..568d0f8f2b6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.3.html @@ -17,28 +17,32 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(100, 25, -100, 25, 1); -ctx.stroke(); -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 25); -ctx.arcTo(200, 25, 0, 25, 1); -ctx.stroke(); -ctx.beginPath(); -ctx.moveTo(-100, 25); -ctx.arcTo(0, 25, -200, 25, 1); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(100, 25, -100, 25, 1); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 25); + ctx.arcTo(200, 25, 0, 25, 1); + ctx.stroke(); + + ctx.beginPath(); + ctx.moveTo(-100, 25); + ctx.arcTo(0, 25, -200, 25, 1); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.3.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.3.worker.js index 2d152b0d83f..8087909cb7c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.3.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.collinear.3.worker.js @@ -13,28 +13,31 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(100, 25, -100, 25, 1); -ctx.stroke(); -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 25); -ctx.arcTo(200, 25, 0, 25, 1); -ctx.stroke(); -ctx.beginPath(); -ctx.moveTo(-100, 25); -ctx.arcTo(0, 25, -200, 25, 1); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(100, 25, -100, 25, 1); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 25); + ctx.arcTo(200, 25, 0, 25, 1); + ctx.stroke(); + + ctx.beginPath(); + ctx.moveTo(-100, 25); + ctx.arcTo(0, 25, -200, 25, 1); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.1.html index 81dc7b1bd81..ec1bd0399dc 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.1.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.arcTo(100, 50, 200, 50, 0.1); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.arcTo(100, 50, 200, 50, 0.1); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.1.worker.js index 99354ac735a..74d71b6253f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.1.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.arcTo(100, 50, 200, 50, 0.1); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.arcTo(100, 50, 200, 50, 0.1); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.2.html index 43c9aec2941..60ee458524e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.2.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.arcTo(0, 25, 50, 250, 0.1); // adds (x1,y1), draws nothing -ctx.lineTo(100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.arcTo(0, 25, 50, 250, 0.1); // adds (x1,y1), draws nothing + ctx.lineTo(100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.2.worker.js index aad3d006c99..76790925afb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.ensuresubpath.2.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.arcTo(0, 25, 50, 250, 0.1); // adds (x1,y1), draws nothing -ctx.lineTo(100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.arcTo(0, 25, 50, 250, 0.1); // adds (x1,y1), draws nothing + ctx.lineTo(100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.negative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.negative.html index 59cf9739777..c35e293a6fa 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.negative.html @@ -17,11 +17,13 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.arcTo(0, 0, 0, 0, -1); }); -t.done(); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.arcTo(0, 0, 0, 0, -1); }); + var path = new Path2D(); + assert_throws_dom("INDEX_SIZE_ERR", function() { path.arcTo(10, 10, 20, 20, -5); }); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.negative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.negative.worker.js index 60813e88bc3..104e7a63873 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.negative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.negative.worker.js @@ -13,11 +13,12 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.arcTo(0, 0, 0, 0, -1); }); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.arcTo(0, 0, 0, 0, -1); }); + var path = new Path2D(); + assert_throws_dom("INDEX_SIZE_ERR", function() { path.arcTo(10, 10, 20, 20, -5); }); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.nonfinite.html index 982ad4a9648..9d2256d79c9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.nonfinite.html @@ -17,59 +17,59 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.arcTo(Infinity, 50, 0, 50, 0); -ctx.arcTo(-Infinity, 50, 0, 50, 0); -ctx.arcTo(NaN, 50, 0, 50, 0); -ctx.arcTo(0, Infinity, 0, 50, 0); -ctx.arcTo(0, -Infinity, 0, 50, 0); -ctx.arcTo(0, NaN, 0, 50, 0); -ctx.arcTo(0, 50, Infinity, 50, 0); -ctx.arcTo(0, 50, -Infinity, 50, 0); -ctx.arcTo(0, 50, NaN, 50, 0); -ctx.arcTo(0, 50, 0, Infinity, 0); -ctx.arcTo(0, 50, 0, -Infinity, 0); -ctx.arcTo(0, 50, 0, NaN, 0); -ctx.arcTo(0, 50, 0, 50, Infinity); -ctx.arcTo(0, 50, 0, 50, -Infinity); -ctx.arcTo(0, 50, 0, 50, NaN); -ctx.arcTo(Infinity, Infinity, 0, 50, 0); -ctx.arcTo(Infinity, Infinity, Infinity, 50, 0); -ctx.arcTo(Infinity, Infinity, Infinity, Infinity, 0); -ctx.arcTo(Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.arcTo(Infinity, Infinity, Infinity, 50, Infinity); -ctx.arcTo(Infinity, Infinity, 0, Infinity, 0); -ctx.arcTo(Infinity, Infinity, 0, Infinity, Infinity); -ctx.arcTo(Infinity, Infinity, 0, 50, Infinity); -ctx.arcTo(Infinity, 50, Infinity, 50, 0); -ctx.arcTo(Infinity, 50, Infinity, Infinity, 0); -ctx.arcTo(Infinity, 50, Infinity, Infinity, Infinity); -ctx.arcTo(Infinity, 50, Infinity, 50, Infinity); -ctx.arcTo(Infinity, 50, 0, Infinity, 0); -ctx.arcTo(Infinity, 50, 0, Infinity, Infinity); -ctx.arcTo(Infinity, 50, 0, 50, Infinity); -ctx.arcTo(0, Infinity, Infinity, 50, 0); -ctx.arcTo(0, Infinity, Infinity, Infinity, 0); -ctx.arcTo(0, Infinity, Infinity, Infinity, Infinity); -ctx.arcTo(0, Infinity, Infinity, 50, Infinity); -ctx.arcTo(0, Infinity, 0, Infinity, 0); -ctx.arcTo(0, Infinity, 0, Infinity, Infinity); -ctx.arcTo(0, Infinity, 0, 50, Infinity); -ctx.arcTo(0, 50, Infinity, Infinity, 0); -ctx.arcTo(0, 50, Infinity, Infinity, Infinity); -ctx.arcTo(0, 50, Infinity, 50, Infinity); -ctx.arcTo(0, 50, 0, Infinity, Infinity); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); -t.done(); + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.arcTo(Infinity, 50, 0, 50, 0); + ctx.arcTo(-Infinity, 50, 0, 50, 0); + ctx.arcTo(NaN, 50, 0, 50, 0); + ctx.arcTo(0, Infinity, 0, 50, 0); + ctx.arcTo(0, -Infinity, 0, 50, 0); + ctx.arcTo(0, NaN, 0, 50, 0); + ctx.arcTo(0, 50, Infinity, 50, 0); + ctx.arcTo(0, 50, -Infinity, 50, 0); + ctx.arcTo(0, 50, NaN, 50, 0); + ctx.arcTo(0, 50, 0, Infinity, 0); + ctx.arcTo(0, 50, 0, -Infinity, 0); + ctx.arcTo(0, 50, 0, NaN, 0); + ctx.arcTo(0, 50, 0, 50, Infinity); + ctx.arcTo(0, 50, 0, 50, -Infinity); + ctx.arcTo(0, 50, 0, 50, NaN); + ctx.arcTo(Infinity, Infinity, 0, 50, 0); + ctx.arcTo(Infinity, Infinity, Infinity, 50, 0); + ctx.arcTo(Infinity, Infinity, Infinity, Infinity, 0); + ctx.arcTo(Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.arcTo(Infinity, Infinity, Infinity, 50, Infinity); + ctx.arcTo(Infinity, Infinity, 0, Infinity, 0); + ctx.arcTo(Infinity, Infinity, 0, Infinity, Infinity); + ctx.arcTo(Infinity, Infinity, 0, 50, Infinity); + ctx.arcTo(Infinity, 50, Infinity, 50, 0); + ctx.arcTo(Infinity, 50, Infinity, Infinity, 0); + ctx.arcTo(Infinity, 50, Infinity, Infinity, Infinity); + ctx.arcTo(Infinity, 50, Infinity, 50, Infinity); + ctx.arcTo(Infinity, 50, 0, Infinity, 0); + ctx.arcTo(Infinity, 50, 0, Infinity, Infinity); + ctx.arcTo(Infinity, 50, 0, 50, Infinity); + ctx.arcTo(0, Infinity, Infinity, 50, 0); + ctx.arcTo(0, Infinity, Infinity, Infinity, 0); + ctx.arcTo(0, Infinity, Infinity, Infinity, Infinity); + ctx.arcTo(0, Infinity, Infinity, 50, Infinity); + ctx.arcTo(0, Infinity, 0, Infinity, 0); + ctx.arcTo(0, Infinity, 0, Infinity, Infinity); + ctx.arcTo(0, Infinity, 0, 50, Infinity); + ctx.arcTo(0, 50, Infinity, Infinity, 0); + ctx.arcTo(0, 50, Infinity, Infinity, Infinity); + ctx.arcTo(0, 50, Infinity, 50, Infinity); + ctx.arcTo(0, 50, 0, Infinity, Infinity); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.nonfinite.worker.js index 6aa674fc90d..1d2c913cfe4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.nonfinite.worker.js @@ -13,59 +13,58 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.arcTo(Infinity, 50, 0, 50, 0); -ctx.arcTo(-Infinity, 50, 0, 50, 0); -ctx.arcTo(NaN, 50, 0, 50, 0); -ctx.arcTo(0, Infinity, 0, 50, 0); -ctx.arcTo(0, -Infinity, 0, 50, 0); -ctx.arcTo(0, NaN, 0, 50, 0); -ctx.arcTo(0, 50, Infinity, 50, 0); -ctx.arcTo(0, 50, -Infinity, 50, 0); -ctx.arcTo(0, 50, NaN, 50, 0); -ctx.arcTo(0, 50, 0, Infinity, 0); -ctx.arcTo(0, 50, 0, -Infinity, 0); -ctx.arcTo(0, 50, 0, NaN, 0); -ctx.arcTo(0, 50, 0, 50, Infinity); -ctx.arcTo(0, 50, 0, 50, -Infinity); -ctx.arcTo(0, 50, 0, 50, NaN); -ctx.arcTo(Infinity, Infinity, 0, 50, 0); -ctx.arcTo(Infinity, Infinity, Infinity, 50, 0); -ctx.arcTo(Infinity, Infinity, Infinity, Infinity, 0); -ctx.arcTo(Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.arcTo(Infinity, Infinity, Infinity, 50, Infinity); -ctx.arcTo(Infinity, Infinity, 0, Infinity, 0); -ctx.arcTo(Infinity, Infinity, 0, Infinity, Infinity); -ctx.arcTo(Infinity, Infinity, 0, 50, Infinity); -ctx.arcTo(Infinity, 50, Infinity, 50, 0); -ctx.arcTo(Infinity, 50, Infinity, Infinity, 0); -ctx.arcTo(Infinity, 50, Infinity, Infinity, Infinity); -ctx.arcTo(Infinity, 50, Infinity, 50, Infinity); -ctx.arcTo(Infinity, 50, 0, Infinity, 0); -ctx.arcTo(Infinity, 50, 0, Infinity, Infinity); -ctx.arcTo(Infinity, 50, 0, 50, Infinity); -ctx.arcTo(0, Infinity, Infinity, 50, 0); -ctx.arcTo(0, Infinity, Infinity, Infinity, 0); -ctx.arcTo(0, Infinity, Infinity, Infinity, Infinity); -ctx.arcTo(0, Infinity, Infinity, 50, Infinity); -ctx.arcTo(0, Infinity, 0, Infinity, 0); -ctx.arcTo(0, Infinity, 0, Infinity, Infinity); -ctx.arcTo(0, Infinity, 0, 50, Infinity); -ctx.arcTo(0, 50, Infinity, Infinity, 0); -ctx.arcTo(0, 50, Infinity, Infinity, Infinity); -ctx.arcTo(0, 50, Infinity, 50, Infinity); -ctx.arcTo(0, 50, 0, Infinity, Infinity); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.arcTo(Infinity, 50, 0, 50, 0); + ctx.arcTo(-Infinity, 50, 0, 50, 0); + ctx.arcTo(NaN, 50, 0, 50, 0); + ctx.arcTo(0, Infinity, 0, 50, 0); + ctx.arcTo(0, -Infinity, 0, 50, 0); + ctx.arcTo(0, NaN, 0, 50, 0); + ctx.arcTo(0, 50, Infinity, 50, 0); + ctx.arcTo(0, 50, -Infinity, 50, 0); + ctx.arcTo(0, 50, NaN, 50, 0); + ctx.arcTo(0, 50, 0, Infinity, 0); + ctx.arcTo(0, 50, 0, -Infinity, 0); + ctx.arcTo(0, 50, 0, NaN, 0); + ctx.arcTo(0, 50, 0, 50, Infinity); + ctx.arcTo(0, 50, 0, 50, -Infinity); + ctx.arcTo(0, 50, 0, 50, NaN); + ctx.arcTo(Infinity, Infinity, 0, 50, 0); + ctx.arcTo(Infinity, Infinity, Infinity, 50, 0); + ctx.arcTo(Infinity, Infinity, Infinity, Infinity, 0); + ctx.arcTo(Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.arcTo(Infinity, Infinity, Infinity, 50, Infinity); + ctx.arcTo(Infinity, Infinity, 0, Infinity, 0); + ctx.arcTo(Infinity, Infinity, 0, Infinity, Infinity); + ctx.arcTo(Infinity, Infinity, 0, 50, Infinity); + ctx.arcTo(Infinity, 50, Infinity, 50, 0); + ctx.arcTo(Infinity, 50, Infinity, Infinity, 0); + ctx.arcTo(Infinity, 50, Infinity, Infinity, Infinity); + ctx.arcTo(Infinity, 50, Infinity, 50, Infinity); + ctx.arcTo(Infinity, 50, 0, Infinity, 0); + ctx.arcTo(Infinity, 50, 0, Infinity, Infinity); + ctx.arcTo(Infinity, 50, 0, 50, Infinity); + ctx.arcTo(0, Infinity, Infinity, 50, 0); + ctx.arcTo(0, Infinity, Infinity, Infinity, 0); + ctx.arcTo(0, Infinity, Infinity, Infinity, Infinity); + ctx.arcTo(0, Infinity, Infinity, 50, Infinity); + ctx.arcTo(0, Infinity, 0, Infinity, 0); + ctx.arcTo(0, Infinity, 0, Infinity, Infinity); + ctx.arcTo(0, Infinity, 0, 50, Infinity); + ctx.arcTo(0, 50, Infinity, Infinity, 0); + ctx.arcTo(0, 50, Infinity, Infinity, Infinity); + ctx.arcTo(0, 50, Infinity, 50, Infinity); + ctx.arcTo(0, 50, 0, Infinity, Infinity); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.scale.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.scale.html index 7139455bda4..26dfa640ff8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.scale.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.scale.html @@ -17,29 +17,31 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 50); -ctx.translate(100, 0); -ctx.scale(0.1, 1); -ctx.arcTo(50, 50, 50, 0, 50); -ctx.lineTo(-1000, 0); -ctx.fill(); -_assertPixel(canvas, 0,0, 0,255,0,255); -_assertPixel(canvas, 50,0, 0,255,0,255); -_assertPixel(canvas, 99,0, 0,255,0,255); -_assertPixel(canvas, 0,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 99,25, 0,255,0,255); -_assertPixel(canvas, 0,49, 0,255,0,255); -_assertPixel(canvas, 50,49, 0,255,0,255); -_assertPixel(canvas, 99,49, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 50); + ctx.translate(100, 0); + ctx.scale(0.1, 1); + ctx.arcTo(50, 50, 50, 0, 50); + ctx.lineTo(-1000, 0); + ctx.fill(); + + _assertPixel(canvas, 0,0, 0,255,0,255); + _assertPixel(canvas, 50,0, 0,255,0,255); + _assertPixel(canvas, 99,0, 0,255,0,255); + _assertPixel(canvas, 0,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 99,25, 0,255,0,255); + _assertPixel(canvas, 0,49, 0,255,0,255); + _assertPixel(canvas, 50,49, 0,255,0,255); + _assertPixel(canvas, 99,49, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.scale.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.scale.worker.js index b06c8f935c5..dc41e6d92dd 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.scale.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.scale.worker.js @@ -13,29 +13,30 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 50); -ctx.translate(100, 0); -ctx.scale(0.1, 1); -ctx.arcTo(50, 50, 50, 0, 50); -ctx.lineTo(-1000, 0); -ctx.fill(); -_assertPixel(canvas, 0,0, 0,255,0,255); -_assertPixel(canvas, 50,0, 0,255,0,255); -_assertPixel(canvas, 99,0, 0,255,0,255); -_assertPixel(canvas, 0,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 99,25, 0,255,0,255); -_assertPixel(canvas, 0,49, 0,255,0,255); -_assertPixel(canvas, 50,49, 0,255,0,255); -_assertPixel(canvas, 99,49, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 50); + ctx.translate(100, 0); + ctx.scale(0.1, 1); + ctx.arcTo(50, 50, 50, 0, 50); + ctx.lineTo(-1000, 0); + ctx.fill(); + + _assertPixel(canvas, 0,0, 0,255,0,255); + _assertPixel(canvas, 50,0, 0,255,0,255); + _assertPixel(canvas, 99,0, 0,255,0,255); + _assertPixel(canvas, 0,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 99,25, 0,255,0,255); + _assertPixel(canvas, 0,49, 0,255,0,255); + _assertPixel(canvas, 50,49, 0,255,0,255); + _assertPixel(canvas, 99,49, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve1.html index 659b02ceed4..f7d10dd61a3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve1.html @@ -17,40 +17,44 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var tol = 1.5; // tolerance to avoid antialiasing artifacts -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 10; -ctx.beginPath(); -ctx.moveTo(10, 25); -ctx.arcTo(75, 25, 75, 60, 20); -ctx.stroke(); -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.rect(10, 20, 45, 10); -ctx.moveTo(80, 45); -ctx.arc(55, 45, 25+tol, 0, -Math.PI/2, true); -ctx.arc(55, 45, 15-tol, -Math.PI/2, 0, false); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 55,19, 0,255,0,255); -_assertPixel(canvas, 55,20, 0,255,0,255); -_assertPixel(canvas, 55,21, 0,255,0,255); -_assertPixel(canvas, 64,22, 0,255,0,255); -_assertPixel(canvas, 65,21, 0,255,0,255); -_assertPixel(canvas, 72,28, 0,255,0,255); -_assertPixel(canvas, 73,27, 0,255,0,255); -_assertPixel(canvas, 78,36, 0,255,0,255); -_assertPixel(canvas, 79,35, 0,255,0,255); -_assertPixel(canvas, 80,44, 0,255,0,255); -_assertPixel(canvas, 80,45, 0,255,0,255); -_assertPixel(canvas, 80,46, 0,255,0,255); -_assertPixel(canvas, 65,45, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + var tol = 1.5; // tolerance to avoid antialiasing artifacts + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 10; + ctx.beginPath(); + ctx.moveTo(10, 25); + ctx.arcTo(75, 25, 75, 60, 20); + ctx.stroke(); + + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.rect(10, 20, 45, 10); + ctx.moveTo(80, 45); + ctx.arc(55, 45, 25+tol, 0, -Math.PI/2, true); + ctx.arc(55, 45, 15-tol, -Math.PI/2, 0, false); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 55,19, 0,255,0,255); + _assertPixel(canvas, 55,20, 0,255,0,255); + _assertPixel(canvas, 55,21, 0,255,0,255); + _assertPixel(canvas, 64,22, 0,255,0,255); + _assertPixel(canvas, 65,21, 0,255,0,255); + _assertPixel(canvas, 72,28, 0,255,0,255); + _assertPixel(canvas, 73,27, 0,255,0,255); + _assertPixel(canvas, 78,36, 0,255,0,255); + _assertPixel(canvas, 79,35, 0,255,0,255); + _assertPixel(canvas, 80,44, 0,255,0,255); + _assertPixel(canvas, 80,45, 0,255,0,255); + _assertPixel(canvas, 80,46, 0,255,0,255); + _assertPixel(canvas, 65,45, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve1.worker.js index 5223b55abb2..c7e61ab5761 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve1.worker.js @@ -13,40 +13,43 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var tol = 1.5; // tolerance to avoid antialiasing artifacts -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 10; -ctx.beginPath(); -ctx.moveTo(10, 25); -ctx.arcTo(75, 25, 75, 60, 20); -ctx.stroke(); -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.rect(10, 20, 45, 10); -ctx.moveTo(80, 45); -ctx.arc(55, 45, 25+tol, 0, -Math.PI/2, true); -ctx.arc(55, 45, 15-tol, -Math.PI/2, 0, false); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 55,19, 0,255,0,255); -_assertPixel(canvas, 55,20, 0,255,0,255); -_assertPixel(canvas, 55,21, 0,255,0,255); -_assertPixel(canvas, 64,22, 0,255,0,255); -_assertPixel(canvas, 65,21, 0,255,0,255); -_assertPixel(canvas, 72,28, 0,255,0,255); -_assertPixel(canvas, 73,27, 0,255,0,255); -_assertPixel(canvas, 78,36, 0,255,0,255); -_assertPixel(canvas, 79,35, 0,255,0,255); -_assertPixel(canvas, 80,44, 0,255,0,255); -_assertPixel(canvas, 80,45, 0,255,0,255); -_assertPixel(canvas, 80,46, 0,255,0,255); -_assertPixel(canvas, 65,45, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var tol = 1.5; // tolerance to avoid antialiasing artifacts + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 10; + ctx.beginPath(); + ctx.moveTo(10, 25); + ctx.arcTo(75, 25, 75, 60, 20); + ctx.stroke(); + + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.rect(10, 20, 45, 10); + ctx.moveTo(80, 45); + ctx.arc(55, 45, 25+tol, 0, -Math.PI/2, true); + ctx.arc(55, 45, 15-tol, -Math.PI/2, 0, false); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 55,19, 0,255,0,255); + _assertPixel(canvas, 55,20, 0,255,0,255); + _assertPixel(canvas, 55,21, 0,255,0,255); + _assertPixel(canvas, 64,22, 0,255,0,255); + _assertPixel(canvas, 65,21, 0,255,0,255); + _assertPixel(canvas, 72,28, 0,255,0,255); + _assertPixel(canvas, 73,27, 0,255,0,255); + _assertPixel(canvas, 78,36, 0,255,0,255); + _assertPixel(canvas, 79,35, 0,255,0,255); + _assertPixel(canvas, 80,44, 0,255,0,255); + _assertPixel(canvas, 80,45, 0,255,0,255); + _assertPixel(canvas, 80,46, 0,255,0,255); + _assertPixel(canvas, 65,45, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve2.html index 02ab6c1437d..1a023322b21 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve2.html @@ -17,39 +17,43 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var tol = 1.5; // tolerance to avoid antialiasing artifacts -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.rect(10, 20, 45, 10); -ctx.moveTo(80, 45); -ctx.arc(55, 45, 25-tol, 0, -Math.PI/2, true); -ctx.arc(55, 45, 15+tol, -Math.PI/2, 0, false); -ctx.fill(); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 10; -ctx.beginPath(); -ctx.moveTo(10, 25); -ctx.arcTo(75, 25, 75, 60, 20); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 55,19, 0,255,0,255); -_assertPixel(canvas, 55,20, 0,255,0,255); -_assertPixel(canvas, 55,21, 0,255,0,255); -_assertPixel(canvas, 64,22, 0,255,0,255); -_assertPixel(canvas, 65,21, 0,255,0,255); -_assertPixel(canvas, 72,28, 0,255,0,255); -_assertPixel(canvas, 73,27, 0,255,0,255); -_assertPixel(canvas, 78,36, 0,255,0,255); -_assertPixel(canvas, 79,35, 0,255,0,255); -_assertPixel(canvas, 80,44, 0,255,0,255); -_assertPixel(canvas, 80,45, 0,255,0,255); -_assertPixel(canvas, 80,46, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + var tol = 1.5; // tolerance to avoid antialiasing artifacts + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.rect(10, 20, 45, 10); + ctx.moveTo(80, 45); + ctx.arc(55, 45, 25-tol, 0, -Math.PI/2, true); + ctx.arc(55, 45, 15+tol, -Math.PI/2, 0, false); + ctx.fill(); + + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 10; + ctx.beginPath(); + ctx.moveTo(10, 25); + ctx.arcTo(75, 25, 75, 60, 20); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 55,19, 0,255,0,255); + _assertPixel(canvas, 55,20, 0,255,0,255); + _assertPixel(canvas, 55,21, 0,255,0,255); + _assertPixel(canvas, 64,22, 0,255,0,255); + _assertPixel(canvas, 65,21, 0,255,0,255); + _assertPixel(canvas, 72,28, 0,255,0,255); + _assertPixel(canvas, 73,27, 0,255,0,255); + _assertPixel(canvas, 78,36, 0,255,0,255); + _assertPixel(canvas, 79,35, 0,255,0,255); + _assertPixel(canvas, 80,44, 0,255,0,255); + _assertPixel(canvas, 80,45, 0,255,0,255); + _assertPixel(canvas, 80,46, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve2.worker.js index f06c2cdc33f..f00e506f30e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.curve2.worker.js @@ -13,39 +13,42 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var tol = 1.5; // tolerance to avoid antialiasing artifacts -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.beginPath(); -ctx.rect(10, 20, 45, 10); -ctx.moveTo(80, 45); -ctx.arc(55, 45, 25-tol, 0, -Math.PI/2, true); -ctx.arc(55, 45, 15+tol, -Math.PI/2, 0, false); -ctx.fill(); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 10; -ctx.beginPath(); -ctx.moveTo(10, 25); -ctx.arcTo(75, 25, 75, 60, 20); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 55,19, 0,255,0,255); -_assertPixel(canvas, 55,20, 0,255,0,255); -_assertPixel(canvas, 55,21, 0,255,0,255); -_assertPixel(canvas, 64,22, 0,255,0,255); -_assertPixel(canvas, 65,21, 0,255,0,255); -_assertPixel(canvas, 72,28, 0,255,0,255); -_assertPixel(canvas, 73,27, 0,255,0,255); -_assertPixel(canvas, 78,36, 0,255,0,255); -_assertPixel(canvas, 79,35, 0,255,0,255); -_assertPixel(canvas, 80,44, 0,255,0,255); -_assertPixel(canvas, 80,45, 0,255,0,255); -_assertPixel(canvas, 80,46, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var tol = 1.5; // tolerance to avoid antialiasing artifacts + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#f00'; + ctx.beginPath(); + ctx.rect(10, 20, 45, 10); + ctx.moveTo(80, 45); + ctx.arc(55, 45, 25-tol, 0, -Math.PI/2, true); + ctx.arc(55, 45, 15+tol, -Math.PI/2, 0, false); + ctx.fill(); + + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 10; + ctx.beginPath(); + ctx.moveTo(10, 25); + ctx.arcTo(75, 25, 75, 60, 20); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 55,19, 0,255,0,255); + _assertPixel(canvas, 55,20, 0,255,0,255); + _assertPixel(canvas, 55,21, 0,255,0,255); + _assertPixel(canvas, 64,22, 0,255,0,255); + _assertPixel(canvas, 65,21, 0,255,0,255); + _assertPixel(canvas, 72,28, 0,255,0,255); + _assertPixel(canvas, 73,27, 0,255,0,255); + _assertPixel(canvas, 78,36, 0,255,0,255); + _assertPixel(canvas, 79,35, 0,255,0,255); + _assertPixel(canvas, 80,44, 0,255,0,255); + _assertPixel(canvas, 80,45, 0,255,0,255); + _assertPixel(canvas, 80,46, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.end.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.end.html index 0871c39157f..3f8af61215c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.end.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.end.html @@ -17,23 +17,24 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.moveTo(-100, -100); -ctx.arcTo(-100, 25, 200, 25, 10); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.moveTo(-100, -100); + ctx.arcTo(-100, 25, 200, 25, 10); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.end.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.end.worker.js index f3addb0a0c7..20cc956a449 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.end.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.end.worker.js @@ -13,23 +13,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.moveTo(-100, -100); -ctx.arcTo(-100, 25, 200, 25, 10); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.moveTo(-100, -100); + ctx.arcTo(-100, 25, 200, 25, 10); + ctx.stroke(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.start.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.start.html index 5040462ada3..a426a19d8a2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.start.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.start.html @@ -17,23 +17,24 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(200, 25, 200, 50, 10); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(200, 25, 200, 50, 10); + ctx.stroke(); + + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.start.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.start.worker.js index 36706d600e2..cebf27a821b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.start.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.shape.start.worker.js @@ -13,23 +13,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(200, 25, 200, 50, 10); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(200, 25, 200, 50, 10); + ctx.stroke(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.transformation.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.transformation.html index bea6374ea4e..842210138a6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.transformation.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.transformation.html @@ -17,28 +17,30 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 50); -ctx.translate(100, 0); -ctx.arcTo(50, 50, 50, 0, 50); -ctx.lineTo(-100, 0); -ctx.fill(); -_assertPixel(canvas, 0,0, 0,255,0,255); -_assertPixel(canvas, 50,0, 0,255,0,255); -_assertPixel(canvas, 99,0, 0,255,0,255); -_assertPixel(canvas, 0,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 99,25, 0,255,0,255); -_assertPixel(canvas, 0,49, 0,255,0,255); -_assertPixel(canvas, 50,49, 0,255,0,255); -_assertPixel(canvas, 99,49, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 50); + ctx.translate(100, 0); + ctx.arcTo(50, 50, 50, 0, 50); + ctx.lineTo(-100, 0); + ctx.fill(); + + _assertPixel(canvas, 0,0, 0,255,0,255); + _assertPixel(canvas, 50,0, 0,255,0,255); + _assertPixel(canvas, 99,0, 0,255,0,255); + _assertPixel(canvas, 0,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 99,25, 0,255,0,255); + _assertPixel(canvas, 0,49, 0,255,0,255); + _assertPixel(canvas, 50,49, 0,255,0,255); + _assertPixel(canvas, 99,49, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.transformation.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.transformation.worker.js index 925140b6750..585a500079f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.transformation.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.transformation.worker.js @@ -13,28 +13,29 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 50); -ctx.translate(100, 0); -ctx.arcTo(50, 50, 50, 0, 50); -ctx.lineTo(-100, 0); -ctx.fill(); -_assertPixel(canvas, 0,0, 0,255,0,255); -_assertPixel(canvas, 50,0, 0,255,0,255); -_assertPixel(canvas, 99,0, 0,255,0,255); -_assertPixel(canvas, 0,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 99,25, 0,255,0,255); -_assertPixel(canvas, 0,49, 0,255,0,255); -_assertPixel(canvas, 50,49, 0,255,0,255); -_assertPixel(canvas, 99,49, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 50); + ctx.translate(100, 0); + ctx.arcTo(50, 50, 50, 0, 50); + ctx.lineTo(-100, 0); + ctx.fill(); + + _assertPixel(canvas, 0,0, 0,255,0,255); + _assertPixel(canvas, 50,0, 0,255,0,255); + _assertPixel(canvas, 99,0, 0,255,0,255); + _assertPixel(canvas, 0,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 99,25, 0,255,0,255); + _assertPixel(canvas, 0,49, 0,255,0,255); + _assertPixel(canvas, 50,49, 0,255,0,255); + _assertPixel(canvas, 99,49, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.1.html index 00541a938b6..a367385551b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.1.html @@ -17,24 +17,27 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(100, 25, 100, 100, 0); -ctx.stroke(); -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(0, -25); -ctx.arcTo(50, -25, 50, 50, 0); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(100, 25, 100, 100, 0); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(0, -25); + ctx.arcTo(50, -25, 50, 50, 0); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.1.worker.js index cee6d1c5baa..8f6d979a55a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.1.worker.js @@ -13,24 +13,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(100, 25, 100, 100, 0); -ctx.stroke(); -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(0, -25); -ctx.arcTo(50, -25, 50, 50, 0); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(100, 25, 100, 100, 0); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(0, -25); + ctx.arcTo(50, -25, 50, 50, 0); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.2.html index e10fe5ce95e..87ab4e13dea 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.2.html @@ -17,24 +17,27 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(100, 25, -100, 25, 0); -ctx.stroke(); -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 25); -ctx.arcTo(200, 25, 50, 25, 0); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(100, 25, -100, 25, 0); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 25); + ctx.arcTo(200, 25, 50, 25, 0); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.2.worker.js index d0cc4a1484a..0a459763254 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.arcTo.zero.2.worker.js @@ -13,24 +13,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.strokeStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.arcTo(100, 25, -100, 25, 0); -ctx.stroke(); -ctx.strokeStyle = '#f00'; -ctx.beginPath(); -ctx.moveTo(100, 25); -ctx.arcTo(200, 25, 50, 25, 0); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.strokeStyle = '#0f0'; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.arcTo(100, 25, -100, 25, 0); + ctx.stroke(); + + ctx.strokeStyle = '#f00'; + ctx.beginPath(); + ctx.moveTo(100, 25); + ctx.arcTo(200, 25, 50, 25, 0); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.beginPath.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.beginPath.html index 8b9c4cdc7ac..b2043d604d9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.beginPath.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.beginPath.html @@ -17,17 +17,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.rect(0, 0, 100, 50); -ctx.beginPath(); -ctx.fillStyle = '#f00'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.rect(0, 0, 100, 50); + ctx.beginPath(); + ctx.fillStyle = '#f00'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.beginPath.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.beginPath.worker.js index 18b81afa5c4..35a4acc84d6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.beginPath.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.beginPath.worker.js @@ -13,17 +13,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.rect(0, 0, 100, 50); -ctx.beginPath(); -ctx.fillStyle = '#f00'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.rect(0, 0, 100, 50); + ctx.beginPath(); + ctx.fillStyle = '#f00'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.basic.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.basic.html index 69172874322..099919060be 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.basic.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.bezierCurveTo(100, 25, 100, 25, 100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.bezierCurveTo(100, 25, 100, 25, 100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.basic.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.basic.worker.js index a365372c9e6..e7c86a08f96 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.basic.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.basic.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.bezierCurveTo(100, 25, 100, 25, 100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.bezierCurveTo(100, 25, 100, 25, 100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.html index 67dd771fcbe..6a11d1bfbb0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.bezierCurveTo(100, 50, 200, 50, 200, 50); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 95,45, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.bezierCurveTo(100, 50, 200, 50, 200, 50); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 95,45, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.worker.js index beb275ba378..d6ef6f3f1b8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.bezierCurveTo(100, 50, 200, 50, 200, 50); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 95,45, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.bezierCurveTo(100, 50, 200, 50, 200, 50); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 95,45, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.html index d4f99e1e2a4..d2afd19f666 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.bezierCurveTo(0, 25, 100, 25, 100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 5,45, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.bezierCurveTo(0, 25, 100, 25, 100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 5,45, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.worker.js index 7176dba0787..6860e60f4ac 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.bezierCurveTo(0, 25, 100, 25, 100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 5,45, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.bezierCurveTo(0, 25, 100, 25, 100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 5,45, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.nonfinite.html index 4c5abfbdc1e..b49e2f43f3f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.nonfinite.html @@ -17,93 +17,93 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, 50); -ctx.bezierCurveTo(-Infinity, 50, 0, 50, 0, 50); -ctx.bezierCurveTo(NaN, 50, 0, 50, 0, 50); -ctx.bezierCurveTo(0, Infinity, 0, 50, 0, 50); -ctx.bezierCurveTo(0, -Infinity, 0, 50, 0, 50); -ctx.bezierCurveTo(0, NaN, 0, 50, 0, 50); -ctx.bezierCurveTo(0, 50, Infinity, 50, 0, 50); -ctx.bezierCurveTo(0, 50, -Infinity, 50, 0, 50); -ctx.bezierCurveTo(0, 50, NaN, 50, 0, 50); -ctx.bezierCurveTo(0, 50, 0, Infinity, 0, 50); -ctx.bezierCurveTo(0, 50, 0, -Infinity, 0, 50); -ctx.bezierCurveTo(0, 50, 0, NaN, 0, 50); -ctx.bezierCurveTo(0, 50, 0, 50, Infinity, 50); -ctx.bezierCurveTo(0, 50, 0, 50, -Infinity, 50); -ctx.bezierCurveTo(0, 50, 0, 50, NaN, 50); -ctx.bezierCurveTo(0, 50, 0, 50, 0, Infinity); -ctx.bezierCurveTo(0, 50, 0, 50, 0, -Infinity); -ctx.bezierCurveTo(0, 50, 0, 50, 0, NaN); -ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, 50); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, 50); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, 50); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, 50); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, 50); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, 50); -ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, 50); -ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, 50); -ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, Infinity); -ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, 50); -ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, 50); -ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, 50); -ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, Infinity); -ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, 50); -ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, Infinity); -ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, 50); -ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, 50); -ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, Infinity); -ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, 50); -ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, Infinity); -ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, 50); -ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, 50); -ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, 50); -ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, Infinity); -ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, 50); -ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, Infinity); -ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, Infinity); -ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, 50); -ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, 50); -ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, Infinity); -ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, 50); -ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, Infinity); -ctx.bezierCurveTo(0, Infinity, 0, 50, 0, Infinity); -ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, 50); -ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, 50); -ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, Infinity); -ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, 50); -ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, Infinity); -ctx.bezierCurveTo(0, 50, Infinity, 50, 0, Infinity); -ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, 50); -ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(0, 50, 0, Infinity, 0, Infinity); -ctx.bezierCurveTo(0, 50, 0, 50, Infinity, Infinity); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); -t.done(); + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, 50); + ctx.bezierCurveTo(-Infinity, 50, 0, 50, 0, 50); + ctx.bezierCurveTo(NaN, 50, 0, 50, 0, 50); + ctx.bezierCurveTo(0, Infinity, 0, 50, 0, 50); + ctx.bezierCurveTo(0, -Infinity, 0, 50, 0, 50); + ctx.bezierCurveTo(0, NaN, 0, 50, 0, 50); + ctx.bezierCurveTo(0, 50, Infinity, 50, 0, 50); + ctx.bezierCurveTo(0, 50, -Infinity, 50, 0, 50); + ctx.bezierCurveTo(0, 50, NaN, 50, 0, 50); + ctx.bezierCurveTo(0, 50, 0, Infinity, 0, 50); + ctx.bezierCurveTo(0, 50, 0, -Infinity, 0, 50); + ctx.bezierCurveTo(0, 50, 0, NaN, 0, 50); + ctx.bezierCurveTo(0, 50, 0, 50, Infinity, 50); + ctx.bezierCurveTo(0, 50, 0, 50, -Infinity, 50); + ctx.bezierCurveTo(0, 50, 0, 50, NaN, 50); + ctx.bezierCurveTo(0, 50, 0, 50, 0, Infinity); + ctx.bezierCurveTo(0, 50, 0, 50, 0, -Infinity); + ctx.bezierCurveTo(0, 50, 0, 50, 0, NaN); + ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, 50); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, 50); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, 50); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, 50); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, 50); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, 50); + ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, 50); + ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, 50); + ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, Infinity); + ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, 50); + ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, 50); + ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, 50); + ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, Infinity); + ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, 50); + ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, Infinity); + ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, 50); + ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, 50); + ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, Infinity); + ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, 50); + ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, Infinity); + ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, 50); + ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, 50); + ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, 50); + ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, Infinity); + ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, 50); + ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, Infinity); + ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, Infinity); + ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, 50); + ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, 50); + ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, Infinity); + ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, 50); + ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, Infinity); + ctx.bezierCurveTo(0, Infinity, 0, 50, 0, Infinity); + ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, 50); + ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, 50); + ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, Infinity); + ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, 50); + ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, Infinity); + ctx.bezierCurveTo(0, 50, Infinity, 50, 0, Infinity); + ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, 50); + ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(0, 50, 0, Infinity, 0, Infinity); + ctx.bezierCurveTo(0, 50, 0, 50, Infinity, Infinity); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.nonfinite.worker.js index 752cb1b0ab8..7eaf278f6cb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.nonfinite.worker.js @@ -13,93 +13,92 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, 50); -ctx.bezierCurveTo(-Infinity, 50, 0, 50, 0, 50); -ctx.bezierCurveTo(NaN, 50, 0, 50, 0, 50); -ctx.bezierCurveTo(0, Infinity, 0, 50, 0, 50); -ctx.bezierCurveTo(0, -Infinity, 0, 50, 0, 50); -ctx.bezierCurveTo(0, NaN, 0, 50, 0, 50); -ctx.bezierCurveTo(0, 50, Infinity, 50, 0, 50); -ctx.bezierCurveTo(0, 50, -Infinity, 50, 0, 50); -ctx.bezierCurveTo(0, 50, NaN, 50, 0, 50); -ctx.bezierCurveTo(0, 50, 0, Infinity, 0, 50); -ctx.bezierCurveTo(0, 50, 0, -Infinity, 0, 50); -ctx.bezierCurveTo(0, 50, 0, NaN, 0, 50); -ctx.bezierCurveTo(0, 50, 0, 50, Infinity, 50); -ctx.bezierCurveTo(0, 50, 0, 50, -Infinity, 50); -ctx.bezierCurveTo(0, 50, 0, 50, NaN, 50); -ctx.bezierCurveTo(0, 50, 0, 50, 0, Infinity); -ctx.bezierCurveTo(0, 50, 0, 50, 0, -Infinity); -ctx.bezierCurveTo(0, 50, 0, 50, 0, NaN); -ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, 50); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, 50); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, 50); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, 50); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, 50); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, 50); -ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, 50); -ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, 50); -ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, Infinity); -ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, 50); -ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, 50); -ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, 50); -ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, Infinity); -ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, 50); -ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, Infinity); -ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, 50); -ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, 50); -ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, Infinity); -ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, 50); -ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, Infinity); -ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, Infinity); -ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, 50); -ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, 50); -ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, 50); -ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, Infinity); -ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, 50); -ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, Infinity); -ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, Infinity); -ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, 50); -ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, 50); -ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, Infinity); -ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, 50); -ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, Infinity); -ctx.bezierCurveTo(0, Infinity, 0, 50, 0, Infinity); -ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, 50); -ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, 50); -ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, Infinity); -ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, 50); -ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, Infinity); -ctx.bezierCurveTo(0, 50, Infinity, 50, 0, Infinity); -ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, 50); -ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, Infinity); -ctx.bezierCurveTo(0, 50, 0, Infinity, 0, Infinity); -ctx.bezierCurveTo(0, 50, 0, 50, Infinity, Infinity); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, 50); + ctx.bezierCurveTo(-Infinity, 50, 0, 50, 0, 50); + ctx.bezierCurveTo(NaN, 50, 0, 50, 0, 50); + ctx.bezierCurveTo(0, Infinity, 0, 50, 0, 50); + ctx.bezierCurveTo(0, -Infinity, 0, 50, 0, 50); + ctx.bezierCurveTo(0, NaN, 0, 50, 0, 50); + ctx.bezierCurveTo(0, 50, Infinity, 50, 0, 50); + ctx.bezierCurveTo(0, 50, -Infinity, 50, 0, 50); + ctx.bezierCurveTo(0, 50, NaN, 50, 0, 50); + ctx.bezierCurveTo(0, 50, 0, Infinity, 0, 50); + ctx.bezierCurveTo(0, 50, 0, -Infinity, 0, 50); + ctx.bezierCurveTo(0, 50, 0, NaN, 0, 50); + ctx.bezierCurveTo(0, 50, 0, 50, Infinity, 50); + ctx.bezierCurveTo(0, 50, 0, 50, -Infinity, 50); + ctx.bezierCurveTo(0, 50, 0, 50, NaN, 50); + ctx.bezierCurveTo(0, 50, 0, 50, 0, Infinity); + ctx.bezierCurveTo(0, 50, 0, 50, 0, -Infinity); + ctx.bezierCurveTo(0, 50, 0, 50, 0, NaN); + ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, 50); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, 50); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, 50); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, 50); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, 50); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, 50); + ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, 50); + ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, 50); + ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, Infinity); + ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, 50); + ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, 50); + ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, 50); + ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, Infinity); + ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, 50); + ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, Infinity); + ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, 50); + ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, 50); + ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, Infinity); + ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, 50); + ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, Infinity); + ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, Infinity); + ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, 50); + ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, 50); + ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, 50); + ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, Infinity); + ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, 50); + ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, Infinity); + ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, Infinity); + ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, 50); + ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, 50); + ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, Infinity); + ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, 50); + ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, Infinity); + ctx.bezierCurveTo(0, Infinity, 0, 50, 0, Infinity); + ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, 50); + ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, 50); + ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, Infinity); + ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, 50); + ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, Infinity); + ctx.bezierCurveTo(0, 50, Infinity, 50, 0, Infinity); + ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, 50); + ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, Infinity); + ctx.bezierCurveTo(0, 50, 0, Infinity, 0, Infinity); + ctx.bezierCurveTo(0, 50, 0, 50, Infinity, Infinity); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.scaled.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.scaled.html index 2608237a6c0..10a085e9dec 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.scaled.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.scaled.html @@ -17,24 +17,24 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.scale(1000, 1000); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 0.055; -ctx.beginPath(); -ctx.moveTo(-2, 3.1); -ctx.bezierCurveTo(-2, -1, 2.1, -1, 2.1, 3.1); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(1000, 1000); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 0.055; + ctx.beginPath(); + ctx.moveTo(-2, 3.1); + ctx.bezierCurveTo(-2, -1, 2.1, -1, 2.1, 3.1); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.scaled.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.scaled.worker.js index 641cccf4b46..5098fe83eb6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.scaled.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.scaled.worker.js @@ -13,24 +13,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.scale(1000, 1000); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 0.055; -ctx.beginPath(); -ctx.moveTo(-2, 3.1); -ctx.bezierCurveTo(-2, -1, 2.1, -1, 2.1, 3.1); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(1000, 1000); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 0.055; + ctx.beginPath(); + ctx.moveTo(-2, 3.1); + ctx.bezierCurveTo(-2, -1, 2.1, -1, 2.1, 3.1); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.shape.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.shape.html index 5f8f8daac2a..fc6b9273e04 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.shape.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.shape.html @@ -17,23 +17,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 55; -ctx.beginPath(); -ctx.moveTo(-2000, 3100); -ctx.bezierCurveTo(-2000, -1000, 2100, -1000, 2100, 3100); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 55; + ctx.beginPath(); + ctx.moveTo(-2000, 3100); + ctx.bezierCurveTo(-2000, -1000, 2100, -1000, 2100, 3100); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.shape.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.shape.worker.js index ee42982f2f6..58f601c5d5b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.shape.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.bezierCurveTo.shape.worker.js @@ -13,23 +13,22 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 55; -ctx.beginPath(); -ctx.moveTo(-2000, 3100); -ctx.bezierCurveTo(-2000, -1000, 2100, -1000, 2100, 3100); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 55; + ctx.beginPath(); + ctx.moveTo(-2000, 3100); + ctx.bezierCurveTo(-2000, -1000, 2100, -1000, 2100, 3100); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.1.html index cca53f6be6d..e90be3d73f0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.1.html @@ -17,18 +17,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(0, 0, 100, 50); -ctx.clip(); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.beginPath(); + ctx.rect(0, 0, 100, 50); + ctx.clip(); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.1.worker.js index cf5a5d3b63f..708608e1e00 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.1.worker.js @@ -13,18 +13,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(0, 0, 100, 50); -ctx.clip(); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.rect(0, 0, 100, 50); + ctx.clip(); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.2.html index d5ef79bf1a1..6426ba2d838 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.2.html @@ -17,18 +17,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(-100, 0, 100, 50); -ctx.clip(); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.beginPath(); + ctx.rect(-100, 0, 100, 50); + ctx.clip(); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.2.worker.js index bad906d4b73..1ec28b6205e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.basic.2.worker.js @@ -13,18 +13,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(-100, 0, 100, 50); -ctx.clip(); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.rect(-100, 0, 100, 50); + ctx.clip(); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.empty.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.empty.html index d74fff0d81f..30e0d6cba48 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.empty.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.empty.html @@ -17,17 +17,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.clip(); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.beginPath(); + ctx.clip(); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.empty.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.empty.worker.js index 51beb6426a5..3f91a7e2e78 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.empty.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.empty.worker.js @@ -13,17 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.clip(); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.clip(); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.intersect.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.intersect.html index 3b269ce102d..94607f6d926 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.intersect.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.intersect.html @@ -17,21 +17,24 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(0, 0, 50, 50); -ctx.clip(); -ctx.beginPath(); -ctx.rect(50, 0, 50, 50) -ctx.clip(); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.beginPath(); + ctx.rect(0, 0, 50, 50); + ctx.clip(); + ctx.beginPath(); + ctx.rect(50, 0, 50, 50) + ctx.clip(); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.intersect.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.intersect.worker.js index 791c1bb7848..8c0fcb68bd3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.intersect.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.intersect.worker.js @@ -13,21 +13,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(0, 0, 50, 50); -ctx.clip(); -ctx.beginPath(); -ctx.rect(50, 0, 50, 50) -ctx.clip(); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.rect(0, 0, 50, 50); + ctx.clip(); + ctx.beginPath(); + ctx.rect(50, 0, 50, 50) + ctx.clip(); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.unaffected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.unaffected.html index a0ba94fb8a4..e9b69282af9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.unaffected.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.unaffected.html @@ -17,22 +17,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 0); -ctx.lineTo(0, 50); -ctx.lineTo(100, 50); -ctx.lineTo(100, 0); -ctx.clip(); -ctx.lineTo(0, 0); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + + ctx.beginPath(); + ctx.moveTo(0, 0); + ctx.lineTo(0, 50); + ctx.lineTo(100, 50); + ctx.lineTo(100, 0); + ctx.clip(); + + ctx.lineTo(0, 0); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.unaffected.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.unaffected.worker.js index e03257021c4..d65a421d336 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.unaffected.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.unaffected.worker.js @@ -13,22 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.beginPath(); -ctx.moveTo(0, 0); -ctx.lineTo(0, 50); -ctx.lineTo(100, 50); -ctx.lineTo(100, 0); -ctx.clip(); -ctx.lineTo(0, 0); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + + ctx.beginPath(); + ctx.moveTo(0, 0); + ctx.lineTo(0, 50); + ctx.lineTo(100, 50); + ctx.lineTo(100, 0); + ctx.clip(); + + ctx.lineTo(0, 0); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.1.html index 9a20e493db2..2fd7c1abbf9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.1.html @@ -17,26 +17,29 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.moveTo(-10, -10); -ctx.lineTo(110, -10); -ctx.lineTo(110, 60); -ctx.lineTo(-10, 60); -ctx.lineTo(-10, -10); -ctx.lineTo(0, 0); -ctx.lineTo(0, 50); -ctx.lineTo(100, 50); -ctx.lineTo(100, 0); -ctx.clip(); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.beginPath(); + ctx.moveTo(-10, -10); + ctx.lineTo(110, -10); + ctx.lineTo(110, 60); + ctx.lineTo(-10, 60); + ctx.lineTo(-10, -10); + ctx.lineTo(0, 0); + ctx.lineTo(0, 50); + ctx.lineTo(100, 50); + ctx.lineTo(100, 0); + ctx.clip(); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.1.worker.js index 02565fcc8b8..aa89fd55c3d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.1.worker.js @@ -13,26 +13,28 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.moveTo(-10, -10); -ctx.lineTo(110, -10); -ctx.lineTo(110, 60); -ctx.lineTo(-10, 60); -ctx.lineTo(-10, -10); -ctx.lineTo(0, 0); -ctx.lineTo(0, 50); -ctx.lineTo(100, 50); -ctx.lineTo(100, 0); -ctx.clip(); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.moveTo(-10, -10); + ctx.lineTo(110, -10); + ctx.lineTo(110, 60); + ctx.lineTo(-10, 60); + ctx.lineTo(-10, -10); + ctx.lineTo(0, 0); + ctx.lineTo(0, 50); + ctx.lineTo(100, 50); + ctx.lineTo(100, 0); + ctx.clip(); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.2.html index 1f223a3b38f..eed064f84ec 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.2.html @@ -17,29 +17,33 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.moveTo(-10, -10); -ctx.lineTo(110, -10); -ctx.lineTo(110, 60); -ctx.lineTo(-10, 60); -ctx.lineTo(-10, -10); -ctx.clip(); -ctx.beginPath(); -ctx.moveTo(0, 0); -ctx.lineTo(0, 50); -ctx.lineTo(100, 50); -ctx.lineTo(100, 0); -ctx.lineTo(0, 0); -ctx.clip(); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.beginPath(); + ctx.moveTo(-10, -10); + ctx.lineTo(110, -10); + ctx.lineTo(110, 60); + ctx.lineTo(-10, 60); + ctx.lineTo(-10, -10); + ctx.clip(); + + ctx.beginPath(); + ctx.moveTo(0, 0); + ctx.lineTo(0, 50); + ctx.lineTo(100, 50); + ctx.lineTo(100, 0); + ctx.lineTo(0, 0); + ctx.clip(); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.2.worker.js index e7e8c5039de..5c9cac6bb60 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.clip.winding.2.worker.js @@ -13,29 +13,32 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.moveTo(-10, -10); -ctx.lineTo(110, -10); -ctx.lineTo(110, 60); -ctx.lineTo(-10, 60); -ctx.lineTo(-10, -10); -ctx.clip(); -ctx.beginPath(); -ctx.moveTo(0, 0); -ctx.lineTo(0, 50); -ctx.lineTo(100, 50); -ctx.lineTo(100, 0); -ctx.lineTo(0, 0); -ctx.clip(); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.beginPath(); + ctx.moveTo(-10, -10); + ctx.lineTo(110, -10); + ctx.lineTo(110, 60); + ctx.lineTo(-10, 60); + ctx.lineTo(-10, -10); + ctx.clip(); + + ctx.beginPath(); + ctx.moveTo(0, 0); + ctx.lineTo(0, 50); + ctx.lineTo(100, 50); + ctx.lineTo(100, 0); + ctx.lineTo(0, 0); + ctx.clip(); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.empty.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.empty.html index 50ea865696c..c7596a8f1cc 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.empty.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.empty.html @@ -17,16 +17,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.closePath(); -ctx.fillStyle = '#f00'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.closePath(); + ctx.fillStyle = '#f00'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.empty.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.empty.worker.js index c06ce48635f..c9a4030e681 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.empty.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.empty.worker.js @@ -13,16 +13,15 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.closePath(); -ctx.fillStyle = '#f00'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.closePath(); + ctx.fillStyle = '#f00'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.newline.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.newline.html index dca2e01b7e9..771f3d3ca08 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.newline.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.newline.html @@ -17,21 +17,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.moveTo(-100, 25); -ctx.lineTo(-100, -100); -ctx.lineTo(200, -100); -ctx.lineTo(200, 25); -ctx.closePath(); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.moveTo(-100, 25); + ctx.lineTo(-100, -100); + ctx.lineTo(200, -100); + ctx.lineTo(200, 25); + ctx.closePath(); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.newline.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.newline.worker.js index 5d27821f551..4dff932086e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.newline.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.newline.worker.js @@ -13,21 +13,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.moveTo(-100, 25); -ctx.lineTo(-100, -100); -ctx.lineTo(200, -100); -ctx.lineTo(200, 25); -ctx.closePath(); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.moveTo(-100, 25); + ctx.lineTo(-100, -100); + ctx.lineTo(200, -100); + ctx.lineTo(200, 25); + ctx.closePath(); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.nextpoint.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.nextpoint.html index 4cf02d2b644..3dffdeaf5b9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.nextpoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.nextpoint.html @@ -17,20 +17,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.moveTo(-100, 25); -ctx.lineTo(-100, -1000); -ctx.closePath(); -ctx.lineTo(1000, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.moveTo(-100, 25); + ctx.lineTo(-100, -1000); + ctx.closePath(); + ctx.lineTo(1000, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.nextpoint.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.nextpoint.worker.js index 8a84ce7d83c..86d931b6714 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.nextpoint.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.closePath.nextpoint.worker.js @@ -13,20 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.moveTo(-100, 25); -ctx.lineTo(-100, -1000); -ctx.closePath(); -ctx.lineTo(1000, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.moveTo(-100, 25); + ctx.lineTo(-100, -1000); + ctx.closePath(); + ctx.lineTo(1000, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.ellipse.basics.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.ellipse.basics.html new file mode 100644 index 00000000000..d664c455931 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.ellipse.basics.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.ellipse.basics</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.ellipse.basics</h1> +<p class="desc">Verify canvas throws error when drawing ellipse with negative radii.</p> + + +<script> +var t = async_test("Verify canvas throws error when drawing ellipse with negative radii."); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.ellipse(10, 10, 10, 5, 0, 0, 1, false); + ctx.ellipse(10, 10, 10, 0, 0, 0, 1, false); + ctx.ellipse(10, 10, -0, 5, 0, 0, 1, false); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.ellipse(10, 10, -2, 5, 0, 0, 1, false); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.ellipse(10, 10, 0, -1.5, 0, 0, 1, false); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.ellipse(10, 10, -2, -5, 0, 0, 1, false); }); + ctx.ellipse(80, 0, 10, 4294967277, Math.PI / -84, -Math.PI / 2147483436, false); + t.done(); + +}); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.ellipse.basics.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.ellipse.basics.worker.js new file mode 100644 index 00000000000..60f3e9a6731 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.ellipse.basics.worker.js @@ -0,0 +1,28 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.ellipse.basics +// Description:Verify canvas throws error when drawing ellipse with negative radii. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify canvas throws error when drawing ellipse with negative radii."); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.ellipse(10, 10, 10, 5, 0, 0, 1, false); + ctx.ellipse(10, 10, 10, 0, 0, 0, 1, false); + ctx.ellipse(10, 10, -0, 5, 0, 0, 1, false); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.ellipse(10, 10, -2, 5, 0, 0, 1, false); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.ellipse(10, 10, 0, -1.5, 0, 0, 1, false); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.ellipse(10, 10, -2, -5, 0, 0, 1, false); }); + ctx.ellipse(80, 0, 10, 4294967277, Math.PI / -84, -Math.PI / 2147483436, false); + t.done(); +}); +done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.basic.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.basic.html index 72e755f7e8f..6f8fd51de79 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.basic.html @@ -17,19 +17,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.basic.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.basic.worker.js index 2c63e1ec97f..9dad73b579b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.basic.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.basic.worker.js @@ -13,19 +13,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.unaffected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.unaffected.html index 9d545125398..706e38d176f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.unaffected.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.unaffected.html @@ -17,22 +17,24 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#00f'; -ctx.fillRect(0, 0, 100, 50); -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.lineTo(100, 50); -ctx.fillStyle = '#f00'; -ctx.fill(); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 90,10, 0,255,0,255); -_assertPixel(canvas, 10,40, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#00f'; + ctx.fillRect(0, 0, 100, 50); + + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.lineTo(100, 50); + ctx.fillStyle = '#f00'; + ctx.fill(); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + _assertPixel(canvas, 90,10, 0,255,0,255); + _assertPixel(canvas, 10,40, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.unaffected.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.unaffected.worker.js index 6b4aa9244f3..b6d79828668 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.unaffected.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.closed.unaffected.worker.js @@ -13,22 +13,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#00f'; -ctx.fillRect(0, 0, 100, 50); -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.lineTo(100, 50); -ctx.fillStyle = '#f00'; -ctx.fill(); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 90,10, 0,255,0,255); -_assertPixel(canvas, 10,40, 0,255,0,255); -t.done(); + ctx.fillStyle = '#00f'; + ctx.fillRect(0, 0, 100, 50); + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.lineTo(100, 50); + ctx.fillStyle = '#f00'; + ctx.fill(); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + _assertPixel(canvas, 90,10, 0,255,0,255); + _assertPixel(canvas, 10,40, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.overlap.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.overlap.html index 6eaf88edcde..da936fab579 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.overlap.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.overlap.html @@ -17,18 +17,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#000'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = 'rgba(0, 255, 0, 0.5)'; -ctx.rect(0, 0, 100, 50); -ctx.closePath(); -ctx.rect(10, 10, 80, 30); -ctx.fill(); -_assertPixelApprox(canvas, 50,25, 0,127,0,255, 1); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#000'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = 'rgba(0, 255, 0, 0.5)'; + ctx.rect(0, 0, 100, 50); + ctx.closePath(); + ctx.rect(10, 10, 80, 30); + ctx.fill(); + + _assertPixelApprox(canvas, 50,25, 0,127,0,255, 1); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.overlap.png b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.overlap.png Binary files differnew file mode 100644 index 00000000000..e2a35d48d4c --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.overlap.png diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.overlap.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.overlap.worker.js index e1d64fe40bf..8f30cc7af2c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.overlap.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.overlap.worker.js @@ -13,18 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#000'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = 'rgba(0, 255, 0, 0.5)'; -ctx.rect(0, 0, 100, 50); -ctx.closePath(); -ctx.rect(10, 10, 80, 30); -ctx.fill(); -_assertPixelApprox(canvas, 50,25, 0,127,0,255, 1); -t.done(); + ctx.fillStyle = '#000'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = 'rgba(0, 255, 0, 0.5)'; + ctx.rect(0, 0, 100, 50); + ctx.closePath(); + ctx.rect(10, 10, 80, 30); + ctx.fill(); + + _assertPixelApprox(canvas, 50,25, 0,127,0,255, 1); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.add.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.add.html index c5f64924da3..40845a4a778 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.add.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.add.html @@ -17,24 +17,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.moveTo(-10, -10); -ctx.lineTo(110, -10); -ctx.lineTo(110, 60); -ctx.lineTo(-10, 60); -ctx.lineTo(-10, -10); -ctx.lineTo(0, 0); -ctx.lineTo(100, 0); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.moveTo(-10, -10); + ctx.lineTo(110, -10); + ctx.lineTo(110, 60); + ctx.lineTo(-10, 60); + ctx.lineTo(-10, -10); + ctx.lineTo(0, 0); + ctx.lineTo(100, 0); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.add.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.add.worker.js index b40e1706239..cdbfc7f3a49 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.add.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.add.worker.js @@ -13,24 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.moveTo(-10, -10); -ctx.lineTo(110, -10); -ctx.lineTo(110, 60); -ctx.lineTo(-10, 60); -ctx.lineTo(-10, -10); -ctx.lineTo(0, 0); -ctx.lineTo(100, 0); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.moveTo(-10, -10); + ctx.lineTo(110, -10); + ctx.lineTo(110, 60); + ctx.lineTo(-10, 60); + ctx.lineTo(-10, -10); + ctx.lineTo(0, 0); + ctx.lineTo(100, 0); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.1.html index 4f553f2bc32..e0f9c838b15 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.1.html @@ -17,24 +17,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.moveTo(-10, -10); -ctx.lineTo(110, -10); -ctx.lineTo(110, 60); -ctx.lineTo(-10, 60); -ctx.lineTo(-10, -10); -ctx.lineTo(0, 0); -ctx.lineTo(0, 50); -ctx.lineTo(100, 50); -ctx.lineTo(100, 0); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#f00'; + ctx.moveTo(-10, -10); + ctx.lineTo(110, -10); + ctx.lineTo(110, 60); + ctx.lineTo(-10, 60); + ctx.lineTo(-10, -10); + ctx.lineTo(0, 0); + ctx.lineTo(0, 50); + ctx.lineTo(100, 50); + ctx.lineTo(100, 0); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.1.worker.js index a8209154139..3d6a1660def 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.1.worker.js @@ -13,24 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.moveTo(-10, -10); -ctx.lineTo(110, -10); -ctx.lineTo(110, 60); -ctx.lineTo(-10, 60); -ctx.lineTo(-10, -10); -ctx.lineTo(0, 0); -ctx.lineTo(0, 50); -ctx.lineTo(100, 50); -ctx.lineTo(100, 0); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.moveTo(-10, -10); + ctx.lineTo(110, -10); + ctx.lineTo(110, 60); + ctx.lineTo(-10, 60); + ctx.lineTo(-10, -10); + ctx.lineTo(0, 0); + ctx.lineTo(0, 50); + ctx.lineTo(100, 50); + ctx.lineTo(100, 0); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.2.html index cf1fcaa2d44..c7de03ae084 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.2.html @@ -17,23 +17,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.moveTo(-10, -10); -ctx.lineTo(110, -10); -ctx.lineTo(110, 60); -ctx.lineTo(-10, 60); -ctx.moveTo(0, 0); -ctx.lineTo(0, 50); -ctx.lineTo(100, 50); -ctx.lineTo(100, 0); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#f00'; + ctx.moveTo(-10, -10); + ctx.lineTo(110, -10); + ctx.lineTo(110, 60); + ctx.lineTo(-10, 60); + ctx.moveTo(0, 0); + ctx.lineTo(0, 50); + ctx.lineTo(100, 50); + ctx.lineTo(100, 0); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.2.worker.js index 2c83a41ae8e..0e8b4c79a59 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.2.worker.js @@ -13,23 +13,24 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.moveTo(-10, -10); -ctx.lineTo(110, -10); -ctx.lineTo(110, 60); -ctx.lineTo(-10, 60); -ctx.moveTo(0, 0); -ctx.lineTo(0, 50); -ctx.lineTo(100, 50); -ctx.lineTo(100, 0); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.moveTo(-10, -10); + ctx.lineTo(110, -10); + ctx.lineTo(110, 60); + ctx.lineTo(-10, 60); + ctx.moveTo(0, 0); + ctx.lineTo(0, 50); + ctx.lineTo(100, 50); + ctx.lineTo(100, 0); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.3.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.3.html index ffcbfe2518d..3d12380357d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.3.html @@ -17,29 +17,31 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.moveTo(-10, -10); -ctx.lineTo(110, -10); -ctx.lineTo(110, 60); -ctx.lineTo(-10, 60); -ctx.lineTo(-10, -10); -ctx.lineTo(-20, -20); -ctx.lineTo(120, -20); -ctx.lineTo(120, 70); -ctx.lineTo(-20, 70); -ctx.lineTo(-20, -20); -ctx.lineTo(0, 0); -ctx.lineTo(0, 50); -ctx.lineTo(100, 50); -ctx.lineTo(100, 0); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.moveTo(-10, -10); + ctx.lineTo(110, -10); + ctx.lineTo(110, 60); + ctx.lineTo(-10, 60); + ctx.lineTo(-10, -10); + ctx.lineTo(-20, -20); + ctx.lineTo(120, -20); + ctx.lineTo(120, 70); + ctx.lineTo(-20, 70); + ctx.lineTo(-20, -20); + ctx.lineTo(0, 0); + ctx.lineTo(0, 50); + ctx.lineTo(100, 50); + ctx.lineTo(100, 0); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.3.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.3.worker.js index ca5510abf21..6c9f07c76a8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.3.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.fill.winding.subtract.3.worker.js @@ -13,29 +13,30 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.moveTo(-10, -10); -ctx.lineTo(110, -10); -ctx.lineTo(110, 60); -ctx.lineTo(-10, 60); -ctx.lineTo(-10, -10); -ctx.lineTo(-20, -20); -ctx.lineTo(120, -20); -ctx.lineTo(120, 70); -ctx.lineTo(-20, 70); -ctx.lineTo(-20, -20); -ctx.lineTo(0, 0); -ctx.lineTo(0, 50); -ctx.lineTo(100, 50); -ctx.lineTo(100, 0); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.moveTo(-10, -10); + ctx.lineTo(110, -10); + ctx.lineTo(110, 60); + ctx.lineTo(-10, 60); + ctx.lineTo(-10, -10); + ctx.lineTo(-20, -20); + ctx.lineTo(120, -20); + ctx.lineTo(120, 70); + ctx.lineTo(-20, 70); + ctx.lineTo(-20, -20); + ctx.lineTo(0, 0); + ctx.lineTo(0, 50); + ctx.lineTo(100, 50); + ctx.lineTo(100, 0); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.initial.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.initial.html index 35c96cdab5d..e2e02f51423 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.initial.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.initial.html @@ -17,16 +17,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.closePath(); -ctx.fillStyle = '#f00'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.closePath(); + ctx.fillStyle = '#f00'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.initial.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.initial.worker.js index de8597fbc3c..de1a9350329 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.initial.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.initial.worker.js @@ -13,16 +13,15 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.closePath(); -ctx.fillStyle = '#f00'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.closePath(); + ctx.fillStyle = '#f00'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.arc.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.arc.html index fe12f9457af..ccffcd7d76c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.arc.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.arc.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.arc(50, 25, 10, 0, Math.PI, false); -_assertSame(ctx.isPointInPath(50, 10), false, "ctx.isPointInPath(50, 10)", "false"); -_assertSame(ctx.isPointInPath(50, 20), false, "ctx.isPointInPath(50, 20)", "false"); -_assertSame(ctx.isPointInPath(50, 30), true, "ctx.isPointInPath(50, 30)", "true"); -_assertSame(ctx.isPointInPath(50, 40), false, "ctx.isPointInPath(50, 40)", "false"); -_assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); -_assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); -_assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); -_assertSame(ctx.isPointInPath(70, 30), false, "ctx.isPointInPath(70, 30)", "false"); -t.done(); + ctx.arc(50, 25, 10, 0, Math.PI, false); + _assertSame(ctx.isPointInPath(50, 10), false, "ctx.isPointInPath(50, 10)", "false"); + _assertSame(ctx.isPointInPath(50, 20), false, "ctx.isPointInPath(50, 20)", "false"); + _assertSame(ctx.isPointInPath(50, 30), true, "ctx.isPointInPath(50, 30)", "true"); + _assertSame(ctx.isPointInPath(50, 40), false, "ctx.isPointInPath(50, 40)", "false"); + _assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); + _assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); + _assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); + _assertSame(ctx.isPointInPath(70, 30), false, "ctx.isPointInPath(70, 30)", "false"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.arc.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.arc.worker.js index 2803e393256..13510b744f5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.arc.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.arc.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.arc(50, 25, 10, 0, Math.PI, false); -_assertSame(ctx.isPointInPath(50, 10), false, "ctx.isPointInPath(50, 10)", "false"); -_assertSame(ctx.isPointInPath(50, 20), false, "ctx.isPointInPath(50, 20)", "false"); -_assertSame(ctx.isPointInPath(50, 30), true, "ctx.isPointInPath(50, 30)", "true"); -_assertSame(ctx.isPointInPath(50, 40), false, "ctx.isPointInPath(50, 40)", "false"); -_assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); -_assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); -_assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); -_assertSame(ctx.isPointInPath(70, 30), false, "ctx.isPointInPath(70, 30)", "false"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.arc(50, 25, 10, 0, Math.PI, false); + _assertSame(ctx.isPointInPath(50, 10), false, "ctx.isPointInPath(50, 10)", "false"); + _assertSame(ctx.isPointInPath(50, 20), false, "ctx.isPointInPath(50, 20)", "false"); + _assertSame(ctx.isPointInPath(50, 30), true, "ctx.isPointInPath(50, 30)", "true"); + _assertSame(ctx.isPointInPath(50, 40), false, "ctx.isPointInPath(50, 40)", "false"); + _assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); + _assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); + _assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); + _assertSame(ctx.isPointInPath(70, 30), false, "ctx.isPointInPath(70, 30)", "false"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.1.html index 3cd24f54875..7b9673a8120 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.1.html @@ -17,13 +17,13 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.rect(0, 0, 20, 20); -_assertSame(ctx.isPointInPath(10, 10), true, "ctx.isPointInPath(10, 10)", "true"); -_assertSame(ctx.isPointInPath(30, 10), false, "ctx.isPointInPath(30, 10)", "false"); -t.done(); + ctx.rect(0, 0, 20, 20); + _assertSame(ctx.isPointInPath(10, 10), true, "ctx.isPointInPath(10, 10)", "true"); + _assertSame(ctx.isPointInPath(30, 10), false, "ctx.isPointInPath(30, 10)", "false"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.1.worker.js index 93dd86a5f79..f51900ea6bf 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.1.worker.js @@ -13,13 +13,12 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.rect(0, 0, 20, 20); -_assertSame(ctx.isPointInPath(10, 10), true, "ctx.isPointInPath(10, 10)", "true"); -_assertSame(ctx.isPointInPath(30, 10), false, "ctx.isPointInPath(30, 10)", "false"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.rect(0, 0, 20, 20); + _assertSame(ctx.isPointInPath(10, 10), true, "ctx.isPointInPath(10, 10)", "true"); + _assertSame(ctx.isPointInPath(30, 10), false, "ctx.isPointInPath(30, 10)", "false"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.2.html index 42381d3f552..3710dd185d9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.2.html @@ -17,13 +17,13 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.rect(20, 0, 20, 20); -_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); -_assertSame(ctx.isPointInPath(30, 10), true, "ctx.isPointInPath(30, 10)", "true"); -t.done(); + ctx.rect(20, 0, 20, 20); + _assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); + _assertSame(ctx.isPointInPath(30, 10), true, "ctx.isPointInPath(30, 10)", "true"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.2.worker.js index 7dbc5fc6fb2..6024a0dc390 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.2.worker.js @@ -13,13 +13,12 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.rect(20, 0, 20, 20); -_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); -_assertSame(ctx.isPointInPath(30, 10), true, "ctx.isPointInPath(30, 10)", "true"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.rect(20, 0, 20, 20); + _assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); + _assertSame(ctx.isPointInPath(30, 10), true, "ctx.isPointInPath(30, 10)", "true"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.html new file mode 100644 index 00000000000..21cf448de21 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.html @@ -0,0 +1,66 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.isPointInPath.basic</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInPath.basic</h1> +<p class="desc">Verify the winding rule in isPointInPath works for for rect path.</p> + + +<script> +var t = async_test("Verify the winding rule in isPointInPath works for for rect 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 = 200; + canvas.height = 200; + + // Testing default isPointInPath + ctx.beginPath(); + ctx.rect(0, 0, 100, 100); + ctx.rect(25, 25, 50, 50); + _assertSame(ctx.isPointInPath(50, 50), true, "ctx.isPointInPath(50, 50)", "true"); + _assertSame(ctx.isPointInPath(NaN, 50), false, "ctx.isPointInPath(NaN, 50)", "false"); + _assertSame(ctx.isPointInPath(50, NaN), false, "ctx.isPointInPath(50, NaN)", "false"); + + // Testing nonzero isPointInPath + ctx.beginPath(); + ctx.rect(0, 0, 100, 100); + ctx.rect(25, 25, 50, 50); + _assertSame(ctx.isPointInPath(50, 50, 'nonzero'), true, "ctx.isPointInPath(50, 50, 'nonzero')", "true"); + + // Testing evenodd isPointInPath + ctx.beginPath(); + ctx.rect(0, 0, 100, 100); + ctx.rect(25, 25, 50, 50); + _assertSame(ctx.isPointInPath(50, 50, 'evenodd'), false, "ctx.isPointInPath(50, 50, 'evenodd')", "false"); + + // Testing extremely large scale + ctx.save(); + ctx.scale(Number.MAX_VALUE, Number.MAX_VALUE); + ctx.beginPath(); + ctx.rect(-10, -10, 20, 20); + _assertSame(ctx.isPointInPath(0, 0, 'nonzero'), true, "ctx.isPointInPath(0, 0, 'nonzero')", "true"); + _assertSame(ctx.isPointInPath(0, 0, 'evenodd'), true, "ctx.isPointInPath(0, 0, 'evenodd')", "true"); + ctx.restore(); + + // Check with non-invertible ctm. + ctx.save(); + ctx.scale(0, 0); + ctx.beginPath(); + ctx.rect(-10, -10, 20, 20); + _assertSame(ctx.isPointInPath(0, 0, 'nonzero'), false, "ctx.isPointInPath(0, 0, 'nonzero')", "false"); + _assertSame(ctx.isPointInPath(0, 0, 'evenodd'), false, "ctx.isPointInPath(0, 0, 'evenodd')", "false"); + ctx.restore(); + t.done(); + +}); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.worker.js new file mode 100644 index 00000000000..3e2a95c15e5 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.basic.worker.js @@ -0,0 +1,61 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.isPointInPath.basic +// Description:Verify the winding rule in isPointInPath works for for rect path. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify the winding rule in isPointInPath works for for rect 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 = 200; + canvas.height = 200; + + // Testing default isPointInPath + ctx.beginPath(); + ctx.rect(0, 0, 100, 100); + ctx.rect(25, 25, 50, 50); + _assertSame(ctx.isPointInPath(50, 50), true, "ctx.isPointInPath(50, 50)", "true"); + _assertSame(ctx.isPointInPath(NaN, 50), false, "ctx.isPointInPath(NaN, 50)", "false"); + _assertSame(ctx.isPointInPath(50, NaN), false, "ctx.isPointInPath(50, NaN)", "false"); + + // Testing nonzero isPointInPath + ctx.beginPath(); + ctx.rect(0, 0, 100, 100); + ctx.rect(25, 25, 50, 50); + _assertSame(ctx.isPointInPath(50, 50, 'nonzero'), true, "ctx.isPointInPath(50, 50, 'nonzero')", "true"); + + // Testing evenodd isPointInPath + ctx.beginPath(); + ctx.rect(0, 0, 100, 100); + ctx.rect(25, 25, 50, 50); + _assertSame(ctx.isPointInPath(50, 50, 'evenodd'), false, "ctx.isPointInPath(50, 50, 'evenodd')", "false"); + + // Testing extremely large scale + ctx.save(); + ctx.scale(Number.MAX_VALUE, Number.MAX_VALUE); + ctx.beginPath(); + ctx.rect(-10, -10, 20, 20); + _assertSame(ctx.isPointInPath(0, 0, 'nonzero'), true, "ctx.isPointInPath(0, 0, 'nonzero')", "true"); + _assertSame(ctx.isPointInPath(0, 0, 'evenodd'), true, "ctx.isPointInPath(0, 0, 'evenodd')", "true"); + ctx.restore(); + + // Check with non-invertible ctm. + ctx.save(); + ctx.scale(0, 0); + ctx.beginPath(); + ctx.rect(-10, -10, 20, 20); + _assertSame(ctx.isPointInPath(0, 0, 'nonzero'), false, "ctx.isPointInPath(0, 0, 'nonzero')", "false"); + _assertSame(ctx.isPointInPath(0, 0, 'evenodd'), false, "ctx.isPointInPath(0, 0, 'evenodd')", "false"); + ctx.restore(); + t.done(); +}); +done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bezier.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bezier.html index f336fe4c7f6..d348110305e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bezier.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bezier.html @@ -17,32 +17,32 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.moveTo(25, 25); -ctx.bezierCurveTo(50, -50, 50, 100, 75, 25); -_assertSame(ctx.isPointInPath(25, 20), false, "ctx.isPointInPath(25, 20)", "false"); -_assertSame(ctx.isPointInPath(25, 30), false, "ctx.isPointInPath(25, 30)", "false"); -_assertSame(ctx.isPointInPath(30, 20), true, "ctx.isPointInPath(30, 20)", "true"); -_assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); -_assertSame(ctx.isPointInPath(40, 2), false, "ctx.isPointInPath(40, 2)", "false"); -_assertSame(ctx.isPointInPath(40, 20), true, "ctx.isPointInPath(40, 20)", "true"); -_assertSame(ctx.isPointInPath(40, 30), false, "ctx.isPointInPath(40, 30)", "false"); -_assertSame(ctx.isPointInPath(40, 47), false, "ctx.isPointInPath(40, 47)", "false"); -_assertSame(ctx.isPointInPath(45, 20), true, "ctx.isPointInPath(45, 20)", "true"); -_assertSame(ctx.isPointInPath(45, 30), false, "ctx.isPointInPath(45, 30)", "false"); -_assertSame(ctx.isPointInPath(55, 20), false, "ctx.isPointInPath(55, 20)", "false"); -_assertSame(ctx.isPointInPath(55, 30), true, "ctx.isPointInPath(55, 30)", "true"); -_assertSame(ctx.isPointInPath(60, 2), false, "ctx.isPointInPath(60, 2)", "false"); -_assertSame(ctx.isPointInPath(60, 20), false, "ctx.isPointInPath(60, 20)", "false"); -_assertSame(ctx.isPointInPath(60, 30), true, "ctx.isPointInPath(60, 30)", "true"); -_assertSame(ctx.isPointInPath(60, 47), false, "ctx.isPointInPath(60, 47)", "false"); -_assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); -_assertSame(ctx.isPointInPath(70, 30), true, "ctx.isPointInPath(70, 30)", "true"); -_assertSame(ctx.isPointInPath(75, 20), false, "ctx.isPointInPath(75, 20)", "false"); -_assertSame(ctx.isPointInPath(75, 30), false, "ctx.isPointInPath(75, 30)", "false"); -t.done(); + ctx.moveTo(25, 25); + ctx.bezierCurveTo(50, -50, 50, 100, 75, 25); + _assertSame(ctx.isPointInPath(25, 20), false, "ctx.isPointInPath(25, 20)", "false"); + _assertSame(ctx.isPointInPath(25, 30), false, "ctx.isPointInPath(25, 30)", "false"); + _assertSame(ctx.isPointInPath(30, 20), true, "ctx.isPointInPath(30, 20)", "true"); + _assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); + _assertSame(ctx.isPointInPath(40, 2), false, "ctx.isPointInPath(40, 2)", "false"); + _assertSame(ctx.isPointInPath(40, 20), true, "ctx.isPointInPath(40, 20)", "true"); + _assertSame(ctx.isPointInPath(40, 30), false, "ctx.isPointInPath(40, 30)", "false"); + _assertSame(ctx.isPointInPath(40, 47), false, "ctx.isPointInPath(40, 47)", "false"); + _assertSame(ctx.isPointInPath(45, 20), true, "ctx.isPointInPath(45, 20)", "true"); + _assertSame(ctx.isPointInPath(45, 30), false, "ctx.isPointInPath(45, 30)", "false"); + _assertSame(ctx.isPointInPath(55, 20), false, "ctx.isPointInPath(55, 20)", "false"); + _assertSame(ctx.isPointInPath(55, 30), true, "ctx.isPointInPath(55, 30)", "true"); + _assertSame(ctx.isPointInPath(60, 2), false, "ctx.isPointInPath(60, 2)", "false"); + _assertSame(ctx.isPointInPath(60, 20), false, "ctx.isPointInPath(60, 20)", "false"); + _assertSame(ctx.isPointInPath(60, 30), true, "ctx.isPointInPath(60, 30)", "true"); + _assertSame(ctx.isPointInPath(60, 47), false, "ctx.isPointInPath(60, 47)", "false"); + _assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); + _assertSame(ctx.isPointInPath(70, 30), true, "ctx.isPointInPath(70, 30)", "true"); + _assertSame(ctx.isPointInPath(75, 20), false, "ctx.isPointInPath(75, 20)", "false"); + _assertSame(ctx.isPointInPath(75, 30), false, "ctx.isPointInPath(75, 30)", "false"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bezier.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bezier.worker.js index 6017efc286e..894fe5da314 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bezier.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bezier.worker.js @@ -13,32 +13,31 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.moveTo(25, 25); -ctx.bezierCurveTo(50, -50, 50, 100, 75, 25); -_assertSame(ctx.isPointInPath(25, 20), false, "ctx.isPointInPath(25, 20)", "false"); -_assertSame(ctx.isPointInPath(25, 30), false, "ctx.isPointInPath(25, 30)", "false"); -_assertSame(ctx.isPointInPath(30, 20), true, "ctx.isPointInPath(30, 20)", "true"); -_assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); -_assertSame(ctx.isPointInPath(40, 2), false, "ctx.isPointInPath(40, 2)", "false"); -_assertSame(ctx.isPointInPath(40, 20), true, "ctx.isPointInPath(40, 20)", "true"); -_assertSame(ctx.isPointInPath(40, 30), false, "ctx.isPointInPath(40, 30)", "false"); -_assertSame(ctx.isPointInPath(40, 47), false, "ctx.isPointInPath(40, 47)", "false"); -_assertSame(ctx.isPointInPath(45, 20), true, "ctx.isPointInPath(45, 20)", "true"); -_assertSame(ctx.isPointInPath(45, 30), false, "ctx.isPointInPath(45, 30)", "false"); -_assertSame(ctx.isPointInPath(55, 20), false, "ctx.isPointInPath(55, 20)", "false"); -_assertSame(ctx.isPointInPath(55, 30), true, "ctx.isPointInPath(55, 30)", "true"); -_assertSame(ctx.isPointInPath(60, 2), false, "ctx.isPointInPath(60, 2)", "false"); -_assertSame(ctx.isPointInPath(60, 20), false, "ctx.isPointInPath(60, 20)", "false"); -_assertSame(ctx.isPointInPath(60, 30), true, "ctx.isPointInPath(60, 30)", "true"); -_assertSame(ctx.isPointInPath(60, 47), false, "ctx.isPointInPath(60, 47)", "false"); -_assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); -_assertSame(ctx.isPointInPath(70, 30), true, "ctx.isPointInPath(70, 30)", "true"); -_assertSame(ctx.isPointInPath(75, 20), false, "ctx.isPointInPath(75, 20)", "false"); -_assertSame(ctx.isPointInPath(75, 30), false, "ctx.isPointInPath(75, 30)", "false"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.moveTo(25, 25); + ctx.bezierCurveTo(50, -50, 50, 100, 75, 25); + _assertSame(ctx.isPointInPath(25, 20), false, "ctx.isPointInPath(25, 20)", "false"); + _assertSame(ctx.isPointInPath(25, 30), false, "ctx.isPointInPath(25, 30)", "false"); + _assertSame(ctx.isPointInPath(30, 20), true, "ctx.isPointInPath(30, 20)", "true"); + _assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); + _assertSame(ctx.isPointInPath(40, 2), false, "ctx.isPointInPath(40, 2)", "false"); + _assertSame(ctx.isPointInPath(40, 20), true, "ctx.isPointInPath(40, 20)", "true"); + _assertSame(ctx.isPointInPath(40, 30), false, "ctx.isPointInPath(40, 30)", "false"); + _assertSame(ctx.isPointInPath(40, 47), false, "ctx.isPointInPath(40, 47)", "false"); + _assertSame(ctx.isPointInPath(45, 20), true, "ctx.isPointInPath(45, 20)", "true"); + _assertSame(ctx.isPointInPath(45, 30), false, "ctx.isPointInPath(45, 30)", "false"); + _assertSame(ctx.isPointInPath(55, 20), false, "ctx.isPointInPath(55, 20)", "false"); + _assertSame(ctx.isPointInPath(55, 30), true, "ctx.isPointInPath(55, 30)", "true"); + _assertSame(ctx.isPointInPath(60, 2), false, "ctx.isPointInPath(60, 2)", "false"); + _assertSame(ctx.isPointInPath(60, 20), false, "ctx.isPointInPath(60, 20)", "false"); + _assertSame(ctx.isPointInPath(60, 30), true, "ctx.isPointInPath(60, 30)", "true"); + _assertSame(ctx.isPointInPath(60, 47), false, "ctx.isPointInPath(60, 47)", "false"); + _assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); + _assertSame(ctx.isPointInPath(70, 30), true, "ctx.isPointInPath(70, 30)", "true"); + _assertSame(ctx.isPointInPath(75, 20), false, "ctx.isPointInPath(75, 20)", "false"); + _assertSame(ctx.isPointInPath(75, 30), false, "ctx.isPointInPath(75, 30)", "false"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bigarc.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bigarc.html index 2e6e78fedb0..fcb4ca88273 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bigarc.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bigarc.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.arc(50, 25, 10, 0, 7, false); -_assertSame(ctx.isPointInPath(50, 10), false, "ctx.isPointInPath(50, 10)", "false"); -_assertSame(ctx.isPointInPath(50, 20), true, "ctx.isPointInPath(50, 20)", "true"); -_assertSame(ctx.isPointInPath(50, 30), true, "ctx.isPointInPath(50, 30)", "true"); -_assertSame(ctx.isPointInPath(50, 40), false, "ctx.isPointInPath(50, 40)", "false"); -_assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); -_assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); -_assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); -_assertSame(ctx.isPointInPath(70, 30), false, "ctx.isPointInPath(70, 30)", "false"); -t.done(); + ctx.arc(50, 25, 10, 0, 7, false); + _assertSame(ctx.isPointInPath(50, 10), false, "ctx.isPointInPath(50, 10)", "false"); + _assertSame(ctx.isPointInPath(50, 20), true, "ctx.isPointInPath(50, 20)", "true"); + _assertSame(ctx.isPointInPath(50, 30), true, "ctx.isPointInPath(50, 30)", "true"); + _assertSame(ctx.isPointInPath(50, 40), false, "ctx.isPointInPath(50, 40)", "false"); + _assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); + _assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); + _assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); + _assertSame(ctx.isPointInPath(70, 30), false, "ctx.isPointInPath(70, 30)", "false"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bigarc.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bigarc.worker.js index 1ee00102152..40233790c81 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bigarc.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.bigarc.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.arc(50, 25, 10, 0, 7, false); -_assertSame(ctx.isPointInPath(50, 10), false, "ctx.isPointInPath(50, 10)", "false"); -_assertSame(ctx.isPointInPath(50, 20), true, "ctx.isPointInPath(50, 20)", "true"); -_assertSame(ctx.isPointInPath(50, 30), true, "ctx.isPointInPath(50, 30)", "true"); -_assertSame(ctx.isPointInPath(50, 40), false, "ctx.isPointInPath(50, 40)", "false"); -_assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); -_assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); -_assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); -_assertSame(ctx.isPointInPath(70, 30), false, "ctx.isPointInPath(70, 30)", "false"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.arc(50, 25, 10, 0, 7, false); + _assertSame(ctx.isPointInPath(50, 10), false, "ctx.isPointInPath(50, 10)", "false"); + _assertSame(ctx.isPointInPath(50, 20), true, "ctx.isPointInPath(50, 20)", "true"); + _assertSame(ctx.isPointInPath(50, 30), true, "ctx.isPointInPath(50, 30)", "true"); + _assertSame(ctx.isPointInPath(50, 40), false, "ctx.isPointInPath(50, 40)", "false"); + _assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); + _assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); + _assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); + _assertSame(ctx.isPointInPath(70, 30), false, "ctx.isPointInPath(70, 30)", "false"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.edge.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.edge.html index bcd4eaefd9f..aa367b4e56c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.edge.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.edge.html @@ -17,23 +17,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.rect(0, 0, 20, 20); -_assertSame(ctx.isPointInPath(0, 0), true, "ctx.isPointInPath(0, 0)", "true"); -_assertSame(ctx.isPointInPath(10, 0), true, "ctx.isPointInPath(10, 0)", "true"); -_assertSame(ctx.isPointInPath(20, 0), true, "ctx.isPointInPath(20, 0)", "true"); -_assertSame(ctx.isPointInPath(20, 10), true, "ctx.isPointInPath(20, 10)", "true"); -_assertSame(ctx.isPointInPath(20, 20), true, "ctx.isPointInPath(20, 20)", "true"); -_assertSame(ctx.isPointInPath(10, 20), true, "ctx.isPointInPath(10, 20)", "true"); -_assertSame(ctx.isPointInPath(0, 20), true, "ctx.isPointInPath(0, 20)", "true"); -_assertSame(ctx.isPointInPath(0, 10), true, "ctx.isPointInPath(0, 10)", "true"); -_assertSame(ctx.isPointInPath(10, -0.01), false, "ctx.isPointInPath(10, -0.01)", "false"); -_assertSame(ctx.isPointInPath(10, 20.01), false, "ctx.isPointInPath(10, 20.01)", "false"); -_assertSame(ctx.isPointInPath(-0.01, 10), false, "ctx.isPointInPath(-0.01, 10)", "false"); -_assertSame(ctx.isPointInPath(20.01, 10), false, "ctx.isPointInPath(20.01, 10)", "false"); -t.done(); + ctx.rect(0, 0, 20, 20); + _assertSame(ctx.isPointInPath(0, 0), true, "ctx.isPointInPath(0, 0)", "true"); + _assertSame(ctx.isPointInPath(10, 0), true, "ctx.isPointInPath(10, 0)", "true"); + _assertSame(ctx.isPointInPath(20, 0), true, "ctx.isPointInPath(20, 0)", "true"); + _assertSame(ctx.isPointInPath(20, 10), true, "ctx.isPointInPath(20, 10)", "true"); + _assertSame(ctx.isPointInPath(20, 20), true, "ctx.isPointInPath(20, 20)", "true"); + _assertSame(ctx.isPointInPath(10, 20), true, "ctx.isPointInPath(10, 20)", "true"); + _assertSame(ctx.isPointInPath(0, 20), true, "ctx.isPointInPath(0, 20)", "true"); + _assertSame(ctx.isPointInPath(0, 10), true, "ctx.isPointInPath(0, 10)", "true"); + _assertSame(ctx.isPointInPath(10, -0.01), false, "ctx.isPointInPath(10, -0.01)", "false"); + _assertSame(ctx.isPointInPath(10, 20.01), false, "ctx.isPointInPath(10, 20.01)", "false"); + _assertSame(ctx.isPointInPath(-0.01, 10), false, "ctx.isPointInPath(-0.01, 10)", "false"); + _assertSame(ctx.isPointInPath(20.01, 10), false, "ctx.isPointInPath(20.01, 10)", "false"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.edge.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.edge.worker.js index 21222ebc4fb..3918a6fe83d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.edge.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.edge.worker.js @@ -13,23 +13,22 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.rect(0, 0, 20, 20); -_assertSame(ctx.isPointInPath(0, 0), true, "ctx.isPointInPath(0, 0)", "true"); -_assertSame(ctx.isPointInPath(10, 0), true, "ctx.isPointInPath(10, 0)", "true"); -_assertSame(ctx.isPointInPath(20, 0), true, "ctx.isPointInPath(20, 0)", "true"); -_assertSame(ctx.isPointInPath(20, 10), true, "ctx.isPointInPath(20, 10)", "true"); -_assertSame(ctx.isPointInPath(20, 20), true, "ctx.isPointInPath(20, 20)", "true"); -_assertSame(ctx.isPointInPath(10, 20), true, "ctx.isPointInPath(10, 20)", "true"); -_assertSame(ctx.isPointInPath(0, 20), true, "ctx.isPointInPath(0, 20)", "true"); -_assertSame(ctx.isPointInPath(0, 10), true, "ctx.isPointInPath(0, 10)", "true"); -_assertSame(ctx.isPointInPath(10, -0.01), false, "ctx.isPointInPath(10, -0.01)", "false"); -_assertSame(ctx.isPointInPath(10, 20.01), false, "ctx.isPointInPath(10, 20.01)", "false"); -_assertSame(ctx.isPointInPath(-0.01, 10), false, "ctx.isPointInPath(-0.01, 10)", "false"); -_assertSame(ctx.isPointInPath(20.01, 10), false, "ctx.isPointInPath(20.01, 10)", "false"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.rect(0, 0, 20, 20); + _assertSame(ctx.isPointInPath(0, 0), true, "ctx.isPointInPath(0, 0)", "true"); + _assertSame(ctx.isPointInPath(10, 0), true, "ctx.isPointInPath(10, 0)", "true"); + _assertSame(ctx.isPointInPath(20, 0), true, "ctx.isPointInPath(20, 0)", "true"); + _assertSame(ctx.isPointInPath(20, 10), true, "ctx.isPointInPath(20, 10)", "true"); + _assertSame(ctx.isPointInPath(20, 20), true, "ctx.isPointInPath(20, 20)", "true"); + _assertSame(ctx.isPointInPath(10, 20), true, "ctx.isPointInPath(10, 20)", "true"); + _assertSame(ctx.isPointInPath(0, 20), true, "ctx.isPointInPath(0, 20)", "true"); + _assertSame(ctx.isPointInPath(0, 10), true, "ctx.isPointInPath(0, 10)", "true"); + _assertSame(ctx.isPointInPath(10, -0.01), false, "ctx.isPointInPath(10, -0.01)", "false"); + _assertSame(ctx.isPointInPath(10, 20.01), false, "ctx.isPointInPath(10, 20.01)", "false"); + _assertSame(ctx.isPointInPath(-0.01, 10), false, "ctx.isPointInPath(-0.01, 10)", "false"); + _assertSame(ctx.isPointInPath(20.01, 10), false, "ctx.isPointInPath(20.01, 10)", "false"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.empty.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.empty.html index 9a875097b02..d2ebf1e7e1b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.empty.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.empty.html @@ -17,11 +17,11 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -_assertSame(ctx.isPointInPath(0, 0), false, "ctx.isPointInPath(0, 0)", "false"); -t.done(); + _assertSame(ctx.isPointInPath(0, 0), false, "ctx.isPointInPath(0, 0)", "false"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.empty.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.empty.worker.js index e449ee2e69b..319836dcb58 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.empty.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.empty.worker.js @@ -13,11 +13,10 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -_assertSame(ctx.isPointInPath(0, 0), false, "ctx.isPointInPath(0, 0)", "false"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + _assertSame(ctx.isPointInPath(0, 0), false, "ctx.isPointInPath(0, 0)", "false"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.nonfinite.html index 8dc4c1df3a0..ef12d057ed5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.nonfinite.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.rect(-100, -50, 200, 100); -_assertSame(ctx.isPointInPath(Infinity, 0), false, "ctx.isPointInPath(Infinity, 0)", "false"); -_assertSame(ctx.isPointInPath(-Infinity, 0), false, "ctx.isPointInPath(-Infinity, 0)", "false"); -_assertSame(ctx.isPointInPath(NaN, 0), false, "ctx.isPointInPath(NaN, 0)", "false"); -_assertSame(ctx.isPointInPath(0, Infinity), false, "ctx.isPointInPath(0, Infinity)", "false"); -_assertSame(ctx.isPointInPath(0, -Infinity), false, "ctx.isPointInPath(0, -Infinity)", "false"); -_assertSame(ctx.isPointInPath(0, NaN), false, "ctx.isPointInPath(0, NaN)", "false"); -_assertSame(ctx.isPointInPath(NaN, NaN), false, "ctx.isPointInPath(NaN, NaN)", "false"); -t.done(); + ctx.rect(-100, -50, 200, 100); + _assertSame(ctx.isPointInPath(Infinity, 0), false, "ctx.isPointInPath(Infinity, 0)", "false"); + _assertSame(ctx.isPointInPath(-Infinity, 0), false, "ctx.isPointInPath(-Infinity, 0)", "false"); + _assertSame(ctx.isPointInPath(NaN, 0), false, "ctx.isPointInPath(NaN, 0)", "false"); + _assertSame(ctx.isPointInPath(0, Infinity), false, "ctx.isPointInPath(0, Infinity)", "false"); + _assertSame(ctx.isPointInPath(0, -Infinity), false, "ctx.isPointInPath(0, -Infinity)", "false"); + _assertSame(ctx.isPointInPath(0, NaN), false, "ctx.isPointInPath(0, NaN)", "false"); + _assertSame(ctx.isPointInPath(NaN, NaN), false, "ctx.isPointInPath(NaN, NaN)", "false"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.nonfinite.worker.js index 70a4ece1621..dfa6eec766c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.nonfinite.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.rect(-100, -50, 200, 100); -_assertSame(ctx.isPointInPath(Infinity, 0), false, "ctx.isPointInPath(Infinity, 0)", "false"); -_assertSame(ctx.isPointInPath(-Infinity, 0), false, "ctx.isPointInPath(-Infinity, 0)", "false"); -_assertSame(ctx.isPointInPath(NaN, 0), false, "ctx.isPointInPath(NaN, 0)", "false"); -_assertSame(ctx.isPointInPath(0, Infinity), false, "ctx.isPointInPath(0, Infinity)", "false"); -_assertSame(ctx.isPointInPath(0, -Infinity), false, "ctx.isPointInPath(0, -Infinity)", "false"); -_assertSame(ctx.isPointInPath(0, NaN), false, "ctx.isPointInPath(0, NaN)", "false"); -_assertSame(ctx.isPointInPath(NaN, NaN), false, "ctx.isPointInPath(NaN, NaN)", "false"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.rect(-100, -50, 200, 100); + _assertSame(ctx.isPointInPath(Infinity, 0), false, "ctx.isPointInPath(Infinity, 0)", "false"); + _assertSame(ctx.isPointInPath(-Infinity, 0), false, "ctx.isPointInPath(-Infinity, 0)", "false"); + _assertSame(ctx.isPointInPath(NaN, 0), false, "ctx.isPointInPath(NaN, 0)", "false"); + _assertSame(ctx.isPointInPath(0, Infinity), false, "ctx.isPointInPath(0, Infinity)", "false"); + _assertSame(ctx.isPointInPath(0, -Infinity), false, "ctx.isPointInPath(0, -Infinity)", "false"); + _assertSame(ctx.isPointInPath(0, NaN), false, "ctx.isPointInPath(0, NaN)", "false"); + _assertSame(ctx.isPointInPath(NaN, NaN), false, "ctx.isPointInPath(NaN, NaN)", "false"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.outside.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.outside.html index d1a1d86a02c..ce2ab819dd8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.outside.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.outside.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.rect(0, -100, 20, 20); -ctx.rect(20, -10, 20, 20); -_assertSame(ctx.isPointInPath(10, -110), false, "ctx.isPointInPath(10, -110)", "false"); -_assertSame(ctx.isPointInPath(10, -90), true, "ctx.isPointInPath(10, -90)", "true"); -_assertSame(ctx.isPointInPath(10, -70), false, "ctx.isPointInPath(10, -70)", "false"); -_assertSame(ctx.isPointInPath(30, -20), false, "ctx.isPointInPath(30, -20)", "false"); -_assertSame(ctx.isPointInPath(30, 0), true, "ctx.isPointInPath(30, 0)", "true"); -_assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); -t.done(); + ctx.rect(0, -100, 20, 20); + ctx.rect(20, -10, 20, 20); + _assertSame(ctx.isPointInPath(10, -110), false, "ctx.isPointInPath(10, -110)", "false"); + _assertSame(ctx.isPointInPath(10, -90), true, "ctx.isPointInPath(10, -90)", "true"); + _assertSame(ctx.isPointInPath(10, -70), false, "ctx.isPointInPath(10, -70)", "false"); + _assertSame(ctx.isPointInPath(30, -20), false, "ctx.isPointInPath(30, -20)", "false"); + _assertSame(ctx.isPointInPath(30, 0), true, "ctx.isPointInPath(30, 0)", "true"); + _assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.outside.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.outside.worker.js index 6d071050469..d4db12ef379 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.outside.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.outside.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.rect(0, -100, 20, 20); -ctx.rect(20, -10, 20, 20); -_assertSame(ctx.isPointInPath(10, -110), false, "ctx.isPointInPath(10, -110)", "false"); -_assertSame(ctx.isPointInPath(10, -90), true, "ctx.isPointInPath(10, -90)", "true"); -_assertSame(ctx.isPointInPath(10, -70), false, "ctx.isPointInPath(10, -70)", "false"); -_assertSame(ctx.isPointInPath(30, -20), false, "ctx.isPointInPath(30, -20)", "false"); -_assertSame(ctx.isPointInPath(30, 0), true, "ctx.isPointInPath(30, 0)", "true"); -_assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.rect(0, -100, 20, 20); + ctx.rect(20, -10, 20, 20); + _assertSame(ctx.isPointInPath(10, -110), false, "ctx.isPointInPath(10, -110)", "false"); + _assertSame(ctx.isPointInPath(10, -90), true, "ctx.isPointInPath(10, -90)", "true"); + _assertSame(ctx.isPointInPath(10, -70), false, "ctx.isPointInPath(10, -70)", "false"); + _assertSame(ctx.isPointInPath(30, -20), false, "ctx.isPointInPath(30, -20)", "false"); + _assertSame(ctx.isPointInPath(30, 0), true, "ctx.isPointInPath(30, 0)", "true"); + _assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.subpath.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.subpath.html index b0ea1f9a0f1..c4abd927646 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.subpath.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.subpath.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.rect(0, 0, 20, 20); -ctx.beginPath(); -ctx.rect(20, 0, 20, 20); -ctx.closePath(); -ctx.rect(40, 0, 20, 20); -_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); -_assertSame(ctx.isPointInPath(30, 10), true, "ctx.isPointInPath(30, 10)", "true"); -_assertSame(ctx.isPointInPath(50, 10), true, "ctx.isPointInPath(50, 10)", "true"); -t.done(); + ctx.rect(0, 0, 20, 20); + ctx.beginPath(); + ctx.rect(20, 0, 20, 20); + ctx.closePath(); + ctx.rect(40, 0, 20, 20); + _assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); + _assertSame(ctx.isPointInPath(30, 10), true, "ctx.isPointInPath(30, 10)", "true"); + _assertSame(ctx.isPointInPath(50, 10), true, "ctx.isPointInPath(50, 10)", "true"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.subpath.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.subpath.worker.js index 4a82fcc08a1..82df3b7c70a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.subpath.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.subpath.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.rect(0, 0, 20, 20); -ctx.beginPath(); -ctx.rect(20, 0, 20, 20); -ctx.closePath(); -ctx.rect(40, 0, 20, 20); -_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); -_assertSame(ctx.isPointInPath(30, 10), true, "ctx.isPointInPath(30, 10)", "true"); -_assertSame(ctx.isPointInPath(50, 10), true, "ctx.isPointInPath(50, 10)", "true"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.rect(0, 0, 20, 20); + ctx.beginPath(); + ctx.rect(20, 0, 20, 20); + ctx.closePath(); + ctx.rect(40, 0, 20, 20); + _assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); + _assertSame(ctx.isPointInPath(30, 10), true, "ctx.isPointInPath(30, 10)", "true"); + _assertSame(ctx.isPointInPath(50, 10), true, "ctx.isPointInPath(50, 10)", "true"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.1.html index 9b7b2e5ee0f..bccaa842e52 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.1.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.translate(50, 0); -ctx.rect(0, 0, 20, 20); -_assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); -_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); -_assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); -_assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); -_assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); -_assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); -t.done(); + ctx.translate(50, 0); + ctx.rect(0, 0, 20, 20); + _assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); + _assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); + _assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); + _assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); + _assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); + _assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.1.worker.js index 2fafbe910e9..0774fd0d62d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.1.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.translate(50, 0); -ctx.rect(0, 0, 20, 20); -_assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); -_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); -_assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); -_assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); -_assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); -_assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.translate(50, 0); + ctx.rect(0, 0, 20, 20); + _assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); + _assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); + _assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); + _assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); + _assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); + _assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.2.html index 45b884f2b5c..1e587c1d8a8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.2.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.rect(50, 0, 20, 20); -ctx.translate(50, 0); -_assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); -_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); -_assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); -_assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); -_assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); -_assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); -t.done(); + ctx.rect(50, 0, 20, 20); + ctx.translate(50, 0); + _assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); + _assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); + _assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); + _assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); + _assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); + _assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.2.worker.js index 3f37e62057e..ff4c42c450c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.2.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.rect(50, 0, 20, 20); -ctx.translate(50, 0); -_assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); -_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); -_assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); -_assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); -_assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); -_assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.rect(50, 0, 20, 20); + ctx.translate(50, 0); + _assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); + _assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); + _assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); + _assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); + _assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); + _assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.3.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.3.html index 923da480e8a..826d7e23c98 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.3.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.scale(-1, 1); -ctx.rect(-70, 0, 20, 20); -_assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); -_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); -_assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); -_assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); -_assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); -_assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); -t.done(); + ctx.scale(-1, 1); + ctx.rect(-70, 0, 20, 20); + _assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); + _assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); + _assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); + _assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); + _assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); + _assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.3.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.3.worker.js index 172d0a72a4e..f6750e91090 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.3.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.3.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.scale(-1, 1); -ctx.rect(-70, 0, 20, 20); -_assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); -_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); -_assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); -_assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); -_assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); -_assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.scale(-1, 1); + ctx.rect(-70, 0, 20, 20); + _assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); + _assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); + _assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); + _assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); + _assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); + _assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.4.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.4.html index 0f87cc2b212..97792d68893 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.4.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.4.html @@ -17,16 +17,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.translate(50, 0); -ctx.rect(50, 0, 20, 20); -ctx.translate(0, 50); -_assertSame(ctx.isPointInPath(60, 10), false, "ctx.isPointInPath(60, 10)", "false"); -_assertSame(ctx.isPointInPath(110, 10), true, "ctx.isPointInPath(110, 10)", "true"); -_assertSame(ctx.isPointInPath(110, 60), false, "ctx.isPointInPath(110, 60)", "false"); -t.done(); + ctx.translate(50, 0); + ctx.rect(50, 0, 20, 20); + ctx.translate(0, 50); + _assertSame(ctx.isPointInPath(60, 10), false, "ctx.isPointInPath(60, 10)", "false"); + _assertSame(ctx.isPointInPath(110, 10), true, "ctx.isPointInPath(110, 10)", "true"); + _assertSame(ctx.isPointInPath(110, 60), false, "ctx.isPointInPath(110, 60)", "false"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.4.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.4.worker.js index 993148110a5..f43a8a3d1ef 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.4.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.transform.4.worker.js @@ -13,16 +13,15 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.translate(50, 0); -ctx.rect(50, 0, 20, 20); -ctx.translate(0, 50); -_assertSame(ctx.isPointInPath(60, 10), false, "ctx.isPointInPath(60, 10)", "false"); -_assertSame(ctx.isPointInPath(110, 10), true, "ctx.isPointInPath(110, 10)", "true"); -_assertSame(ctx.isPointInPath(110, 60), false, "ctx.isPointInPath(110, 60)", "false"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.translate(50, 0); + ctx.rect(50, 0, 20, 20); + ctx.translate(0, 50); + _assertSame(ctx.isPointInPath(60, 10), false, "ctx.isPointInPath(60, 10)", "false"); + _assertSame(ctx.isPointInPath(110, 10), true, "ctx.isPointInPath(110, 10)", "true"); + _assertSame(ctx.isPointInPath(110, 60), false, "ctx.isPointInPath(110, 60)", "false"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.unclosed.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.unclosed.html index 098370f0f7d..3920c7de4b5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.unclosed.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.unclosed.html @@ -17,16 +17,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.moveTo(0, 0); -ctx.lineTo(20, 0); -ctx.lineTo(20, 20); -ctx.lineTo(0, 20); -_assertSame(ctx.isPointInPath(10, 10), true, "ctx.isPointInPath(10, 10)", "true"); -_assertSame(ctx.isPointInPath(30, 10), false, "ctx.isPointInPath(30, 10)", "false"); -t.done(); + ctx.moveTo(0, 0); + ctx.lineTo(20, 0); + ctx.lineTo(20, 20); + ctx.lineTo(0, 20); + _assertSame(ctx.isPointInPath(10, 10), true, "ctx.isPointInPath(10, 10)", "true"); + _assertSame(ctx.isPointInPath(30, 10), false, "ctx.isPointInPath(30, 10)", "false"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.unclosed.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.unclosed.worker.js index ad4ac8781bc..7b5ffc4a795 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.unclosed.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.unclosed.worker.js @@ -13,16 +13,15 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.moveTo(0, 0); -ctx.lineTo(20, 0); -ctx.lineTo(20, 20); -ctx.lineTo(0, 20); -_assertSame(ctx.isPointInPath(10, 10), true, "ctx.isPointInPath(10, 10)", "true"); -_assertSame(ctx.isPointInPath(30, 10), false, "ctx.isPointInPath(30, 10)", "false"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.moveTo(0, 0); + ctx.lineTo(20, 0); + ctx.lineTo(20, 20); + ctx.lineTo(0, 20); + _assertSame(ctx.isPointInPath(10, 10), true, "ctx.isPointInPath(10, 10)", "true"); + _assertSame(ctx.isPointInPath(30, 10), false, "ctx.isPointInPath(30, 10)", "false"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.winding.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.winding.html index 9698017e4fe..b2741a5069f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.winding.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.winding.html @@ -17,30 +17,31 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -// Create a square ring, using opposite windings to make a hole in the centre -ctx.moveTo(0, 0); -ctx.lineTo(50, 0); -ctx.lineTo(50, 50); -ctx.lineTo(0, 50); -ctx.lineTo(0, 0); -ctx.lineTo(10, 10); -ctx.lineTo(10, 40); -ctx.lineTo(40, 40); -ctx.lineTo(40, 10); -ctx.lineTo(10, 10); -_assertSame(ctx.isPointInPath(5, 5), true, "ctx.isPointInPath(5, 5)", "true"); -_assertSame(ctx.isPointInPath(25, 5), true, "ctx.isPointInPath(25, 5)", "true"); -_assertSame(ctx.isPointInPath(45, 5), true, "ctx.isPointInPath(45, 5)", "true"); -_assertSame(ctx.isPointInPath(5, 25), true, "ctx.isPointInPath(5, 25)", "true"); -_assertSame(ctx.isPointInPath(25, 25), false, "ctx.isPointInPath(25, 25)", "false"); -_assertSame(ctx.isPointInPath(45, 25), true, "ctx.isPointInPath(45, 25)", "true"); -_assertSame(ctx.isPointInPath(5, 45), true, "ctx.isPointInPath(5, 45)", "true"); -_assertSame(ctx.isPointInPath(25, 45), true, "ctx.isPointInPath(25, 45)", "true"); -_assertSame(ctx.isPointInPath(45, 45), true, "ctx.isPointInPath(45, 45)", "true"); -t.done(); + // Create a square ring, using opposite windings to make a hole in the centre + ctx.moveTo(0, 0); + ctx.lineTo(50, 0); + ctx.lineTo(50, 50); + ctx.lineTo(0, 50); + ctx.lineTo(0, 0); + ctx.lineTo(10, 10); + ctx.lineTo(10, 40); + ctx.lineTo(40, 40); + ctx.lineTo(40, 10); + ctx.lineTo(10, 10); + + _assertSame(ctx.isPointInPath(5, 5), true, "ctx.isPointInPath(5, 5)", "true"); + _assertSame(ctx.isPointInPath(25, 5), true, "ctx.isPointInPath(25, 5)", "true"); + _assertSame(ctx.isPointInPath(45, 5), true, "ctx.isPointInPath(45, 5)", "true"); + _assertSame(ctx.isPointInPath(5, 25), true, "ctx.isPointInPath(5, 25)", "true"); + _assertSame(ctx.isPointInPath(25, 25), false, "ctx.isPointInPath(25, 25)", "false"); + _assertSame(ctx.isPointInPath(45, 25), true, "ctx.isPointInPath(45, 25)", "true"); + _assertSame(ctx.isPointInPath(5, 45), true, "ctx.isPointInPath(5, 45)", "true"); + _assertSame(ctx.isPointInPath(25, 45), true, "ctx.isPointInPath(25, 45)", "true"); + _assertSame(ctx.isPointInPath(45, 45), true, "ctx.isPointInPath(45, 45)", "true"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.winding.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.winding.worker.js index 6ef758114a0..094bc05910d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.winding.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInPath.winding.worker.js @@ -13,30 +13,30 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -// Create a square ring, using opposite windings to make a hole in the centre -ctx.moveTo(0, 0); -ctx.lineTo(50, 0); -ctx.lineTo(50, 50); -ctx.lineTo(0, 50); -ctx.lineTo(0, 0); -ctx.lineTo(10, 10); -ctx.lineTo(10, 40); -ctx.lineTo(40, 40); -ctx.lineTo(40, 10); -ctx.lineTo(10, 10); -_assertSame(ctx.isPointInPath(5, 5), true, "ctx.isPointInPath(5, 5)", "true"); -_assertSame(ctx.isPointInPath(25, 5), true, "ctx.isPointInPath(25, 5)", "true"); -_assertSame(ctx.isPointInPath(45, 5), true, "ctx.isPointInPath(45, 5)", "true"); -_assertSame(ctx.isPointInPath(5, 25), true, "ctx.isPointInPath(5, 25)", "true"); -_assertSame(ctx.isPointInPath(25, 25), false, "ctx.isPointInPath(25, 25)", "false"); -_assertSame(ctx.isPointInPath(45, 25), true, "ctx.isPointInPath(45, 25)", "true"); -_assertSame(ctx.isPointInPath(5, 45), true, "ctx.isPointInPath(5, 45)", "true"); -_assertSame(ctx.isPointInPath(25, 45), true, "ctx.isPointInPath(25, 45)", "true"); -_assertSame(ctx.isPointInPath(45, 45), true, "ctx.isPointInPath(45, 45)", "true"); -t.done(); + // Create a square ring, using opposite windings to make a hole in the centre + ctx.moveTo(0, 0); + ctx.lineTo(50, 0); + ctx.lineTo(50, 50); + ctx.lineTo(0, 50); + ctx.lineTo(0, 0); + ctx.lineTo(10, 10); + ctx.lineTo(10, 40); + ctx.lineTo(40, 40); + ctx.lineTo(40, 10); + ctx.lineTo(10, 10); + _assertSame(ctx.isPointInPath(5, 5), true, "ctx.isPointInPath(5, 5)", "true"); + _assertSame(ctx.isPointInPath(25, 5), true, "ctx.isPointInPath(25, 5)", "true"); + _assertSame(ctx.isPointInPath(45, 5), true, "ctx.isPointInPath(45, 5)", "true"); + _assertSame(ctx.isPointInPath(5, 25), true, "ctx.isPointInPath(5, 25)", "true"); + _assertSame(ctx.isPointInPath(25, 25), false, "ctx.isPointInPath(25, 25)", "false"); + _assertSame(ctx.isPointInPath(45, 25), true, "ctx.isPointInPath(45, 25)", "true"); + _assertSame(ctx.isPointInPath(5, 45), true, "ctx.isPointInPath(5, 45)", "true"); + _assertSame(ctx.isPointInPath(25, 45), true, "ctx.isPointInPath(25, 45)", "true"); + _assertSame(ctx.isPointInPath(45, 45), true, "ctx.isPointInPath(45, 45)", "true"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInStroke.scaleddashes.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInStroke.scaleddashes.html new file mode 100644 index 00000000000..1ed13b32de6 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInStroke.scaleddashes.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.isPointInStroke.scaleddashes</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInStroke.scaleddashes</h1> +<p class="desc">isPointInStroke() should return correct results on dashed paths at high scale factors</p> + + +<script> +var t = async_test("isPointInStroke() should return correct results on dashed paths at high scale factors"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + var scale = 20; + ctx.setLineDash([10, 21.4159]); // dash from t=0 to t=10 along the circle + ctx.scale(scale, scale); + ctx.ellipse(6, 10, 5, 5, 0, 2*Math.PI, false); + ctx.stroke(); + + // hit-test the beginning of the dash (t=0) + _assertSame(ctx.isPointInStroke(11*scale, 10*scale), true, "ctx.isPointInStroke(11*scale, 10*scale)", "true"); + // hit-test the middle of the dash (t=5) + _assertSame(ctx.isPointInStroke(8.70*scale, 14.21*scale), true, "ctx.isPointInStroke(8.70*scale, 14.21*scale)", "true"); + // hit-test the end of the dash (t=9.8) + _assertSame(ctx.isPointInStroke(4.10*scale, 14.63*scale), true, "ctx.isPointInStroke(4.10*scale, 14.63*scale)", "true"); + // hit-test past the end of the dash (t=10.2) + _assertSame(ctx.isPointInStroke(3.74*scale, 14.46*scale), false, "ctx.isPointInStroke(3.74*scale, 14.46*scale)", "false"); + t.done(); + +}); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInStroke.scaleddashes.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInStroke.scaleddashes.worker.js new file mode 100644 index 00000000000..240905308e3 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInStroke.scaleddashes.worker.js @@ -0,0 +1,35 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.isPointInStroke.scaleddashes +// Description:isPointInStroke() should return correct results on dashed paths at high scale factors +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("isPointInStroke() should return correct results on dashed paths at high scale factors"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + var scale = 20; + ctx.setLineDash([10, 21.4159]); // dash from t=0 to t=10 along the circle + ctx.scale(scale, scale); + ctx.ellipse(6, 10, 5, 5, 0, 2*Math.PI, false); + ctx.stroke(); + + // hit-test the beginning of the dash (t=0) + _assertSame(ctx.isPointInStroke(11*scale, 10*scale), true, "ctx.isPointInStroke(11*scale, 10*scale)", "true"); + // hit-test the middle of the dash (t=5) + _assertSame(ctx.isPointInStroke(8.70*scale, 14.21*scale), true, "ctx.isPointInStroke(8.70*scale, 14.21*scale)", "true"); + // hit-test the end of the dash (t=9.8) + _assertSame(ctx.isPointInStroke(4.10*scale, 14.63*scale), true, "ctx.isPointInStroke(4.10*scale, 14.63*scale)", "true"); + // hit-test past the end of the dash (t=10.2) + _assertSame(ctx.isPointInStroke(3.74*scale, 14.46*scale), false, "ctx.isPointInStroke(3.74*scale, 14.46*scale)", "false"); + t.done(); +}); +done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInpath.invalid.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInpath.invalid.html new file mode 100644 index 00000000000..0b4c635fc86 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInpath.invalid.html @@ -0,0 +1,51 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.isPointInpath.invalid</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInpath.invalid</h1> +<p class="desc">Verify isPointInPath throws exceptions with invalid inputs.</p> + + +<script> +var t = async_test("Verify isPointInPath throws exceptions with invalid inputs."); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + canvas.width = 200; + canvas.height = 200; + path = new Path2D(); + path.rect(0, 0, 100, 100); + path.rect(25, 25, 50, 50); + // Testing invalid enumeration isPointInPath (w/ and w/o Path object'); + assert_throws_js(TypeError, function() { ctx.isPointInPath(path, 50, 50, 'gazonk'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(50, 50, 'gazonk'); }); + + // Testing invalid type isPointInPath with Path object'); + assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, 'nonzero'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, 'evenodd'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, null); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(path, 50, 50, null); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, 'nonzero'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, 'evenodd'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, undefined); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50, 'nonzero'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50, 'evenodd'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50, 'nonzero'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50, 'evenodd'); }); + t.done(); + +}); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInpath.invalid.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInpath.invalid.worker.js new file mode 100644 index 00000000000..f09eeb75264 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInpath.invalid.worker.js @@ -0,0 +1,46 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.isPointInpath.invalid +// Description:Verify isPointInPath throws exceptions with invalid inputs. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify isPointInPath throws exceptions with invalid inputs."); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + canvas.width = 200; + canvas.height = 200; + path = new Path2D(); + path.rect(0, 0, 100, 100); + path.rect(25, 25, 50, 50); + // Testing invalid enumeration isPointInPath (w/ and w/o Path object'); + assert_throws_js(TypeError, function() { ctx.isPointInPath(path, 50, 50, 'gazonk'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(50, 50, 'gazonk'); }); + + // Testing invalid type isPointInPath with Path object'); + assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, 'nonzero'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, 'evenodd'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(null, 50, 50, null); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(path, 50, 50, null); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, 'nonzero'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, 'evenodd'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(undefined, 50, 50, undefined); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50, 'nonzero'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath([], 50, 50, 'evenodd'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50, 'nonzero'); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath({}, 50, 50, 'evenodd'); }); + t.done(); +}); +done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInpath.multi.path.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInpath.multi.path.html new file mode 100644 index 00000000000..945855231b7 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInpath.multi.path.html @@ -0,0 +1,49 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.isPointInpath.multi.path</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.isPointInpath.multi.path</h1> +<p class="desc">Verify the winding rule in isPointInPath works for path object.</p> + + +<script> +var t = async_test("Verify the winding rule in isPointInPath works for path 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'); + + canvas.width = 200; + canvas.height = 200; + + // Testing default isPointInPath with Path object'); + path = new Path2D(); + path.rect(0, 0, 100, 100); + path.rect(25, 25, 50, 50); + _assertSame(ctx.isPointInPath(path, 50, 50), true, "ctx.isPointInPath(path, 50, 50)", "true"); + _assertSame(ctx.isPointInPath(path, 50, 50, undefined), true, "ctx.isPointInPath(path, 50, 50, undefined)", "true"); + _assertSame(ctx.isPointInPath(path, NaN, 50), false, "ctx.isPointInPath(path, NaN, 50)", "false"); + _assertSame(ctx.isPointInPath(path, 50, NaN), false, "ctx.isPointInPath(path, 50, NaN)", "false"); + + // Testing nonzero isPointInPath with Path object'); + path = new Path2D(); + path.rect(0, 0, 100, 100); + path.rect(25, 25, 50, 50); + _assertSame(ctx.isPointInPath(path, 50, 50, 'nonzero'), true, "ctx.isPointInPath(path, 50, 50, 'nonzero')", "true"); + + // Testing evenodd isPointInPath with Path object'); + path = new Path2D(); + path.rect(0, 0, 100, 100); + path.rect(25, 25, 50, 50); + assert_false(ctx.isPointInPath(path, 50, 50, 'evenodd')); + t.done(); + +}); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInpath.multi.path.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInpath.multi.path.worker.js new file mode 100644 index 00000000000..d3d4e60747b --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.isPointInpath.multi.path.worker.js @@ -0,0 +1,44 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.isPointInpath.multi.path +// Description:Verify the winding rule in isPointInPath works for path object. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify the winding rule in isPointInPath works for path 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'); + + canvas.width = 200; + canvas.height = 200; + + // Testing default isPointInPath with Path object'); + path = new Path2D(); + path.rect(0, 0, 100, 100); + path.rect(25, 25, 50, 50); + _assertSame(ctx.isPointInPath(path, 50, 50), true, "ctx.isPointInPath(path, 50, 50)", "true"); + _assertSame(ctx.isPointInPath(path, 50, 50, undefined), true, "ctx.isPointInPath(path, 50, 50, undefined)", "true"); + _assertSame(ctx.isPointInPath(path, NaN, 50), false, "ctx.isPointInPath(path, NaN, 50)", "false"); + _assertSame(ctx.isPointInPath(path, 50, NaN), false, "ctx.isPointInPath(path, 50, NaN)", "false"); + + // Testing nonzero isPointInPath with Path object'); + path = new Path2D(); + path.rect(0, 0, 100, 100); + path.rect(25, 25, 50, 50); + _assertSame(ctx.isPointInPath(path, 50, 50, 'nonzero'), true, "ctx.isPointInPath(path, 50, 50, 'nonzero')", "true"); + + // Testing evenodd isPointInPath with Path object'); + path = new Path2D(); + path.rect(0, 0, 100, 100); + path.rect(25, 25, 50, 50); + assert_false(ctx.isPointInPath(path, 50, 50, 'evenodd')); + t.done(); +}); +done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.basic.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.basic.html index 3247ededcc8..e0bc64617f9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.basic.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.lineTo(100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.lineTo(100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.basic.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.basic.worker.js index 980de5c1b28..6e02a1f149c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.basic.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.basic.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.lineTo(100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.lineTo(100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.1.html index 5a15f9ece48..2561a2f5559 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.1.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.lineTo(100, 50); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.lineTo(100, 50); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.1.worker.js index 024754ca0ea..ae4d85735ec 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.1.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.lineTo(100, 50); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.lineTo(100, 50); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.2.html index eaad8dabcce..9ca14a13935 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.2.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.lineTo(0, 25); -ctx.lineTo(100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.lineTo(0, 25); + ctx.lineTo(100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.2.worker.js index 2a15c9e14d4..b6af21235f4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.ensuresubpath.2.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.lineTo(0, 25); -ctx.lineTo(100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.lineTo(0, 25); + ctx.lineTo(100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nextpoint.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nextpoint.html index fc697b9be59..a649d3a86da 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nextpoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nextpoint.html @@ -17,20 +17,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.moveTo(-100, -100); -ctx.lineTo(0, 25); -ctx.lineTo(100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.moveTo(-100, -100); + ctx.lineTo(0, 25); + ctx.lineTo(100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nextpoint.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nextpoint.worker.js index de9d56be06e..9e4e24a06de 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nextpoint.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nextpoint.worker.js @@ -13,20 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.moveTo(-100, -100); -ctx.lineTo(0, 25); -ctx.lineTo(100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.moveTo(-100, -100); + ctx.lineTo(0, 25); + ctx.lineTo(100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.details.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.details.html index 82270be5344..35bc80d3369 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.details.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.details.html @@ -17,15 +17,15 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -for (var arg1 of [Infinity, -Infinity, NaN]) { - var converted = false; - ctx.lineTo(arg1, { valueOf: function() { converted = true; return 0; } }); - _assert(converted, "converted"); -} -t.done(); + for (var arg1 of [Infinity, -Infinity, NaN]) { + var converted = false; + ctx.lineTo(arg1, { valueOf: function() { converted = true; return 0; } }); + _assert(converted, "converted"); + } + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.details.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.details.worker.js index bf74ee5b504..5052c74b94f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.details.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.details.worker.js @@ -13,15 +13,14 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -for (var arg1 of [Infinity, -Infinity, NaN]) { - var converted = false; - ctx.lineTo(arg1, { valueOf: function() { converted = true; return 0; } }); - _assert(converted, "converted"); -} -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + for (var arg1 of [Infinity, -Infinity, NaN]) { + var converted = false; + ctx.lineTo(arg1, { valueOf: function() { converted = true; return 0; } }); + _assert(converted, "converted"); + } + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.html index 02d77163fd2..5a144dd7f61 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.html @@ -17,25 +17,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.lineTo(Infinity, 50); -ctx.lineTo(-Infinity, 50); -ctx.lineTo(NaN, 50); -ctx.lineTo(0, Infinity); -ctx.lineTo(0, -Infinity); -ctx.lineTo(0, NaN); -ctx.lineTo(Infinity, Infinity); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); -t.done(); + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.lineTo(Infinity, 50); + ctx.lineTo(-Infinity, 50); + ctx.lineTo(NaN, 50); + ctx.lineTo(0, Infinity); + ctx.lineTo(0, -Infinity); + ctx.lineTo(0, NaN); + ctx.lineTo(Infinity, Infinity); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.worker.js index 5161b4e4322..82921b7cd9a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.lineTo.nonfinite.worker.js @@ -13,25 +13,24 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.lineTo(Infinity, 50); -ctx.lineTo(-Infinity, 50); -ctx.lineTo(NaN, 50); -ctx.lineTo(0, Infinity); -ctx.lineTo(0, -Infinity); -ctx.lineTo(0, NaN); -ctx.lineTo(Infinity, Infinity); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.lineTo(Infinity, 50); + ctx.lineTo(-Infinity, 50); + ctx.lineTo(NaN, 50); + ctx.lineTo(0, Infinity); + ctx.lineTo(0, -Infinity); + ctx.lineTo(0, NaN); + ctx.lineTo(Infinity, Infinity); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.basic.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.basic.html index 8363792c706..f9777c6ca8f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.basic.html @@ -17,20 +17,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.rect(0, 0, 10, 50); -ctx.moveTo(100, 0); -ctx.lineTo(10, 0); -ctx.lineTo(10, 50); -ctx.lineTo(100, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 90,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.rect(0, 0, 10, 50); + ctx.moveTo(100, 0); + ctx.lineTo(10, 0); + ctx.lineTo(10, 50); + ctx.lineTo(100, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 90,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.basic.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.basic.worker.js index eca39660bce..0b1df374b67 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.basic.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.basic.worker.js @@ -13,20 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.rect(0, 0, 10, 50); -ctx.moveTo(100, 0); -ctx.lineTo(10, 0); -ctx.lineTo(10, 50); -ctx.lineTo(100, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 90,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.rect(0, 0, 10, 50); + ctx.moveTo(100, 0); + ctx.lineTo(10, 0); + ctx.lineTo(10, 50); + ctx.lineTo(100, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 90,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.multiple.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.multiple.html index 928c9783d44..0b56cbbfef3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.multiple.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.multiple.html @@ -17,20 +17,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.moveTo(0, 25); -ctx.moveTo(100, 25); -ctx.moveTo(0, 25); -ctx.lineTo(100, 25); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.moveTo(0, 25); + ctx.moveTo(100, 25); + ctx.moveTo(0, 25); + ctx.lineTo(100, 25); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.multiple.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.multiple.worker.js index 686f5ae84ad..9f49ea8a1ba 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.multiple.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.multiple.worker.js @@ -13,20 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.moveTo(0, 25); -ctx.moveTo(100, 25); -ctx.moveTo(0, 25); -ctx.lineTo(100, 25); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.moveTo(0, 25); + ctx.moveTo(100, 25); + ctx.moveTo(0, 25); + ctx.lineTo(100, 25); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.newsubpath.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.newsubpath.html index 89fda23ffc9..c2594c006ed 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.newsubpath.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.newsubpath.html @@ -17,20 +17,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.moveTo(0, 0); -ctx.moveTo(100, 0); -ctx.moveTo(100, 50); -ctx.moveTo(0, 50); -ctx.fillStyle = '#f00'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.moveTo(0, 0); + ctx.moveTo(100, 0); + ctx.moveTo(100, 50); + ctx.moveTo(0, 50); + ctx.fillStyle = '#f00'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.newsubpath.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.newsubpath.worker.js index d00491c42bf..e3c9c8529d2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.newsubpath.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.newsubpath.worker.js @@ -13,20 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.moveTo(0, 0); -ctx.moveTo(100, 0); -ctx.moveTo(100, 50); -ctx.moveTo(0, 50); -ctx.fillStyle = '#f00'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.moveTo(0, 0); + ctx.moveTo(100, 0); + ctx.moveTo(100, 50); + ctx.moveTo(0, 50); + ctx.fillStyle = '#f00'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.nonfinite.html index 1a2e6cfe839..ea3eb34c767 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.nonfinite.html @@ -17,24 +17,24 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.moveTo(Infinity, 50); -ctx.moveTo(-Infinity, 50); -ctx.moveTo(NaN, 50); -ctx.moveTo(0, Infinity); -ctx.moveTo(0, -Infinity); -ctx.moveTo(0, NaN); -ctx.moveTo(Infinity, Infinity); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.moveTo(Infinity, 50); + ctx.moveTo(-Infinity, 50); + ctx.moveTo(NaN, 50); + ctx.moveTo(0, Infinity); + ctx.moveTo(0, -Infinity); + ctx.moveTo(0, NaN); + ctx.moveTo(Infinity, Infinity); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.nonfinite.worker.js index ced534fb954..97e2bd72e34 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.moveTo.nonfinite.worker.js @@ -13,24 +13,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.moveTo(Infinity, 50); -ctx.moveTo(-Infinity, 50); -ctx.moveTo(NaN, 50); -ctx.moveTo(0, Infinity); -ctx.moveTo(0, -Infinity); -ctx.moveTo(0, NaN); -ctx.moveTo(Infinity, Infinity); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.moveTo(Infinity, 50); + ctx.moveTo(-Infinity, 50); + ctx.moveTo(NaN, 50); + ctx.moveTo(0, Infinity); + ctx.moveTo(0, -Infinity); + ctx.moveTo(0, NaN); + ctx.moveTo(Infinity, Infinity); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.basic.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.basic.html index 46a83e112c5..4d14ce5585b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.basic.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.quadraticCurveTo(100, 25, 100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.quadraticCurveTo(100, 25, 100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.basic.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.basic.worker.js index a1dfa045d94..161e5f1a65f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.basic.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.basic.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.moveTo(0, 25); -ctx.quadraticCurveTo(100, 25, 100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.moveTo(0, 25); + ctx.quadraticCurveTo(100, 25, 100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.html index 37662e46185..3e916f00c7d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.quadraticCurveTo(100, 50, 200, 50); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 95,45, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.quadraticCurveTo(100, 50, 200, 50); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 95,45, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.worker.js index fe20e7b890f..95dcf2bed1c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.quadraticCurveTo(100, 50, 200, 50); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 95,45, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.quadraticCurveTo(100, 50, 200, 50); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 95,45, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.html index 2f18424749f..2fb05a26582 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.quadraticCurveTo(0, 25, 100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 5,45, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.quadraticCurveTo(0, 25, 100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 5,45, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.worker.js index f840168f986..4beaf9dae2b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.beginPath(); -ctx.quadraticCurveTo(0, 25, 100, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 5,45, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.beginPath(); + ctx.quadraticCurveTo(0, 25, 100, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 5,45, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.nonfinite.html index 1083f027e2c..ee4f333a08a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.nonfinite.html @@ -17,41 +17,41 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.quadraticCurveTo(Infinity, 50, 0, 50); -ctx.quadraticCurveTo(-Infinity, 50, 0, 50); -ctx.quadraticCurveTo(NaN, 50, 0, 50); -ctx.quadraticCurveTo(0, Infinity, 0, 50); -ctx.quadraticCurveTo(0, -Infinity, 0, 50); -ctx.quadraticCurveTo(0, NaN, 0, 50); -ctx.quadraticCurveTo(0, 50, Infinity, 50); -ctx.quadraticCurveTo(0, 50, -Infinity, 50); -ctx.quadraticCurveTo(0, 50, NaN, 50); -ctx.quadraticCurveTo(0, 50, 0, Infinity); -ctx.quadraticCurveTo(0, 50, 0, -Infinity); -ctx.quadraticCurveTo(0, 50, 0, NaN); -ctx.quadraticCurveTo(Infinity, Infinity, 0, 50); -ctx.quadraticCurveTo(Infinity, Infinity, Infinity, 50); -ctx.quadraticCurveTo(Infinity, Infinity, Infinity, Infinity); -ctx.quadraticCurveTo(Infinity, Infinity, 0, Infinity); -ctx.quadraticCurveTo(Infinity, 50, Infinity, 50); -ctx.quadraticCurveTo(Infinity, 50, Infinity, Infinity); -ctx.quadraticCurveTo(Infinity, 50, 0, Infinity); -ctx.quadraticCurveTo(0, Infinity, Infinity, 50); -ctx.quadraticCurveTo(0, Infinity, Infinity, Infinity); -ctx.quadraticCurveTo(0, Infinity, 0, Infinity); -ctx.quadraticCurveTo(0, 50, Infinity, Infinity); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); -t.done(); + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.quadraticCurveTo(Infinity, 50, 0, 50); + ctx.quadraticCurveTo(-Infinity, 50, 0, 50); + ctx.quadraticCurveTo(NaN, 50, 0, 50); + ctx.quadraticCurveTo(0, Infinity, 0, 50); + ctx.quadraticCurveTo(0, -Infinity, 0, 50); + ctx.quadraticCurveTo(0, NaN, 0, 50); + ctx.quadraticCurveTo(0, 50, Infinity, 50); + ctx.quadraticCurveTo(0, 50, -Infinity, 50); + ctx.quadraticCurveTo(0, 50, NaN, 50); + ctx.quadraticCurveTo(0, 50, 0, Infinity); + ctx.quadraticCurveTo(0, 50, 0, -Infinity); + ctx.quadraticCurveTo(0, 50, 0, NaN); + ctx.quadraticCurveTo(Infinity, Infinity, 0, 50); + ctx.quadraticCurveTo(Infinity, Infinity, Infinity, 50); + ctx.quadraticCurveTo(Infinity, Infinity, Infinity, Infinity); + ctx.quadraticCurveTo(Infinity, Infinity, 0, Infinity); + ctx.quadraticCurveTo(Infinity, 50, Infinity, 50); + ctx.quadraticCurveTo(Infinity, 50, Infinity, Infinity); + ctx.quadraticCurveTo(Infinity, 50, 0, Infinity); + ctx.quadraticCurveTo(0, Infinity, Infinity, 50); + ctx.quadraticCurveTo(0, Infinity, Infinity, Infinity); + ctx.quadraticCurveTo(0, Infinity, 0, Infinity); + ctx.quadraticCurveTo(0, 50, Infinity, Infinity); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.nonfinite.worker.js index df17bd6d362..a61eb9a8cad 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.nonfinite.worker.js @@ -13,41 +13,40 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.quadraticCurveTo(Infinity, 50, 0, 50); -ctx.quadraticCurveTo(-Infinity, 50, 0, 50); -ctx.quadraticCurveTo(NaN, 50, 0, 50); -ctx.quadraticCurveTo(0, Infinity, 0, 50); -ctx.quadraticCurveTo(0, -Infinity, 0, 50); -ctx.quadraticCurveTo(0, NaN, 0, 50); -ctx.quadraticCurveTo(0, 50, Infinity, 50); -ctx.quadraticCurveTo(0, 50, -Infinity, 50); -ctx.quadraticCurveTo(0, 50, NaN, 50); -ctx.quadraticCurveTo(0, 50, 0, Infinity); -ctx.quadraticCurveTo(0, 50, 0, -Infinity); -ctx.quadraticCurveTo(0, 50, 0, NaN); -ctx.quadraticCurveTo(Infinity, Infinity, 0, 50); -ctx.quadraticCurveTo(Infinity, Infinity, Infinity, 50); -ctx.quadraticCurveTo(Infinity, Infinity, Infinity, Infinity); -ctx.quadraticCurveTo(Infinity, Infinity, 0, Infinity); -ctx.quadraticCurveTo(Infinity, 50, Infinity, 50); -ctx.quadraticCurveTo(Infinity, 50, Infinity, Infinity); -ctx.quadraticCurveTo(Infinity, 50, 0, Infinity); -ctx.quadraticCurveTo(0, Infinity, Infinity, 50); -ctx.quadraticCurveTo(0, Infinity, Infinity, Infinity); -ctx.quadraticCurveTo(0, Infinity, 0, Infinity); -ctx.quadraticCurveTo(0, 50, Infinity, Infinity); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.quadraticCurveTo(Infinity, 50, 0, 50); + ctx.quadraticCurveTo(-Infinity, 50, 0, 50); + ctx.quadraticCurveTo(NaN, 50, 0, 50); + ctx.quadraticCurveTo(0, Infinity, 0, 50); + ctx.quadraticCurveTo(0, -Infinity, 0, 50); + ctx.quadraticCurveTo(0, NaN, 0, 50); + ctx.quadraticCurveTo(0, 50, Infinity, 50); + ctx.quadraticCurveTo(0, 50, -Infinity, 50); + ctx.quadraticCurveTo(0, 50, NaN, 50); + ctx.quadraticCurveTo(0, 50, 0, Infinity); + ctx.quadraticCurveTo(0, 50, 0, -Infinity); + ctx.quadraticCurveTo(0, 50, 0, NaN); + ctx.quadraticCurveTo(Infinity, Infinity, 0, 50); + ctx.quadraticCurveTo(Infinity, Infinity, Infinity, 50); + ctx.quadraticCurveTo(Infinity, Infinity, Infinity, Infinity); + ctx.quadraticCurveTo(Infinity, Infinity, 0, Infinity); + ctx.quadraticCurveTo(Infinity, 50, Infinity, 50); + ctx.quadraticCurveTo(Infinity, 50, Infinity, Infinity); + ctx.quadraticCurveTo(Infinity, 50, 0, Infinity); + ctx.quadraticCurveTo(0, Infinity, Infinity, 50); + ctx.quadraticCurveTo(0, Infinity, Infinity, Infinity); + ctx.quadraticCurveTo(0, Infinity, 0, Infinity); + ctx.quadraticCurveTo(0, 50, Infinity, Infinity); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.scaled.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.scaled.html index 60ba483f14d..92c9377d6f6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.scaled.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.scaled.html @@ -17,24 +17,24 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.scale(1000, 1000); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 0.055; -ctx.beginPath(); -ctx.moveTo(-1, 1.05); -ctx.quadraticCurveTo(0, -1, 1.2, 1.05); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(1000, 1000); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 0.055; + ctx.beginPath(); + ctx.moveTo(-1, 1.05); + ctx.quadraticCurveTo(0, -1, 1.2, 1.05); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.scaled.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.scaled.worker.js index 298001b212e..04fd6e904d7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.scaled.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.scaled.worker.js @@ -13,24 +13,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.scale(1000, 1000); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 0.055; -ctx.beginPath(); -ctx.moveTo(-1, 1.05); -ctx.quadraticCurveTo(0, -1, 1.2, 1.05); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(1000, 1000); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 0.055; + ctx.beginPath(); + ctx.moveTo(-1, 1.05); + ctx.quadraticCurveTo(0, -1, 1.2, 1.05); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.shape.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.shape.html index 21cb175d598..ea42d669cb5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.shape.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.shape.html @@ -17,23 +17,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 55; -ctx.beginPath(); -ctx.moveTo(-1000, 1050); -ctx.quadraticCurveTo(0, -1000, 1200, 1050); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 55; + ctx.beginPath(); + ctx.moveTo(-1000, 1050); + ctx.quadraticCurveTo(0, -1000, 1200, 1050); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.shape.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.shape.worker.js index f7aac9135af..9f2afea09d2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.shape.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.quadraticCurveTo.shape.worker.js @@ -13,23 +13,22 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 55; -ctx.beginPath(); -ctx.moveTo(-1000, 1050); -ctx.quadraticCurveTo(0, -1000, 1200, 1050); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 55; + ctx.beginPath(); + ctx.moveTo(-1000, 1050); + ctx.quadraticCurveTo(0, -1000, 1200, 1050); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.basic.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.basic.html index 5214bd8dc05..e8d874709d8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.basic.html @@ -17,16 +17,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.rect(0, 0, 100, 50); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.rect(0, 0, 100, 50); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.basic.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.basic.worker.js index dcf3dc2a4bc..c8eb3838f9d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.basic.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.basic.worker.js @@ -13,16 +13,15 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.rect(0, 0, 100, 50); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.rect(0, 0, 100, 50); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.closed.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.closed.html index 70db3725a11..6f618743904 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.closed.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.closed.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 200; -ctx.lineJoin = 'miter'; -ctx.rect(100, 50, 100, 100); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 200; + ctx.lineJoin = 'miter'; + ctx.rect(100, 50, 100, 100); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.closed.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.closed.worker.js index 6ee09ef8d43..f40868730b3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.closed.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.closed.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 200; -ctx.lineJoin = 'miter'; -ctx.rect(100, 50, 100, 100); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 200; + ctx.lineJoin = 'miter'; + ctx.rect(100, 50, 100, 100); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.end.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.end.1.html index bb4bfc0c906..e4d5ece132b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.end.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.end.1.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.rect(200, 100, 400, 1000); -ctx.lineTo(-2000, -1000); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.rect(200, 100, 400, 1000); + ctx.lineTo(-2000, -1000); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.end.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.end.1.worker.js index f576ac43664..fcf9d0526f9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.end.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.end.1.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.rect(200, 100, 400, 1000); -ctx.lineTo(-2000, -1000); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.rect(200, 100, 400, 1000); + ctx.lineTo(-2000, -1000); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.end.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.end.2.html index 1f945a858e9..d6bad78abb6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.end.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.end.2.html @@ -17,23 +17,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 450; -ctx.lineCap = 'round'; -ctx.lineJoin = 'bevel'; -ctx.rect(150, 150, 2000, 2000); -ctx.lineTo(160, 160); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 450; + ctx.lineCap = 'round'; + ctx.lineJoin = 'bevel'; + ctx.rect(150, 150, 2000, 2000); + ctx.lineTo(160, 160); + ctx.stroke(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.end.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.end.2.worker.js index 8813ed81522..84c1b71d71d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.end.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.end.2.worker.js @@ -13,23 +13,22 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 450; -ctx.lineCap = 'round'; -ctx.lineJoin = 'bevel'; -ctx.rect(150, 150, 2000, 2000); -ctx.lineTo(160, 160); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 450; + ctx.lineCap = 'round'; + ctx.lineJoin = 'bevel'; + ctx.rect(150, 150, 2000, 2000); + ctx.lineTo(160, 160); + ctx.stroke(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.negative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.negative.html index 8c9effe2a54..730e2e887a7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.negative.html @@ -17,23 +17,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.fillStyle = '#0f0'; -ctx.rect(0, 0, 50, 25); -ctx.rect(100, 0, -50, 25); -ctx.rect(0, 50, 50, -25); -ctx.rect(100, 50, -50, -25); -ctx.fill(); -_assertPixel(canvas, 25,12, 0,255,0,255); -_assertPixel(canvas, 75,12, 0,255,0,255); -_assertPixel(canvas, 25,37, 0,255,0,255); -_assertPixel(canvas, 75,37, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.fillStyle = '#0f0'; + ctx.rect(0, 0, 50, 25); + ctx.rect(100, 0, -50, 25); + ctx.rect(0, 50, 50, -25); + ctx.rect(100, 50, -50, -25); + ctx.fill(); + _assertPixel(canvas, 25,12, 0,255,0,255); + _assertPixel(canvas, 75,12, 0,255,0,255); + _assertPixel(canvas, 25,37, 0,255,0,255); + _assertPixel(canvas, 75,37, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.negative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.negative.worker.js index ea01c6d3f07..44449e85e2c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.negative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.negative.worker.js @@ -13,23 +13,22 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.fillStyle = '#0f0'; -ctx.rect(0, 0, 50, 25); -ctx.rect(100, 0, -50, 25); -ctx.rect(0, 50, 50, -25); -ctx.rect(100, 50, -50, -25); -ctx.fill(); -_assertPixel(canvas, 25,12, 0,255,0,255); -_assertPixel(canvas, 75,12, 0,255,0,255); -_assertPixel(canvas, 25,37, 0,255,0,255); -_assertPixel(canvas, 75,37, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.fillStyle = '#0f0'; + ctx.rect(0, 0, 50, 25); + ctx.rect(100, 0, -50, 25); + ctx.rect(0, 50, 50, -25); + ctx.rect(100, 50, -50, -25); + ctx.fill(); + _assertPixel(canvas, 25,12, 0,255,0,255); + _assertPixel(canvas, 75,12, 0,255,0,255); + _assertPixel(canvas, 25,37, 0,255,0,255); + _assertPixel(canvas, 75,37, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.newsubpath.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.newsubpath.html index 1dcfbe94869..05b972e045d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.newsubpath.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.newsubpath.html @@ -17,20 +17,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.moveTo(-100, 25); -ctx.lineTo(-50, 25); -ctx.rect(200, 25, 1, 1); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.moveTo(-100, 25); + ctx.lineTo(-50, 25); + ctx.rect(200, 25, 1, 1); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.newsubpath.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.newsubpath.worker.js index 44962c5f2f4..bdf4a926c1f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.newsubpath.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.newsubpath.worker.js @@ -13,20 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.moveTo(-100, 25); -ctx.lineTo(-50, 25); -ctx.rect(200, 25, 1, 1); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.moveTo(-100, 25); + ctx.lineTo(-50, 25); + ctx.rect(200, 25, 1, 1); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.nonfinite.html index 7f92cf5e48c..16d76aaf185 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.nonfinite.html @@ -17,41 +17,41 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.rect(Infinity, 50, 1, 1); -ctx.rect(-Infinity, 50, 1, 1); -ctx.rect(NaN, 50, 1, 1); -ctx.rect(0, Infinity, 1, 1); -ctx.rect(0, -Infinity, 1, 1); -ctx.rect(0, NaN, 1, 1); -ctx.rect(0, 50, Infinity, 1); -ctx.rect(0, 50, -Infinity, 1); -ctx.rect(0, 50, NaN, 1); -ctx.rect(0, 50, 1, Infinity); -ctx.rect(0, 50, 1, -Infinity); -ctx.rect(0, 50, 1, NaN); -ctx.rect(Infinity, Infinity, 1, 1); -ctx.rect(Infinity, Infinity, Infinity, 1); -ctx.rect(Infinity, Infinity, Infinity, Infinity); -ctx.rect(Infinity, Infinity, 1, Infinity); -ctx.rect(Infinity, 50, Infinity, 1); -ctx.rect(Infinity, 50, Infinity, Infinity); -ctx.rect(Infinity, 50, 1, Infinity); -ctx.rect(0, Infinity, Infinity, 1); -ctx.rect(0, Infinity, Infinity, Infinity); -ctx.rect(0, Infinity, 1, Infinity); -ctx.rect(0, 50, Infinity, Infinity); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); -t.done(); + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.rect(Infinity, 50, 1, 1); + ctx.rect(-Infinity, 50, 1, 1); + ctx.rect(NaN, 50, 1, 1); + ctx.rect(0, Infinity, 1, 1); + ctx.rect(0, -Infinity, 1, 1); + ctx.rect(0, NaN, 1, 1); + ctx.rect(0, 50, Infinity, 1); + ctx.rect(0, 50, -Infinity, 1); + ctx.rect(0, 50, NaN, 1); + ctx.rect(0, 50, 1, Infinity); + ctx.rect(0, 50, 1, -Infinity); + ctx.rect(0, 50, 1, NaN); + ctx.rect(Infinity, Infinity, 1, 1); + ctx.rect(Infinity, Infinity, Infinity, 1); + ctx.rect(Infinity, Infinity, Infinity, Infinity); + ctx.rect(Infinity, Infinity, 1, Infinity); + ctx.rect(Infinity, 50, Infinity, 1); + ctx.rect(Infinity, 50, Infinity, Infinity); + ctx.rect(Infinity, 50, 1, Infinity); + ctx.rect(0, Infinity, Infinity, 1); + ctx.rect(0, Infinity, Infinity, Infinity); + ctx.rect(0, Infinity, 1, Infinity); + ctx.rect(0, 50, Infinity, Infinity); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.nonfinite.worker.js index 6fa1e82ae48..307a5ec08f7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.nonfinite.worker.js @@ -13,41 +13,40 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.rect(Infinity, 50, 1, 1); -ctx.rect(-Infinity, 50, 1, 1); -ctx.rect(NaN, 50, 1, 1); -ctx.rect(0, Infinity, 1, 1); -ctx.rect(0, -Infinity, 1, 1); -ctx.rect(0, NaN, 1, 1); -ctx.rect(0, 50, Infinity, 1); -ctx.rect(0, 50, -Infinity, 1); -ctx.rect(0, 50, NaN, 1); -ctx.rect(0, 50, 1, Infinity); -ctx.rect(0, 50, 1, -Infinity); -ctx.rect(0, 50, 1, NaN); -ctx.rect(Infinity, Infinity, 1, 1); -ctx.rect(Infinity, Infinity, Infinity, 1); -ctx.rect(Infinity, Infinity, Infinity, Infinity); -ctx.rect(Infinity, Infinity, 1, Infinity); -ctx.rect(Infinity, 50, Infinity, 1); -ctx.rect(Infinity, 50, Infinity, Infinity); -ctx.rect(Infinity, 50, 1, Infinity); -ctx.rect(0, Infinity, Infinity, 1); -ctx.rect(0, Infinity, Infinity, Infinity); -ctx.rect(0, Infinity, 1, Infinity); -ctx.rect(0, 50, Infinity, Infinity); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.rect(Infinity, 50, 1, 1); + ctx.rect(-Infinity, 50, 1, 1); + ctx.rect(NaN, 50, 1, 1); + ctx.rect(0, Infinity, 1, 1); + ctx.rect(0, -Infinity, 1, 1); + ctx.rect(0, NaN, 1, 1); + ctx.rect(0, 50, Infinity, 1); + ctx.rect(0, 50, -Infinity, 1); + ctx.rect(0, 50, NaN, 1); + ctx.rect(0, 50, 1, Infinity); + ctx.rect(0, 50, 1, -Infinity); + ctx.rect(0, 50, 1, NaN); + ctx.rect(Infinity, Infinity, 1, 1); + ctx.rect(Infinity, Infinity, Infinity, 1); + ctx.rect(Infinity, Infinity, Infinity, Infinity); + ctx.rect(Infinity, Infinity, 1, Infinity); + ctx.rect(Infinity, 50, Infinity, 1); + ctx.rect(Infinity, 50, Infinity, Infinity); + ctx.rect(Infinity, 50, 1, Infinity); + ctx.rect(0, Infinity, Infinity, 1); + ctx.rect(0, Infinity, Infinity, Infinity); + ctx.rect(0, Infinity, 1, Infinity); + ctx.rect(0, 50, Infinity, Infinity); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.selfintersect.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.selfintersect.html index 36c3f074194..af97fa6d38c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.selfintersect.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.selfintersect.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 90; -ctx.beginPath(); -ctx.rect(45, 20, 10, 10); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 90; + ctx.beginPath(); + ctx.rect(45, 20, 10, 10); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.selfintersect.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.selfintersect.worker.js index 84c2687f309..495d016e80c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.selfintersect.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.selfintersect.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 90; -ctx.beginPath(); -ctx.rect(45, 20, 10, 10); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 90; + ctx.beginPath(); + ctx.rect(45, 20, 10, 10); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.winding.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.winding.html index c4f4128188b..a7f79c5223a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.winding.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.winding.html @@ -17,23 +17,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.fillStyle = '#f00'; -ctx.rect(0, 0, 50, 50); -ctx.rect(100, 50, -50, -50); -ctx.rect(0, 25, 100, -25); -ctx.rect(100, 25, -100, 25); -ctx.fill(); -_assertPixel(canvas, 25,12, 0,255,0,255); -_assertPixel(canvas, 75,12, 0,255,0,255); -_assertPixel(canvas, 25,37, 0,255,0,255); -_assertPixel(canvas, 75,37, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.fillStyle = '#f00'; + ctx.rect(0, 0, 50, 50); + ctx.rect(100, 50, -50, -50); + ctx.rect(0, 25, 100, -25); + ctx.rect(100, 25, -100, 25); + ctx.fill(); + _assertPixel(canvas, 25,12, 0,255,0,255); + _assertPixel(canvas, 75,12, 0,255,0,255); + _assertPixel(canvas, 25,37, 0,255,0,255); + _assertPixel(canvas, 75,37, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.winding.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.winding.worker.js index 90a3d05e8b2..45ff0427e1c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.winding.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.winding.worker.js @@ -13,23 +13,22 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.fillStyle = '#f00'; -ctx.rect(0, 0, 50, 50); -ctx.rect(100, 50, -50, -50); -ctx.rect(0, 25, 100, -25); -ctx.rect(100, 25, -100, 25); -ctx.fill(); -_assertPixel(canvas, 25,12, 0,255,0,255); -_assertPixel(canvas, 75,12, 0,255,0,255); -_assertPixel(canvas, 25,37, 0,255,0,255); -_assertPixel(canvas, 75,37, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.fillStyle = '#f00'; + ctx.rect(0, 0, 50, 50); + ctx.rect(100, 50, -50, -50); + ctx.rect(0, 25, 100, -25); + ctx.rect(100, 25, -100, 25); + ctx.fill(); + _assertPixel(canvas, 25,12, 0,255,0,255); + _assertPixel(canvas, 75,12, 0,255,0,255); + _assertPixel(canvas, 25,37, 0,255,0,255); + _assertPixel(canvas, 75,37, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.1.html index 90c0bb1f68a..45dac2079d3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.1.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.rect(0, 50, 100, 0); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.rect(0, 50, 100, 0); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.1.worker.js index 4d080710d07..de6fb58c8a3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.1.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.rect(0, 50, 100, 0); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.rect(0, 50, 100, 0); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.2.html index 4c3ae6f6ddf..0386ea06e70 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.2.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.rect(50, -100, 0, 250); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.rect(50, -100, 0, 250); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.2.worker.js index 93d5a528759..8e323d2dd08 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.2.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.rect(50, -100, 0, 250); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.rect(50, -100, 0, 250); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.3.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.3.html index 86bd7494186..12990409293 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.3.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.rect(50, 25, 0, 0); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.rect(50, 25, 0, 0); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.3.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.3.worker.js index 6403de43c03..5e6f490c73e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.3.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.3.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.rect(50, 25, 0, 0); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.rect(50, 25, 0, 0); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.4.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.4.html index 063ef2ba1d5..93da1300de3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.4.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.4.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.rect(100, 25, 0, 0); -ctx.lineTo(0, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.rect(100, 25, 0, 0); + ctx.lineTo(0, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.4.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.4.worker.js index 87fd6985663..e19da3b9177 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.4.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.4.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.rect(100, 25, 0, 0); -ctx.lineTo(0, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.rect(100, 25, 0, 0); + ctx.lineTo(0, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.5.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.5.html index 0fa0b075504..45a7f03813f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.5.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.5.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.moveTo(0, 0); -ctx.rect(100, 25, 0, 0); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.moveTo(0, 0); + ctx.rect(100, 25, 0, 0); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.5.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.5.worker.js index 77851f54d3e..d39a7415738 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.5.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.5.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.moveTo(0, 0); -ctx.rect(100, 25, 0, 0); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.moveTo(0, 0); + ctx.rect(100, 25, 0, 0); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.6.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.6.html index a3cf7b60ac7..ac74e206608 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.6.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.6.html @@ -17,20 +17,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineJoin = 'miter'; -ctx.miterLimit = 1.5; -ctx.lineWidth = 200; -ctx.beginPath(); -ctx.rect(100, 25, 1000, 0); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineJoin = 'miter'; + ctx.miterLimit = 1.5; + ctx.lineWidth = 200; + ctx.beginPath(); + ctx.rect(100, 25, 1000, 0); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.6.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.6.worker.js index 5db284837c4..a567359c30a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.6.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.rect.zero.6.worker.js @@ -13,20 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineJoin = 'miter'; -ctx.miterLimit = 1.5; -ctx.lineWidth = 200; -ctx.beginPath(); -ctx.rect(100, 25, 1000, 0); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineJoin = 'miter'; + ctx.miterLimit = 1.5; + ctx.lineWidth = 200; + ctx.beginPath(); + ctx.rect(100, 25, 1000, 0); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.html index 479ab00cd7d..f7e80a0119f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.html @@ -6,50 +6,50 @@ <script src="/html/canvas/resources/canvas-tests.js"></script> <h1>2d.path.roundrect.1.radius.dompoint</h1> -<p class="desc">Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottom-left corners.</p> +<p class="desc">Verify that when one radius is given to roundRect(), specified as a DOMPoint, it applies to all corners.</p> <script> -var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottom-left corners."); +var t = async_test("Verify that when one radius is given to roundRect(), specified as a DOMPoint, it applies to all corners."); var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20)]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20)]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.single argument.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.single argument.html new file mode 100644 index 00000000000..4ea78c32d12 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.single argument.html @@ -0,0 +1,55 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.1.radius.dompoint.single argument</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.1.radius.dompoint.single argument</h1> +<p class="desc">Verify that when one radius is given to roundRect() as a non-array argument, specified as a DOMPoint, it applies to all corners.</p> + + +<script> +var t = async_test("Verify that when one radius is given to roundRect() as a non-array argument, specified as a DOMPoint, it applies to all corners."); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, new DOMPoint(40, 20)); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + t.done(); + +}); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.single argument.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.single argument.worker.js new file mode 100644 index 00000000000..b93d88e89cd --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.single argument.worker.js @@ -0,0 +1,50 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.1.radius.dompoint.single argument +// Description:Verify that when one radius is given to roundRect() as a non-array argument, specified as a DOMPoint, it applies to all corners. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when one radius is given to roundRect() as a non-array argument, specified as a DOMPoint, it applies to all corners."); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, new DOMPoint(40, 20)); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + t.done(); +}); +done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.worker.js index ba4fb4e611f..06d787437e7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompoint.worker.js @@ -1,51 +1,50 @@ // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.path.roundrect.1.radius.dompoint -// Description:Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottom-left corners. +// Description:Verify that when one radius is given to roundRect(), specified as a DOMPoint, it applies to all corners. // Note: importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottom-left corners."); +var t = async_test("Verify that when one radius is given to roundRect(), specified as a DOMPoint, it applies to all corners."); var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20)]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20)]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.html index 18ff259e66c..97084a446fd 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.html @@ -6,50 +6,50 @@ <script src="/html/canvas/resources/canvas-tests.js"></script> <h1>2d.path.roundrect.1.radius.dompointinit</h1> -<p class="desc">Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottomInit-left corners.</p> +<p class="desc">Verify that when one radius is given to roundRect(), specified as a DOMPointInit, applies to all corners.</p> <script> -var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottomInit-left corners."); +var t = async_test("Verify that when one radius is given to roundRect(), specified as a DOMPointInit, applies to all corners."); var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.single.argument.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.single.argument.html new file mode 100644 index 00000000000..10c5c14cff0 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.single.argument.html @@ -0,0 +1,55 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.1.radius.dompointinit.single.argument</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.1.radius.dompointinit.single.argument</h1> +<p class="desc">Verify that when one radius is given to roundRect() as a non-array argument, specified as a DOMPointInit, applies to all corners.</p> + + +<script> +var t = async_test("Verify that when one radius is given to roundRect() as a non-array argument, specified as a DOMPointInit, applies to all corners."); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, {x: 40, y: 20}); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + t.done(); + +}); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.single.argument.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.single.argument.worker.js new file mode 100644 index 00000000000..a62370677be --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.single.argument.worker.js @@ -0,0 +1,50 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.1.radius.dompointinit.single.argument +// Description:Verify that when one radius is given to roundRect() as a non-array argument, specified as a DOMPointInit, applies to all corners. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when one radius is given to roundRect() as a non-array argument, specified as a DOMPointInit, applies to all corners."); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, {x: 40, y: 20}); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + t.done(); +}); +done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.worker.js index 589950c04e0..56c8e1fcef5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.dompointinit.worker.js @@ -1,51 +1,50 @@ // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.path.roundrect.1.radius.dompointinit -// Description:Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottomInit-left corners. +// Description:Verify that when one radius is given to roundRect(), specified as a DOMPointInit, applies to all corners. // Note: importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottomInit-left corners."); +var t = async_test("Verify that when one radius is given to roundRect(), specified as a DOMPointInit, applies to all corners."); var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.html index 4761bb5e5e8..33574eeaa0e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [20]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [20]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.single.argument.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.single.argument.html new file mode 100644 index 00000000000..b2c826ff386 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.single.argument.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.1.radius.double.single.argument</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.1.radius.double.single.argument</h1> +<p class="desc">Verify that when one radius is given to roundRect() as a non-array argument, specified as a double, it applies to all corners.</p> + + +<script> +var t = async_test("Verify that when one radius is given to roundRect() as a non-array argument, specified as a double, it applies to all corners."); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, 20); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); + t.done(); + +}); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.single.argument.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.single.argument.worker.js new file mode 100644 index 00000000000..04350e81aac --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.single.argument.worker.js @@ -0,0 +1,30 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.1.radius.double.single.argument +// Description:Verify that when one radius is given to roundRect() as a non-array argument, specified as a double, it applies to all corners. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Verify that when one radius is given to roundRect() as a non-array argument, specified as a double, it applies to all corners."); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, 20); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); + t.done(); +}); +done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.worker.js index 57f28c77786..ef9da08d618 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.1.radius.double.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [20]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [20]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompoint.html index c96ed08f05c..7f67c42ed48 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompoint.html @@ -17,31 +17,31 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompoint.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompoint.worker.js index 7e7a4efddc0..5d0387d0d1f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompoint.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompoint.worker.js @@ -13,31 +13,30 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompointinit.html index 02b889c7592..2ac0347d96b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompointinit.html @@ -6,42 +6,42 @@ <script src="/html/canvas/resources/canvas-tests.js"></script> <h1>2d.path.roundrect.2.radii.1.dompointinit</h1> -<p class="desc">Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottomInit-right corners.</p> +<p class="desc">Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPointInit, applies to the top-left and bottom-right corners.</p> <script> -var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottomInit-right corners."); +var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPointInit, applies to the top-left and bottom-right corners."); var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompointinit.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompointinit.worker.js index fcc3cb088ae..240a36e846a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompointinit.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.dompointinit.worker.js @@ -1,43 +1,42 @@ // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.path.roundrect.2.radii.1.dompointinit -// Description:Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottomInit-right corners. +// Description:Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPointInit, applies to the top-left and bottom-right corners. // Note: importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottomInit-right corners."); +var t = async_test("Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPointInit, applies to the top-left and bottom-right corners."); var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.double.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.double.html index 2a6a030237b..791e59ee7e0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.double.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [20, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [20, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.double.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.double.worker.js index 6d4d029b1c8..0fc351c3d62 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.double.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.1.double.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [20, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [20, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompoint.html index bc6e27c6830..d0b085e1703 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompoint.html @@ -17,31 +17,31 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20)]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20)]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompoint.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompoint.worker.js index fead59e863b..4c6bb06bdb7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompoint.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompoint.worker.js @@ -13,31 +13,30 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20)]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20)]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompointinit.html index fcca1c739fc..380dd269978 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompointinit.html @@ -6,42 +6,42 @@ <script src="/html/canvas/resources/canvas-tests.js"></script> <h1>2d.path.roundrect.2.radii.2.dompointinit</h1> -<p class="desc">Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottomInit-left corners.</p> +<p class="desc">Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPointInit, applies to the top-right and bottom-left corners.</p> <script> -var t = async_test("Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottomInit-left corners."); +var t = async_test("Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPointInit, applies to the top-right and bottom-left corners."); var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompointinit.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompointinit.worker.js index ab334e4ca06..e8cdd2c0153 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompointinit.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.dompointinit.worker.js @@ -1,43 +1,42 @@ // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.path.roundrect.2.radii.2.dompointinit -// Description:Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottomInit-left corners. +// Description:Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPointInit, applies to the top-right and bottom-left corners. // Note: importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test("Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottomInit-left corners."); +var t = async_test("Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPointInit, applies to the top-right and bottom-left corners."); var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.double.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.double.html index 2bc67375669..b7b25727b9e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.double.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 20]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 20]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.double.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.double.worker.js index d355852a5ce..756328682df 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.double.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.2.radii.2.double.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 20]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 20]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompoint.html index f3388e6562e..b7f3e53261a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompoint.html @@ -17,26 +17,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// other corners -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // other corners + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompoint.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompoint.worker.js index 36c6401bf3d..9ac4d731c3a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompoint.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompoint.worker.js @@ -13,26 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// other corners -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + // other corners + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompointinit.html index dd96e859ea1..93f89159b1d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompointinit.html @@ -17,26 +17,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// other corners -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // other corners + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompointinit.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompointinit.worker.js index a497d5788ba..9d00729ce9e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompointinit.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.dompointinit.worker.js @@ -13,26 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// other corners -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + // other corners + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.double.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.double.html index 4c5f57122cd..976458bc5f0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.double.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [20, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [20, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.double.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.double.worker.js index 171a2ae5e6f..c4e1c4fc039 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.double.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.1.double.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [20, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [20, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompoint.html index 3459ac27bb2..1a89c28d15f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompoint.html @@ -17,31 +17,31 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20), 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20), 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompoint.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompoint.worker.js index 9588780f978..4e4df3a6013 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompoint.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompoint.worker.js @@ -13,31 +13,30 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20), 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20), 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompointinit.html index 6476be489f7..82ceb6a7bcc 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompointinit.html @@ -6,42 +6,42 @@ <script src="/html/canvas/resources/canvas-tests.js"></script> <h1>2d.path.roundrect.3.radii.2.dompointinit</h1> -<p class="desc">Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottomInit-left corners.</p> +<p class="desc">Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottom-left corners.</p> <script> -var t = async_test("Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottomInit-left corners."); +var t = async_test("Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottom-left corners."); var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompointinit.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompointinit.worker.js index 42dead8509b..1333e2386d7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompointinit.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.dompointinit.worker.js @@ -1,43 +1,42 @@ // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.path.roundrect.3.radii.2.dompointinit -// Description:Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottomInit-left corners. +// Description:Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottom-left corners. // Note: importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test("Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottomInit-left corners."); +var t = async_test("Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottom-left corners."); var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.double.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.double.html index 652745e0bed..b466956d580 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.double.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 20, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 20, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.double.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.double.worker.js index e3929fbfdbb..027dbae52ac 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.double.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.2.double.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 20, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 20, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompoint.html index 1c295143c81..897aeb2685f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompoint.html @@ -17,26 +17,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, new DOMPoint(40, 20)]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, new DOMPoint(40, 20)]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompoint.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompoint.worker.js index c8e08ec297f..8a80623fc9a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompoint.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompoint.worker.js @@ -13,26 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, new DOMPoint(40, 20)]); -ctx.fillStyle = '#0f0'; -ctx.fill(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, new DOMPoint(40, 20)]); + ctx.fillStyle = '#0f0'; + ctx.fill(); -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompointinit.html index f8e62a5bf62..e1e055cb643 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompointinit.html @@ -17,26 +17,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, {x: 40, y: 20}]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, {x: 40, y: 20}]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompointinit.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompointinit.worker.js index 0fe2b89877a..d3b188dd7f5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompointinit.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.dompointinit.worker.js @@ -13,26 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, {x: 40, y: 20}]); -ctx.fillStyle = '#0f0'; -ctx.fill(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, {x: 40, y: 20}]); + ctx.fillStyle = '#0f0'; + ctx.fill(); -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.double.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.double.html index ff1301d9cd4..a0e0553364f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.double.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, 20]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, 20]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.double.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.double.worker.js index 2422435d526..177e7c5f6d1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.double.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.3.radii.3.double.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, 20]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, 20]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompoint.html index 3110983f7f8..72e8d6ce335 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompoint.html @@ -17,26 +17,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// other corners -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // other corners + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompoint.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompoint.worker.js index 3bdb12e0298..f27f696f1c7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompoint.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompoint.worker.js @@ -13,26 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// other corners -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + // other corners + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompointinit.html index 976b39a1021..df6bb11e02c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompointinit.html @@ -17,26 +17,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// other corners -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + + // other corners + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompointinit.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompointinit.worker.js index 86b43ad2a19..2f9d2eb30f8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompointinit.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.dompointinit.worker.js @@ -13,26 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); -// top-left corner -_assertPixel(canvas, 20,1, 255,0,0,255); -_assertPixel(canvas, 41,1, 0,255,0,255); -_assertPixel(canvas, 1,10, 255,0,0,255); -_assertPixel(canvas, 1,21, 0,255,0,255); - -// other corners -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + // top-left corner + _assertPixel(canvas, 20,1, 255,0,0,255); + _assertPixel(canvas, 41,1, 0,255,0,255); + _assertPixel(canvas, 1,10, 255,0,0,255); + _assertPixel(canvas, 1,21, 0,255,0,255); + // other corners + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.double.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.double.html index c75d6420c9c..b669a7bb6af 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.double.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [20, 0, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [20, 0, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.double.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.double.worker.js index 925c93b0c90..9658a39cfbb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.double.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.1.double.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [20, 0, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [20, 0, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompoint.html index 33d861d6dce..b387d88990b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompoint.html @@ -17,26 +17,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20), 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20), 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompoint.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompoint.worker.js index 12d1a8c8e63..83d3f66b3cf 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompoint.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompoint.worker.js @@ -13,26 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20), 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20), 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompointinit.html index b088c2e717b..76719124e2b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompointinit.html @@ -17,26 +17,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompointinit.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompointinit.worker.js index 49a247a2663..21766040b46 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompointinit.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.dompointinit.worker.js @@ -13,26 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); -// top-right corner -_assertPixel(canvas, 79,1, 255,0,0,255); -_assertPixel(canvas, 58,1, 0,255,0,255); -_assertPixel(canvas, 98,10, 255,0,0,255); -_assertPixel(canvas, 98,21, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + // top-right corner + _assertPixel(canvas, 79,1, 255,0,0,255); + _assertPixel(canvas, 58,1, 0,255,0,255); + _assertPixel(canvas, 98,10, 255,0,0,255); + _assertPixel(canvas, 98,21, 0,255,0,255); + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.double.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.double.html index 71395e0e9ee..001cb8429ca 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.double.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 20, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 20, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.double.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.double.worker.js index f868c6272ef..b9935a1bd9b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.double.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.2.double.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 20, 0, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 20, 0, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompoint.html index 4922bf37f22..5c8c686086e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompoint.html @@ -17,26 +17,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, new DOMPoint(40, 20), 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, new DOMPoint(40, 20), 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompoint.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompoint.worker.js index 2da2f3591c6..819b1a39867 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompoint.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompoint.worker.js @@ -13,26 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, new DOMPoint(40, 20), 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, new DOMPoint(40, 20), 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompointinit.html index 3b6f2fd863f..1b94b7d7ed5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompointinit.html @@ -17,26 +17,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, {x: 40, y: 20}, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, {x: 40, y: 20}, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompointinit.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompointinit.worker.js index 65a3feb36f4..e4bd04aa296 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompointinit.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.dompointinit.worker.js @@ -13,26 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, {x: 40, y: 20}, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, {x: 40, y: 20}, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); -// bottom-right corner -_assertPixel(canvas, 79,48, 255,0,0,255); -_assertPixel(canvas, 58,48, 0,255,0,255); -_assertPixel(canvas, 98,39, 255,0,0,255); -_assertPixel(canvas, 98,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + // bottom-right corner + _assertPixel(canvas, 79,48, 255,0,0,255); + _assertPixel(canvas, 58,48, 0,255,0,255); + _assertPixel(canvas, 98,39, 255,0,0,255); + _assertPixel(canvas, 98,28, 0,255,0,255); + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.double.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.double.html index 3dd2af98007..2a76d2b7b1f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.double.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, 20, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, 20, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.double.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.double.worker.js index a327ceac157..ada627b4695 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.double.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.3.double.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, 20, 0]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, 20, 0]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompoint.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompoint.html index d61a3133cc4..ce86e45e8b3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompoint.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompoint.html @@ -17,26 +17,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, 0, new DOMPoint(40, 20)]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, 0, new DOMPoint(40, 20)]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompoint.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompoint.worker.js index d8a121e6da9..770291c6f9a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompoint.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompoint.worker.js @@ -13,26 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, 0, new DOMPoint(40, 20)]); -ctx.fillStyle = '#0f0'; -ctx.fill(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, 0, new DOMPoint(40, 20)]); + ctx.fillStyle = '#0f0'; + ctx.fill(); -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompointinit.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompointinit.html index 94ffc00433e..f0ec6c3b999 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompointinit.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompointinit.html @@ -17,26 +17,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, 0, {x: 40, y: 20}]); -ctx.fillStyle = '#0f0'; -ctx.fill(); - -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, 0, {x: 40, y: 20}]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompointinit.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompointinit.worker.js index b7babb52961..48310c6a30b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompointinit.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.dompointinit.worker.js @@ -13,26 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, 0, {x: 40, y: 20}]); -ctx.fillStyle = '#0f0'; -ctx.fill(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, 0, {x: 40, y: 20}]); + ctx.fillStyle = '#0f0'; + ctx.fill(); -// bottom-left corner -_assertPixel(canvas, 20,48, 255,0,0,255); -_assertPixel(canvas, 41,48, 0,255,0,255); -_assertPixel(canvas, 1,39, 255,0,0,255); -_assertPixel(canvas, 1,28, 0,255,0,255); - -// other corners -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + // bottom-left corner + _assertPixel(canvas, 20,48, 255,0,0,255); + _assertPixel(canvas, 41,48, 0,255,0,255); + _assertPixel(canvas, 1,39, 255,0,0,255); + _assertPixel(canvas, 1,28, 0,255,0,255); + // other corners + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.double.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.double.html index 4ab25818476..6940622cf03 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.double.html @@ -17,19 +17,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, 0, 20]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, 0, 20]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.double.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.double.worker.js index ad4cca49536..e97ebd98ff7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.double.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.4.radii.4.double.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [0, 0, 0, 20]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [0, 0, 0, 20]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.badinput.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.badinput.html new file mode 100644 index 00000000000..97b322971c3 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.badinput.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.badinput</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.badinput</h1> +<p class="desc">roundRect() throws or does not throw errors given the strange inputs.</p> + + +<script> +var t = async_test("roundRect() throws or does not throw errors given the strange inputs."); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.roundRect(0, 0, 100, 100, { foo: "bar" }); //=> DOMPointInit + ctx.roundRect(0, 0, 100, 100, undefined); //=> "missing" -> 0 + ctx.roundRect(0, 0, 100, 100, [[]]); //=> « DOMPointInit » + ctx.roundRect(0, 0, 100, 100, [[25]]); //=> « DOMPointInit » + ctx.roundRect(0, 0, 100, 100, [undefined]); //=> « DOMPointInit » + assert_throws_js(TypeError, function() { ctx.roundRect(0, 0, 100, 100, 0n); }); + assert_throws_js(TypeError, function() { ctx.roundRect(0, 0, 100, 100, { x: 0n }); }); + assert_throws_js(TypeError, function() { ctx.roundRect(0, 0, 100, 100, [{ x: 0n }]); }); + t.done(); + +}); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.badinput.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.badinput.worker.js new file mode 100644 index 00000000000..461dee89ade --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.badinput.worker.js @@ -0,0 +1,29 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.badinput +// Description:roundRect() throws or does not throw errors given the strange inputs. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("roundRect() throws or does not throw errors given the strange inputs."); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.roundRect(0, 0, 100, 100, { foo: "bar" }); //=> DOMPointInit + ctx.roundRect(0, 0, 100, 100, undefined); //=> "missing" -> 0 + ctx.roundRect(0, 0, 100, 100, [[]]); //=> « DOMPointInit » + ctx.roundRect(0, 0, 100, 100, [[25]]); //=> « DOMPointInit » + ctx.roundRect(0, 0, 100, 100, [undefined]); //=> « DOMPointInit » + assert_throws_js(TypeError, function() { ctx.roundRect(0, 0, 100, 100, 0n); }); + assert_throws_js(TypeError, function() { ctx.roundRect(0, 0, 100, 100, { x: 0n }); }); + assert_throws_js(TypeError, function() { ctx.roundRect(0, 0, 100, 100, [{ x: 0n }]); }); + t.done(); +}); +done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.closed.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.closed.html index 1b4abf012c7..7407ead9cf5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.closed.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.closed.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 200; -ctx.lineJoin = 'miter'; -ctx.roundRect(100, 50, 100, 100, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 200; + ctx.lineJoin = 'miter'; + ctx.roundRect(100, 50, 100, 100, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.closed.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.closed.worker.js index e0f1b81aa42..5a9530a6833 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.closed.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.closed.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 200; -ctx.lineJoin = 'miter'; -ctx.roundRect(100, 50, 100, 100, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 200; + ctx.lineJoin = 'miter'; + ctx.roundRect(100, 50, 100, 100, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.1.html index 5c6b3cd537d..d73b82bee4a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.1.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.roundRect(200, 100, 400, 1000, [0]); -ctx.lineTo(-2000, -1000); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.roundRect(200, 100, 400, 1000, [0]); + ctx.lineTo(-2000, -1000); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.1.worker.js index 1ec22bdb6a7..9428df5bbd1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.1.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.roundRect(200, 100, 400, 1000, [0]); -ctx.lineTo(-2000, -1000); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.roundRect(200, 100, 400, 1000, [0]); + ctx.lineTo(-2000, -1000); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.2.html index 3913f69d412..ce9b44ead12 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.2.html @@ -17,23 +17,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 450; -ctx.lineCap = 'round'; -ctx.lineJoin = 'bevel'; -ctx.roundRect(150, 150, 2000, 2000, [0]); -ctx.lineTo(160, 160); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 450; + ctx.lineCap = 'round'; + ctx.lineJoin = 'bevel'; + ctx.roundRect(150, 150, 2000, 2000, [0]); + ctx.lineTo(160, 160); + ctx.stroke(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.2.worker.js index c3085d53c3b..28f1ca1787a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.2.worker.js @@ -13,23 +13,22 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 450; -ctx.lineCap = 'round'; -ctx.lineJoin = 'bevel'; -ctx.roundRect(150, 150, 2000, 2000, [0]); -ctx.lineTo(160, 160); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 450; + ctx.lineCap = 'round'; + ctx.lineJoin = 'bevel'; + ctx.roundRect(150, 150, 2000, 2000, [0]); + ctx.lineTo(160, 160); + ctx.stroke(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.3.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.3.html index 349f13485c0..72183ecd05e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.3.html @@ -17,21 +17,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.roundRect(101, 51, 2000, 2000, [500, 500, 500, 500]); -ctx.lineTo(-1, -1); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.roundRect(101, 51, 2000, 2000, [500, 500, 500, 500]); + ctx.lineTo(-1, -1); + ctx.stroke(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.3.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.3.worker.js index 52b9c442838..57cb328cfa5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.3.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.3.worker.js @@ -13,21 +13,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.roundRect(101, 51, 2000, 2000, [500, 500, 500, 500]); -ctx.lineTo(-1, -1); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.roundRect(101, 51, 2000, 2000, [500, 500, 500, 500]); + ctx.lineTo(-1, -1); + ctx.stroke(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.4.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.4.html index 3c99e3970a1..c4fdee5958e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.4.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.4.html @@ -17,21 +17,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 10; -ctx.roundRect(-1, -1, 2000, 2000, [1000, 1000, 1000, 1000]); -ctx.lineTo(-150, -150); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 10; + ctx.roundRect(-1, -1, 2000, 2000, [1000, 1000, 1000, 1000]); + ctx.lineTo(-150, -150); + ctx.stroke(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.4.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.4.worker.js index 1d57b8978f2..a97a37d1572 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.4.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.end.4.worker.js @@ -13,21 +13,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 10; -ctx.roundRect(-1, -1, 2000, 2000, [1000, 1000, 1000, 1000]); -ctx.lineTo(-150, -150); -ctx.stroke(); -_assertPixel(canvas, 1,1, 0,255,0,255); -_assertPixel(canvas, 98,1, 0,255,0,255); -_assertPixel(canvas, 1,48, 0,255,0,255); -_assertPixel(canvas, 98,48, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 10; + ctx.roundRect(-1, -1, 2000, 2000, [1000, 1000, 1000, 1000]); + ctx.lineTo(-150, -150); + ctx.stroke(); + _assertPixel(canvas, 1,1, 0,255,0,255); + _assertPixel(canvas, 98,1, 0,255,0,255); + _assertPixel(canvas, 1,48, 0,255,0,255); + _assertPixel(canvas, 98,48, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.negative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.negative.html index e3696ca1a5b..aa836572448 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.negative.html @@ -17,29 +17,29 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.fillStyle = '#0f0'; -ctx.roundRect(0, 0, 50, 25, [10, 0, 0, 0]); -ctx.roundRect(100, 0, -50, 25, [10, 0, 0, 0]); -ctx.roundRect(0, 50, 50, -25, [10, 0, 0, 0]); -ctx.roundRect(100, 50, -50, -25, [10, 0, 0, 0]); -ctx.fill(); -// All rects drawn -_assertPixel(canvas, 25,12, 0,255,0,255); -_assertPixel(canvas, 75,12, 0,255,0,255); -_assertPixel(canvas, 25,37, 0,255,0,255); -_assertPixel(canvas, 75,37, 0,255,0,255); -// Correct corners are rounded. -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.fillStyle = '#0f0'; + ctx.roundRect(0, 0, 50, 25, [10, 0, 0, 0]); + ctx.roundRect(100, 0, -50, 25, [10, 0, 0, 0]); + ctx.roundRect(0, 50, 50, -25, [10, 0, 0, 0]); + ctx.roundRect(100, 50, -50, -25, [10, 0, 0, 0]); + ctx.fill(); + // All rects drawn + _assertPixel(canvas, 25,12, 0,255,0,255); + _assertPixel(canvas, 75,12, 0,255,0,255); + _assertPixel(canvas, 25,37, 0,255,0,255); + _assertPixel(canvas, 75,37, 0,255,0,255); + // Correct corners are rounded. + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.negative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.negative.worker.js index c34c20397a8..14459238ed1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.negative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.negative.worker.js @@ -13,29 +13,28 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.fillStyle = '#0f0'; -ctx.roundRect(0, 0, 50, 25, [10, 0, 0, 0]); -ctx.roundRect(100, 0, -50, 25, [10, 0, 0, 0]); -ctx.roundRect(0, 50, 50, -25, [10, 0, 0, 0]); -ctx.roundRect(100, 50, -50, -25, [10, 0, 0, 0]); -ctx.fill(); -// All rects drawn -_assertPixel(canvas, 25,12, 0,255,0,255); -_assertPixel(canvas, 75,12, 0,255,0,255); -_assertPixel(canvas, 25,37, 0,255,0,255); -_assertPixel(canvas, 75,37, 0,255,0,255); -// Correct corners are rounded. -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.fillStyle = '#0f0'; + ctx.roundRect(0, 0, 50, 25, [10, 0, 0, 0]); + ctx.roundRect(100, 0, -50, 25, [10, 0, 0, 0]); + ctx.roundRect(0, 50, 50, -25, [10, 0, 0, 0]); + ctx.roundRect(100, 50, -50, -25, [10, 0, 0, 0]); + ctx.fill(); + // All rects drawn + _assertPixel(canvas, 25,12, 0,255,0,255); + _assertPixel(canvas, 75,12, 0,255,0,255); + _assertPixel(canvas, 25,37, 0,255,0,255); + _assertPixel(canvas, 75,37, 0,255,0,255); + // Correct corners are rounded. + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.newsubpath.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.newsubpath.html index 6d0a8149077..3ad7e5bb5b9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.newsubpath.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.newsubpath.html @@ -17,20 +17,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.moveTo(-100, 25); -ctx.lineTo(-50, 25); -ctx.roundRect(200, 25, 1, 1, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.moveTo(-100, 25); + ctx.lineTo(-50, 25); + ctx.roundRect(200, 25, 1, 1, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.newsubpath.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.newsubpath.worker.js index c6f7934bee9..757327c60d3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.newsubpath.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.newsubpath.worker.js @@ -13,20 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.moveTo(-100, 25); -ctx.lineTo(-50, 25); -ctx.roundRect(200, 25, 1, 1, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.moveTo(-100, 25); + ctx.lineTo(-50, 25); + ctx.roundRect(200, 25, 1, 1, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.nonfinite.html index 29773503013..adddc7b9b89 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.nonfinite.html @@ -17,100 +17,100 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.roundRect(Infinity, 50, 1, 1, [0]); -ctx.roundRect(-Infinity, 50, 1, 1, [0]); -ctx.roundRect(NaN, 50, 1, 1, [0]); -ctx.roundRect(0, Infinity, 1, 1, [0]); -ctx.roundRect(0, -Infinity, 1, 1, [0]); -ctx.roundRect(0, NaN, 1, 1, [0]); -ctx.roundRect(0, 50, Infinity, 1, [0]); -ctx.roundRect(0, 50, -Infinity, 1, [0]); -ctx.roundRect(0, 50, NaN, 1, [0]); -ctx.roundRect(0, 50, 1, Infinity, [0]); -ctx.roundRect(0, 50, 1, -Infinity, [0]); -ctx.roundRect(0, 50, 1, NaN, [0]); -ctx.roundRect(0, 50, 1, 1, [Infinity]); -ctx.roundRect(0, 50, 1, 1, [-Infinity]); -ctx.roundRect(0, 50, 1, 1, [NaN]); -ctx.roundRect(0, 50, 1, 1, [Infinity,0]); -ctx.roundRect(0, 50, 1, 1, [-Infinity,0]); -ctx.roundRect(0, 50, 1, 1, [NaN,0]); -ctx.roundRect(0, 50, 1, 1, [0,Infinity]); -ctx.roundRect(0, 50, 1, 1, [0,-Infinity]); -ctx.roundRect(0, 50, 1, 1, [0,NaN]); -ctx.roundRect(0, 50, 1, 1, [Infinity,0,0]); -ctx.roundRect(0, 50, 1, 1, [-Infinity,0,0]); -ctx.roundRect(0, 50, 1, 1, [NaN,0,0]); -ctx.roundRect(0, 50, 1, 1, [0,Infinity,0]); -ctx.roundRect(0, 50, 1, 1, [0,-Infinity,0]); -ctx.roundRect(0, 50, 1, 1, [0,NaN,0]); -ctx.roundRect(0, 50, 1, 1, [0,0,Infinity]); -ctx.roundRect(0, 50, 1, 1, [0,0,-Infinity]); -ctx.roundRect(0, 50, 1, 1, [0,0,NaN]); -ctx.roundRect(0, 50, 1, 1, [Infinity,0,0,0]); -ctx.roundRect(0, 50, 1, 1, [-Infinity,0,0,0]); -ctx.roundRect(0, 50, 1, 1, [NaN,0,0,0]); -ctx.roundRect(0, 50, 1, 1, [0,Infinity,0,0]); -ctx.roundRect(0, 50, 1, 1, [0,-Infinity,0,0]); -ctx.roundRect(0, 50, 1, 1, [0,NaN,0,0]); -ctx.roundRect(0, 50, 1, 1, [0,0,Infinity,0]); -ctx.roundRect(0, 50, 1, 1, [0,0,-Infinity,0]); -ctx.roundRect(0, 50, 1, 1, [0,0,NaN,0]); -ctx.roundRect(0, 50, 1, 1, [0,0,0,Infinity]); -ctx.roundRect(0, 50, 1, 1, [0,0,0,-Infinity]); -ctx.roundRect(0, 50, 1, 1, [0,0,0,NaN]); -ctx.roundRect(Infinity, Infinity, 1, 1, [0]); -ctx.roundRect(Infinity, Infinity, Infinity, 1, [0]); -ctx.roundRect(Infinity, Infinity, Infinity, Infinity, [0]); -ctx.roundRect(Infinity, Infinity, Infinity, Infinity, [Infinity]); -ctx.roundRect(Infinity, Infinity, Infinity, 1, [Infinity]); -ctx.roundRect(Infinity, Infinity, 1, Infinity, [0]); -ctx.roundRect(Infinity, Infinity, 1, Infinity, [Infinity]); -ctx.roundRect(Infinity, Infinity, 1, 1, [Infinity]); -ctx.roundRect(Infinity, 50, Infinity, 1, [0]); -ctx.roundRect(Infinity, 50, Infinity, Infinity, [0]); -ctx.roundRect(Infinity, 50, Infinity, Infinity, [Infinity]); -ctx.roundRect(Infinity, 50, Infinity, 1, [Infinity]); -ctx.roundRect(Infinity, 50, 1, Infinity, [0]); -ctx.roundRect(Infinity, 50, 1, Infinity, [Infinity]); -ctx.roundRect(Infinity, 50, 1, 1, [Infinity]); -ctx.roundRect(0, Infinity, Infinity, 1, [0]); -ctx.roundRect(0, Infinity, Infinity, Infinity, [0]); -ctx.roundRect(0, Infinity, Infinity, Infinity, [Infinity]); -ctx.roundRect(0, Infinity, Infinity, 1, [Infinity]); -ctx.roundRect(0, Infinity, 1, Infinity, [0]); -ctx.roundRect(0, Infinity, 1, Infinity, [Infinity]); -ctx.roundRect(0, Infinity, 1, 1, [Infinity]); -ctx.roundRect(0, 50, Infinity, Infinity, [0]); -ctx.roundRect(0, 50, Infinity, Infinity, [Infinity]); -ctx.roundRect(0, 50, Infinity, 1, [Infinity]); -ctx.roundRect(0, 50, 1, Infinity, [Infinity]); -ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, Infinity)]); -ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, -Infinity)]); -ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, NaN)]); -ctx.roundRect(0, 0, 100, 100, [new DOMPoint(Infinity, 10)]); -ctx.roundRect(0, 0, 100, 100, [new DOMPoint(-Infinity, 10)]); -ctx.roundRect(0, 0, 100, 100, [new DOMPoint(NaN, 10)]); -ctx.roundRect(0, 0, 100, 100, [{x: 10, y: Infinity}]); -ctx.roundRect(0, 0, 100, 100, [{x: 10, y: -Infinity}]); -ctx.roundRect(0, 0, 100, 100, [{x: 10, y: NaN}]); -ctx.roundRect(0, 0, 100, 100, [{x: Infinity, y: 10}]); -ctx.roundRect(0, 0, 100, 100, [{x: -Infinity, y: 10}]); -ctx.roundRect(0, 0, 100, 100, [{x: NaN, y: 10}]); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.roundRect(Infinity, 50, 1, 1, [0]); + ctx.roundRect(-Infinity, 50, 1, 1, [0]); + ctx.roundRect(NaN, 50, 1, 1, [0]); + ctx.roundRect(0, Infinity, 1, 1, [0]); + ctx.roundRect(0, -Infinity, 1, 1, [0]); + ctx.roundRect(0, NaN, 1, 1, [0]); + ctx.roundRect(0, 50, Infinity, 1, [0]); + ctx.roundRect(0, 50, -Infinity, 1, [0]); + ctx.roundRect(0, 50, NaN, 1, [0]); + ctx.roundRect(0, 50, 1, Infinity, [0]); + ctx.roundRect(0, 50, 1, -Infinity, [0]); + ctx.roundRect(0, 50, 1, NaN, [0]); + ctx.roundRect(0, 50, 1, 1, [Infinity]); + ctx.roundRect(0, 50, 1, 1, [-Infinity]); + ctx.roundRect(0, 50, 1, 1, [NaN]); + ctx.roundRect(0, 50, 1, 1, [Infinity,0]); + ctx.roundRect(0, 50, 1, 1, [-Infinity,0]); + ctx.roundRect(0, 50, 1, 1, [NaN,0]); + ctx.roundRect(0, 50, 1, 1, [0,Infinity]); + ctx.roundRect(0, 50, 1, 1, [0,-Infinity]); + ctx.roundRect(0, 50, 1, 1, [0,NaN]); + ctx.roundRect(0, 50, 1, 1, [Infinity,0,0]); + ctx.roundRect(0, 50, 1, 1, [-Infinity,0,0]); + ctx.roundRect(0, 50, 1, 1, [NaN,0,0]); + ctx.roundRect(0, 50, 1, 1, [0,Infinity,0]); + ctx.roundRect(0, 50, 1, 1, [0,-Infinity,0]); + ctx.roundRect(0, 50, 1, 1, [0,NaN,0]); + ctx.roundRect(0, 50, 1, 1, [0,0,Infinity]); + ctx.roundRect(0, 50, 1, 1, [0,0,-Infinity]); + ctx.roundRect(0, 50, 1, 1, [0,0,NaN]); + ctx.roundRect(0, 50, 1, 1, [Infinity,0,0,0]); + ctx.roundRect(0, 50, 1, 1, [-Infinity,0,0,0]); + ctx.roundRect(0, 50, 1, 1, [NaN,0,0,0]); + ctx.roundRect(0, 50, 1, 1, [0,Infinity,0,0]); + ctx.roundRect(0, 50, 1, 1, [0,-Infinity,0,0]); + ctx.roundRect(0, 50, 1, 1, [0,NaN,0,0]); + ctx.roundRect(0, 50, 1, 1, [0,0,Infinity,0]); + ctx.roundRect(0, 50, 1, 1, [0,0,-Infinity,0]); + ctx.roundRect(0, 50, 1, 1, [0,0,NaN,0]); + ctx.roundRect(0, 50, 1, 1, [0,0,0,Infinity]); + ctx.roundRect(0, 50, 1, 1, [0,0,0,-Infinity]); + ctx.roundRect(0, 50, 1, 1, [0,0,0,NaN]); + ctx.roundRect(Infinity, Infinity, 1, 1, [0]); + ctx.roundRect(Infinity, Infinity, Infinity, 1, [0]); + ctx.roundRect(Infinity, Infinity, Infinity, Infinity, [0]); + ctx.roundRect(Infinity, Infinity, Infinity, Infinity, [Infinity]); + ctx.roundRect(Infinity, Infinity, Infinity, 1, [Infinity]); + ctx.roundRect(Infinity, Infinity, 1, Infinity, [0]); + ctx.roundRect(Infinity, Infinity, 1, Infinity, [Infinity]); + ctx.roundRect(Infinity, Infinity, 1, 1, [Infinity]); + ctx.roundRect(Infinity, 50, Infinity, 1, [0]); + ctx.roundRect(Infinity, 50, Infinity, Infinity, [0]); + ctx.roundRect(Infinity, 50, Infinity, Infinity, [Infinity]); + ctx.roundRect(Infinity, 50, Infinity, 1, [Infinity]); + ctx.roundRect(Infinity, 50, 1, Infinity, [0]); + ctx.roundRect(Infinity, 50, 1, Infinity, [Infinity]); + ctx.roundRect(Infinity, 50, 1, 1, [Infinity]); + ctx.roundRect(0, Infinity, Infinity, 1, [0]); + ctx.roundRect(0, Infinity, Infinity, Infinity, [0]); + ctx.roundRect(0, Infinity, Infinity, Infinity, [Infinity]); + ctx.roundRect(0, Infinity, Infinity, 1, [Infinity]); + ctx.roundRect(0, Infinity, 1, Infinity, [0]); + ctx.roundRect(0, Infinity, 1, Infinity, [Infinity]); + ctx.roundRect(0, Infinity, 1, 1, [Infinity]); + ctx.roundRect(0, 50, Infinity, Infinity, [0]); + ctx.roundRect(0, 50, Infinity, Infinity, [Infinity]); + ctx.roundRect(0, 50, Infinity, 1, [Infinity]); + ctx.roundRect(0, 50, 1, Infinity, [Infinity]); + ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, Infinity)]); + ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, -Infinity)]); + ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, NaN)]); + ctx.roundRect(0, 0, 100, 100, [new DOMPoint(Infinity, 10)]); + ctx.roundRect(0, 0, 100, 100, [new DOMPoint(-Infinity, 10)]); + ctx.roundRect(0, 0, 100, 100, [new DOMPoint(NaN, 10)]); + ctx.roundRect(0, 0, 100, 100, [{x: 10, y: Infinity}]); + ctx.roundRect(0, 0, 100, 100, [{x: 10, y: -Infinity}]); + ctx.roundRect(0, 0, 100, 100, [{x: 10, y: NaN}]); + ctx.roundRect(0, 0, 100, 100, [{x: Infinity, y: 10}]); + ctx.roundRect(0, 0, 100, 100, [{x: -Infinity, y: 10}]); + ctx.roundRect(0, 0, 100, 100, [{x: NaN, y: 10}]); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.nonfinite.worker.js index 68d0d8a09a3..d6d44d6ffe0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.nonfinite.worker.js @@ -13,100 +13,99 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.moveTo(0, 0); -ctx.lineTo(100, 0); -ctx.roundRect(Infinity, 50, 1, 1, [0]); -ctx.roundRect(-Infinity, 50, 1, 1, [0]); -ctx.roundRect(NaN, 50, 1, 1, [0]); -ctx.roundRect(0, Infinity, 1, 1, [0]); -ctx.roundRect(0, -Infinity, 1, 1, [0]); -ctx.roundRect(0, NaN, 1, 1, [0]); -ctx.roundRect(0, 50, Infinity, 1, [0]); -ctx.roundRect(0, 50, -Infinity, 1, [0]); -ctx.roundRect(0, 50, NaN, 1, [0]); -ctx.roundRect(0, 50, 1, Infinity, [0]); -ctx.roundRect(0, 50, 1, -Infinity, [0]); -ctx.roundRect(0, 50, 1, NaN, [0]); -ctx.roundRect(0, 50, 1, 1, [Infinity]); -ctx.roundRect(0, 50, 1, 1, [-Infinity]); -ctx.roundRect(0, 50, 1, 1, [NaN]); -ctx.roundRect(0, 50, 1, 1, [Infinity,0]); -ctx.roundRect(0, 50, 1, 1, [-Infinity,0]); -ctx.roundRect(0, 50, 1, 1, [NaN,0]); -ctx.roundRect(0, 50, 1, 1, [0,Infinity]); -ctx.roundRect(0, 50, 1, 1, [0,-Infinity]); -ctx.roundRect(0, 50, 1, 1, [0,NaN]); -ctx.roundRect(0, 50, 1, 1, [Infinity,0,0]); -ctx.roundRect(0, 50, 1, 1, [-Infinity,0,0]); -ctx.roundRect(0, 50, 1, 1, [NaN,0,0]); -ctx.roundRect(0, 50, 1, 1, [0,Infinity,0]); -ctx.roundRect(0, 50, 1, 1, [0,-Infinity,0]); -ctx.roundRect(0, 50, 1, 1, [0,NaN,0]); -ctx.roundRect(0, 50, 1, 1, [0,0,Infinity]); -ctx.roundRect(0, 50, 1, 1, [0,0,-Infinity]); -ctx.roundRect(0, 50, 1, 1, [0,0,NaN]); -ctx.roundRect(0, 50, 1, 1, [Infinity,0,0,0]); -ctx.roundRect(0, 50, 1, 1, [-Infinity,0,0,0]); -ctx.roundRect(0, 50, 1, 1, [NaN,0,0,0]); -ctx.roundRect(0, 50, 1, 1, [0,Infinity,0,0]); -ctx.roundRect(0, 50, 1, 1, [0,-Infinity,0,0]); -ctx.roundRect(0, 50, 1, 1, [0,NaN,0,0]); -ctx.roundRect(0, 50, 1, 1, [0,0,Infinity,0]); -ctx.roundRect(0, 50, 1, 1, [0,0,-Infinity,0]); -ctx.roundRect(0, 50, 1, 1, [0,0,NaN,0]); -ctx.roundRect(0, 50, 1, 1, [0,0,0,Infinity]); -ctx.roundRect(0, 50, 1, 1, [0,0,0,-Infinity]); -ctx.roundRect(0, 50, 1, 1, [0,0,0,NaN]); -ctx.roundRect(Infinity, Infinity, 1, 1, [0]); -ctx.roundRect(Infinity, Infinity, Infinity, 1, [0]); -ctx.roundRect(Infinity, Infinity, Infinity, Infinity, [0]); -ctx.roundRect(Infinity, Infinity, Infinity, Infinity, [Infinity]); -ctx.roundRect(Infinity, Infinity, Infinity, 1, [Infinity]); -ctx.roundRect(Infinity, Infinity, 1, Infinity, [0]); -ctx.roundRect(Infinity, Infinity, 1, Infinity, [Infinity]); -ctx.roundRect(Infinity, Infinity, 1, 1, [Infinity]); -ctx.roundRect(Infinity, 50, Infinity, 1, [0]); -ctx.roundRect(Infinity, 50, Infinity, Infinity, [0]); -ctx.roundRect(Infinity, 50, Infinity, Infinity, [Infinity]); -ctx.roundRect(Infinity, 50, Infinity, 1, [Infinity]); -ctx.roundRect(Infinity, 50, 1, Infinity, [0]); -ctx.roundRect(Infinity, 50, 1, Infinity, [Infinity]); -ctx.roundRect(Infinity, 50, 1, 1, [Infinity]); -ctx.roundRect(0, Infinity, Infinity, 1, [0]); -ctx.roundRect(0, Infinity, Infinity, Infinity, [0]); -ctx.roundRect(0, Infinity, Infinity, Infinity, [Infinity]); -ctx.roundRect(0, Infinity, Infinity, 1, [Infinity]); -ctx.roundRect(0, Infinity, 1, Infinity, [0]); -ctx.roundRect(0, Infinity, 1, Infinity, [Infinity]); -ctx.roundRect(0, Infinity, 1, 1, [Infinity]); -ctx.roundRect(0, 50, Infinity, Infinity, [0]); -ctx.roundRect(0, 50, Infinity, Infinity, [Infinity]); -ctx.roundRect(0, 50, Infinity, 1, [Infinity]); -ctx.roundRect(0, 50, 1, Infinity, [Infinity]); -ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, Infinity)]); -ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, -Infinity)]); -ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, NaN)]); -ctx.roundRect(0, 0, 100, 100, [new DOMPoint(Infinity, 10)]); -ctx.roundRect(0, 0, 100, 100, [new DOMPoint(-Infinity, 10)]); -ctx.roundRect(0, 0, 100, 100, [new DOMPoint(NaN, 10)]); -ctx.roundRect(0, 0, 100, 100, [{x: 10, y: Infinity}]); -ctx.roundRect(0, 0, 100, 100, [{x: 10, y: -Infinity}]); -ctx.roundRect(0, 0, 100, 100, [{x: 10, y: NaN}]); -ctx.roundRect(0, 0, 100, 100, [{x: Infinity, y: 10}]); -ctx.roundRect(0, 0, 100, 100, [{x: -Infinity, y: 10}]); -ctx.roundRect(0, 0, 100, 100, [{x: NaN, y: 10}]); -ctx.lineTo(100, 50); -ctx.lineTo(0, 50); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 90,45, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.moveTo(0, 0); + ctx.lineTo(100, 0); + ctx.roundRect(Infinity, 50, 1, 1, [0]); + ctx.roundRect(-Infinity, 50, 1, 1, [0]); + ctx.roundRect(NaN, 50, 1, 1, [0]); + ctx.roundRect(0, Infinity, 1, 1, [0]); + ctx.roundRect(0, -Infinity, 1, 1, [0]); + ctx.roundRect(0, NaN, 1, 1, [0]); + ctx.roundRect(0, 50, Infinity, 1, [0]); + ctx.roundRect(0, 50, -Infinity, 1, [0]); + ctx.roundRect(0, 50, NaN, 1, [0]); + ctx.roundRect(0, 50, 1, Infinity, [0]); + ctx.roundRect(0, 50, 1, -Infinity, [0]); + ctx.roundRect(0, 50, 1, NaN, [0]); + ctx.roundRect(0, 50, 1, 1, [Infinity]); + ctx.roundRect(0, 50, 1, 1, [-Infinity]); + ctx.roundRect(0, 50, 1, 1, [NaN]); + ctx.roundRect(0, 50, 1, 1, [Infinity,0]); + ctx.roundRect(0, 50, 1, 1, [-Infinity,0]); + ctx.roundRect(0, 50, 1, 1, [NaN,0]); + ctx.roundRect(0, 50, 1, 1, [0,Infinity]); + ctx.roundRect(0, 50, 1, 1, [0,-Infinity]); + ctx.roundRect(0, 50, 1, 1, [0,NaN]); + ctx.roundRect(0, 50, 1, 1, [Infinity,0,0]); + ctx.roundRect(0, 50, 1, 1, [-Infinity,0,0]); + ctx.roundRect(0, 50, 1, 1, [NaN,0,0]); + ctx.roundRect(0, 50, 1, 1, [0,Infinity,0]); + ctx.roundRect(0, 50, 1, 1, [0,-Infinity,0]); + ctx.roundRect(0, 50, 1, 1, [0,NaN,0]); + ctx.roundRect(0, 50, 1, 1, [0,0,Infinity]); + ctx.roundRect(0, 50, 1, 1, [0,0,-Infinity]); + ctx.roundRect(0, 50, 1, 1, [0,0,NaN]); + ctx.roundRect(0, 50, 1, 1, [Infinity,0,0,0]); + ctx.roundRect(0, 50, 1, 1, [-Infinity,0,0,0]); + ctx.roundRect(0, 50, 1, 1, [NaN,0,0,0]); + ctx.roundRect(0, 50, 1, 1, [0,Infinity,0,0]); + ctx.roundRect(0, 50, 1, 1, [0,-Infinity,0,0]); + ctx.roundRect(0, 50, 1, 1, [0,NaN,0,0]); + ctx.roundRect(0, 50, 1, 1, [0,0,Infinity,0]); + ctx.roundRect(0, 50, 1, 1, [0,0,-Infinity,0]); + ctx.roundRect(0, 50, 1, 1, [0,0,NaN,0]); + ctx.roundRect(0, 50, 1, 1, [0,0,0,Infinity]); + ctx.roundRect(0, 50, 1, 1, [0,0,0,-Infinity]); + ctx.roundRect(0, 50, 1, 1, [0,0,0,NaN]); + ctx.roundRect(Infinity, Infinity, 1, 1, [0]); + ctx.roundRect(Infinity, Infinity, Infinity, 1, [0]); + ctx.roundRect(Infinity, Infinity, Infinity, Infinity, [0]); + ctx.roundRect(Infinity, Infinity, Infinity, Infinity, [Infinity]); + ctx.roundRect(Infinity, Infinity, Infinity, 1, [Infinity]); + ctx.roundRect(Infinity, Infinity, 1, Infinity, [0]); + ctx.roundRect(Infinity, Infinity, 1, Infinity, [Infinity]); + ctx.roundRect(Infinity, Infinity, 1, 1, [Infinity]); + ctx.roundRect(Infinity, 50, Infinity, 1, [0]); + ctx.roundRect(Infinity, 50, Infinity, Infinity, [0]); + ctx.roundRect(Infinity, 50, Infinity, Infinity, [Infinity]); + ctx.roundRect(Infinity, 50, Infinity, 1, [Infinity]); + ctx.roundRect(Infinity, 50, 1, Infinity, [0]); + ctx.roundRect(Infinity, 50, 1, Infinity, [Infinity]); + ctx.roundRect(Infinity, 50, 1, 1, [Infinity]); + ctx.roundRect(0, Infinity, Infinity, 1, [0]); + ctx.roundRect(0, Infinity, Infinity, Infinity, [0]); + ctx.roundRect(0, Infinity, Infinity, Infinity, [Infinity]); + ctx.roundRect(0, Infinity, Infinity, 1, [Infinity]); + ctx.roundRect(0, Infinity, 1, Infinity, [0]); + ctx.roundRect(0, Infinity, 1, Infinity, [Infinity]); + ctx.roundRect(0, Infinity, 1, 1, [Infinity]); + ctx.roundRect(0, 50, Infinity, Infinity, [0]); + ctx.roundRect(0, 50, Infinity, Infinity, [Infinity]); + ctx.roundRect(0, 50, Infinity, 1, [Infinity]); + ctx.roundRect(0, 50, 1, Infinity, [Infinity]); + ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, Infinity)]); + ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, -Infinity)]); + ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, NaN)]); + ctx.roundRect(0, 0, 100, 100, [new DOMPoint(Infinity, 10)]); + ctx.roundRect(0, 0, 100, 100, [new DOMPoint(-Infinity, 10)]); + ctx.roundRect(0, 0, 100, 100, [new DOMPoint(NaN, 10)]); + ctx.roundRect(0, 0, 100, 100, [{x: 10, y: Infinity}]); + ctx.roundRect(0, 0, 100, 100, [{x: 10, y: -Infinity}]); + ctx.roundRect(0, 0, 100, 100, [{x: 10, y: NaN}]); + ctx.roundRect(0, 0, 100, 100, [{x: Infinity, y: 10}]); + ctx.roundRect(0, 0, 100, 100, [{x: -Infinity, y: 10}]); + ctx.roundRect(0, 0, 100, 100, [{x: NaN, y: 10}]); + ctx.lineTo(100, 50); + ctx.lineTo(0, 50); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 90,45, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.1.html index c1916bf78f2..db4d871f9f6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.1.html @@ -17,24 +17,24 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [40, 40, 40, 40]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 2,25, 0,255,0,255); -_assertPixel(canvas, 50,1, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 50,48, 0,255,0,255); -_assertPixel(canvas, 97,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [40, 40, 40, 40]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 2,25, 0,255,0,255); + _assertPixel(canvas, 50,1, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 50,48, 0,255,0,255); + _assertPixel(canvas, 97,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.1.worker.js index 9da41478d91..27076dbe21f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.1.worker.js @@ -13,24 +13,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [40, 40, 40, 40]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 2,25, 0,255,0,255); -_assertPixel(canvas, 50,1, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 50,48, 0,255,0,255); -_assertPixel(canvas, 97,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [40, 40, 40, 40]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 2,25, 0,255,0,255); + _assertPixel(canvas, 50,1, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 50,48, 0,255,0,255); + _assertPixel(canvas, 97,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.2.html index f2a69c4ffc7..985942ca361 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.2.html @@ -17,24 +17,24 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [1000, 1000, 1000, 1000]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 2,25, 0,255,0,255); -_assertPixel(canvas, 50,1, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 50,48, 0,255,0,255); -_assertPixel(canvas, 97,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [1000, 1000, 1000, 1000]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 2,25, 0,255,0,255); + _assertPixel(canvas, 50,1, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 50,48, 0,255,0,255); + _assertPixel(canvas, 97,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.2.worker.js index f0d3f57ca48..5b6de579ae1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.intersecting.2.worker.js @@ -13,24 +13,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.roundRect(0, 0, 100, 50, [1000, 1000, 1000, 1000]); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 2,25, 0,255,0,255); -_assertPixel(canvas, 50,1, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 50,48, 0,255,0,255); -_assertPixel(canvas, 97,25, 0,255,0,255); -_assertPixel(canvas, 1,1, 255,0,0,255); -_assertPixel(canvas, 98,1, 255,0,0,255); -_assertPixel(canvas, 1,48, 255,0,0,255); -_assertPixel(canvas, 98,48, 255,0,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(0, 0, 100, 50, [1000, 1000, 1000, 1000]); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixel(canvas, 2,25, 0,255,0,255); + _assertPixel(canvas, 50,1, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 50,48, 0,255,0,255); + _assertPixel(canvas, 97,25, 0,255,0,255); + _assertPixel(canvas, 1,1, 255,0,0,255); + _assertPixel(canvas, 98,1, 255,0,0,255); + _assertPixel(canvas, 1,48, 255,0,0,255); + _assertPixel(canvas, 98,48, 255,0,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.html index 55e344d3749..60a7bebd24c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.html @@ -17,16 +17,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [-1])}); -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [1, -1])}); -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [new DOMPoint(-1, 1), 1])}); -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [new DOMPoint(1, -1)])}); -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [{x: -1, y: 1}, 1])}); -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [{x: 1, y: -1}])}); -t.done(); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [-1])}); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [1, -1])}); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [new DOMPoint(-1, 1), 1])}); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [new DOMPoint(1, -1)])}); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [{x: -1, y: 1}, 1])}); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [{x: 1, y: -1}])}); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.worker.js index 050e5f7f007..554a1ac078e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.negative.worker.js @@ -13,16 +13,15 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [-1])}); -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [1, -1])}); -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [new DOMPoint(-1, 1), 1])}); -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [new DOMPoint(1, -1)])}); -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [{x: -1, y: 1}, 1])}); -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [{x: 1, y: -1}])}); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [-1])}); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [1, -1])}); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [new DOMPoint(-1, 1), 1])}); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [new DOMPoint(1, -1)])}); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [{x: -1, y: 1}, 1])}); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [{x: 1, y: -1}])}); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.noargument.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.noargument.html new file mode 100644 index 00000000000..26a69afad07 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.noargument.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.path.roundrect.radius.noargument</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.path.roundrect.radius.noargument</h1> +<p class="desc">Check that roundRect draws a rectangle when no radii are provided.</p> + + +<script> +var t = async_test("Check that roundRect draws a rectangle when no radii are provided."); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(10, 10, 80, 30); + ctx.fillStyle = '#0f0'; + ctx.fill(); + // upper left corner (10, 10) + _assertPixel(canvas, 10,9, 255,0,0,255); + _assertPixel(canvas, 9,10, 255,0,0,255); + _assertPixel(canvas, 10,10, 0,255,0,255); + + // upper right corner (89, 10) + _assertPixel(canvas, 90,10, 255,0,0,255); + _assertPixel(canvas, 89,9, 255,0,0,255); + _assertPixel(canvas, 89,10, 0,255,0,255); + + // lower right corner (89, 39) + _assertPixel(canvas, 89,40, 255,0,0,255); + _assertPixel(canvas, 90,39, 255,0,0,255); + _assertPixel(canvas, 89,39, 0,255,0,255); + + // lower left corner (10, 30) + _assertPixel(canvas, 9,39, 255,0,0,255); + _assertPixel(canvas, 10,40, 255,0,0,255); + _assertPixel(canvas, 10,39, 0,255,0,255); + t.done(); + +}); +</script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.noargument.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.noargument.worker.js new file mode 100644 index 00000000000..1f6227786b6 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.noargument.worker.js @@ -0,0 +1,45 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.path.roundrect.radius.noargument +// Description:Check that roundRect draws a rectangle when no radii are provided. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Check that roundRect draws a rectangle when no radii are provided."); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.roundRect(10, 10, 80, 30); + ctx.fillStyle = '#0f0'; + ctx.fill(); + // upper left corner (10, 10) + _assertPixel(canvas, 10,9, 255,0,0,255); + _assertPixel(canvas, 9,10, 255,0,0,255); + _assertPixel(canvas, 10,10, 0,255,0,255); + + // upper right corner (89, 10) + _assertPixel(canvas, 90,10, 255,0,0,255); + _assertPixel(canvas, 89,9, 255,0,0,255); + _assertPixel(canvas, 89,10, 0,255,0,255); + + // lower right corner (89, 39) + _assertPixel(canvas, 89,40, 255,0,0,255); + _assertPixel(canvas, 90,39, 255,0,0,255); + _assertPixel(canvas, 89,39, 0,255,0,255); + + // lower left corner (10, 30) + _assertPixel(canvas, 9,39, 255,0,0,255); + _assertPixel(canvas, 10,40, 255,0,0,255); + _assertPixel(canvas, 10,39, 0,255,0,255); + t.done(); +}); +done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.none.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.none.html index 530efe46b1f..763113e4388 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.none.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.none.html @@ -17,11 +17,11 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 100, 50, [])}); -t.done(); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 100, 50, [])}); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.none.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.none.worker.js index 3209e421de6..fefd1b4dd39 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.none.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.none.worker.js @@ -13,11 +13,10 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 100, 50, [])}); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 100, 50, [])}); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.toomany.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.toomany.html index c667dc690af..ce330875fb3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.toomany.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.toomany.html @@ -17,11 +17,11 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 100, 50, [0, 0, 0, 0, 0])}); -t.done(); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 100, 50, [0, 0, 0, 0, 0])}); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.toomany.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.toomany.worker.js index 3b05057eda3..e1250afac70 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.toomany.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.radius.toomany.worker.js @@ -13,11 +13,10 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 100, 50, [0, 0, 0, 0, 0])}); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 100, 50, [0, 0, 0, 0, 0])}); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.selfintersect.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.selfintersect.html index 0ec25354903..15ee6f49581 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.selfintersect.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.selfintersect.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.roundRect(0, 0, 100, 50, [0]); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 90; -ctx.beginPath(); -ctx.roundRect(45, 20, 10, 10, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.roundRect(0, 0, 100, 50, [0]); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 90; + ctx.beginPath(); + ctx.roundRect(45, 20, 10, 10, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.selfintersect.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.selfintersect.worker.js index 8b6221414ba..91741110fc7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.selfintersect.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.selfintersect.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.roundRect(0, 0, 100, 50, [0]); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 90; -ctx.beginPath(); -ctx.roundRect(45, 20, 10, 10, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.roundRect(0, 0, 100, 50, [0]); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 90; + ctx.beginPath(); + ctx.roundRect(45, 20, 10, 10, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.winding.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.winding.html index e7f52fbf292..47ecd777dc0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.winding.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.winding.html @@ -17,23 +17,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.fillStyle = '#f00'; -ctx.roundRect(0, 0, 50, 50, [0]); -ctx.roundRect(100, 50, -50, -50, [0]); -ctx.roundRect(0, 25, 100, -25, [0]); -ctx.roundRect(100, 25, -100, 25, [0]); -ctx.fill(); -_assertPixel(canvas, 25,12, 0,255,0,255); -_assertPixel(canvas, 75,12, 0,255,0,255); -_assertPixel(canvas, 25,37, 0,255,0,255); -_assertPixel(canvas, 75,37, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.fillStyle = '#f00'; + ctx.roundRect(0, 0, 50, 50, [0]); + ctx.roundRect(100, 50, -50, -50, [0]); + ctx.roundRect(0, 25, 100, -25, [0]); + ctx.roundRect(100, 25, -100, 25, [0]); + ctx.fill(); + _assertPixel(canvas, 25,12, 0,255,0,255); + _assertPixel(canvas, 75,12, 0,255,0,255); + _assertPixel(canvas, 25,37, 0,255,0,255); + _assertPixel(canvas, 75,37, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.winding.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.winding.worker.js index 82e6b5c3135..737e99f3731 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.winding.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.winding.worker.js @@ -13,23 +13,22 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.fillStyle = '#f00'; -ctx.roundRect(0, 0, 50, 50, [0]); -ctx.roundRect(100, 50, -50, -50, [0]); -ctx.roundRect(0, 25, 100, -25, [0]); -ctx.roundRect(100, 25, -100, 25, [0]); -ctx.fill(); -_assertPixel(canvas, 25,12, 0,255,0,255); -_assertPixel(canvas, 75,12, 0,255,0,255); -_assertPixel(canvas, 25,37, 0,255,0,255); -_assertPixel(canvas, 75,37, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.fillStyle = '#f00'; + ctx.roundRect(0, 0, 50, 50, [0]); + ctx.roundRect(100, 50, -50, -50, [0]); + ctx.roundRect(0, 25, 100, -25, [0]); + ctx.roundRect(100, 25, -100, 25, [0]); + ctx.fill(); + _assertPixel(canvas, 25,12, 0,255,0,255); + _assertPixel(canvas, 75,12, 0,255,0,255); + _assertPixel(canvas, 25,37, 0,255,0,255); + _assertPixel(canvas, 75,37, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.1.html index 252475194ee..772339dcc69 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.1.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.roundRect(0, 50, 100, 0, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.roundRect(0, 50, 100, 0, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.1.worker.js index 17c9be78ec6..afcaa207699 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.1.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.roundRect(0, 50, 100, 0, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.roundRect(0, 50, 100, 0, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.2.html index 2463e88f1eb..2aad5aad417 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.2.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.roundRect(50, -100, 0, 250, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.roundRect(50, -100, 0, 250, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.2.worker.js index 9ae058a8476..dec178bd202 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.2.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.roundRect(50, -100, 0, 250, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.roundRect(50, -100, 0, 250, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.3.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.3.html index 39de433b081..485384aaff8 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.3.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.3.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.roundRect(50, 25, 0, 0, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.roundRect(50, 25, 0, 0, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.3.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.3.worker.js index 98d37e08e53..88adb5c4373 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.3.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.3.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.beginPath(); -ctx.roundRect(50, 25, 0, 0, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.beginPath(); + ctx.roundRect(50, 25, 0, 0, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.4.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.4.html index 3c6c734b19b..dfd4821a841 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.4.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.4.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.roundRect(100, 25, 0, 0, [0]); -ctx.lineTo(0, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.roundRect(100, 25, 0, 0, [0]); + ctx.lineTo(0, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.4.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.4.worker.js index 462cde2a03e..fe8cc149c56 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.4.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.4.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 50; -ctx.roundRect(100, 25, 0, 0, [0]); -ctx.lineTo(0, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 50; + ctx.roundRect(100, 25, 0, 0, [0]); + ctx.lineTo(0, 25); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.5.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.5.html index de66603a66b..931a737e3bb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.5.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.5.html @@ -17,18 +17,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.moveTo(0, 0); -ctx.roundRect(100, 25, 0, 0, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.moveTo(0, 0); + ctx.roundRect(100, 25, 0, 0, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.5.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.5.worker.js index 0f706ce246f..1fd61246a98 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.5.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.5.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.moveTo(0, 0); -ctx.roundRect(100, 25, 0, 0, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.moveTo(0, 0); + ctx.roundRect(100, 25, 0, 0, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.6.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.6.html index bd7ef0fa94c..25ed23d3293 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.6.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.6.html @@ -17,20 +17,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineJoin = 'miter'; -ctx.miterLimit = 1.5; -ctx.lineWidth = 200; -ctx.beginPath(); -ctx.roundRect(100, 25, 1000, 0, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineJoin = 'miter'; + ctx.miterLimit = 1.5; + ctx.lineWidth = 200; + ctx.beginPath(); + ctx.roundRect(100, 25, 1000, 0, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.6.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.6.worker.js index f2115cdd461..c4b6fba5b0a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.6.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.roundrect.zero.6.worker.js @@ -13,20 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineJoin = 'miter'; -ctx.miterLimit = 1.5; -ctx.lineWidth = 200; -ctx.beginPath(); -ctx.roundRect(100, 25, 1000, 0, [0]); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineJoin = 'miter'; + ctx.miterLimit = 1.5; + ctx.lineWidth = 200; + ctx.beginPath(); + ctx.roundRect(100, 25, 1000, 0, [0]); + ctx.stroke(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.empty.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.empty.html index a873b260da2..29a95da20d5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.empty.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.empty.html @@ -17,21 +17,24 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.moveTo(40, 25); -ctx.moveTo(60, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; + + ctx.beginPath(); + ctx.moveTo(40, 25); + ctx.moveTo(60, 25); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.empty.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.empty.worker.js index 1852c918768..56ee68f185b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.empty.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.empty.worker.js @@ -13,21 +13,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.moveTo(40, 25); -ctx.moveTo(60, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; + + ctx.beginPath(); + ctx.moveTo(40, 25); + ctx.moveTo(60, 25); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.overlap.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.overlap.html index 252a840ed75..c3847464bb7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.overlap.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.overlap.html @@ -17,20 +17,22 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#000'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = 'rgba(0, 255, 0, 0.5)'; -ctx.lineWidth = 50; -ctx.moveTo(0, 20); -ctx.lineTo(100, 20); -ctx.moveTo(0, 30); -ctx.lineTo(100, 30); -ctx.stroke(); -_assertPixelApprox(canvas, 50,25, 0,127,0,255, 1); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#000'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = 'rgba(0, 255, 0, 0.5)'; + ctx.lineWidth = 50; + ctx.moveTo(0, 20); + ctx.lineTo(100, 20); + ctx.moveTo(0, 30); + ctx.lineTo(100, 30); + ctx.stroke(); + + _assertPixelApprox(canvas, 50,25, 0,127,0,255, 1); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.overlap.png b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.overlap.png Binary files differnew file mode 100644 index 00000000000..e2a35d48d4c --- /dev/null +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.overlap.png diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.overlap.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.overlap.worker.js index aa7cc51d774..0e59d3bfc0a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.overlap.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.overlap.worker.js @@ -13,20 +13,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#000'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = 'rgba(0, 255, 0, 0.5)'; -ctx.lineWidth = 50; -ctx.moveTo(0, 20); -ctx.lineTo(100, 20); -ctx.moveTo(0, 30); -ctx.lineTo(100, 30); -ctx.stroke(); -_assertPixelApprox(canvas, 50,25, 0,127,0,255, 1); -t.done(); + ctx.fillStyle = '#000'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = 'rgba(0, 255, 0, 0.5)'; + ctx.lineWidth = 50; + ctx.moveTo(0, 20); + ctx.lineTo(100, 20); + ctx.moveTo(0, 30); + ctx.lineTo(100, 30); + ctx.stroke(); + + _assertPixelApprox(canvas, 50,25, 0,127,0,255, 1); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.arc.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.arc.html index 67f25440dcd..40a73b85fbb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.arc.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.arc.html @@ -17,25 +17,29 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.arcTo(50, 25, 150, 25, 10); -ctx.stroke(); -ctx.beginPath(); -ctx.moveTo(60, 25); -ctx.arc(50, 25, 10, 0, 0, false); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; + + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.arcTo(50, 25, 150, 25, 10); + ctx.stroke(); + + ctx.beginPath(); + ctx.moveTo(60, 25); + ctx.arc(50, 25, 10, 0, 0, false); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.arc.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.arc.worker.js index ca5844ce2aa..880e8146ba5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.arc.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.arc.worker.js @@ -13,25 +13,28 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.arcTo(50, 25, 150, 25, 10); -ctx.stroke(); -ctx.beginPath(); -ctx.moveTo(60, 25); -ctx.arc(50, 25, 10, 0, 0, false); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; + + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.arcTo(50, 25, 150, 25, 10); + ctx.stroke(); + + ctx.beginPath(); + ctx.moveTo(60, 25); + ctx.arc(50, 25, 10, 0, 0, false); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.closed.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.closed.html index 1012975fcf4..2a3b40068dd 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.closed.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.closed.html @@ -17,22 +17,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.lineTo(50, 25); -ctx.closePath(); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; + + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.lineTo(50, 25); + ctx.closePath(); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.closed.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.closed.worker.js index 9b3426f6d0c..e1d271bf6aa 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.closed.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.closed.worker.js @@ -13,22 +13,24 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.lineTo(50, 25); -ctx.closePath(); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; + + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.lineTo(50, 25); + ctx.closePath(); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.corner.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.corner.html index 553fdb61657..45db65d6d11 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.corner.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.corner.html @@ -17,24 +17,27 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 400; -ctx.lineJoin = 'miter'; -ctx.miterLimit = 1.4; -ctx.beginPath(); -ctx.moveTo(-1000, 200); -ctx.lineTo(-100, 200); -ctx.lineTo(-100, 200); -ctx.lineTo(-100, 200); -ctx.lineTo(-100, 1000); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 400; + ctx.lineJoin = 'miter'; + ctx.miterLimit = 1.4; + + ctx.beginPath(); + ctx.moveTo(-1000, 200); + ctx.lineTo(-100, 200); + ctx.lineTo(-100, 200); + ctx.lineTo(-100, 200); + ctx.lineTo(-100, 1000); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.corner.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.corner.worker.js index c2233bbc15b..fff4ba19e98 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.corner.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.corner.worker.js @@ -13,24 +13,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 400; -ctx.lineJoin = 'miter'; -ctx.miterLimit = 1.4; -ctx.beginPath(); -ctx.moveTo(-1000, 200); -ctx.lineTo(-100, 200); -ctx.lineTo(-100, 200); -ctx.lineTo(-100, 200); -ctx.lineTo(-100, 1000); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 400; + ctx.lineJoin = 'miter'; + ctx.miterLimit = 1.4; + + ctx.beginPath(); + ctx.moveTo(-1000, 200); + ctx.lineTo(-100, 200); + ctx.lineTo(-100, 200); + ctx.lineTo(-100, 200); + ctx.lineTo(-100, 1000); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.curve.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.curve.html index ae2f922a41b..946395f1c17 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.curve.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.curve.html @@ -17,25 +17,29 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.quadraticCurveTo(50, 25, 50, 25); -ctx.stroke(); -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.bezierCurveTo(50, 25, 50, 25, 50, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; + + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.quadraticCurveTo(50, 25, 50, 25); + ctx.stroke(); + + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.bezierCurveTo(50, 25, 50, 25, 50, 25); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.curve.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.curve.worker.js index 7dc88a72134..ed960fdbe7f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.curve.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.curve.worker.js @@ -13,25 +13,28 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.quadraticCurveTo(50, 25, 50, 25); -ctx.stroke(); -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.bezierCurveTo(50, 25, 50, 25, 50, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; + + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.quadraticCurveTo(50, 25, 50, 25); + ctx.stroke(); + + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.bezierCurveTo(50, 25, 50, 25, 50, 25); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.line.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.line.html index e9163cab40d..1f0a892455c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.line.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.line.html @@ -17,21 +17,24 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.lineTo(50, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; + + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.lineTo(50, 25); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.line.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.line.worker.js index 160bbe7eea3..a00e73bcbbe 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.line.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.line.worker.js @@ -13,21 +13,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.moveTo(50, 25); -ctx.lineTo(50, 25); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; + + ctx.beginPath(); + ctx.moveTo(50, 25); + ctx.lineTo(50, 25); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.rect.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.rect.html index 72d0d6b6e98..ffce538d919 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.rect.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.rect.html @@ -17,21 +17,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.rect(50, 25, 0, 0); -ctx.stroke(); -ctx.strokeRect(50, 25, 0, 0); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; + + ctx.beginPath(); + ctx.rect(50, 25, 0, 0); + ctx.stroke(); + + ctx.strokeRect(50, 25, 0, 0); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.rect.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.rect.worker.js index c6ed67ed9e4..87bb533ff9e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.rect.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.prune.rect.worker.js @@ -13,21 +13,24 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 100; -ctx.lineCap = 'round'; -ctx.lineJoin = 'round'; -ctx.beginPath(); -ctx.rect(50, 25, 0, 0); -ctx.stroke(); -ctx.strokeRect(50, 25, 0, 0); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 100; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; + + ctx.beginPath(); + ctx.rect(50, 25, 0, 0); + ctx.stroke(); + + ctx.strokeRect(50, 25, 0, 0); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale1.html index e13fd9fe550..47639065d33 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale1.html @@ -17,35 +17,38 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(25, 12.5, 50, 25); -ctx.save(); -ctx.scale(50, 25); -ctx.strokeStyle = '#0f0'; -ctx.stroke(); -ctx.restore(); -ctx.beginPath(); -ctx.rect(-25, -12.5, 150, 75); -ctx.save(); -ctx.scale(50, 25); -ctx.strokeStyle = '#f00'; -ctx.stroke(); -ctx.restore(); -_assertPixel(canvas, 0,0, 0,255,0,255); -_assertPixel(canvas, 50,0, 0,255,0,255); -_assertPixel(canvas, 99,0, 0,255,0,255); -_assertPixel(canvas, 0,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 99,25, 0,255,0,255); -_assertPixel(canvas, 0,49, 0,255,0,255); -_assertPixel(canvas, 50,49, 0,255,0,255); -_assertPixel(canvas, 99,49, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.beginPath(); + ctx.rect(25, 12.5, 50, 25); + ctx.save(); + ctx.scale(50, 25); + ctx.strokeStyle = '#0f0'; + ctx.stroke(); + ctx.restore(); + + ctx.beginPath(); + ctx.rect(-25, -12.5, 150, 75); + ctx.save(); + ctx.scale(50, 25); + ctx.strokeStyle = '#f00'; + ctx.stroke(); + ctx.restore(); + + _assertPixel(canvas, 0,0, 0,255,0,255); + _assertPixel(canvas, 50,0, 0,255,0,255); + _assertPixel(canvas, 99,0, 0,255,0,255); + _assertPixel(canvas, 0,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 99,25, 0,255,0,255); + _assertPixel(canvas, 0,49, 0,255,0,255); + _assertPixel(canvas, 50,49, 0,255,0,255); + _assertPixel(canvas, 99,49, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale1.worker.js index ef7b2d4d04e..3725fdf6e87 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale1.worker.js @@ -13,35 +13,37 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(25, 12.5, 50, 25); -ctx.save(); -ctx.scale(50, 25); -ctx.strokeStyle = '#0f0'; -ctx.stroke(); -ctx.restore(); -ctx.beginPath(); -ctx.rect(-25, -12.5, 150, 75); -ctx.save(); -ctx.scale(50, 25); -ctx.strokeStyle = '#f00'; -ctx.stroke(); -ctx.restore(); -_assertPixel(canvas, 0,0, 0,255,0,255); -_assertPixel(canvas, 50,0, 0,255,0,255); -_assertPixel(canvas, 99,0, 0,255,0,255); -_assertPixel(canvas, 0,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 99,25, 0,255,0,255); -_assertPixel(canvas, 0,49, 0,255,0,255); -_assertPixel(canvas, 50,49, 0,255,0,255); -_assertPixel(canvas, 99,49, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.rect(25, 12.5, 50, 25); + ctx.save(); + ctx.scale(50, 25); + ctx.strokeStyle = '#0f0'; + ctx.stroke(); + ctx.restore(); + + ctx.beginPath(); + ctx.rect(-25, -12.5, 150, 75); + ctx.save(); + ctx.scale(50, 25); + ctx.strokeStyle = '#f00'; + ctx.stroke(); + ctx.restore(); + + _assertPixel(canvas, 0,0, 0,255,0,255); + _assertPixel(canvas, 50,0, 0,255,0,255); + _assertPixel(canvas, 99,0, 0,255,0,255); + _assertPixel(canvas, 0,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 99,25, 0,255,0,255); + _assertPixel(canvas, 0,49, 0,255,0,255); + _assertPixel(canvas, 50,49, 0,255,0,255); + _assertPixel(canvas, 99,49, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale2.html index 2b80f16898e..447a6dfadc4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale2.html @@ -17,37 +17,40 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(25, 12.5, 50, 25); -ctx.save(); -ctx.rotate(Math.PI/2); -ctx.scale(25, 50); -ctx.strokeStyle = '#0f0'; -ctx.stroke(); -ctx.restore(); -ctx.beginPath(); -ctx.rect(-25, -12.5, 150, 75); -ctx.save(); -ctx.rotate(Math.PI/2); -ctx.scale(25, 50); -ctx.strokeStyle = '#f00'; -ctx.stroke(); -ctx.restore(); -_assertPixel(canvas, 0,0, 0,255,0,255); -_assertPixel(canvas, 50,0, 0,255,0,255); -_assertPixel(canvas, 99,0, 0,255,0,255); -_assertPixel(canvas, 0,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 99,25, 0,255,0,255); -_assertPixel(canvas, 0,49, 0,255,0,255); -_assertPixel(canvas, 50,49, 0,255,0,255); -_assertPixel(canvas, 99,49, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.beginPath(); + ctx.rect(25, 12.5, 50, 25); + ctx.save(); + ctx.rotate(Math.PI/2); + ctx.scale(25, 50); + ctx.strokeStyle = '#0f0'; + ctx.stroke(); + ctx.restore(); + + ctx.beginPath(); + ctx.rect(-25, -12.5, 150, 75); + ctx.save(); + ctx.rotate(Math.PI/2); + ctx.scale(25, 50); + ctx.strokeStyle = '#f00'; + ctx.stroke(); + ctx.restore(); + + _assertPixel(canvas, 0,0, 0,255,0,255); + _assertPixel(canvas, 50,0, 0,255,0,255); + _assertPixel(canvas, 99,0, 0,255,0,255); + _assertPixel(canvas, 0,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 99,25, 0,255,0,255); + _assertPixel(canvas, 0,49, 0,255,0,255); + _assertPixel(canvas, 50,49, 0,255,0,255); + _assertPixel(canvas, 99,49, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale2.worker.js index 9c6d4fbf54a..5223de78166 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale2.worker.js @@ -13,37 +13,39 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.beginPath(); -ctx.rect(25, 12.5, 50, 25); -ctx.save(); -ctx.rotate(Math.PI/2); -ctx.scale(25, 50); -ctx.strokeStyle = '#0f0'; -ctx.stroke(); -ctx.restore(); -ctx.beginPath(); -ctx.rect(-25, -12.5, 150, 75); -ctx.save(); -ctx.rotate(Math.PI/2); -ctx.scale(25, 50); -ctx.strokeStyle = '#f00'; -ctx.stroke(); -ctx.restore(); -_assertPixel(canvas, 0,0, 0,255,0,255); -_assertPixel(canvas, 50,0, 0,255,0,255); -_assertPixel(canvas, 99,0, 0,255,0,255); -_assertPixel(canvas, 0,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 99,25, 0,255,0,255); -_assertPixel(canvas, 0,49, 0,255,0,255); -_assertPixel(canvas, 50,49, 0,255,0,255); -_assertPixel(canvas, 99,49, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.beginPath(); + ctx.rect(25, 12.5, 50, 25); + ctx.save(); + ctx.rotate(Math.PI/2); + ctx.scale(25, 50); + ctx.strokeStyle = '#0f0'; + ctx.stroke(); + ctx.restore(); + + ctx.beginPath(); + ctx.rect(-25, -12.5, 150, 75); + ctx.save(); + ctx.rotate(Math.PI/2); + ctx.scale(25, 50); + ctx.strokeStyle = '#f00'; + ctx.stroke(); + ctx.restore(); + + _assertPixel(canvas, 0,0, 0,255,0,255); + _assertPixel(canvas, 50,0, 0,255,0,255); + _assertPixel(canvas, 99,0, 0,255,0,255); + _assertPixel(canvas, 0,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 99,25, 0,255,0,255); + _assertPixel(canvas, 0,49, 0,255,0,255); + _assertPixel(canvas, 50,49, 0,255,0,255); + _assertPixel(canvas, 99,49, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.skew.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.skew.html index 55e96e08e06..1fb118b1226 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.skew.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.skew.html @@ -17,50 +17,54 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.save(); -ctx.beginPath(); -ctx.moveTo(49, -50); -ctx.lineTo(201, -50); -ctx.rotate(Math.PI/4); -ctx.scale(1, 283); -ctx.strokeStyle = '#0f0'; -ctx.stroke(); -ctx.restore(); -ctx.save(); -ctx.beginPath(); -ctx.translate(-150, 0); -ctx.moveTo(49, -50); -ctx.lineTo(199, -50); -ctx.rotate(Math.PI/4); -ctx.scale(1, 142); -ctx.strokeStyle = '#f00'; -ctx.stroke(); -ctx.restore(); -ctx.save(); -ctx.beginPath(); -ctx.translate(-150, 0); -ctx.moveTo(49, -50); -ctx.lineTo(199, -50); -ctx.rotate(Math.PI/4); -ctx.scale(1, 142); -ctx.strokeStyle = '#f00'; -ctx.stroke(); -ctx.restore(); -_assertPixel(canvas, 0,0, 0,255,0,255); -_assertPixel(canvas, 50,0, 0,255,0,255); -_assertPixel(canvas, 99,0, 0,255,0,255); -_assertPixel(canvas, 0,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 99,25, 0,255,0,255); -_assertPixel(canvas, 0,49, 0,255,0,255); -_assertPixel(canvas, 50,49, 0,255,0,255); -_assertPixel(canvas, 99,49, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.save(); + ctx.beginPath(); + ctx.moveTo(49, -50); + ctx.lineTo(201, -50); + ctx.rotate(Math.PI/4); + ctx.scale(1, 283); + ctx.strokeStyle = '#0f0'; + ctx.stroke(); + ctx.restore(); + + ctx.save(); + ctx.beginPath(); + ctx.translate(-150, 0); + ctx.moveTo(49, -50); + ctx.lineTo(199, -50); + ctx.rotate(Math.PI/4); + ctx.scale(1, 142); + ctx.strokeStyle = '#f00'; + ctx.stroke(); + ctx.restore(); + + ctx.save(); + ctx.beginPath(); + ctx.translate(-150, 0); + ctx.moveTo(49, -50); + ctx.lineTo(199, -50); + ctx.rotate(Math.PI/4); + ctx.scale(1, 142); + ctx.strokeStyle = '#f00'; + ctx.stroke(); + ctx.restore(); + + _assertPixel(canvas, 0,0, 0,255,0,255); + _assertPixel(canvas, 50,0, 0,255,0,255); + _assertPixel(canvas, 99,0, 0,255,0,255); + _assertPixel(canvas, 0,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 99,25, 0,255,0,255); + _assertPixel(canvas, 0,49, 0,255,0,255); + _assertPixel(canvas, 50,49, 0,255,0,255); + _assertPixel(canvas, 99,49, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.skew.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.skew.worker.js index 745afe4ff53..e65b796d068 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.skew.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.skew.worker.js @@ -13,50 +13,53 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.save(); -ctx.beginPath(); -ctx.moveTo(49, -50); -ctx.lineTo(201, -50); -ctx.rotate(Math.PI/4); -ctx.scale(1, 283); -ctx.strokeStyle = '#0f0'; -ctx.stroke(); -ctx.restore(); -ctx.save(); -ctx.beginPath(); -ctx.translate(-150, 0); -ctx.moveTo(49, -50); -ctx.lineTo(199, -50); -ctx.rotate(Math.PI/4); -ctx.scale(1, 142); -ctx.strokeStyle = '#f00'; -ctx.stroke(); -ctx.restore(); -ctx.save(); -ctx.beginPath(); -ctx.translate(-150, 0); -ctx.moveTo(49, -50); -ctx.lineTo(199, -50); -ctx.rotate(Math.PI/4); -ctx.scale(1, 142); -ctx.strokeStyle = '#f00'; -ctx.stroke(); -ctx.restore(); -_assertPixel(canvas, 0,0, 0,255,0,255); -_assertPixel(canvas, 50,0, 0,255,0,255); -_assertPixel(canvas, 99,0, 0,255,0,255); -_assertPixel(canvas, 0,25, 0,255,0,255); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 99,25, 0,255,0,255); -_assertPixel(canvas, 0,49, 0,255,0,255); -_assertPixel(canvas, 50,49, 0,255,0,255); -_assertPixel(canvas, 99,49, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.save(); + ctx.beginPath(); + ctx.moveTo(49, -50); + ctx.lineTo(201, -50); + ctx.rotate(Math.PI/4); + ctx.scale(1, 283); + ctx.strokeStyle = '#0f0'; + ctx.stroke(); + ctx.restore(); + + ctx.save(); + ctx.beginPath(); + ctx.translate(-150, 0); + ctx.moveTo(49, -50); + ctx.lineTo(199, -50); + ctx.rotate(Math.PI/4); + ctx.scale(1, 142); + ctx.strokeStyle = '#f00'; + ctx.stroke(); + ctx.restore(); + + ctx.save(); + ctx.beginPath(); + ctx.translate(-150, 0); + ctx.moveTo(49, -50); + ctx.lineTo(199, -50); + ctx.rotate(Math.PI/4); + ctx.scale(1, 142); + ctx.strokeStyle = '#f00'; + ctx.stroke(); + ctx.restore(); + + _assertPixel(canvas, 0,0, 0,255,0,255); + _assertPixel(canvas, 50,0, 0,255,0,255); + _assertPixel(canvas, 99,0, 0,255,0,255); + _assertPixel(canvas, 0,25, 0,255,0,255); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 99,25, 0,255,0,255); + _assertPixel(canvas, 0,49, 0,255,0,255); + _assertPixel(canvas, 50,49, 0,255,0,255); + _assertPixel(canvas, 99,49, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.unaffected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.unaffected.html index 58e7f75dc8e..3fc9cfad883 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.unaffected.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.unaffected.html @@ -17,23 +17,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.moveTo(-100, 25); -ctx.lineTo(-100, -100); -ctx.lineTo(200, -100); -ctx.lineTo(200, 25); -ctx.strokeStyle = '#f00'; -ctx.stroke(); -ctx.closePath(); -ctx.strokeStyle = '#0f0'; -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.lineWidth = 50; + ctx.moveTo(-100, 25); + ctx.lineTo(-100, -100); + ctx.lineTo(200, -100); + ctx.lineTo(200, 25); + ctx.strokeStyle = '#f00'; + ctx.stroke(); + + ctx.closePath(); + ctx.strokeStyle = '#0f0'; + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.unaffected.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.unaffected.worker.js index a47c32d0099..d9df1ada943 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.unaffected.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.unaffected.worker.js @@ -13,23 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.lineWidth = 50; -ctx.moveTo(-100, 25); -ctx.lineTo(-100, -100); -ctx.lineTo(200, -100); -ctx.lineTo(200, 25); -ctx.strokeStyle = '#f00'; -ctx.stroke(); -ctx.closePath(); -ctx.strokeStyle = '#0f0'; -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.lineWidth = 50; + ctx.moveTo(-100, 25); + ctx.lineTo(-100, -100); + ctx.lineTo(200, -100); + ctx.lineTo(200, 25); + ctx.strokeStyle = '#f00'; + ctx.stroke(); + + ctx.closePath(); + ctx.strokeStyle = '#0f0'; + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.union.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.union.html index c3f063fe52d..6b980acff2d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.union.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.union.html @@ -17,20 +17,22 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 40; -ctx.moveTo(0, 10); -ctx.lineTo(100, 10); -ctx.moveTo(100, 40); -ctx.lineTo(0, 40); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 40; + ctx.moveTo(0, 10); + ctx.lineTo(100, 10); + ctx.moveTo(100, 40); + ctx.lineTo(0, 40); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.union.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.union.worker.js index 282cb10bf75..3b05feec039 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.union.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.union.worker.js @@ -13,20 +13,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.strokeStyle = '#0f0'; -ctx.lineWidth = 40; -ctx.moveTo(0, 10); -ctx.lineTo(100, 10); -ctx.moveTo(100, 40); -ctx.lineTo(0, 40); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.strokeStyle = '#0f0'; + ctx.lineWidth = 40; + ctx.moveTo(0, 10); + ctx.lineTo(100, 10); + ctx.moveTo(100, 40); + ctx.lineTo(0, 40); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.basic.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.basic.html index 18370041384..27f00aae037 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.basic.html @@ -17,18 +17,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.translate(-100, 0); -ctx.rect(100, 0, 100, 50); -ctx.translate(0, -100); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.translate(-100, 0); + ctx.rect(100, 0, 100, 50); + ctx.translate(0, -100); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.basic.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.basic.worker.js index 7bc112dd1d0..3ae4c876d5b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.basic.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.basic.worker.js @@ -13,18 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.translate(-100, 0); -ctx.rect(100, 0, 100, 50); -ctx.translate(0, -100); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.translate(-100, 0); + ctx.rect(100, 0, 100, 50); + ctx.translate(0, -100); + ctx.fillStyle = '#0f0'; + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.changing.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.changing.html index b8a467387d5..786a5cf5891 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.changing.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.changing.html @@ -17,25 +17,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.moveTo(0, 0); -ctx.translate(100, 0); -ctx.lineTo(0, 0); -ctx.translate(0, 50); -ctx.lineTo(0, 0); -ctx.translate(-100, 0); -ctx.lineTo(0, 0); -ctx.translate(1000, 1000); -ctx.rotate(Math.PI/2); -ctx.scale(0.1, 0.1); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.moveTo(0, 0); + ctx.translate(100, 0); + ctx.lineTo(0, 0); + ctx.translate(0, 50); + ctx.lineTo(0, 0); + ctx.translate(-100, 0); + ctx.lineTo(0, 0); + ctx.translate(1000, 1000); + ctx.rotate(Math.PI/2); + ctx.scale(0.1, 0.1); + ctx.fill(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.changing.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.changing.worker.js index 2460d24b199..2d8993c685c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.changing.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.changing.worker.js @@ -13,25 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.moveTo(0, 0); -ctx.translate(100, 0); -ctx.lineTo(0, 0); -ctx.translate(0, 50); -ctx.lineTo(0, 0); -ctx.translate(-100, 0); -ctx.lineTo(0, 0); -ctx.translate(1000, 1000); -ctx.rotate(Math.PI/2); -ctx.scale(0.1, 0.1); -ctx.fill(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.moveTo(0, 0); + ctx.translate(100, 0); + ctx.lineTo(0, 0); + ctx.translate(0, 50); + ctx.lineTo(0, 0); + ctx.translate(-100, 0); + ctx.lineTo(0, 0); + ctx.translate(1000, 1000); + ctx.rotate(Math.PI/2); + ctx.scale(0.1, 0.1); + ctx.fill(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.multiple.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.multiple.html index fcc2942435f..636491bb0ee 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.multiple.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.multiple.html @@ -17,28 +17,31 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.translate(-100, 0); -ctx.rect(0, 0, 100, 50); -ctx.fill(); -ctx.translate(100, 0); -ctx.fill(); -ctx.beginPath(); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.translate(0, -50); -ctx.moveTo(0, 25); -ctx.lineTo(100, 25); -ctx.stroke(); -ctx.translate(0, 50); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.fillStyle = '#f00'; + ctx.translate(-100, 0); + ctx.rect(0, 0, 100, 50); + ctx.fill(); + ctx.translate(100, 0); + ctx.fill(); + + ctx.beginPath(); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.translate(0, -50); + ctx.moveTo(0, 25); + ctx.lineTo(100, 25); + ctx.stroke(); + ctx.translate(0, 50); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.multiple.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.multiple.worker.js index a2a04ca7776..a9fb37d0de1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.multiple.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.transformation.multiple.worker.js @@ -13,28 +13,30 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.translate(-100, 0); -ctx.rect(0, 0, 100, 50); -ctx.fill(); -ctx.translate(100, 0); -ctx.fill(); -ctx.beginPath(); -ctx.strokeStyle = '#f00'; -ctx.lineWidth = 50; -ctx.translate(0, -50); -ctx.moveTo(0, 25); -ctx.lineTo(100, 25); -ctx.stroke(); -ctx.translate(0, 50); -ctx.stroke(); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.translate(-100, 0); + ctx.rect(0, 0, 100, 50); + ctx.fill(); + ctx.translate(100, 0); + ctx.fill(); + + ctx.beginPath(); + ctx.strokeStyle = '#f00'; + ctx.lineWidth = 50; + ctx.translate(0, -50); + ctx.moveTo(0, 25); + ctx.lineTo(100, 25); + ctx.stroke(); + ctx.translate(0, 50); + ctx.stroke(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.basic.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.basic.html index 1f21ce6e32b..f6932386dfb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.basic.html @@ -15,15 +15,13 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -_assertDifferent(ctx.createImageData(ctx.createImageData(1, 1)), null, "ctx.createImageData(ctx.createImageData(1, 1))", "null"); -})(canvas, ctx); -t.done(); + _assertDifferent(ctx.createImageData(ctx.createImageData(1, 1)), null, "ctx.createImageData(ctx.createImageData(1, 1))", "null"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.basic.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.basic.worker.js index 54d2cadb1c9..30f3ed21b19 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.basic.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.basic.worker.js @@ -13,11 +13,10 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -_assertDifferent(ctx.createImageData(ctx.createImageData(1, 1)), null, "ctx.createImageData(ctx.createImageData(1, 1))", "null"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + _assertDifferent(ctx.createImageData(ctx.createImageData(1, 1)), null, "ctx.createImageData(ctx.createImageData(1, 1))", "null"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.initial.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.initial.html index 6e9e02c77d0..627b09b8bd2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.initial.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.initial.html @@ -15,26 +15,24 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -var imgdata1 = ctx.getImageData(0, 0, 10, 20); -var imgdata2 = ctx.createImageData(imgdata1); -_assertSame(imgdata2.data.length, imgdata1.data.length, "imgdata2.data.length", "imgdata1.data.length"); -_assertSame(imgdata2.width, imgdata1.width, "imgdata2.width", "imgdata1.width"); -_assertSame(imgdata2.height, imgdata1.height, "imgdata2.height", "imgdata1.height"); -var isTransparentBlack = true; -for (var i = 0; i < imgdata2.data.length; ++i) - if (imgdata2.data[i] !== 0) - isTransparentBlack = false; -_assert(isTransparentBlack, "isTransparentBlack"); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + var imgdata1 = ctx.getImageData(0, 0, 10, 20); + var imgdata2 = ctx.createImageData(imgdata1); + _assertSame(imgdata2.data.length, imgdata1.data.length, "imgdata2.data.length", "imgdata1.data.length"); + _assertSame(imgdata2.width, imgdata1.width, "imgdata2.width", "imgdata1.width"); + _assertSame(imgdata2.height, imgdata1.height, "imgdata2.height", "imgdata1.height"); + var isTransparentBlack = true; + for (var i = 0; i < imgdata2.data.length; ++i) + if (imgdata2.data[i] !== 0) + isTransparentBlack = false; + _assert(isTransparentBlack, "isTransparentBlack"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.initial.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.initial.worker.js index bfff76b29fd..da0856a487c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.initial.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.initial.worker.js @@ -13,22 +13,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -var imgdata1 = ctx.getImageData(0, 0, 10, 20); -var imgdata2 = ctx.createImageData(imgdata1); -_assertSame(imgdata2.data.length, imgdata1.data.length, "imgdata2.data.length", "imgdata1.data.length"); -_assertSame(imgdata2.width, imgdata1.width, "imgdata2.width", "imgdata1.width"); -_assertSame(imgdata2.height, imgdata1.height, "imgdata2.height", "imgdata1.height"); -var isTransparentBlack = true; -for (var i = 0; i < imgdata2.data.length; ++i) - if (imgdata2.data[i] !== 0) - isTransparentBlack = false; -_assert(isTransparentBlack, "isTransparentBlack"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + var imgdata1 = ctx.getImageData(0, 0, 10, 20); + var imgdata2 = ctx.createImageData(imgdata1); + _assertSame(imgdata2.data.length, imgdata1.data.length, "imgdata2.data.length", "imgdata1.data.length"); + _assertSame(imgdata2.width, imgdata1.width, "imgdata2.width", "imgdata1.width"); + _assertSame(imgdata2.height, imgdata1.height, "imgdata2.height", "imgdata1.height"); + var isTransparentBlack = true; + for (var i = 0; i < imgdata2.data.length; ++i) + if (imgdata2.data[i] !== 0) + isTransparentBlack = false; + _assert(isTransparentBlack, "isTransparentBlack"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.zero.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.zero.html index a4d074043f3..b5a95172b61 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.zero.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.zero.html @@ -15,15 +15,13 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.createImageData(null); }); -})(canvas, ctx); -t.done(); + assert_throws_js(TypeError, function() { ctx.createImageData(null); }); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.zero.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.zero.worker.js index c51067ed620..1eabd9ebf31 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.zero.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create1.zero.worker.js @@ -13,11 +13,10 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -assert_throws_js(TypeError, function() { ctx.createImageData(null); }); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + assert_throws_js(TypeError, function() { ctx.createImageData(null); }); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.basic.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.basic.html index 4e99cac955f..7c265f5209d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.basic.html @@ -15,15 +15,13 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -_assertDifferent(ctx.createImageData(1, 1), null, "ctx.createImageData(1, 1)", "null"); -})(canvas, ctx); -t.done(); + _assertDifferent(ctx.createImageData(1, 1), null, "ctx.createImageData(1, 1)", "null"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.basic.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.basic.worker.js index e99cbe276bc..26ca82929cb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.basic.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.basic.worker.js @@ -13,11 +13,10 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -_assertDifferent(ctx.createImageData(1, 1), null, "ctx.createImageData(1, 1)", "null"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + _assertDifferent(ctx.createImageData(1, 1), null, "ctx.createImageData(1, 1)", "null"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.double.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.double.html index d927f28854d..ca54641a30e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.double.html @@ -15,20 +15,18 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var imgdata1 = ctx.createImageData(10.01, 10.99); -var imgdata2 = ctx.createImageData(-10.01, -10.99); -_assertSame(imgdata1.width, 10, "imgdata1.width", "10"); -_assertSame(imgdata1.height, 10, "imgdata1.height", "10"); -_assertSame(imgdata2.width, 10, "imgdata2.width", "10"); -_assertSame(imgdata2.height, 10, "imgdata2.height", "10"); -})(canvas, ctx); -t.done(); + var imgdata1 = ctx.createImageData(10.01, 10.99); + var imgdata2 = ctx.createImageData(-10.01, -10.99); + _assertSame(imgdata1.width, 10, "imgdata1.width", "10"); + _assertSame(imgdata1.height, 10, "imgdata1.height", "10"); + _assertSame(imgdata2.width, 10, "imgdata2.width", "10"); + _assertSame(imgdata2.height, 10, "imgdata2.height", "10"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.double.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.double.worker.js index 773204cd418..2f3416d0f0e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.double.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.double.worker.js @@ -13,16 +13,15 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var imgdata1 = ctx.createImageData(10.01, 10.99); -var imgdata2 = ctx.createImageData(-10.01, -10.99); -_assertSame(imgdata1.width, 10, "imgdata1.width", "10"); -_assertSame(imgdata1.height, 10, "imgdata1.height", "10"); -_assertSame(imgdata2.width, 10, "imgdata2.width", "10"); -_assertSame(imgdata2.height, 10, "imgdata2.height", "10"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var imgdata1 = ctx.createImageData(10.01, 10.99); + var imgdata2 = ctx.createImageData(-10.01, -10.99); + _assertSame(imgdata1.width, 10, "imgdata1.width", "10"); + _assertSame(imgdata1.height, 10, "imgdata1.height", "10"); + _assertSame(imgdata2.width, 10, "imgdata2.width", "10"); + _assertSame(imgdata2.height, 10, "imgdata2.height", "10"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.initial.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.initial.html index 10029344246..566a9a30db2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.initial.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.initial.html @@ -15,23 +15,21 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var imgdata = ctx.createImageData(10, 20); -_assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); -_assert(imgdata.width < imgdata.height, "imgdata.width < imgdata.height"); -_assert(imgdata.width > 0, "imgdata.width > 0"); -var isTransparentBlack = true; -for (var i = 0; i < imgdata.data.length; ++i) - if (imgdata.data[i] !== 0) - isTransparentBlack = false; -_assert(isTransparentBlack, "isTransparentBlack"); -})(canvas, ctx); -t.done(); + var imgdata = ctx.createImageData(10, 20); + _assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); + _assert(imgdata.width < imgdata.height, "imgdata.width < imgdata.height"); + _assert(imgdata.width > 0, "imgdata.width > 0"); + var isTransparentBlack = true; + for (var i = 0; i < imgdata.data.length; ++i) + if (imgdata.data[i] !== 0) + isTransparentBlack = false; + _assert(isTransparentBlack, "isTransparentBlack"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.initial.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.initial.worker.js index 0e681dee076..472e1dfd2e3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.initial.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.initial.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var imgdata = ctx.createImageData(10, 20); -_assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); -_assert(imgdata.width < imgdata.height, "imgdata.width < imgdata.height"); -_assert(imgdata.width > 0, "imgdata.width > 0"); -var isTransparentBlack = true; -for (var i = 0; i < imgdata.data.length; ++i) - if (imgdata.data[i] !== 0) - isTransparentBlack = false; -_assert(isTransparentBlack, "isTransparentBlack"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var imgdata = ctx.createImageData(10, 20); + _assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); + _assert(imgdata.width < imgdata.height, "imgdata.width < imgdata.height"); + _assert(imgdata.width > 0, "imgdata.width > 0"); + var isTransparentBlack = true; + for (var i = 0; i < imgdata.data.length; ++i) + if (imgdata.data[i] !== 0) + isTransparentBlack = false; + _assert(isTransparentBlack, "isTransparentBlack"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.large.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.large.html index e18893e9086..75b8f737fd9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.large.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.large.html @@ -15,23 +15,21 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var imgdata = ctx.createImageData(1000, 2000); -_assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); -_assert(imgdata.width < imgdata.height, "imgdata.width < imgdata.height"); -_assert(imgdata.width > 0, "imgdata.width > 0"); -var isTransparentBlack = true; -for (var i = 0; i < imgdata.data.length; i += 7813) // check ~1024 points (assuming normal scaling) - if (imgdata.data[i] !== 0) - isTransparentBlack = false; -_assert(isTransparentBlack, "isTransparentBlack"); -})(canvas, ctx); -t.done(); + var imgdata = ctx.createImageData(1000, 2000); + _assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); + _assert(imgdata.width < imgdata.height, "imgdata.width < imgdata.height"); + _assert(imgdata.width > 0, "imgdata.width > 0"); + var isTransparentBlack = true; + for (var i = 0; i < imgdata.data.length; i += 7813) // check ~1024 points (assuming normal scaling) + if (imgdata.data[i] !== 0) + isTransparentBlack = false; + _assert(isTransparentBlack, "isTransparentBlack"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.large.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.large.worker.js index 57dda69d4d0..e2b85bfb692 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.large.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.large.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var imgdata = ctx.createImageData(1000, 2000); -_assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); -_assert(imgdata.width < imgdata.height, "imgdata.width < imgdata.height"); -_assert(imgdata.width > 0, "imgdata.width > 0"); -var isTransparentBlack = true; -for (var i = 0; i < imgdata.data.length; i += 7813) // check ~1024 points (assuming normal scaling) - if (imgdata.data[i] !== 0) - isTransparentBlack = false; -_assert(isTransparentBlack, "isTransparentBlack"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var imgdata = ctx.createImageData(1000, 2000); + _assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); + _assert(imgdata.width < imgdata.height, "imgdata.width < imgdata.height"); + _assert(imgdata.width > 0, "imgdata.width > 0"); + var isTransparentBlack = true; + for (var i = 0; i < imgdata.data.length; i += 7813) // check ~1024 points (assuming normal scaling) + if (imgdata.data[i] !== 0) + isTransparentBlack = false; + _assert(isTransparentBlack, "isTransparentBlack"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.negative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.negative.html index 9272c9ed9c1..b41153c2824 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.negative.html @@ -15,21 +15,19 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var imgdata1 = ctx.createImageData(10, 20); -var imgdata2 = ctx.createImageData(-10, 20); -var imgdata3 = ctx.createImageData(10, -20); -var imgdata4 = ctx.createImageData(-10, -20); -_assertSame(imgdata1.data.length, imgdata2.data.length, "imgdata1.data.length", "imgdata2.data.length"); -_assertSame(imgdata2.data.length, imgdata3.data.length, "imgdata2.data.length", "imgdata3.data.length"); -_assertSame(imgdata3.data.length, imgdata4.data.length, "imgdata3.data.length", "imgdata4.data.length"); -})(canvas, ctx); -t.done(); + var imgdata1 = ctx.createImageData(10, 20); + var imgdata2 = ctx.createImageData(-10, 20); + var imgdata3 = ctx.createImageData(10, -20); + var imgdata4 = ctx.createImageData(-10, -20); + _assertSame(imgdata1.data.length, imgdata2.data.length, "imgdata1.data.length", "imgdata2.data.length"); + _assertSame(imgdata2.data.length, imgdata3.data.length, "imgdata2.data.length", "imgdata3.data.length"); + _assertSame(imgdata3.data.length, imgdata4.data.length, "imgdata3.data.length", "imgdata4.data.length"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.negative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.negative.worker.js index a5cb8572955..62ed60e1029 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.negative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.negative.worker.js @@ -13,17 +13,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var imgdata1 = ctx.createImageData(10, 20); -var imgdata2 = ctx.createImageData(-10, 20); -var imgdata3 = ctx.createImageData(10, -20); -var imgdata4 = ctx.createImageData(-10, -20); -_assertSame(imgdata1.data.length, imgdata2.data.length, "imgdata1.data.length", "imgdata2.data.length"); -_assertSame(imgdata2.data.length, imgdata3.data.length, "imgdata2.data.length", "imgdata3.data.length"); -_assertSame(imgdata3.data.length, imgdata4.data.length, "imgdata3.data.length", "imgdata4.data.length"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var imgdata1 = ctx.createImageData(10, 20); + var imgdata2 = ctx.createImageData(-10, 20); + var imgdata3 = ctx.createImageData(10, -20); + var imgdata4 = ctx.createImageData(-10, -20); + _assertSame(imgdata1.data.length, imgdata2.data.length, "imgdata1.data.length", "imgdata2.data.length"); + _assertSame(imgdata2.data.length, imgdata3.data.length, "imgdata2.data.length", "imgdata3.data.length"); + _assertSame(imgdata3.data.length, imgdata4.data.length, "imgdata3.data.length", "imgdata4.data.length"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.nonfinite.html index f51dd744210..dd6f6d83501 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.nonfinite.html @@ -15,31 +15,29 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.createImageData(-Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.createImageData(NaN, 10); }); -assert_throws_js(TypeError, function() { ctx.createImageData(10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.createImageData(10, -Infinity); }); -assert_throws_js(TypeError, function() { ctx.createImageData(10, NaN); }); -assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, Infinity); }); -var posinfobj = { valueOf: function() { return Infinity; } }, - neginfobj = { valueOf: function() { return -Infinity; } }, - nanobj = { valueOf: function() { return -Infinity; } }; -assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.createImageData(neginfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.createImageData(nanobj, 10); }); -assert_throws_js(TypeError, function() { ctx.createImageData(10, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.createImageData(10, neginfobj); }); -assert_throws_js(TypeError, function() { ctx.createImageData(10, nanobj); }); -assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, posinfobj); }); -})(canvas, ctx); -t.done(); + assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.createImageData(-Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.createImageData(NaN, 10); }); + assert_throws_js(TypeError, function() { ctx.createImageData(10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.createImageData(10, -Infinity); }); + assert_throws_js(TypeError, function() { ctx.createImageData(10, NaN); }); + assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, Infinity); }); + var posinfobj = { valueOf: function() { return Infinity; } }, + neginfobj = { valueOf: function() { return -Infinity; } }, + nanobj = { valueOf: function() { return -Infinity; } }; + assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.createImageData(neginfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.createImageData(nanobj, 10); }); + assert_throws_js(TypeError, function() { ctx.createImageData(10, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.createImageData(10, neginfobj); }); + assert_throws_js(TypeError, function() { ctx.createImageData(10, nanobj); }); + assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, posinfobj); }); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.nonfinite.worker.js index ace0f64f94e..18825588bbc 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.nonfinite.worker.js @@ -13,27 +13,26 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.createImageData(-Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.createImageData(NaN, 10); }); -assert_throws_js(TypeError, function() { ctx.createImageData(10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.createImageData(10, -Infinity); }); -assert_throws_js(TypeError, function() { ctx.createImageData(10, NaN); }); -assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, Infinity); }); -var posinfobj = { valueOf: function() { return Infinity; } }, - neginfobj = { valueOf: function() { return -Infinity; } }, - nanobj = { valueOf: function() { return -Infinity; } }; -assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.createImageData(neginfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.createImageData(nanobj, 10); }); -assert_throws_js(TypeError, function() { ctx.createImageData(10, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.createImageData(10, neginfobj); }); -assert_throws_js(TypeError, function() { ctx.createImageData(10, nanobj); }); -assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, posinfobj); }); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.createImageData(-Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.createImageData(NaN, 10); }); + assert_throws_js(TypeError, function() { ctx.createImageData(10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.createImageData(10, -Infinity); }); + assert_throws_js(TypeError, function() { ctx.createImageData(10, NaN); }); + assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, Infinity); }); + var posinfobj = { valueOf: function() { return Infinity; } }, + neginfobj = { valueOf: function() { return -Infinity; } }, + nanobj = { valueOf: function() { return -Infinity; } }; + assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.createImageData(neginfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.createImageData(nanobj, 10); }); + assert_throws_js(TypeError, function() { ctx.createImageData(10, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.createImageData(10, neginfobj); }); + assert_throws_js(TypeError, function() { ctx.createImageData(10, nanobj); }); + assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, posinfobj); }); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.round.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.round.html index 046a04dbcca..0ecb2fb686a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.round.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.round.html @@ -15,18 +15,16 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var imgdata1 = ctx.createImageData(10.01, 10.99); -var imgdata2 = ctx.getImageData(0, 0, 10.01, 10.99); -_assertSame(imgdata1.width, imgdata2.width, "imgdata1.width", "imgdata2.width"); -_assertSame(imgdata1.height, imgdata2.height, "imgdata1.height", "imgdata2.height"); -})(canvas, ctx); -t.done(); + var imgdata1 = ctx.createImageData(10.01, 10.99); + var imgdata2 = ctx.getImageData(0, 0, 10.01, 10.99); + _assertSame(imgdata1.width, imgdata2.width, "imgdata1.width", "imgdata2.width"); + _assertSame(imgdata1.height, imgdata2.height, "imgdata1.height", "imgdata2.height"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.round.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.round.worker.js index 23874984188..b416a02bf23 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.round.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.round.worker.js @@ -13,14 +13,13 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var imgdata1 = ctx.createImageData(10.01, 10.99); -var imgdata2 = ctx.getImageData(0, 0, 10.01, 10.99); -_assertSame(imgdata1.width, imgdata2.width, "imgdata1.width", "imgdata2.width"); -_assertSame(imgdata1.height, imgdata2.height, "imgdata1.height", "imgdata2.height"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var imgdata1 = ctx.createImageData(10.01, 10.99); + var imgdata2 = ctx.getImageData(0, 0, 10.01, 10.99); + _assertSame(imgdata1.width, imgdata2.width, "imgdata1.width", "imgdata2.width"); + _assertSame(imgdata1.height, imgdata2.height, "imgdata1.height", "imgdata2.height"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.zero.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.zero.html index f109c7dc03f..2f7082a7f06 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.zero.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.zero.html @@ -15,19 +15,17 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(10, 0); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0, 10); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0, 0); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0.99, 10); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(10, 0.1); }); -})(canvas, ctx); -t.done(); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(10, 0); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0, 10); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0, 0); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0.99, 10); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(10, 0.1); }); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.zero.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.zero.worker.js index 061e4ca1366..7f57c338988 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.zero.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.create2.zero.worker.js @@ -13,15 +13,14 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(10, 0); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0, 10); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0, 0); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0.99, 10); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(10, 0.1); }); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(10, 0); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0, 10); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0, 0); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(0.99, 10); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.createImageData(10, 0.1); }); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.basic.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.basic.html index e9cc7e98018..d810e64e38b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.basic.html @@ -15,15 +15,13 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -_assertDifferent(ctx.getImageData(0, 0, 100, 50), null, "ctx.getImageData(0, 0, 100, 50)", "null"); -})(canvas, ctx); -t.done(); + _assertDifferent(ctx.getImageData(0, 0, 100, 50), null, "ctx.getImageData(0, 0, 100, 50)", "null"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.basic.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.basic.worker.js index 8accaccc752..f28268be17e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.basic.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.basic.worker.js @@ -13,11 +13,10 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -_assertDifferent(ctx.getImageData(0, 0, 100, 50), null, "ctx.getImageData(0, 0, 100, 50)", "null"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + _assertDifferent(ctx.getImageData(0, 0, 100, 50), null, "ctx.getImageData(0, 0, 100, 50)", "null"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.clamp.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.clamp.html index f832c51c550..825d00a5c4c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.clamp.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.clamp.html @@ -15,26 +15,24 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = 'rgb(-100, -200, -300)'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = 'rgb(256, 300, 400)'; -ctx.fillRect(20, 10, 60, 10); -var imgdata1 = ctx.getImageData(10, 5, 1, 1); -_assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata1.data[1], 0, "imgdata1.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata1.data[2], 0, "imgdata1.data[\""+(2)+"\"]", "0"); -var imgdata2 = ctx.getImageData(30, 15, 1, 1); -_assertSame(imgdata2.data[0], 255, "imgdata2.data[\""+(0)+"\"]", "255"); -_assertSame(imgdata2.data[1], 255, "imgdata2.data[\""+(1)+"\"]", "255"); -_assertSame(imgdata2.data[2], 255, "imgdata2.data[\""+(2)+"\"]", "255"); -})(canvas, ctx); -t.done(); + ctx.fillStyle = 'rgb(-100, -200, -300)'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = 'rgb(256, 300, 400)'; + ctx.fillRect(20, 10, 60, 10); + var imgdata1 = ctx.getImageData(10, 5, 1, 1); + _assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata1.data[1], 0, "imgdata1.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata1.data[2], 0, "imgdata1.data[\""+(2)+"\"]", "0"); + var imgdata2 = ctx.getImageData(30, 15, 1, 1); + _assertSame(imgdata2.data[0], 255, "imgdata2.data[\""+(0)+"\"]", "255"); + _assertSame(imgdata2.data[1], 255, "imgdata2.data[\""+(1)+"\"]", "255"); + _assertSame(imgdata2.data[2], 255, "imgdata2.data[\""+(2)+"\"]", "255"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.clamp.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.clamp.worker.js index ceeb8d5d868..fb4e76584a3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.clamp.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.clamp.worker.js @@ -13,22 +13,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = 'rgb(-100, -200, -300)'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = 'rgb(256, 300, 400)'; -ctx.fillRect(20, 10, 60, 10); -var imgdata1 = ctx.getImageData(10, 5, 1, 1); -_assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata1.data[1], 0, "imgdata1.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata1.data[2], 0, "imgdata1.data[\""+(2)+"\"]", "0"); -var imgdata2 = ctx.getImageData(30, 15, 1, 1); -_assertSame(imgdata2.data[0], 255, "imgdata2.data[\""+(0)+"\"]", "255"); -_assertSame(imgdata2.data[1], 255, "imgdata2.data[\""+(1)+"\"]", "255"); -_assertSame(imgdata2.data[2], 255, "imgdata2.data[\""+(2)+"\"]", "255"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = 'rgb(-100, -200, -300)'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = 'rgb(256, 300, 400)'; + ctx.fillRect(20, 10, 60, 10); + var imgdata1 = ctx.getImageData(10, 5, 1, 1); + _assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata1.data[1], 0, "imgdata1.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata1.data[2], 0, "imgdata1.data[\""+(2)+"\"]", "0"); + var imgdata2 = ctx.getImageData(30, 15, 1, 1); + _assertSame(imgdata2.data[0], 255, "imgdata2.data[\""+(0)+"\"]", "255"); + _assertSame(imgdata2.data[1], 255, "imgdata2.data[\""+(1)+"\"]", "255"); + _assertSame(imgdata2.data[2], 255, "imgdata2.data[\""+(2)+"\"]", "255"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.double.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.double.html index 6839632de70..64fc7c7c12b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.double.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.double.html @@ -15,20 +15,18 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var imgdata1 = ctx.getImageData(0, 0, 10.01, 10.99); -var imgdata2 = ctx.getImageData(0, 0, -10.01, -10.99); -_assertSame(imgdata1.width, 10, "imgdata1.width", "10"); -_assertSame(imgdata1.height, 10, "imgdata1.height", "10"); -_assertSame(imgdata2.width, 10, "imgdata2.width", "10"); -_assertSame(imgdata2.height, 10, "imgdata2.height", "10"); -})(canvas, ctx); -t.done(); + var imgdata1 = ctx.getImageData(0, 0, 10.01, 10.99); + var imgdata2 = ctx.getImageData(0, 0, -10.01, -10.99); + _assertSame(imgdata1.width, 10, "imgdata1.width", "10"); + _assertSame(imgdata1.height, 10, "imgdata1.height", "10"); + _assertSame(imgdata2.width, 10, "imgdata2.width", "10"); + _assertSame(imgdata2.height, 10, "imgdata2.height", "10"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.double.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.double.worker.js index e05fe1009cb..316dce7f807 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.double.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.double.worker.js @@ -13,16 +13,15 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var imgdata1 = ctx.getImageData(0, 0, 10.01, 10.99); -var imgdata2 = ctx.getImageData(0, 0, -10.01, -10.99); -_assertSame(imgdata1.width, 10, "imgdata1.width", "10"); -_assertSame(imgdata1.height, 10, "imgdata1.height", "10"); -_assertSame(imgdata2.width, 10, "imgdata2.width", "10"); -_assertSame(imgdata2.height, 10, "imgdata2.height", "10"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var imgdata1 = ctx.getImageData(0, 0, 10.01, 10.99); + var imgdata2 = ctx.getImageData(0, 0, -10.01, -10.99); + _assertSame(imgdata1.width, 10, "imgdata1.width", "10"); + _assertSame(imgdata1.height, 10, "imgdata1.height", "10"); + _assertSame(imgdata2.width, 10, "imgdata2.width", "10"); + _assertSame(imgdata2.height, 10, "imgdata2.height", "10"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.invalid.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.invalid.html index df63bd2e2a5..dfc5d106ee1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.invalid.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.invalid.html @@ -15,33 +15,31 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -imageData = ctx.getImageData(0,0,2,2); -var testValues = [NaN, true, false, "\"garbage\"", "-1", - "0", "1", "2", Infinity, -Infinity, - -5, -0.5, 0, 0.5, 5, - 5.4, 255, 256, null, undefined]; -var testResults = [0, 1, 0, 0, 0, - 0, 1, 2, 255, 0, - 0, 0, 0, 0, 5, - 5, 255, 255, 0, 0]; -for (var i = 0; i < testValues.length; i++) { - imageData.data[0] = testValues[i]; - _assert(imageData.data[0] == testResults[i], "imageData.data[\""+(0)+"\"] == testResults[\""+(i)+"\"]"); -} -imageData.data['foo']='garbage'; -_assert(imageData.data['foo'] == 'garbage', "imageData.data['foo'] == 'garbage'"); -imageData.data[-1]='garbage'; -_assert(imageData.data[-1] == undefined, "imageData.data[-1] == undefined"); -imageData.data[17]='garbage'; -_assert(imageData.data[17] == undefined, "imageData.data[\""+(17)+"\"] == undefined"); -})(canvas, ctx); -t.done(); + imageData = ctx.getImageData(0,0,2,2); + var testValues = [NaN, true, false, "\"garbage\"", "-1", + "0", "1", "2", Infinity, -Infinity, + -5, -0.5, 0, 0.5, 5, + 5.4, 255, 256, null, undefined]; + var testResults = [0, 1, 0, 0, 0, + 0, 1, 2, 255, 0, + 0, 0, 0, 0, 5, + 5, 255, 255, 0, 0]; + for (var i = 0; i < testValues.length; i++) { + imageData.data[0] = testValues[i]; + _assert(imageData.data[0] == testResults[i], "imageData.data[\""+(0)+"\"] == testResults[\""+(i)+"\"]"); + } + imageData.data['foo']='garbage'; + _assert(imageData.data['foo'] == 'garbage', "imageData.data['foo'] == 'garbage'"); + imageData.data[-1]='garbage'; + _assert(imageData.data[-1] == undefined, "imageData.data[-1] == undefined"); + imageData.data[17]='garbage'; + _assert(imageData.data[17] == undefined, "imageData.data[\""+(17)+"\"] == undefined"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.invalid.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.invalid.worker.js index c9798f59f63..5206899b6ae 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.invalid.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.invalid.worker.js @@ -13,29 +13,28 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -imageData = ctx.getImageData(0,0,2,2); -var testValues = [NaN, true, false, "\"garbage\"", "-1", - "0", "1", "2", Infinity, -Infinity, - -5, -0.5, 0, 0.5, 5, - 5.4, 255, 256, null, undefined]; -var testResults = [0, 1, 0, 0, 0, - 0, 1, 2, 255, 0, - 0, 0, 0, 0, 5, - 5, 255, 255, 0, 0]; -for (var i = 0; i < testValues.length; i++) { - imageData.data[0] = testValues[i]; - _assert(imageData.data[0] == testResults[i], "imageData.data[\""+(0)+"\"] == testResults[\""+(i)+"\"]"); -} -imageData.data['foo']='garbage'; -_assert(imageData.data['foo'] == 'garbage', "imageData.data['foo'] == 'garbage'"); -imageData.data[-1]='garbage'; -_assert(imageData.data[-1] == undefined, "imageData.data[-1] == undefined"); -imageData.data[17]='garbage'; -_assert(imageData.data[17] == undefined, "imageData.data[\""+(17)+"\"] == undefined"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + imageData = ctx.getImageData(0,0,2,2); + var testValues = [NaN, true, false, "\"garbage\"", "-1", + "0", "1", "2", Infinity, -Infinity, + -5, -0.5, 0, 0.5, 5, + 5.4, 255, 256, null, undefined]; + var testResults = [0, 1, 0, 0, 0, + 0, 1, 2, 255, 0, + 0, 0, 0, 0, 5, + 5, 255, 255, 0, 0]; + for (var i = 0; i < testValues.length; i++) { + imageData.data[0] = testValues[i]; + _assert(imageData.data[0] == testResults[i], "imageData.data[\""+(0)+"\"] == testResults[\""+(i)+"\"]"); + } + imageData.data['foo']='garbage'; + _assert(imageData.data['foo'] == 'garbage', "imageData.data['foo'] == 'garbage'"); + imageData.data[-1]='garbage'; + _assert(imageData.data[-1] == undefined, "imageData.data[-1] == undefined"); + imageData.data[17]='garbage'; + _assert(imageData.data[17] == undefined, "imageData.data[\""+(17)+"\"] == undefined"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.large.crash.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.large.crash.html index 5e6102d67d0..3e05c3c92b9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.large.crash.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.large.crash.html @@ -15,15 +15,13 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.getImageData(10, 0xffffffff, 2147483647, 10); }); -})(canvas, ctx); -t.done(); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 0xffffffff, 2147483647, 10); }); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.large.crash.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.large.crash.worker.js index 142c0b833d0..62c1771dbab 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.large.crash.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.large.crash.worker.js @@ -13,11 +13,10 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -assert_throws_js(TypeError, function() { ctx.getImageData(10, 0xffffffff, 2147483647, 10); }); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 0xffffffff, 2147483647, 10); }); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.length.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.length.html index 19fbac06535..47b5fcd166f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.length.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.length.html @@ -15,16 +15,14 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); -_assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); -})(canvas, ctx); -t.done(); + var imgdata = ctx.getImageData(0, 0, 10, 10); + _assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.length.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.length.worker.js index dd2e3dd6c5f..74ed6015f08 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.length.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.length.worker.js @@ -13,12 +13,11 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var imgdata = ctx.getImageData(0, 0, 10, 10); -_assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var imgdata = ctx.getImageData(0, 0, 10, 10); + _assertSame(imgdata.data.length, imgdata.width*imgdata.height*4, "imgdata.data.length", "imgdata.width*imgdata.height*4"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonfinite.html index b9324865b6b..62cad618483 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonfinite.html @@ -15,63 +15,61 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(-Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(NaN, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, -Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, NaN, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, -Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, NaN, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, -Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, NaN); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, Infinity); }); -var posinfobj = { valueOf: function() { return Infinity; } }, - neginfobj = { valueOf: function() { return -Infinity; } }, - nanobj = { valueOf: function() { return -Infinity; } }; -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(neginfobj, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(nanobj, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, neginfobj, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, nanobj, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, neginfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, nanobj, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, neginfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, nanobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, posinfobj); }); -})(canvas, ctx); -t.done(); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(-Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(NaN, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, -Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, NaN, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, -Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, NaN, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, -Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, NaN); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, Infinity); }); + var posinfobj = { valueOf: function() { return Infinity; } }, + neginfobj = { valueOf: function() { return -Infinity; } }, + nanobj = { valueOf: function() { return -Infinity; } }; + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(neginfobj, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(nanobj, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, neginfobj, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, nanobj, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, neginfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, nanobj, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, neginfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, nanobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, posinfobj); }); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonfinite.worker.js index da70d1b2138..98b4913a132 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonfinite.worker.js @@ -13,59 +13,58 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(-Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(NaN, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, -Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, NaN, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, -Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, NaN, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, -Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, NaN); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, Infinity); }); -var posinfobj = { valueOf: function() { return Infinity; } }, - neginfobj = { valueOf: function() { return -Infinity; } }, - nanobj = { valueOf: function() { return -Infinity; } }; -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(neginfobj, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(nanobj, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, neginfobj, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, nanobj, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, neginfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, nanobj, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, neginfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, nanobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, 10); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, posinfobj); }); -assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, posinfobj); }); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(-Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(NaN, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, -Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, NaN, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, -Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, NaN, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, -Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, NaN); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, Infinity); }); + var posinfobj = { valueOf: function() { return Infinity; } }, + neginfobj = { valueOf: function() { return -Infinity; } }, + nanobj = { valueOf: function() { return -Infinity; } }; + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(neginfobj, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(nanobj, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, neginfobj, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, nanobj, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, neginfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, nanobj, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, neginfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, nanobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, 10); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, posinfobj); }); + assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, posinfobj); }); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonpremul.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonpremul.html index 89eea879318..3a97d9dc05b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonpremul.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonpremul.html @@ -15,22 +15,20 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = 'rgba(255, 255, 255, 0.5)'; -ctx.fillRect(0, 0, 100, 50); -var imgdata = ctx.getImageData(10, 10, 10, 10); -_assert(imgdata.data[0] > 200, "imgdata.data[\""+(0)+"\"] > 200"); -_assert(imgdata.data[1] > 200, "imgdata.data[\""+(1)+"\"] > 200"); -_assert(imgdata.data[2] > 200, "imgdata.data[\""+(2)+"\"] > 200"); -_assert(imgdata.data[3] > 100, "imgdata.data[\""+(3)+"\"] > 100"); -_assert(imgdata.data[3] < 200, "imgdata.data[\""+(3)+"\"] < 200"); -})(canvas, ctx); -t.done(); + ctx.fillStyle = 'rgba(255, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + var imgdata = ctx.getImageData(10, 10, 10, 10); + _assert(imgdata.data[0] > 200, "imgdata.data[\""+(0)+"\"] > 200"); + _assert(imgdata.data[1] > 200, "imgdata.data[\""+(1)+"\"] > 200"); + _assert(imgdata.data[2] > 200, "imgdata.data[\""+(2)+"\"] > 200"); + _assert(imgdata.data[3] > 100, "imgdata.data[\""+(3)+"\"] > 100"); + _assert(imgdata.data[3] < 200, "imgdata.data[\""+(3)+"\"] < 200"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonpremul.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonpremul.worker.js index d568c31b38d..1a8da5efb0a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonpremul.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.nonpremul.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = 'rgba(255, 255, 255, 0.5)'; -ctx.fillRect(0, 0, 100, 50); -var imgdata = ctx.getImageData(10, 10, 10, 10); -_assert(imgdata.data[0] > 200, "imgdata.data[\""+(0)+"\"] > 200"); -_assert(imgdata.data[1] > 200, "imgdata.data[\""+(1)+"\"] > 200"); -_assert(imgdata.data[2] > 200, "imgdata.data[\""+(2)+"\"] > 200"); -_assert(imgdata.data[3] > 100, "imgdata.data[\""+(3)+"\"] > 100"); -_assert(imgdata.data[3] < 200, "imgdata.data[\""+(3)+"\"] < 200"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = 'rgba(255, 255, 255, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + var imgdata = ctx.getImageData(10, 10, 10, 10); + _assert(imgdata.data[0] > 200, "imgdata.data[\""+(0)+"\"] > 200"); + _assert(imgdata.data[1] > 200, "imgdata.data[\""+(1)+"\"] > 200"); + _assert(imgdata.data[2] > 200, "imgdata.data[\""+(2)+"\"] > 200"); + _assert(imgdata.data[3] > 100, "imgdata.data[\""+(3)+"\"] > 100"); + _assert(imgdata.data[3] < 200, "imgdata.data[\""+(3)+"\"] < 200"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.alpha.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.alpha.html index f79f5f351e0..04eb67902fa 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.alpha.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.alpha.html @@ -15,19 +15,17 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = 'rgba(0, 0, 0, 0.5)'; -ctx.fillRect(0, 0, 100, 50); -var imgdata = ctx.getImageData(0, 0, 10, 10); -_assert(imgdata.data[3] < 200, "imgdata.data[\""+(3)+"\"] < 200"); -_assert(imgdata.data[3] > 100, "imgdata.data[\""+(3)+"\"] > 100"); -})(canvas, ctx); -t.done(); + ctx.fillStyle = 'rgba(0, 0, 0, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + var imgdata = ctx.getImageData(0, 0, 10, 10); + _assert(imgdata.data[3] < 200, "imgdata.data[\""+(3)+"\"] < 200"); + _assert(imgdata.data[3] > 100, "imgdata.data[\""+(3)+"\"] > 100"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.alpha.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.alpha.worker.js index 038844816f3..4338436a6df 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.alpha.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.alpha.worker.js @@ -13,15 +13,14 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = 'rgba(0, 0, 0, 0.5)'; -ctx.fillRect(0, 0, 100, 50); -var imgdata = ctx.getImageData(0, 0, 10, 10); -_assert(imgdata.data[3] < 200, "imgdata.data[\""+(3)+"\"] < 200"); -_assert(imgdata.data[3] > 100, "imgdata.data[\""+(3)+"\"] > 100"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = 'rgba(0, 0, 0, 0.5)'; + ctx.fillRect(0, 0, 100, 50); + var imgdata = ctx.getImageData(0, 0, 10, 10); + _assert(imgdata.data[3] < 200, "imgdata.data[\""+(3)+"\"] < 200"); + _assert(imgdata.data[3] > 100, "imgdata.data[\""+(3)+"\"] > 100"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.cols.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.cols.html index 9afceba7023..f5b315c60a3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.cols.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.cols.html @@ -15,22 +15,20 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#fff'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#000'; -ctx.fillRect(0, 0, 2, 50); -var imgdata = ctx.getImageData(0, 0, 10, 10); -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata.data[Math.round(imgdata.width/2*4)], 255, "imgdata.data[Math.round(imgdata.width/2*4)]", "255"); -_assertSame(imgdata.data[Math.round((imgdata.height/2)*imgdata.width*4)], 0, "imgdata.data[Math.round((imgdata.height/2)*imgdata.width*4)]", "0"); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#fff'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#000'; + ctx.fillRect(0, 0, 2, 50); + var imgdata = ctx.getImageData(0, 0, 10, 10); + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata.data[Math.round(imgdata.width/2*4)], 255, "imgdata.data[Math.round(imgdata.width/2*4)]", "255"); + _assertSame(imgdata.data[Math.round((imgdata.height/2)*imgdata.width*4)], 0, "imgdata.data[Math.round((imgdata.height/2)*imgdata.width*4)]", "0"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.cols.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.cols.worker.js index 6a13c4dee65..6a070e25169 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.cols.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.cols.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#fff'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#000'; -ctx.fillRect(0, 0, 2, 50); -var imgdata = ctx.getImageData(0, 0, 10, 10); -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata.data[Math.round(imgdata.width/2*4)], 255, "imgdata.data[Math.round(imgdata.width/2*4)]", "255"); -_assertSame(imgdata.data[Math.round((imgdata.height/2)*imgdata.width*4)], 0, "imgdata.data[Math.round((imgdata.height/2)*imgdata.width*4)]", "0"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#fff'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#000'; + ctx.fillRect(0, 0, 2, 50); + var imgdata = ctx.getImageData(0, 0, 10, 10); + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata.data[Math.round(imgdata.width/2*4)], 255, "imgdata.data[Math.round(imgdata.width/2*4)]", "255"); + _assertSame(imgdata.data[Math.round((imgdata.height/2)*imgdata.width*4)], 0, "imgdata.data[Math.round((imgdata.height/2)*imgdata.width*4)]", "0"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rgb.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rgb.html index 0fd4759409e..661b437fb1b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rgb.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rgb.html @@ -15,25 +15,23 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#48c'; -ctx.fillRect(0, 0, 100, 50); -var imgdata = ctx.getImageData(0, 0, 10, 10); -_assertSame(imgdata.data[0], 0x44, "imgdata.data[\""+(0)+"\"]", "0x44"); -_assertSame(imgdata.data[1], 0x88, "imgdata.data[\""+(1)+"\"]", "0x88"); -_assertSame(imgdata.data[2], 0xCC, "imgdata.data[\""+(2)+"\"]", "0xCC"); -_assertSame(imgdata.data[3], 255, "imgdata.data[\""+(3)+"\"]", "255"); -_assertSame(imgdata.data[4], 0x44, "imgdata.data[\""+(4)+"\"]", "0x44"); -_assertSame(imgdata.data[5], 0x88, "imgdata.data[\""+(5)+"\"]", "0x88"); -_assertSame(imgdata.data[6], 0xCC, "imgdata.data[\""+(6)+"\"]", "0xCC"); -_assertSame(imgdata.data[7], 255, "imgdata.data[\""+(7)+"\"]", "255"); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#48c'; + ctx.fillRect(0, 0, 100, 50); + var imgdata = ctx.getImageData(0, 0, 10, 10); + _assertSame(imgdata.data[0], 0x44, "imgdata.data[\""+(0)+"\"]", "0x44"); + _assertSame(imgdata.data[1], 0x88, "imgdata.data[\""+(1)+"\"]", "0x88"); + _assertSame(imgdata.data[2], 0xCC, "imgdata.data[\""+(2)+"\"]", "0xCC"); + _assertSame(imgdata.data[3], 255, "imgdata.data[\""+(3)+"\"]", "255"); + _assertSame(imgdata.data[4], 0x44, "imgdata.data[\""+(4)+"\"]", "0x44"); + _assertSame(imgdata.data[5], 0x88, "imgdata.data[\""+(5)+"\"]", "0x88"); + _assertSame(imgdata.data[6], 0xCC, "imgdata.data[\""+(6)+"\"]", "0xCC"); + _assertSame(imgdata.data[7], 255, "imgdata.data[\""+(7)+"\"]", "255"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rgb.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rgb.worker.js index 771a777b9bd..4e5974f9f86 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rgb.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rgb.worker.js @@ -13,21 +13,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#48c'; -ctx.fillRect(0, 0, 100, 50); -var imgdata = ctx.getImageData(0, 0, 10, 10); -_assertSame(imgdata.data[0], 0x44, "imgdata.data[\""+(0)+"\"]", "0x44"); -_assertSame(imgdata.data[1], 0x88, "imgdata.data[\""+(1)+"\"]", "0x88"); -_assertSame(imgdata.data[2], 0xCC, "imgdata.data[\""+(2)+"\"]", "0xCC"); -_assertSame(imgdata.data[3], 255, "imgdata.data[\""+(3)+"\"]", "255"); -_assertSame(imgdata.data[4], 0x44, "imgdata.data[\""+(4)+"\"]", "0x44"); -_assertSame(imgdata.data[5], 0x88, "imgdata.data[\""+(5)+"\"]", "0x88"); -_assertSame(imgdata.data[6], 0xCC, "imgdata.data[\""+(6)+"\"]", "0xCC"); -_assertSame(imgdata.data[7], 255, "imgdata.data[\""+(7)+"\"]", "255"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#48c'; + ctx.fillRect(0, 0, 100, 50); + var imgdata = ctx.getImageData(0, 0, 10, 10); + _assertSame(imgdata.data[0], 0x44, "imgdata.data[\""+(0)+"\"]", "0x44"); + _assertSame(imgdata.data[1], 0x88, "imgdata.data[\""+(1)+"\"]", "0x88"); + _assertSame(imgdata.data[2], 0xCC, "imgdata.data[\""+(2)+"\"]", "0xCC"); + _assertSame(imgdata.data[3], 255, "imgdata.data[\""+(3)+"\"]", "255"); + _assertSame(imgdata.data[4], 0x44, "imgdata.data[\""+(4)+"\"]", "0x44"); + _assertSame(imgdata.data[5], 0x88, "imgdata.data[\""+(5)+"\"]", "0x88"); + _assertSame(imgdata.data[6], 0xCC, "imgdata.data[\""+(6)+"\"]", "0xCC"); + _assertSame(imgdata.data[7], 255, "imgdata.data[\""+(7)+"\"]", "255"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rows.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rows.html index eb7a137ab19..6d8ee2eba5e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rows.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rows.html @@ -15,22 +15,20 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#fff'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#000'; -ctx.fillRect(0, 0, 100, 2); -var imgdata = ctx.getImageData(0, 0, 10, 10); -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata.data[Math.floor(imgdata.width/2*4)], 0, "imgdata.data[Math.floor(imgdata.width/2*4)]", "0"); -_assertSame(imgdata.data[(imgdata.height/2)*imgdata.width*4], 255, "imgdata.data[(imgdata.height/2)*imgdata.width*4]", "255"); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#fff'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#000'; + ctx.fillRect(0, 0, 100, 2); + var imgdata = ctx.getImageData(0, 0, 10, 10); + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata.data[Math.floor(imgdata.width/2*4)], 0, "imgdata.data[Math.floor(imgdata.width/2*4)]", "0"); + _assertSame(imgdata.data[(imgdata.height/2)*imgdata.width*4], 255, "imgdata.data[(imgdata.height/2)*imgdata.width*4]", "255"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rows.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rows.worker.js index 1f75f9301c9..1d3226a5033 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rows.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.order.rows.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#fff'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#000'; -ctx.fillRect(0, 0, 100, 2); -var imgdata = ctx.getImageData(0, 0, 10, 10); -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata.data[Math.floor(imgdata.width/2*4)], 0, "imgdata.data[Math.floor(imgdata.width/2*4)]", "0"); -_assertSame(imgdata.data[(imgdata.height/2)*imgdata.width*4], 255, "imgdata.data[(imgdata.height/2)*imgdata.width*4]", "255"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#fff'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#000'; + ctx.fillRect(0, 0, 100, 2); + var imgdata = ctx.getImageData(0, 0, 10, 10); + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata.data[Math.floor(imgdata.width/2*4)], 0, "imgdata.data[Math.floor(imgdata.width/2*4)]", "0"); + _assertSame(imgdata.data[(imgdata.height/2)*imgdata.width*4], 255, "imgdata.data[(imgdata.height/2)*imgdata.width*4]", "255"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.range.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.range.html index 91c0c5844a5..8db1a42ca11 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.range.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.range.html @@ -15,22 +15,20 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#000'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#fff'; -ctx.fillRect(20, 10, 60, 10); -var imgdata1 = ctx.getImageData(10, 5, 1, 1); -_assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); -var imgdata2 = ctx.getImageData(30, 15, 1, 1); -_assertSame(imgdata2.data[0], 255, "imgdata2.data[\""+(0)+"\"]", "255"); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#000'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#fff'; + ctx.fillRect(20, 10, 60, 10); + var imgdata1 = ctx.getImageData(10, 5, 1, 1); + _assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); + var imgdata2 = ctx.getImageData(30, 15, 1, 1); + _assertSame(imgdata2.data[0], 255, "imgdata2.data[\""+(0)+"\"]", "255"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.range.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.range.worker.js index 9389c22bd31..2e962beeaed 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.range.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.range.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#000'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#fff'; -ctx.fillRect(20, 10, 60, 10); -var imgdata1 = ctx.getImageData(10, 5, 1, 1); -_assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); -var imgdata2 = ctx.getImageData(30, 15, 1, 1); -_assertSame(imgdata2.data[0], 255, "imgdata2.data[\""+(0)+"\"]", "255"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#000'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#fff'; + ctx.fillRect(20, 10, 60, 10); + var imgdata1 = ctx.getImageData(10, 5, 1, 1); + _assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); + var imgdata2 = ctx.getImageData(30, 15, 1, 1); + _assertSame(imgdata2.data[0], 255, "imgdata2.data[\""+(0)+"\"]", "255"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.rounding.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.rounding.html index a06d180a575..f939ba82dfa 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.rounding.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.rounding.html @@ -15,33 +15,31 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -function testDimensions(sx, sy, sw, sh, width, height) -{ - imageData = ctx.getImageData(sx, sy, sw, sh); - _assert(imageData.width == width, "imageData.width == width"); - _assert(imageData.height == height, "imageData.height == height"); -} + function testDimensions(sx, sy, sw, sh, width, height) + { + imageData = ctx.getImageData(sx, sy, sw, sh); + _assert(imageData.width == width, "imageData.width == width"); + _assert(imageData.height == height, "imageData.height == height"); + } -testDimensions(0, 0, 20, 10, 20, 10); + testDimensions(0, 0, 20, 10, 20, 10); -testDimensions(.1, .2, 20, 10, 20, 10); -testDimensions(.9, .8, 20, 10, 20, 10); + testDimensions(.1, .2, 20, 10, 20, 10); + testDimensions(.9, .8, 20, 10, 20, 10); -testDimensions(0, 0, 20.9, 10.9, 20, 10); -testDimensions(0, 0, 20.1, 10.1, 20, 10); + testDimensions(0, 0, 20.9, 10.9, 20, 10); + testDimensions(0, 0, 20.1, 10.1, 20, 10); -testDimensions(-1, -1, 20, 10, 20, 10); + testDimensions(-1, -1, 20, 10, 20, 10); -testDimensions(-1.1, 0, 20, 10, 20, 10); -testDimensions(-1.9, 0, 20, 10, 20, 10); -})(canvas, ctx); -t.done(); + testDimensions(-1.1, 0, 20, 10, 20, 10); + testDimensions(-1.9, 0, 20, 10, 20, 10); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.rounding.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.rounding.worker.js index 8cdbf790f9d..b2cd08ade2c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.rounding.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.rounding.worker.js @@ -13,29 +13,28 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -function testDimensions(sx, sy, sw, sh, width, height) -{ - imageData = ctx.getImageData(sx, sy, sw, sh); - _assert(imageData.width == width, "imageData.width == width"); - _assert(imageData.height == height, "imageData.height == height"); -} + function testDimensions(sx, sy, sw, sh, width, height) + { + imageData = ctx.getImageData(sx, sy, sw, sh); + _assert(imageData.width == width, "imageData.width == width"); + _assert(imageData.height == height, "imageData.height == height"); + } -testDimensions(0, 0, 20, 10, 20, 10); + testDimensions(0, 0, 20, 10, 20, 10); -testDimensions(.1, .2, 20, 10, 20, 10); -testDimensions(.9, .8, 20, 10, 20, 10); + testDimensions(.1, .2, 20, 10, 20, 10); + testDimensions(.9, .8, 20, 10, 20, 10); -testDimensions(0, 0, 20.9, 10.9, 20, 10); -testDimensions(0, 0, 20.1, 10.1, 20, 10); + testDimensions(0, 0, 20.9, 10.9, 20, 10); + testDimensions(0, 0, 20.1, 10.1, 20, 10); -testDimensions(-1, -1, 20, 10, 20, 10); - -testDimensions(-1.1, 0, 20, 10, 20, 10); -testDimensions(-1.9, 0, 20, 10, 20, 10); -t.done(); + testDimensions(-1, -1, 20, 10, 20, 10); + testDimensions(-1.1, 0, 20, 10, 20, 10); + testDimensions(-1.9, 0, 20, 10, 20, 10); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.negative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.negative.html index 7e9d36338d7..a4b9c7e41c7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.negative.html @@ -15,34 +15,32 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#000'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#fff'; -ctx.fillRect(20, 10, 60, 10); - -var imgdata1 = ctx.getImageData(85, 25, -10, -10); -_assertSame(imgdata1.data[0], 255, "imgdata1.data[\""+(0)+"\"]", "255"); -_assertSame(imgdata1.data[1], 255, "imgdata1.data[\""+(1)+"\"]", "255"); -_assertSame(imgdata1.data[2], 255, "imgdata1.data[\""+(2)+"\"]", "255"); -_assertSame(imgdata1.data[3], 255, "imgdata1.data[\""+(3)+"\"]", "255"); -_assertSame(imgdata1.data[imgdata1.data.length-4+0], 0, "imgdata1.data[imgdata1.data.length-4+0]", "0"); -_assertSame(imgdata1.data[imgdata1.data.length-4+1], 0, "imgdata1.data[imgdata1.data.length-4+1]", "0"); -_assertSame(imgdata1.data[imgdata1.data.length-4+2], 0, "imgdata1.data[imgdata1.data.length-4+2]", "0"); -_assertSame(imgdata1.data[imgdata1.data.length-4+3], 255, "imgdata1.data[imgdata1.data.length-4+3]", "255"); - -var imgdata2 = ctx.getImageData(0, 0, -1, -1); -_assertSame(imgdata2.data[0], 0, "imgdata2.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata2.data[1], 0, "imgdata2.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata2.data[2], 0, "imgdata2.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata2.data[3], 0, "imgdata2.data[\""+(3)+"\"]", "0"); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#000'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#fff'; + ctx.fillRect(20, 10, 60, 10); + + var imgdata1 = ctx.getImageData(85, 25, -10, -10); + _assertSame(imgdata1.data[0], 255, "imgdata1.data[\""+(0)+"\"]", "255"); + _assertSame(imgdata1.data[1], 255, "imgdata1.data[\""+(1)+"\"]", "255"); + _assertSame(imgdata1.data[2], 255, "imgdata1.data[\""+(2)+"\"]", "255"); + _assertSame(imgdata1.data[3], 255, "imgdata1.data[\""+(3)+"\"]", "255"); + _assertSame(imgdata1.data[imgdata1.data.length-4+0], 0, "imgdata1.data[imgdata1.data.length-4+0]", "0"); + _assertSame(imgdata1.data[imgdata1.data.length-4+1], 0, "imgdata1.data[imgdata1.data.length-4+1]", "0"); + _assertSame(imgdata1.data[imgdata1.data.length-4+2], 0, "imgdata1.data[imgdata1.data.length-4+2]", "0"); + _assertSame(imgdata1.data[imgdata1.data.length-4+3], 255, "imgdata1.data[imgdata1.data.length-4+3]", "255"); + + var imgdata2 = ctx.getImageData(0, 0, -1, -1); + _assertSame(imgdata2.data[0], 0, "imgdata2.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata2.data[1], 0, "imgdata2.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata2.data[2], 0, "imgdata2.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata2.data[3], 0, "imgdata2.data[\""+(3)+"\"]", "0"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.negative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.negative.worker.js index 989178792a0..62929918ec4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.negative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.negative.worker.js @@ -13,30 +13,29 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#000'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#fff'; -ctx.fillRect(20, 10, 60, 10); + ctx.fillStyle = '#000'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#fff'; + ctx.fillRect(20, 10, 60, 10); -var imgdata1 = ctx.getImageData(85, 25, -10, -10); -_assertSame(imgdata1.data[0], 255, "imgdata1.data[\""+(0)+"\"]", "255"); -_assertSame(imgdata1.data[1], 255, "imgdata1.data[\""+(1)+"\"]", "255"); -_assertSame(imgdata1.data[2], 255, "imgdata1.data[\""+(2)+"\"]", "255"); -_assertSame(imgdata1.data[3], 255, "imgdata1.data[\""+(3)+"\"]", "255"); -_assertSame(imgdata1.data[imgdata1.data.length-4+0], 0, "imgdata1.data[imgdata1.data.length-4+0]", "0"); -_assertSame(imgdata1.data[imgdata1.data.length-4+1], 0, "imgdata1.data[imgdata1.data.length-4+1]", "0"); -_assertSame(imgdata1.data[imgdata1.data.length-4+2], 0, "imgdata1.data[imgdata1.data.length-4+2]", "0"); -_assertSame(imgdata1.data[imgdata1.data.length-4+3], 255, "imgdata1.data[imgdata1.data.length-4+3]", "255"); - -var imgdata2 = ctx.getImageData(0, 0, -1, -1); -_assertSame(imgdata2.data[0], 0, "imgdata2.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata2.data[1], 0, "imgdata2.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata2.data[2], 0, "imgdata2.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata2.data[3], 0, "imgdata2.data[\""+(3)+"\"]", "0"); -t.done(); + var imgdata1 = ctx.getImageData(85, 25, -10, -10); + _assertSame(imgdata1.data[0], 255, "imgdata1.data[\""+(0)+"\"]", "255"); + _assertSame(imgdata1.data[1], 255, "imgdata1.data[\""+(1)+"\"]", "255"); + _assertSame(imgdata1.data[2], 255, "imgdata1.data[\""+(2)+"\"]", "255"); + _assertSame(imgdata1.data[3], 255, "imgdata1.data[\""+(3)+"\"]", "255"); + _assertSame(imgdata1.data[imgdata1.data.length-4+0], 0, "imgdata1.data[imgdata1.data.length-4+0]", "0"); + _assertSame(imgdata1.data[imgdata1.data.length-4+1], 0, "imgdata1.data[imgdata1.data.length-4+1]", "0"); + _assertSame(imgdata1.data[imgdata1.data.length-4+2], 0, "imgdata1.data[imgdata1.data.length-4+2]", "0"); + _assertSame(imgdata1.data[imgdata1.data.length-4+3], 255, "imgdata1.data[imgdata1.data.length-4+3]", "255"); + var imgdata2 = ctx.getImageData(0, 0, -1, -1); + _assertSame(imgdata2.data[0], 0, "imgdata2.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata2.data[1], 0, "imgdata2.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata2.data[2], 0, "imgdata2.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata2.data[3], 0, "imgdata2.data[\""+(3)+"\"]", "0"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.outside.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.outside.html index 7dbe2dd1b34..ca11da80d50 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.outside.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.outside.html @@ -15,74 +15,72 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#08f'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#08f'; + ctx.fillRect(0, 0, 100, 50); -var imgdata1 = ctx.getImageData(-10, 5, 1, 1); -_assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata1.data[1], 0, "imgdata1.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata1.data[2], 0, "imgdata1.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata1.data[3], 0, "imgdata1.data[\""+(3)+"\"]", "0"); + var imgdata1 = ctx.getImageData(-10, 5, 1, 1); + _assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata1.data[1], 0, "imgdata1.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata1.data[2], 0, "imgdata1.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata1.data[3], 0, "imgdata1.data[\""+(3)+"\"]", "0"); -var imgdata2 = ctx.getImageData(10, -5, 1, 1); -_assertSame(imgdata2.data[0], 0, "imgdata2.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata2.data[1], 0, "imgdata2.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata2.data[2], 0, "imgdata2.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata2.data[3], 0, "imgdata2.data[\""+(3)+"\"]", "0"); + var imgdata2 = ctx.getImageData(10, -5, 1, 1); + _assertSame(imgdata2.data[0], 0, "imgdata2.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata2.data[1], 0, "imgdata2.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata2.data[2], 0, "imgdata2.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata2.data[3], 0, "imgdata2.data[\""+(3)+"\"]", "0"); -var imgdata3 = ctx.getImageData(200, 5, 1, 1); -_assertSame(imgdata3.data[0], 0, "imgdata3.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata3.data[1], 0, "imgdata3.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata3.data[2], 0, "imgdata3.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata3.data[3], 0, "imgdata3.data[\""+(3)+"\"]", "0"); + var imgdata3 = ctx.getImageData(200, 5, 1, 1); + _assertSame(imgdata3.data[0], 0, "imgdata3.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata3.data[1], 0, "imgdata3.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata3.data[2], 0, "imgdata3.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata3.data[3], 0, "imgdata3.data[\""+(3)+"\"]", "0"); -var imgdata4 = ctx.getImageData(10, 60, 1, 1); -_assertSame(imgdata4.data[0], 0, "imgdata4.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata4.data[1], 0, "imgdata4.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata4.data[2], 0, "imgdata4.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata4.data[3], 0, "imgdata4.data[\""+(3)+"\"]", "0"); + var imgdata4 = ctx.getImageData(10, 60, 1, 1); + _assertSame(imgdata4.data[0], 0, "imgdata4.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata4.data[1], 0, "imgdata4.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata4.data[2], 0, "imgdata4.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata4.data[3], 0, "imgdata4.data[\""+(3)+"\"]", "0"); -var imgdata5 = ctx.getImageData(100, 10, 1, 1); -_assertSame(imgdata5.data[0], 0, "imgdata5.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata5.data[1], 0, "imgdata5.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata5.data[2], 0, "imgdata5.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata5.data[3], 0, "imgdata5.data[\""+(3)+"\"]", "0"); + var imgdata5 = ctx.getImageData(100, 10, 1, 1); + _assertSame(imgdata5.data[0], 0, "imgdata5.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata5.data[1], 0, "imgdata5.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata5.data[2], 0, "imgdata5.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata5.data[3], 0, "imgdata5.data[\""+(3)+"\"]", "0"); -var imgdata6 = ctx.getImageData(0, 10, 1, 1); -_assertSame(imgdata6.data[0], 0, "imgdata6.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata6.data[1], 136, "imgdata6.data[\""+(1)+"\"]", "136"); -_assertSame(imgdata6.data[2], 255, "imgdata6.data[\""+(2)+"\"]", "255"); -_assertSame(imgdata6.data[3], 255, "imgdata6.data[\""+(3)+"\"]", "255"); + var imgdata6 = ctx.getImageData(0, 10, 1, 1); + _assertSame(imgdata6.data[0], 0, "imgdata6.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata6.data[1], 136, "imgdata6.data[\""+(1)+"\"]", "136"); + _assertSame(imgdata6.data[2], 255, "imgdata6.data[\""+(2)+"\"]", "255"); + _assertSame(imgdata6.data[3], 255, "imgdata6.data[\""+(3)+"\"]", "255"); -var imgdata7 = ctx.getImageData(-10, 10, 20, 20); -_assertSame(imgdata7.data[ 0*4+0], 0, "imgdata7.data[ 0*4+0]", "0"); -_assertSame(imgdata7.data[ 0*4+1], 0, "imgdata7.data[ 0*4+1]", "0"); -_assertSame(imgdata7.data[ 0*4+2], 0, "imgdata7.data[ 0*4+2]", "0"); -_assertSame(imgdata7.data[ 0*4+3], 0, "imgdata7.data[ 0*4+3]", "0"); -_assertSame(imgdata7.data[ 9*4+0], 0, "imgdata7.data[ 9*4+0]", "0"); -_assertSame(imgdata7.data[ 9*4+1], 0, "imgdata7.data[ 9*4+1]", "0"); -_assertSame(imgdata7.data[ 9*4+2], 0, "imgdata7.data[ 9*4+2]", "0"); -_assertSame(imgdata7.data[ 9*4+3], 0, "imgdata7.data[ 9*4+3]", "0"); -_assertSame(imgdata7.data[10*4+0], 0, "imgdata7.data[10*4+0]", "0"); -_assertSame(imgdata7.data[10*4+1], 136, "imgdata7.data[10*4+1]", "136"); -_assertSame(imgdata7.data[10*4+2], 255, "imgdata7.data[10*4+2]", "255"); -_assertSame(imgdata7.data[10*4+3], 255, "imgdata7.data[10*4+3]", "255"); -_assertSame(imgdata7.data[19*4+0], 0, "imgdata7.data[19*4+0]", "0"); -_assertSame(imgdata7.data[19*4+1], 136, "imgdata7.data[19*4+1]", "136"); -_assertSame(imgdata7.data[19*4+2], 255, "imgdata7.data[19*4+2]", "255"); -_assertSame(imgdata7.data[19*4+3], 255, "imgdata7.data[19*4+3]", "255"); -_assertSame(imgdata7.data[20*4+0], 0, "imgdata7.data[20*4+0]", "0"); -_assertSame(imgdata7.data[20*4+1], 0, "imgdata7.data[20*4+1]", "0"); -_assertSame(imgdata7.data[20*4+2], 0, "imgdata7.data[20*4+2]", "0"); -_assertSame(imgdata7.data[20*4+3], 0, "imgdata7.data[20*4+3]", "0"); -})(canvas, ctx); -t.done(); + var imgdata7 = ctx.getImageData(-10, 10, 20, 20); + _assertSame(imgdata7.data[ 0*4+0], 0, "imgdata7.data[ 0*4+0]", "0"); + _assertSame(imgdata7.data[ 0*4+1], 0, "imgdata7.data[ 0*4+1]", "0"); + _assertSame(imgdata7.data[ 0*4+2], 0, "imgdata7.data[ 0*4+2]", "0"); + _assertSame(imgdata7.data[ 0*4+3], 0, "imgdata7.data[ 0*4+3]", "0"); + _assertSame(imgdata7.data[ 9*4+0], 0, "imgdata7.data[ 9*4+0]", "0"); + _assertSame(imgdata7.data[ 9*4+1], 0, "imgdata7.data[ 9*4+1]", "0"); + _assertSame(imgdata7.data[ 9*4+2], 0, "imgdata7.data[ 9*4+2]", "0"); + _assertSame(imgdata7.data[ 9*4+3], 0, "imgdata7.data[ 9*4+3]", "0"); + _assertSame(imgdata7.data[10*4+0], 0, "imgdata7.data[10*4+0]", "0"); + _assertSame(imgdata7.data[10*4+1], 136, "imgdata7.data[10*4+1]", "136"); + _assertSame(imgdata7.data[10*4+2], 255, "imgdata7.data[10*4+2]", "255"); + _assertSame(imgdata7.data[10*4+3], 255, "imgdata7.data[10*4+3]", "255"); + _assertSame(imgdata7.data[19*4+0], 0, "imgdata7.data[19*4+0]", "0"); + _assertSame(imgdata7.data[19*4+1], 136, "imgdata7.data[19*4+1]", "136"); + _assertSame(imgdata7.data[19*4+2], 255, "imgdata7.data[19*4+2]", "255"); + _assertSame(imgdata7.data[19*4+3], 255, "imgdata7.data[19*4+3]", "255"); + _assertSame(imgdata7.data[20*4+0], 0, "imgdata7.data[20*4+0]", "0"); + _assertSame(imgdata7.data[20*4+1], 0, "imgdata7.data[20*4+1]", "0"); + _assertSame(imgdata7.data[20*4+2], 0, "imgdata7.data[20*4+2]", "0"); + _assertSame(imgdata7.data[20*4+3], 0, "imgdata7.data[20*4+3]", "0"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.outside.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.outside.worker.js index eb7f355d683..35fa83d6687 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.outside.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.outside.worker.js @@ -13,70 +13,69 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#08f'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#08f'; + ctx.fillRect(0, 0, 100, 50); -var imgdata1 = ctx.getImageData(-10, 5, 1, 1); -_assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata1.data[1], 0, "imgdata1.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata1.data[2], 0, "imgdata1.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata1.data[3], 0, "imgdata1.data[\""+(3)+"\"]", "0"); + var imgdata1 = ctx.getImageData(-10, 5, 1, 1); + _assertSame(imgdata1.data[0], 0, "imgdata1.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata1.data[1], 0, "imgdata1.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata1.data[2], 0, "imgdata1.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata1.data[3], 0, "imgdata1.data[\""+(3)+"\"]", "0"); -var imgdata2 = ctx.getImageData(10, -5, 1, 1); -_assertSame(imgdata2.data[0], 0, "imgdata2.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata2.data[1], 0, "imgdata2.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata2.data[2], 0, "imgdata2.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata2.data[3], 0, "imgdata2.data[\""+(3)+"\"]", "0"); + var imgdata2 = ctx.getImageData(10, -5, 1, 1); + _assertSame(imgdata2.data[0], 0, "imgdata2.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata2.data[1], 0, "imgdata2.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata2.data[2], 0, "imgdata2.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata2.data[3], 0, "imgdata2.data[\""+(3)+"\"]", "0"); -var imgdata3 = ctx.getImageData(200, 5, 1, 1); -_assertSame(imgdata3.data[0], 0, "imgdata3.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata3.data[1], 0, "imgdata3.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata3.data[2], 0, "imgdata3.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata3.data[3], 0, "imgdata3.data[\""+(3)+"\"]", "0"); + var imgdata3 = ctx.getImageData(200, 5, 1, 1); + _assertSame(imgdata3.data[0], 0, "imgdata3.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata3.data[1], 0, "imgdata3.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata3.data[2], 0, "imgdata3.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata3.data[3], 0, "imgdata3.data[\""+(3)+"\"]", "0"); -var imgdata4 = ctx.getImageData(10, 60, 1, 1); -_assertSame(imgdata4.data[0], 0, "imgdata4.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata4.data[1], 0, "imgdata4.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata4.data[2], 0, "imgdata4.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata4.data[3], 0, "imgdata4.data[\""+(3)+"\"]", "0"); + var imgdata4 = ctx.getImageData(10, 60, 1, 1); + _assertSame(imgdata4.data[0], 0, "imgdata4.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata4.data[1], 0, "imgdata4.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata4.data[2], 0, "imgdata4.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata4.data[3], 0, "imgdata4.data[\""+(3)+"\"]", "0"); -var imgdata5 = ctx.getImageData(100, 10, 1, 1); -_assertSame(imgdata5.data[0], 0, "imgdata5.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata5.data[1], 0, "imgdata5.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata5.data[2], 0, "imgdata5.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata5.data[3], 0, "imgdata5.data[\""+(3)+"\"]", "0"); + var imgdata5 = ctx.getImageData(100, 10, 1, 1); + _assertSame(imgdata5.data[0], 0, "imgdata5.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata5.data[1], 0, "imgdata5.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata5.data[2], 0, "imgdata5.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata5.data[3], 0, "imgdata5.data[\""+(3)+"\"]", "0"); -var imgdata6 = ctx.getImageData(0, 10, 1, 1); -_assertSame(imgdata6.data[0], 0, "imgdata6.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata6.data[1], 136, "imgdata6.data[\""+(1)+"\"]", "136"); -_assertSame(imgdata6.data[2], 255, "imgdata6.data[\""+(2)+"\"]", "255"); -_assertSame(imgdata6.data[3], 255, "imgdata6.data[\""+(3)+"\"]", "255"); - -var imgdata7 = ctx.getImageData(-10, 10, 20, 20); -_assertSame(imgdata7.data[ 0*4+0], 0, "imgdata7.data[ 0*4+0]", "0"); -_assertSame(imgdata7.data[ 0*4+1], 0, "imgdata7.data[ 0*4+1]", "0"); -_assertSame(imgdata7.data[ 0*4+2], 0, "imgdata7.data[ 0*4+2]", "0"); -_assertSame(imgdata7.data[ 0*4+3], 0, "imgdata7.data[ 0*4+3]", "0"); -_assertSame(imgdata7.data[ 9*4+0], 0, "imgdata7.data[ 9*4+0]", "0"); -_assertSame(imgdata7.data[ 9*4+1], 0, "imgdata7.data[ 9*4+1]", "0"); -_assertSame(imgdata7.data[ 9*4+2], 0, "imgdata7.data[ 9*4+2]", "0"); -_assertSame(imgdata7.data[ 9*4+3], 0, "imgdata7.data[ 9*4+3]", "0"); -_assertSame(imgdata7.data[10*4+0], 0, "imgdata7.data[10*4+0]", "0"); -_assertSame(imgdata7.data[10*4+1], 136, "imgdata7.data[10*4+1]", "136"); -_assertSame(imgdata7.data[10*4+2], 255, "imgdata7.data[10*4+2]", "255"); -_assertSame(imgdata7.data[10*4+3], 255, "imgdata7.data[10*4+3]", "255"); -_assertSame(imgdata7.data[19*4+0], 0, "imgdata7.data[19*4+0]", "0"); -_assertSame(imgdata7.data[19*4+1], 136, "imgdata7.data[19*4+1]", "136"); -_assertSame(imgdata7.data[19*4+2], 255, "imgdata7.data[19*4+2]", "255"); -_assertSame(imgdata7.data[19*4+3], 255, "imgdata7.data[19*4+3]", "255"); -_assertSame(imgdata7.data[20*4+0], 0, "imgdata7.data[20*4+0]", "0"); -_assertSame(imgdata7.data[20*4+1], 0, "imgdata7.data[20*4+1]", "0"); -_assertSame(imgdata7.data[20*4+2], 0, "imgdata7.data[20*4+2]", "0"); -_assertSame(imgdata7.data[20*4+3], 0, "imgdata7.data[20*4+3]", "0"); -t.done(); + var imgdata6 = ctx.getImageData(0, 10, 1, 1); + _assertSame(imgdata6.data[0], 0, "imgdata6.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata6.data[1], 136, "imgdata6.data[\""+(1)+"\"]", "136"); + _assertSame(imgdata6.data[2], 255, "imgdata6.data[\""+(2)+"\"]", "255"); + _assertSame(imgdata6.data[3], 255, "imgdata6.data[\""+(3)+"\"]", "255"); + var imgdata7 = ctx.getImageData(-10, 10, 20, 20); + _assertSame(imgdata7.data[ 0*4+0], 0, "imgdata7.data[ 0*4+0]", "0"); + _assertSame(imgdata7.data[ 0*4+1], 0, "imgdata7.data[ 0*4+1]", "0"); + _assertSame(imgdata7.data[ 0*4+2], 0, "imgdata7.data[ 0*4+2]", "0"); + _assertSame(imgdata7.data[ 0*4+3], 0, "imgdata7.data[ 0*4+3]", "0"); + _assertSame(imgdata7.data[ 9*4+0], 0, "imgdata7.data[ 9*4+0]", "0"); + _assertSame(imgdata7.data[ 9*4+1], 0, "imgdata7.data[ 9*4+1]", "0"); + _assertSame(imgdata7.data[ 9*4+2], 0, "imgdata7.data[ 9*4+2]", "0"); + _assertSame(imgdata7.data[ 9*4+3], 0, "imgdata7.data[ 9*4+3]", "0"); + _assertSame(imgdata7.data[10*4+0], 0, "imgdata7.data[10*4+0]", "0"); + _assertSame(imgdata7.data[10*4+1], 136, "imgdata7.data[10*4+1]", "136"); + _assertSame(imgdata7.data[10*4+2], 255, "imgdata7.data[10*4+2]", "255"); + _assertSame(imgdata7.data[10*4+3], 255, "imgdata7.data[10*4+3]", "255"); + _assertSame(imgdata7.data[19*4+0], 0, "imgdata7.data[19*4+0]", "0"); + _assertSame(imgdata7.data[19*4+1], 136, "imgdata7.data[19*4+1]", "136"); + _assertSame(imgdata7.data[19*4+2], 255, "imgdata7.data[19*4+2]", "255"); + _assertSame(imgdata7.data[19*4+3], 255, "imgdata7.data[19*4+3]", "255"); + _assertSame(imgdata7.data[20*4+0], 0, "imgdata7.data[20*4+0]", "0"); + _assertSame(imgdata7.data[20*4+1], 0, "imgdata7.data[20*4+1]", "0"); + _assertSame(imgdata7.data[20*4+2], 0, "imgdata7.data[20*4+2]", "0"); + _assertSame(imgdata7.data[20*4+3], 0, "imgdata7.data[20*4+3]", "0"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.size.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.size.html index 8a8a71d9884..6cb848a7187 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.size.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.size.html @@ -15,18 +15,16 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var imgdata1 = ctx.getImageData(0, 0, 10, 10); -var imgdata2 = ctx.getImageData(0, 0, 20, 20); -_assert(imgdata2.width > imgdata1.width, "imgdata2.width > imgdata1.width"); -_assert(imgdata2.height > imgdata1.height, "imgdata2.height > imgdata1.height"); -})(canvas, ctx); -t.done(); + var imgdata1 = ctx.getImageData(0, 0, 10, 10); + var imgdata2 = ctx.getImageData(0, 0, 20, 20); + _assert(imgdata2.width > imgdata1.width, "imgdata2.width > imgdata1.width"); + _assert(imgdata2.height > imgdata1.height, "imgdata2.height > imgdata1.height"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.size.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.size.worker.js index 111f4b58696..e54d75b97a6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.size.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.source.size.worker.js @@ -13,14 +13,13 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var imgdata1 = ctx.getImageData(0, 0, 10, 10); -var imgdata2 = ctx.getImageData(0, 0, 20, 20); -_assert(imgdata2.width > imgdata1.width, "imgdata2.width > imgdata1.width"); -_assert(imgdata2.height > imgdata1.height, "imgdata2.height > imgdata1.height"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var imgdata1 = ctx.getImageData(0, 0, 10, 10); + var imgdata2 = ctx.getImageData(0, 0, 20, 20); + _assert(imgdata2.width > imgdata1.width, "imgdata2.width > imgdata1.width"); + _assert(imgdata2.height > imgdata1.height, "imgdata2.height > imgdata1.height"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.unaffected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.unaffected.html index c096cc5be31..66a0b80fd71 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.unaffected.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.unaffected.html @@ -15,30 +15,28 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 50, 50) -ctx.fillStyle = '#f00'; -ctx.fillRect(50, 0, 50, 50) -ctx.save(); -ctx.translate(50, 0); -ctx.globalAlpha = 0.1; -ctx.globalCompositeOperation = 'destination-atop'; -ctx.shadowColor = '#f00'; -ctx.rect(0, 0, 5, 5); -ctx.clip(); -var imgdata = ctx.getImageData(0, 0, 50, 50); -ctx.restore(); -ctx.putImageData(imgdata, 50, 0); -_assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 50) + ctx.fillStyle = '#f00'; + ctx.fillRect(50, 0, 50, 50) + ctx.save(); + ctx.translate(50, 0); + ctx.globalAlpha = 0.1; + ctx.globalCompositeOperation = 'destination-atop'; + ctx.shadowColor = '#f00'; + ctx.rect(0, 0, 5, 5); + ctx.clip(); + var imgdata = ctx.getImageData(0, 0, 50, 50); + ctx.restore(); + ctx.putImageData(imgdata, 50, 0); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.unaffected.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.unaffected.worker.js index a733c6ffdf7..8bf0dddb063 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.unaffected.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.unaffected.worker.js @@ -13,26 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 50, 50) -ctx.fillStyle = '#f00'; -ctx.fillRect(50, 0, 50, 50) -ctx.save(); -ctx.translate(50, 0); -ctx.globalAlpha = 0.1; -ctx.globalCompositeOperation = 'destination-atop'; -ctx.shadowColor = '#f00'; -ctx.rect(0, 0, 5, 5); -ctx.clip(); -var imgdata = ctx.getImageData(0, 0, 50, 50); -ctx.restore(); -ctx.putImageData(imgdata, 50, 0); -_assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 50) + ctx.fillStyle = '#f00'; + ctx.fillRect(50, 0, 50, 50) + ctx.save(); + ctx.translate(50, 0); + ctx.globalAlpha = 0.1; + ctx.globalCompositeOperation = 'destination-atop'; + ctx.shadowColor = '#f00'; + ctx.rect(0, 0, 5, 5); + ctx.clip(); + var imgdata = ctx.getImageData(0, 0, 50, 50); + ctx.restore(); + ctx.putImageData(imgdata, 50, 0); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.zero.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.zero.html index 9bad2b78439..042a8bc5f54 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.zero.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.zero.html @@ -15,21 +15,19 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, 0); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0, 10); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0, 0); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0.1, 10); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, 0.99); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, -0.1, 10); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, -0.99); }); -})(canvas, ctx); -t.done(); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, 0); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0, 10); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0, 0); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0.1, 10); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, 0.99); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, -0.1, 10); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, -0.99); }); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.zero.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.zero.worker.js index 82f021ca8d4..ed31030d3cc 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.zero.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.get.zero.worker.js @@ -13,17 +13,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, 0); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0, 10); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0, 0); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0.1, 10); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, 0.99); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, -0.1, 10); }); -assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, -0.99); }); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, 0); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0, 10); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0, 0); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 0.1, 10); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, 0.99); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, -0.1, 10); }); + assert_throws_dom("INDEX_SIZE_ERR", function() { ctx.getImageData(1, 1, 10, -0.99); }); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.clamp.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.clamp.html index 1bd6224892c..aa6073eedf5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.clamp.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.clamp.html @@ -15,43 +15,41 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); - -imgdata.data[0] = 100; -imgdata.data[0] = 300; -_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); -imgdata.data[0] = 100; -imgdata.data[0] = -100; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); - -imgdata.data[0] = 100; -imgdata.data[0] = 200+Math.pow(2, 32); -_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); -imgdata.data[0] = 100; -imgdata.data[0] = -200-Math.pow(2, 32); -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); - -imgdata.data[0] = 100; -imgdata.data[0] = Math.pow(10, 39); -_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); -imgdata.data[0] = 100; -imgdata.data[0] = -Math.pow(10, 39); -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); - -imgdata.data[0] = 100; -imgdata.data[0] = -Infinity; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -imgdata.data[0] = 100; -imgdata.data[0] = Infinity; -_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + var imgdata = ctx.getImageData(0, 0, 10, 10); + + imgdata.data[0] = 100; + imgdata.data[0] = 300; + _assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); + imgdata.data[0] = 100; + imgdata.data[0] = -100; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + + imgdata.data[0] = 100; + imgdata.data[0] = 200+Math.pow(2, 32); + _assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); + imgdata.data[0] = 100; + imgdata.data[0] = -200-Math.pow(2, 32); + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + + imgdata.data[0] = 100; + imgdata.data[0] = Math.pow(10, 39); + _assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); + imgdata.data[0] = 100; + imgdata.data[0] = -Math.pow(10, 39); + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + + imgdata.data[0] = 100; + imgdata.data[0] = -Infinity; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + imgdata.data[0] = 100; + imgdata.data[0] = Infinity; + _assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.clamp.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.clamp.worker.js index 0914c8fdc75..260198fe2fe 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.clamp.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.clamp.worker.js @@ -13,39 +13,38 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var imgdata = ctx.getImageData(0, 0, 10, 10); - -imgdata.data[0] = 100; -imgdata.data[0] = 300; -_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); -imgdata.data[0] = 100; -imgdata.data[0] = -100; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); - -imgdata.data[0] = 100; -imgdata.data[0] = 200+Math.pow(2, 32); -_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); -imgdata.data[0] = 100; -imgdata.data[0] = -200-Math.pow(2, 32); -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); - -imgdata.data[0] = 100; -imgdata.data[0] = Math.pow(10, 39); -_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); -imgdata.data[0] = 100; -imgdata.data[0] = -Math.pow(10, 39); -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); - -imgdata.data[0] = 100; -imgdata.data[0] = -Infinity; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -imgdata.data[0] = 100; -imgdata.data[0] = Infinity; -_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + var imgdata = ctx.getImageData(0, 0, 10, 10); + + imgdata.data[0] = 100; + imgdata.data[0] = 300; + _assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); + imgdata.data[0] = 100; + imgdata.data[0] = -100; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + + imgdata.data[0] = 100; + imgdata.data[0] = 200+Math.pow(2, 32); + _assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); + imgdata.data[0] = 100; + imgdata.data[0] = -200-Math.pow(2, 32); + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + + imgdata.data[0] = 100; + imgdata.data[0] = Math.pow(10, 39); + _assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); + imgdata.data[0] = 100; + imgdata.data[0] = -Math.pow(10, 39); + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + + imgdata.data[0] = 100; + imgdata.data[0] = -Infinity; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + imgdata.data[0] = 100; + imgdata.data[0] = Infinity; + _assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.nan.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.nan.html index 9910af8e2af..af692a7f9f3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.nan.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.nan.html @@ -15,21 +15,19 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); -imgdata.data[0] = 100; -imgdata.data[0] = NaN; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -imgdata.data[0] = 100; -imgdata.data[0] = "cheese"; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -})(canvas, ctx); -t.done(); + var imgdata = ctx.getImageData(0, 0, 10, 10); + imgdata.data[0] = 100; + imgdata.data[0] = NaN; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + imgdata.data[0] = 100; + imgdata.data[0] = "cheese"; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.nan.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.nan.worker.js index ef2eb21b371..4ebfedb1e83 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.nan.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.nan.worker.js @@ -13,17 +13,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var imgdata = ctx.getImageData(0, 0, 10, 10); -imgdata.data[0] = 100; -imgdata.data[0] = NaN; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -imgdata.data[0] = 100; -imgdata.data[0] = "cheese"; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var imgdata = ctx.getImageData(0, 0, 10, 10); + imgdata.data[0] = 100; + imgdata.data[0] = NaN; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + imgdata.data[0] = 100; + imgdata.data[0] = "cheese"; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.properties.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.properties.html index 13dd3695328..68a6f638686 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.properties.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.properties.html @@ -15,18 +15,16 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); -_assertSame(typeof(imgdata.width), 'number', "typeof(imgdata.width)", "'number'"); -_assertSame(typeof(imgdata.height), 'number', "typeof(imgdata.height)", "'number'"); -_assertSame(typeof(imgdata.data), 'object', "typeof(imgdata.data)", "'object'"); -})(canvas, ctx); -t.done(); + var imgdata = ctx.getImageData(0, 0, 10, 10); + _assertSame(typeof(imgdata.width), 'number', "typeof(imgdata.width)", "'number'"); + _assertSame(typeof(imgdata.height), 'number', "typeof(imgdata.height)", "'number'"); + _assertSame(typeof(imgdata.data), 'object', "typeof(imgdata.data)", "'object'"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.properties.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.properties.worker.js index 42c89ef1179..e428e0d4fce 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.properties.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.properties.worker.js @@ -13,14 +13,13 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var imgdata = ctx.getImageData(0, 0, 10, 10); -_assertSame(typeof(imgdata.width), 'number', "typeof(imgdata.width)", "'number'"); -_assertSame(typeof(imgdata.height), 'number', "typeof(imgdata.height)", "'number'"); -_assertSame(typeof(imgdata.data), 'object', "typeof(imgdata.data)", "'object'"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var imgdata = ctx.getImageData(0, 0, 10, 10); + _assertSame(typeof(imgdata.width), 'number', "typeof(imgdata.width)", "'number'"); + _assertSame(typeof(imgdata.height), 'number', "typeof(imgdata.height)", "'number'"); + _assertSame(typeof(imgdata.data), 'object', "typeof(imgdata.data)", "'object'"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.readonly.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.readonly.html index a141786fec8..2ab5f47f64e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.readonly.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.readonly.html @@ -15,28 +15,26 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); -var w = imgdata.width; -var h = imgdata.height; -var d = imgdata.data; -imgdata.width = 123; -imgdata.height = 123; -imgdata.data = [100,100,100,100]; -_assertSame(imgdata.width, w, "imgdata.width", "w"); -_assertSame(imgdata.height, h, "imgdata.height", "h"); -_assertSame(imgdata.data, d, "imgdata.data", "d"); -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata.data[1], 0, "imgdata.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata.data[2], 0, "imgdata.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata.data[3], 0, "imgdata.data[\""+(3)+"\"]", "0"); -})(canvas, ctx); -t.done(); + var imgdata = ctx.getImageData(0, 0, 10, 10); + var w = imgdata.width; + var h = imgdata.height; + var d = imgdata.data; + imgdata.width = 123; + imgdata.height = 123; + imgdata.data = [100,100,100,100]; + _assertSame(imgdata.width, w, "imgdata.width", "w"); + _assertSame(imgdata.height, h, "imgdata.height", "h"); + _assertSame(imgdata.data, d, "imgdata.data", "d"); + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata.data[1], 0, "imgdata.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata.data[2], 0, "imgdata.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata.data[3], 0, "imgdata.data[\""+(3)+"\"]", "0"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.readonly.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.readonly.worker.js index 068761e2e64..d02f0f319aa 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.readonly.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.readonly.worker.js @@ -13,24 +13,23 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var imgdata = ctx.getImageData(0, 0, 10, 10); -var w = imgdata.width; -var h = imgdata.height; -var d = imgdata.data; -imgdata.width = 123; -imgdata.height = 123; -imgdata.data = [100,100,100,100]; -_assertSame(imgdata.width, w, "imgdata.width", "w"); -_assertSame(imgdata.height, h, "imgdata.height", "h"); -_assertSame(imgdata.data, d, "imgdata.data", "d"); -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -_assertSame(imgdata.data[1], 0, "imgdata.data[\""+(1)+"\"]", "0"); -_assertSame(imgdata.data[2], 0, "imgdata.data[\""+(2)+"\"]", "0"); -_assertSame(imgdata.data[3], 0, "imgdata.data[\""+(3)+"\"]", "0"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var imgdata = ctx.getImageData(0, 0, 10, 10); + var w = imgdata.width; + var h = imgdata.height; + var d = imgdata.data; + imgdata.width = 123; + imgdata.height = 123; + imgdata.data = [100,100,100,100]; + _assertSame(imgdata.width, w, "imgdata.width", "w"); + _assertSame(imgdata.height, h, "imgdata.height", "h"); + _assertSame(imgdata.data, d, "imgdata.data", "d"); + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + _assertSame(imgdata.data[1], 0, "imgdata.data[\""+(1)+"\"]", "0"); + _assertSame(imgdata.data[2], 0, "imgdata.data[\""+(2)+"\"]", "0"); + _assertSame(imgdata.data[3], 0, "imgdata.data[\""+(3)+"\"]", "0"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.round.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.round.html index 306ccb8df44..fbde0cd940e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.round.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.round.html @@ -15,43 +15,41 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); -imgdata.data[0] = 0.499; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -imgdata.data[0] = 0.5; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -imgdata.data[0] = 0.501; -_assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1"); -imgdata.data[0] = 1.499; -_assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1"); -imgdata.data[0] = 1.5; -_assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); -imgdata.data[0] = 1.501; -_assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); -imgdata.data[0] = 2.5; -_assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); -imgdata.data[0] = 3.5; -_assertSame(imgdata.data[0], 4, "imgdata.data[\""+(0)+"\"]", "4"); -imgdata.data[0] = 252.5; -_assertSame(imgdata.data[0], 252, "imgdata.data[\""+(0)+"\"]", "252"); -imgdata.data[0] = 253.5; -_assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254"); -imgdata.data[0] = 254.5; -_assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254"); -imgdata.data[0] = 256.5; -_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); -imgdata.data[0] = -0.5; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -imgdata.data[0] = -1.5; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -})(canvas, ctx); -t.done(); + var imgdata = ctx.getImageData(0, 0, 10, 10); + imgdata.data[0] = 0.499; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + imgdata.data[0] = 0.5; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + imgdata.data[0] = 0.501; + _assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1"); + imgdata.data[0] = 1.499; + _assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1"); + imgdata.data[0] = 1.5; + _assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); + imgdata.data[0] = 1.501; + _assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); + imgdata.data[0] = 2.5; + _assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); + imgdata.data[0] = 3.5; + _assertSame(imgdata.data[0], 4, "imgdata.data[\""+(0)+"\"]", "4"); + imgdata.data[0] = 252.5; + _assertSame(imgdata.data[0], 252, "imgdata.data[\""+(0)+"\"]", "252"); + imgdata.data[0] = 253.5; + _assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254"); + imgdata.data[0] = 254.5; + _assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254"); + imgdata.data[0] = 256.5; + _assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); + imgdata.data[0] = -0.5; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + imgdata.data[0] = -1.5; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.round.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.round.worker.js index 4a88db9cdd0..8ef3c027932 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.round.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.round.worker.js @@ -13,39 +13,38 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var imgdata = ctx.getImageData(0, 0, 10, 10); -imgdata.data[0] = 0.499; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -imgdata.data[0] = 0.5; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -imgdata.data[0] = 0.501; -_assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1"); -imgdata.data[0] = 1.499; -_assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1"); -imgdata.data[0] = 1.5; -_assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); -imgdata.data[0] = 1.501; -_assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); -imgdata.data[0] = 2.5; -_assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); -imgdata.data[0] = 3.5; -_assertSame(imgdata.data[0], 4, "imgdata.data[\""+(0)+"\"]", "4"); -imgdata.data[0] = 252.5; -_assertSame(imgdata.data[0], 252, "imgdata.data[\""+(0)+"\"]", "252"); -imgdata.data[0] = 253.5; -_assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254"); -imgdata.data[0] = 254.5; -_assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254"); -imgdata.data[0] = 256.5; -_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); -imgdata.data[0] = -0.5; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -imgdata.data[0] = -1.5; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var imgdata = ctx.getImageData(0, 0, 10, 10); + imgdata.data[0] = 0.499; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + imgdata.data[0] = 0.5; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + imgdata.data[0] = 0.501; + _assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1"); + imgdata.data[0] = 1.499; + _assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1"); + imgdata.data[0] = 1.5; + _assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); + imgdata.data[0] = 1.501; + _assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); + imgdata.data[0] = 2.5; + _assertSame(imgdata.data[0], 2, "imgdata.data[\""+(0)+"\"]", "2"); + imgdata.data[0] = 3.5; + _assertSame(imgdata.data[0], 4, "imgdata.data[\""+(0)+"\"]", "4"); + imgdata.data[0] = 252.5; + _assertSame(imgdata.data[0], 252, "imgdata.data[\""+(0)+"\"]", "252"); + imgdata.data[0] = 253.5; + _assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254"); + imgdata.data[0] = 254.5; + _assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254"); + imgdata.data[0] = 256.5; + _assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255"); + imgdata.data[0] = -0.5; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + imgdata.data[0] = -1.5; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.set.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.set.html index a5808b77772..27ed5a35047 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.set.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.set.html @@ -15,19 +15,17 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); -imgdata.data[0] = 100; -_assertSame(imgdata.data[0], 100, "imgdata.data[\""+(0)+"\"]", "100"); -imgdata.data[0] = 200; -_assertSame(imgdata.data[0], 200, "imgdata.data[\""+(0)+"\"]", "200"); -})(canvas, ctx); -t.done(); + var imgdata = ctx.getImageData(0, 0, 10, 10); + imgdata.data[0] = 100; + _assertSame(imgdata.data[0], 100, "imgdata.data[\""+(0)+"\"]", "100"); + imgdata.data[0] = 200; + _assertSame(imgdata.data[0], 200, "imgdata.data[\""+(0)+"\"]", "200"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.set.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.set.worker.js index fcb16ab577f..f9b755f7e26 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.set.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.set.worker.js @@ -13,15 +13,14 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var imgdata = ctx.getImageData(0, 0, 10, 10); -imgdata.data[0] = 100; -_assertSame(imgdata.data[0], 100, "imgdata.data[\""+(0)+"\"]", "100"); -imgdata.data[0] = 200; -_assertSame(imgdata.data[0], 200, "imgdata.data[\""+(0)+"\"]", "200"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var imgdata = ctx.getImageData(0, 0, 10, 10); + imgdata.data[0] = 100; + _assertSame(imgdata.data[0], 100, "imgdata.data[\""+(0)+"\"]", "100"); + imgdata.data[0] = 200; + _assertSame(imgdata.data[0], 200, "imgdata.data[\""+(0)+"\"]", "200"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.string.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.string.html index 5245f3a6757..a437c475a59 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.string.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.string.html @@ -15,24 +15,22 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); -imgdata.data[0] = 100; -imgdata.data[0] = "110"; -_assertSame(imgdata.data[0], 110, "imgdata.data[\""+(0)+"\"]", "110"); -imgdata.data[0] = 100; -imgdata.data[0] = "0x78"; -_assertSame(imgdata.data[0], 120, "imgdata.data[\""+(0)+"\"]", "120"); -imgdata.data[0] = 100; -imgdata.data[0] = " +130e0 "; -_assertSame(imgdata.data[0], 130, "imgdata.data[\""+(0)+"\"]", "130"); -})(canvas, ctx); -t.done(); + var imgdata = ctx.getImageData(0, 0, 10, 10); + imgdata.data[0] = 100; + imgdata.data[0] = "110"; + _assertSame(imgdata.data[0], 110, "imgdata.data[\""+(0)+"\"]", "110"); + imgdata.data[0] = 100; + imgdata.data[0] = "0x78"; + _assertSame(imgdata.data[0], 120, "imgdata.data[\""+(0)+"\"]", "120"); + imgdata.data[0] = 100; + imgdata.data[0] = " +130e0 "; + _assertSame(imgdata.data[0], 130, "imgdata.data[\""+(0)+"\"]", "130"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.string.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.string.worker.js index 6c2dcc8b42f..84cff6a48c1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.string.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.string.worker.js @@ -13,20 +13,19 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var imgdata = ctx.getImageData(0, 0, 10, 10); -imgdata.data[0] = 100; -imgdata.data[0] = "110"; -_assertSame(imgdata.data[0], 110, "imgdata.data[\""+(0)+"\"]", "110"); -imgdata.data[0] = 100; -imgdata.data[0] = "0x78"; -_assertSame(imgdata.data[0], 120, "imgdata.data[\""+(0)+"\"]", "120"); -imgdata.data[0] = 100; -imgdata.data[0] = " +130e0 "; -_assertSame(imgdata.data[0], 130, "imgdata.data[\""+(0)+"\"]", "130"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var imgdata = ctx.getImageData(0, 0, 10, 10); + imgdata.data[0] = 100; + imgdata.data[0] = "110"; + _assertSame(imgdata.data[0], 110, "imgdata.data[\""+(0)+"\"]", "110"); + imgdata.data[0] = 100; + imgdata.data[0] = "0x78"; + _assertSame(imgdata.data[0], 120, "imgdata.data[\""+(0)+"\"]", "120"); + imgdata.data[0] = 100; + imgdata.data[0] = " +130e0 "; + _assertSame(imgdata.data[0], 130, "imgdata.data[\""+(0)+"\"]", "130"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.undefined.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.undefined.html index 3290c579bb3..81462339e9b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.undefined.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.undefined.html @@ -15,18 +15,16 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); -imgdata.data[0] = 100; -imgdata.data[0] = undefined; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -})(canvas, ctx); -t.done(); + var imgdata = ctx.getImageData(0, 0, 10, 10); + imgdata.data[0] = 100; + imgdata.data[0] = undefined; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.undefined.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.undefined.worker.js index f6b62993f6c..825f8c102f4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.undefined.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.object.undefined.worker.js @@ -13,14 +13,13 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var imgdata = ctx.getImageData(0, 0, 10, 10); -imgdata.data[0] = 100; -imgdata.data[0] = undefined; -_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var imgdata = ctx.getImageData(0, 0, 10, 10); + imgdata.data[0] = 100; + imgdata.data[0] = undefined; + _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0"); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.alpha.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.alpha.html index 4e64e4207e2..dcd2d92ab13 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.alpha.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.alpha.html @@ -15,21 +15,19 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = 'rgba(0, 255, 0, 0.25)'; -ctx.fillRect(0, 0, 100, 50) -var imgdata = ctx.getImageData(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.putImageData(imgdata, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,64, 2); -})(canvas, ctx); -t.done(); + ctx.fillStyle = 'rgba(0, 255, 0, 0.25)'; + ctx.fillRect(0, 0, 100, 50) + var imgdata = ctx.getImageData(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.putImageData(imgdata, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,64, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.alpha.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.alpha.worker.js index 3349c692869..25d80471897 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.alpha.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.alpha.worker.js @@ -13,17 +13,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = 'rgba(0, 255, 0, 0.25)'; -ctx.fillRect(0, 0, 100, 50) -var imgdata = ctx.getImageData(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.putImageData(imgdata, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,64, 2); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = 'rgba(0, 255, 0, 0.25)'; + ctx.fillRect(0, 0, 100, 50) + var imgdata = ctx.getImageData(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.putImageData(imgdata, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,64, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.basic.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.basic.html index 76f143ad6ae..257e0330d52 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.basic.html @@ -15,21 +15,19 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -var imgdata = ctx.getImageData(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.putImageData(imgdata, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + var imgdata = ctx.getImageData(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.putImageData(imgdata, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.basic.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.basic.worker.js index 276fea2d126..6a68ffa792e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.basic.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.basic.worker.js @@ -13,17 +13,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -var imgdata = ctx.getImageData(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.putImageData(imgdata, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + var imgdata = ctx.getImageData(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.putImageData(imgdata, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.clip.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.clip.html index fef4c2c1a88..648ded588c2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.clip.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.clip.html @@ -15,25 +15,23 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -var imgdata = ctx.getImageData(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.beginPath(); -ctx.rect(0, 0, 50, 50); -ctx.clip(); -ctx.putImageData(imgdata, 0, 0); -_assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + var imgdata = ctx.getImageData(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.beginPath(); + ctx.rect(0, 0, 50, 50); + ctx.clip(); + ctx.putImageData(imgdata, 0, 0); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.clip.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.clip.worker.js index 9188b3cf88e..b665edbb336 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.clip.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.clip.worker.js @@ -13,21 +13,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -var imgdata = ctx.getImageData(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.beginPath(); -ctx.rect(0, 0, 50, 50); -ctx.clip(); -ctx.putImageData(imgdata, 0, 0); -_assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + var imgdata = ctx.getImageData(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.beginPath(); + ctx.rect(0, 0, 50, 50); + ctx.clip(); + ctx.putImageData(imgdata, 0, 0); + _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.created.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.created.html index d936c02d418..08f35117ddb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.created.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.created.html @@ -15,25 +15,23 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var imgdata = ctx.createImageData(100, 50); -for (var i = 0; i < imgdata.data.length; i += 4) { - imgdata.data[i] = 0; - imgdata.data[i+1] = 255; - imgdata.data[i+2] = 0; - imgdata.data[i+3] = 255; -} -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.putImageData(imgdata, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -})(canvas, ctx); -t.done(); + var imgdata = ctx.createImageData(100, 50); + for (var i = 0; i < imgdata.data.length; i += 4) { + imgdata.data[i] = 0; + imgdata.data[i+1] = 255; + imgdata.data[i+2] = 0; + imgdata.data[i+3] = 255; + } + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.putImageData(imgdata, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.created.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.created.worker.js index fd6b5ec8e09..f249efb4bb5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.created.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.created.worker.js @@ -13,21 +13,20 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var imgdata = ctx.createImageData(100, 50); -for (var i = 0; i < imgdata.data.length; i += 4) { - imgdata.data[i] = 0; - imgdata.data[i+1] = 255; - imgdata.data[i+2] = 0; - imgdata.data[i+3] = 255; -} -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.putImageData(imgdata, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var imgdata = ctx.createImageData(100, 50); + for (var i = 0; i < imgdata.data.length; i += 4) { + imgdata.data[i] = 0; + imgdata.data[i+1] = 255; + imgdata.data[i+2] = 0; + imgdata.data[i+3] = 255; + } + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.putImageData(imgdata, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.cross.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.cross.html index e00f9bd0db5..cddd0451a45 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.cross.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.cross.html @@ -15,23 +15,21 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var offscreenCanvas2 = new OffscreenCanvas(100, 50); -var ctx2 = offscreenCanvas2.getContext('2d'); -ctx2.fillStyle = '#0f0'; -ctx2.fillRect(0, 0, 100, 50) -var imgdata = ctx2.getImageData(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.putImageData(imgdata, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -})(canvas, ctx); -t.done(); + var offscreenCanvas2 = new OffscreenCanvas(100, 50); + var ctx2 = offscreenCanvas2.getContext('2d'); + ctx2.fillStyle = '#0f0'; + ctx2.fillRect(0, 0, 100, 50) + var imgdata = ctx2.getImageData(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.putImageData(imgdata, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.cross.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.cross.worker.js index bdeaa352457..0ec4ed142f7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.cross.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.cross.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var offscreenCanvas2 = new OffscreenCanvas(100, 50); -var ctx2 = offscreenCanvas2.getContext('2d'); -ctx2.fillStyle = '#0f0'; -ctx2.fillRect(0, 0, 100, 50) -var imgdata = ctx2.getImageData(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.putImageData(imgdata, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var offscreenCanvas2 = new OffscreenCanvas(100, 50); + var ctx2 = offscreenCanvas2.getContext('2d'); + ctx2.fillStyle = '#0f0'; + ctx2.fillRect(0, 0, 100, 50) + var imgdata = ctx2.getImageData(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.putImageData(imgdata, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.negative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.negative.html index 7493abc0cbb..cea4d0d4775 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.negative.html @@ -15,32 +15,30 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 20, 20) - -var imgdata = ctx.getImageData(0, 0, 100, 50); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#f00'; -ctx.fillRect(40, 20, 20, 20) -ctx.putImageData(imgdata, 40, 20, 20, 20, -20, -20); - -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); -_assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 20, 20) + + var imgdata = ctx.getImageData(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#f00'; + ctx.fillRect(40, 20, 20, 20) + ctx.putImageData(imgdata, 40, 20, 20, 20, -20, -20); + + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.negative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.negative.worker.js index f228813f321..0a7af640492 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.negative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.negative.worker.js @@ -13,28 +13,27 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 20, 20) - -var imgdata = ctx.getImageData(0, 0, 100, 50); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#f00'; -ctx.fillRect(40, 20, 20, 20) -ctx.putImageData(imgdata, 40, 20, 20, 20, -20, -20); - -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); -_assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 20, 20) + + var imgdata = ctx.getImageData(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#f00'; + ctx.fillRect(40, 20, 20, 20) + ctx.putImageData(imgdata, 40, 20, 20, 20, -20, -20); + + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.outside.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.outside.html index 3aa731d7fb3..7b67ef22533 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.outside.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.outside.html @@ -15,34 +15,32 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) - -var imgdata = ctx.getImageData(0, 0, 100, 50); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) - -ctx.putImageData(imgdata, 100, 20, 20, 20, -20, -20); -ctx.putImageData(imgdata, 200, 200, 0, 0, 100, 50); -ctx.putImageData(imgdata, 40, 20, -30, -20, 30, 20); -ctx.putImageData(imgdata, -30, 20, 0, 0, 30, 20); - -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 98,15, 0,255,0,255, 2); -_assertPixelApprox(canvas, 98,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 98,45, 0,255,0,255, 2); -_assertPixelApprox(canvas, 1,5, 0,255,0,255, 2); -_assertPixelApprox(canvas, 1,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 1,45, 0,255,0,255, 2); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + + var imgdata = ctx.getImageData(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + + ctx.putImageData(imgdata, 100, 20, 20, 20, -20, -20); + ctx.putImageData(imgdata, 200, 200, 0, 0, 100, 50); + ctx.putImageData(imgdata, 40, 20, -30, -20, 30, 20); + ctx.putImageData(imgdata, -30, 20, 0, 0, 30, 20); + + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,15, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,45, 0,255,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.outside.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.outside.worker.js index d1993a44803..87b88a09f4e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.outside.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.outside.worker.js @@ -13,30 +13,29 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) - -var imgdata = ctx.getImageData(0, 0, 100, 50); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) - -ctx.putImageData(imgdata, 100, 20, 20, 20, -20, -20); -ctx.putImageData(imgdata, 200, 200, 0, 0, 100, 50); -ctx.putImageData(imgdata, 40, 20, -30, -20, 30, 20); -ctx.putImageData(imgdata, -30, 20, 0, 0, 30, 20); - -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 98,15, 0,255,0,255, 2); -_assertPixelApprox(canvas, 98,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 98,45, 0,255,0,255, 2); -_assertPixelApprox(canvas, 1,5, 0,255,0,255, 2); -_assertPixelApprox(canvas, 1,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 1,45, 0,255,0,255, 2); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + + var imgdata = ctx.getImageData(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + + ctx.putImageData(imgdata, 100, 20, 20, 20, -20, -20); + ctx.putImageData(imgdata, 200, 200, 0, 0, 100, 50); + ctx.putImageData(imgdata, 40, 20, -30, -20, 30, 20); + ctx.putImageData(imgdata, -30, 20, 0, 0, 30, 20); + + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,15, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 98,45, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,5, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 1,45, 0,255,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect1.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect1.html index 17a14cfe9e1..9f571427a87 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect1.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect1.html @@ -15,32 +15,30 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 20, 20) - -var imgdata = ctx.getImageData(0, 0, 100, 50); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#f00'; -ctx.fillRect(40, 20, 20, 20) -ctx.putImageData(imgdata, 40, 20, 0, 0, 20, 20); - -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); -_assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 20, 20) + + var imgdata = ctx.getImageData(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#f00'; + ctx.fillRect(40, 20, 20, 20) + ctx.putImageData(imgdata, 40, 20, 0, 0, 20, 20); + + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect1.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect1.worker.js index d694e2ef435..6feea9556de 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect1.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect1.worker.js @@ -13,28 +13,27 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 20, 20) - -var imgdata = ctx.getImageData(0, 0, 100, 50); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#f00'; -ctx.fillRect(40, 20, 20, 20) -ctx.putImageData(imgdata, 40, 20, 0, 0, 20, 20); - -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); -_assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 20, 20) + + var imgdata = ctx.getImageData(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#f00'; + ctx.fillRect(40, 20, 20, 20) + ctx.putImageData(imgdata, 40, 20, 0, 0, 20, 20); + + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect2.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect2.html index df1f6fe0392..997c1136a1a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect2.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect2.html @@ -15,32 +15,30 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#0f0'; -ctx.fillRect(60, 30, 20, 20) - -var imgdata = ctx.getImageData(0, 0, 100, 50); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#f00'; -ctx.fillRect(40, 20, 20, 20) -ctx.putImageData(imgdata, -20, -10, 60, 30, 20, 20); - -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); -_assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#0f0'; + ctx.fillRect(60, 30, 20, 20) + + var imgdata = ctx.getImageData(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#f00'; + ctx.fillRect(40, 20, 20, 20) + ctx.putImageData(imgdata, -20, -10, 60, 30, 20, 20); + + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect2.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect2.worker.js index 6652b1a9307..752a3cdf1e1 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect2.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.rect2.worker.js @@ -13,28 +13,27 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#0f0'; -ctx.fillRect(60, 30, 20, 20) - -var imgdata = ctx.getImageData(0, 0, 100, 50); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#f00'; -ctx.fillRect(40, 20, 20, 20) -ctx.putImageData(imgdata, -20, -10, 60, 30, 20, 20); - -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); -_assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); -_assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#0f0'; + ctx.fillRect(60, 30, 20, 20) + + var imgdata = ctx.getImageData(0, 0, 100, 50); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#f00'; + ctx.fillRect(40, 20, 20, 20) + ctx.putImageData(imgdata, -20, -10, 60, 30, 20, 20); + + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 35,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 65,25, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,15, 0,255,0,255, 2); + _assertPixelApprox(canvas, 50,45, 0,255,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.zero.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.zero.html index 2e6462895c4..fb90a017e1c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.zero.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.zero.html @@ -15,21 +15,19 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -var imgdata = ctx.getImageData(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -ctx.putImageData(imgdata, 0, 0, 0, 0, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + var imgdata = ctx.getImageData(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + ctx.putImageData(imgdata, 0, 0, 0, 0, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.zero.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.zero.worker.js index db09379c624..2fa474c07f7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.zero.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.dirty.zero.worker.js @@ -13,17 +13,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -var imgdata = ctx.getImageData(0, 0, 100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -ctx.putImageData(imgdata, 0, 0, 0, 0, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + var imgdata = ctx.getImageData(0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + ctx.putImageData(imgdata, 0, 0, 0, 0, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.modified.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.modified.html index 04f64600cd6..337701aaf5a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.modified.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.modified.html @@ -15,26 +15,24 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#f00'; -ctx.fillRect(45, 20, 10, 10) -var imgdata = ctx.getImageData(45, 20, 10, 10); -for (var i = 0, len = imgdata.width*imgdata.height*4; i < len; i += 4) -{ - imgdata.data[i] = 0; - imgdata.data[i+1] = 255; -} -ctx.putImageData(imgdata, 45, 20); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#f00'; + ctx.fillRect(45, 20, 10, 10) + var imgdata = ctx.getImageData(45, 20, 10, 10); + for (var i = 0, len = imgdata.width*imgdata.height*4; i < len; i += 4) + { + imgdata.data[i] = 0; + imgdata.data[i+1] = 255; + } + ctx.putImageData(imgdata, 45, 20); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.modified.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.modified.worker.js index b238d56cf96..846a9dbc2df 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.modified.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.modified.worker.js @@ -13,22 +13,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -ctx.fillStyle = '#f00'; -ctx.fillRect(45, 20, 10, 10) -var imgdata = ctx.getImageData(45, 20, 10, 10); -for (var i = 0, len = imgdata.width*imgdata.height*4; i < len; i += 4) -{ - imgdata.data[i] = 0; - imgdata.data[i+1] = 255; -} -ctx.putImageData(imgdata, 45, 20); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + ctx.fillStyle = '#f00'; + ctx.fillRect(45, 20, 10, 10) + var imgdata = ctx.getImageData(45, 20, 10, 10); + for (var i = 0, len = imgdata.width*imgdata.height*4; i < len; i += 4) + { + imgdata.data[i] = 0; + imgdata.data[i+1] = 255; + } + ctx.putImageData(imgdata, 45, 20); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.nonfinite.html index c8f322c2f03..eb61d38e9ef 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.nonfinite.html @@ -15,97 +15,95 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var imgdata = ctx.getImageData(0, 0, 10, 10); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, -Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, NaN, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, -Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, NaN, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, -Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, NaN, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, -Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, NaN); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, Infinity); }); -})(canvas, ctx); -t.done(); + var imgdata = ctx.getImageData(0, 0, 10, 10); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, -Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, NaN, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, -Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, NaN, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, -Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, NaN, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, -Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, NaN); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, Infinity); }); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.nonfinite.worker.js index c63d66f0dc7..479ad69467c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.nonfinite.worker.js @@ -13,93 +13,92 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var imgdata = ctx.getImageData(0, 0, 10, 10); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, -Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, NaN, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, -Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, NaN, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, -Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, NaN, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, -Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, NaN); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, 10); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, Infinity); }); -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, Infinity); }); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var imgdata = ctx.getImageData(0, 0, 10, 10); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, -Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, NaN, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, -Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, NaN, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, -Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, NaN, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, -Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, NaN); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, 10); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, Infinity); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, Infinity); }); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.null.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.null.html index 82eb5c28b66..89fe06686d2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.null.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.null.html @@ -15,15 +15,13 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.putImageData(null, 0, 0); }); -})(canvas, ctx); -t.done(); + assert_throws_js(TypeError, function() { ctx.putImageData(null, 0, 0); }); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.null.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.null.worker.js index 0b5b746ba0f..2f021b638e7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.null.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.null.worker.js @@ -13,11 +13,10 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -assert_throws_js(TypeError, function() { ctx.putImageData(null, 0, 0); }); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + assert_throws_js(TypeError, function() { ctx.putImageData(null, 0, 0); }); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.path.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.path.html index 8d63a4287d2..6c323760060 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.path.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.path.html @@ -15,22 +15,20 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.rect(0, 0, 100, 50); -var imgdata = ctx.getImageData(0, 0, 100, 50); -ctx.putImageData(imgdata, 0, 0); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.rect(0, 0, 100, 50); + var imgdata = ctx.getImageData(0, 0, 100, 50); + ctx.putImageData(imgdata, 0, 0); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.path.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.path.worker.js index 81bd03eb4f2..66781a922d9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.path.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.path.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.rect(0, 0, 100, 50); -var imgdata = ctx.getImageData(0, 0, 100, 50); -ctx.putImageData(imgdata, 0, 0); -ctx.fillStyle = '#0f0'; -ctx.fill(); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.rect(0, 0, 100, 50); + var imgdata = ctx.getImageData(0, 0, 100, 50); + ctx.putImageData(imgdata, 0, 0); + ctx.fillStyle = '#0f0'; + ctx.fill(); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unaffected.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unaffected.html index 048818fdba5..3d3e99b1356 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unaffected.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unaffected.html @@ -15,27 +15,25 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -var imgdata = ctx.getImageData(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.globalAlpha = 0.1; -ctx.globalCompositeOperation = 'destination-atop'; -ctx.shadowColor = '#f00'; -ctx.shadowBlur = 1; -ctx.translate(100, 50); -ctx.scale(0.1, 0.1); -ctx.putImageData(imgdata, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -})(canvas, ctx); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + var imgdata = ctx.getImageData(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.globalAlpha = 0.1; + ctx.globalCompositeOperation = 'destination-atop'; + ctx.shadowColor = '#f00'; + ctx.shadowBlur = 1; + ctx.translate(100, 50); + ctx.scale(0.1, 0.1); + ctx.putImageData(imgdata, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unaffected.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unaffected.worker.js index 9b931717f0a..75adb865ef9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unaffected.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unaffected.worker.js @@ -13,23 +13,22 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50) -var imgdata = ctx.getImageData(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50) -ctx.globalAlpha = 0.1; -ctx.globalCompositeOperation = 'destination-atop'; -ctx.shadowColor = '#f00'; -ctx.shadowBlur = 1; -ctx.translate(100, 50); -ctx.scale(0.1, 0.1); -ctx.putImageData(imgdata, 0, 0); -_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50) + var imgdata = ctx.getImageData(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50) + ctx.globalAlpha = 0.1; + ctx.globalCompositeOperation = 'destination-atop'; + ctx.shadowColor = '#f00'; + ctx.shadowBlur = 1; + ctx.translate(100, 50); + ctx.scale(0.1, 0.1); + ctx.putImageData(imgdata, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unchanged.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unchanged.html index cab36f19e1e..d78fa4e0357 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unchanged.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unchanged.html @@ -15,32 +15,30 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -var i = 0; -for (var y = 0; y < 16; ++y) { - for (var x = 0; x < 16; ++x, ++i) { - ctx.fillStyle = 'rgba(' + i + ',' + (Math.floor(i*1.5) % 256) + ',' + (Math.floor(i*23.3) % 256) + ',' + (i/256) + ')'; - ctx.fillRect(x, y, 1, 1); - } -} -var imgdata1 = ctx.getImageData(0.1, 0.2, 15.8, 15.9); -var olddata = []; -for (var i = 0; i < imgdata1.data.length; ++i) - olddata[i] = imgdata1.data[i]; - -ctx.putImageData(imgdata1, 0.1, 0.2); - -var imgdata2 = ctx.getImageData(0.1, 0.2, 15.8, 15.9); -for (var i = 0; i < imgdata2.data.length; ++i) { - _assertSame(olddata[i], imgdata2.data[i], "olddata[\""+(i)+"\"]", "imgdata2.data[\""+(i)+"\"]"); -} -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + var i = 0; + for (var y = 0; y < 16; ++y) { + for (var x = 0; x < 16; ++x, ++i) { + ctx.fillStyle = 'rgba(' + i + ',' + (Math.floor(i*1.5) % 256) + ',' + (Math.floor(i*23.3) % 256) + ',' + (i/256) + ')'; + ctx.fillRect(x, y, 1, 1); + } + } + var imgdata1 = ctx.getImageData(0.1, 0.2, 15.8, 15.9); + var olddata = []; + for (var i = 0; i < imgdata1.data.length; ++i) + olddata[i] = imgdata1.data[i]; + + ctx.putImageData(imgdata1, 0.1, 0.2); + + var imgdata2 = ctx.getImageData(0.1, 0.2, 15.8, 15.9); + for (var i = 0; i < imgdata2.data.length; ++i) { + _assertSame(olddata[i], imgdata2.data[i], "olddata[\""+(i)+"\"]", "imgdata2.data[\""+(i)+"\"]"); + } + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unchanged.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unchanged.worker.js index 07f4362f43c..5e9362fab28 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unchanged.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.unchanged.worker.js @@ -13,28 +13,27 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -var i = 0; -for (var y = 0; y < 16; ++y) { - for (var x = 0; x < 16; ++x, ++i) { - ctx.fillStyle = 'rgba(' + i + ',' + (Math.floor(i*1.5) % 256) + ',' + (Math.floor(i*23.3) % 256) + ',' + (i/256) + ')'; - ctx.fillRect(x, y, 1, 1); - } -} -var imgdata1 = ctx.getImageData(0.1, 0.2, 15.8, 15.9); -var olddata = []; -for (var i = 0; i < imgdata1.data.length; ++i) - olddata[i] = imgdata1.data[i]; + var i = 0; + for (var y = 0; y < 16; ++y) { + for (var x = 0; x < 16; ++x, ++i) { + ctx.fillStyle = 'rgba(' + i + ',' + (Math.floor(i*1.5) % 256) + ',' + (Math.floor(i*23.3) % 256) + ',' + (i/256) + ')'; + ctx.fillRect(x, y, 1, 1); + } + } + var imgdata1 = ctx.getImageData(0.1, 0.2, 15.8, 15.9); + var olddata = []; + for (var i = 0; i < imgdata1.data.length; ++i) + olddata[i] = imgdata1.data[i]; -ctx.putImageData(imgdata1, 0.1, 0.2); - -var imgdata2 = ctx.getImageData(0.1, 0.2, 15.8, 15.9); -for (var i = 0; i < imgdata2.data.length; ++i) { - _assertSame(olddata[i], imgdata2.data[i], "olddata[\""+(i)+"\"]", "imgdata2.data[\""+(i)+"\"]"); -} -t.done(); + ctx.putImageData(imgdata1, 0.1, 0.2); + var imgdata2 = ctx.getImageData(0.1, 0.2, 15.8, 15.9); + for (var i = 0; i < imgdata2.data.length; ++i) { + _assertSame(olddata[i], imgdata2.data[i], "olddata[\""+(i)+"\"]", "imgdata2.data[\""+(i)+"\"]"); + } + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.wrongtype.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.wrongtype.html index d726d5f9684..1488e7b111d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.wrongtype.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.wrongtype.html @@ -15,18 +15,16 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -var imgdata = { width: 1, height: 1, data: [255, 0, 0, 255] }; -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.putImageData("cheese", 0, 0); }); -assert_throws_js(TypeError, function() { ctx.putImageData(42, 0, 0); }); -})(canvas, ctx); -t.done(); + var imgdata = { width: 1, height: 1, data: [255, 0, 0, 255] }; + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.putImageData("cheese", 0, 0); }); + assert_throws_js(TypeError, function() { ctx.putImageData(42, 0, 0); }); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.wrongtype.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.wrongtype.worker.js index 9c58133ac96..bf4d6dfedf9 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.wrongtype.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/pixel-manipulation/2d.imageData.put.wrongtype.worker.js @@ -13,14 +13,13 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -var imgdata = { width: 1, height: 1, data: [255, 0, 0, 255] }; -assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0, 0); }); -assert_throws_js(TypeError, function() { ctx.putImageData("cheese", 0, 0); }); -assert_throws_js(TypeError, function() { ctx.putImageData(42, 0, 0); }); -t.done(); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + var imgdata = { width: 1, height: 1, data: [255, 0, 0, 255] }; + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.putImageData("cheese", 0, 0); }); + assert_throws_js(TypeError, function() { ctx.putImageData(42, 0, 0); }); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.order.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.order.html index 83815f367b7..d438c274338 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.order.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.order.html @@ -15,22 +15,20 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.scale(2, 1); -ctx.rotate(Math.PI / 2); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, -50, 50, 50); -_assertPixel(canvas, 75,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.scale(2, 1); + ctx.rotate(Math.PI / 2); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, -50, 50, 50); + _assertPixel(canvas, 75,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.order.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.order.worker.js index d00fe230efb..219cbe84211 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.order.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.order.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.scale(2, 1); -ctx.rotate(Math.PI / 2); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, -50, 50, 50); -_assertPixel(canvas, 75,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(2, 1); + ctx.rotate(Math.PI / 2); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, -50, 50, 50); + _assertPixel(canvas, 75,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.direction.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.direction.html index c20608f81c8..fb0f2950621 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.direction.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.direction.html @@ -15,21 +15,19 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.rotate(Math.PI / 2); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, -100, 50, 100); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.rotate(Math.PI / 2); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, -100, 50, 100); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.direction.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.direction.worker.js index 8506937583e..b92b7d83689 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.direction.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.direction.worker.js @@ -13,17 +13,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.rotate(Math.PI / 2); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, -100, 50, 100); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.rotate(Math.PI / 2); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, -100, 50, 100); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.nonfinite.html index bbc294a24fe..dbde38370db 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.nonfinite.html @@ -15,26 +15,24 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.translate(100, 10); -ctx.rotate(Infinity); -ctx.rotate(-Infinity); -ctx.rotate(NaN); + ctx.translate(100, 10); + ctx.rotate(Infinity); + ctx.rotate(-Infinity); + ctx.rotate(NaN); -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -10, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -10, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.nonfinite.worker.js index 2c892a561b2..52b6605e45b 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.nonfinite.worker.js @@ -13,22 +13,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.translate(100, 10); -ctx.rotate(Infinity); -ctx.rotate(-Infinity); -ctx.rotate(NaN); + ctx.translate(100, 10); + ctx.rotate(Infinity); + ctx.rotate(-Infinity); + ctx.rotate(NaN); -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -10, 100, 50); - -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -10, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.radians.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.radians.html index 75121e39d7f..28006028ca7 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.radians.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.radians.html @@ -15,21 +15,19 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.rotate(Math.PI); // should fail obviously if this is 3.1 degrees -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -50, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.rotate(Math.PI); // should fail obviously if this is 3.1 degrees + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -50, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.radians.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.radians.worker.js index 8c2fdd8ab08..08516911560 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.radians.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.radians.worker.js @@ -13,17 +13,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.rotate(Math.PI); // should fail obviously if this is 3.1 degrees -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -50, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.rotate(Math.PI); // should fail obviously if this is 3.1 degrees + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -50, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrap.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrap.html index 1f9eb838c81..aea14ceddfb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrap.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrap.html @@ -15,26 +15,24 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.rotate(Math.PI * (1 + 4096)); // == pi (mod 2*pi) -// We need about pi +/- 0.001 in order to get correct-looking results -// 32-bit floats can store pi*4097 with precision 2^-10, so that should -// be safe enough on reasonable implementations -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -50, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 98,2, 0,255,0,255); -_assertPixel(canvas, 98,47, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.rotate(Math.PI * (1 + 4096)); // == pi (mod 2*pi) + // We need about pi +/- 0.001 in order to get correct-looking results + // 32-bit floats can store pi*4097 with precision 2^-10, so that should + // be safe enough on reasonable implementations + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -50, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 98,2, 0,255,0,255); + _assertPixel(canvas, 98,47, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrap.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrap.worker.js index 579a1b6dd68..4d0c2f5b5d4 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrap.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrap.worker.js @@ -13,22 +13,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.rotate(Math.PI * (1 + 4096)); // == pi (mod 2*pi) -// We need about pi +/- 0.001 in order to get correct-looking results -// 32-bit floats can store pi*4097 with precision 2^-10, so that should -// be safe enough on reasonable implementations -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -50, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 98,2, 0,255,0,255); -_assertPixel(canvas, 98,47, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.rotate(Math.PI * (1 + 4096)); // == pi (mod 2*pi) + // We need about pi +/- 0.001 in order to get correct-looking results + // 32-bit floats can store pi*4097 with precision 2^-10, so that should + // be safe enough on reasonable implementations + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -50, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 98,2, 0,255,0,255); + _assertPixel(canvas, 98,47, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrapnegative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrapnegative.html index c06f6453155..7363007a4db 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrapnegative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrapnegative.html @@ -15,23 +15,21 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.rotate(-Math.PI * (1 + 4096)); -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -50, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 98,2, 0,255,0,255); -_assertPixel(canvas, 98,47, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.rotate(-Math.PI * (1 + 4096)); + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -50, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 98,2, 0,255,0,255); + _assertPixel(canvas, 98,47, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrapnegative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrapnegative.worker.js index cce91071210..932ecf65125 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrapnegative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.wrapnegative.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.rotate(-Math.PI * (1 + 4096)); -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -50, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -_assertPixel(canvas, 98,2, 0,255,0,255); -_assertPixel(canvas, 98,47, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.rotate(-Math.PI * (1 + 4096)); + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -50, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + _assertPixel(canvas, 98,2, 0,255,0,255); + _assertPixel(canvas, 98,47, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.zero.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.zero.html index 0101fa27c58..965d0e07682 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.zero.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.zero.html @@ -15,21 +15,19 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.rotate(0); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.rotate(0); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.zero.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.zero.worker.js index 1ad0aa59853..659c9fd7a05 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.zero.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.rotate.zero.worker.js @@ -13,17 +13,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.rotate(0); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.rotate(0); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.basic.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.basic.html index 5c70438ba16..d4063f7129e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.basic.html @@ -15,21 +15,19 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.scale(2, 4); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 50, 12.5); -_assertPixel(canvas, 90,40, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.scale(2, 4); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 12.5); + _assertPixel(canvas, 90,40, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.basic.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.basic.worker.js index 73be61007a5..5e79daf3f42 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.basic.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.basic.worker.js @@ -13,17 +13,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.scale(2, 4); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 50, 12.5); -_assertPixel(canvas, 90,40, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(2, 4); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 12.5); + _assertPixel(canvas, 90,40, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.large.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.large.html index 8974545500a..ae8f954a713 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.large.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.large.html @@ -15,21 +15,19 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.scale(1e5, 1e5); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 1, 1); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.scale(1e5, 1e5); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 1, 1); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.large.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.large.worker.js index 30af9631e6c..6d716277280 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.large.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.large.worker.js @@ -13,17 +13,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.scale(1e5, 1e5); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 1, 1); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(1e5, 1e5); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 1, 1); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.multiple.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.multiple.html index b07acf15ce6..6a899d1dd6a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.multiple.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.multiple.html @@ -15,22 +15,20 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.scale(Math.sqrt(2), Math.sqrt(2)); -ctx.scale(Math.sqrt(2), Math.sqrt(2)); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 50, 25); -_assertPixel(canvas, 90,40, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.scale(Math.sqrt(2), Math.sqrt(2)); + ctx.scale(Math.sqrt(2), Math.sqrt(2)); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 25); + _assertPixel(canvas, 90,40, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.multiple.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.multiple.worker.js index 267a7df9441..921e95aa721 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.multiple.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.multiple.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.scale(Math.sqrt(2), Math.sqrt(2)); -ctx.scale(Math.sqrt(2), Math.sqrt(2)); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 50, 25); -_assertPixel(canvas, 90,40, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.scale(Math.sqrt(2), Math.sqrt(2)); + ctx.scale(Math.sqrt(2), Math.sqrt(2)); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 25); + _assertPixel(canvas, 90,40, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.negative.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.negative.html index b516c1154f4..68c5780332c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.negative.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.negative.html @@ -15,30 +15,28 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.save(); -ctx.scale(-1, 1); -ctx.fillStyle = '#0f0'; -ctx.fillRect(-50, 0, 50, 50); -ctx.restore(); - -ctx.save(); -ctx.scale(1, -1); -ctx.fillStyle = '#0f0'; -ctx.fillRect(50, -50, 50, 50); -ctx.restore(); -_assertPixel(canvas, 25,25, 0,255,0,255); -_assertPixel(canvas, 75,25, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.save(); + ctx.scale(-1, 1); + ctx.fillStyle = '#0f0'; + ctx.fillRect(-50, 0, 50, 50); + ctx.restore(); + + ctx.save(); + ctx.scale(1, -1); + ctx.fillStyle = '#0f0'; + ctx.fillRect(50, -50, 50, 50); + ctx.restore(); + _assertPixel(canvas, 25,25, 0,255,0,255); + _assertPixel(canvas, 75,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.negative.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.negative.worker.js index 0e68f7e8d8c..cb0f01c618f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.negative.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.negative.worker.js @@ -13,26 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.save(); -ctx.scale(-1, 1); -ctx.fillStyle = '#0f0'; -ctx.fillRect(-50, 0, 50, 50); -ctx.restore(); - -ctx.save(); -ctx.scale(1, -1); -ctx.fillStyle = '#0f0'; -ctx.fillRect(50, -50, 50, 50); -ctx.restore(); -_assertPixel(canvas, 25,25, 0,255,0,255); -_assertPixel(canvas, 75,25, 0,255,0,255); -t.done(); + ctx.save(); + ctx.scale(-1, 1); + ctx.fillStyle = '#0f0'; + ctx.fillRect(-50, 0, 50, 50); + ctx.restore(); + ctx.save(); + ctx.scale(1, -1); + ctx.fillStyle = '#0f0'; + ctx.fillRect(50, -50, 50, 50); + ctx.restore(); + _assertPixel(canvas, 25,25, 0,255,0,255); + _assertPixel(canvas, 75,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.nonfinite.html index 3d9c75a0dc0..5fd95629c9f 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.nonfinite.html @@ -15,30 +15,28 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.translate(100, 10); -ctx.scale(Infinity, 0.1); -ctx.scale(-Infinity, 0.1); -ctx.scale(NaN, 0.1); -ctx.scale(0.1, Infinity); -ctx.scale(0.1, -Infinity); -ctx.scale(0.1, NaN); -ctx.scale(Infinity, Infinity); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -10, 100, 50); - -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.translate(100, 10); + ctx.scale(Infinity, 0.1); + ctx.scale(-Infinity, 0.1); + ctx.scale(NaN, 0.1); + ctx.scale(0.1, Infinity); + ctx.scale(0.1, -Infinity); + ctx.scale(0.1, NaN); + ctx.scale(Infinity, Infinity); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -10, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.nonfinite.worker.js index 67c5c104481..35f9c90e71c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.nonfinite.worker.js @@ -13,26 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.translate(100, 10); -ctx.scale(Infinity, 0.1); -ctx.scale(-Infinity, 0.1); -ctx.scale(NaN, 0.1); -ctx.scale(0.1, Infinity); -ctx.scale(0.1, -Infinity); -ctx.scale(0.1, NaN); -ctx.scale(Infinity, Infinity); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -10, 100, 50); - -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.translate(100, 10); + ctx.scale(Infinity, 0.1); + ctx.scale(-Infinity, 0.1); + ctx.scale(NaN, 0.1); + ctx.scale(0.1, Infinity); + ctx.scale(0.1, -Infinity); + ctx.scale(0.1, NaN); + ctx.scale(Infinity, Infinity); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -10, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.zero.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.zero.html index 4b664125c22..b4269bd1405 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.zero.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.zero.html @@ -15,32 +15,30 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.save(); -ctx.translate(50, 0); -ctx.scale(0, 1); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.restore(); - -ctx.save(); -ctx.translate(0, 25); -ctx.scale(1, 0); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.restore(); - -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.save(); + ctx.translate(50, 0); + ctx.scale(0, 1); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.restore(); + + ctx.save(); + ctx.translate(0, 25); + ctx.scale(1, 0); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.restore(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.zero.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.zero.worker.js index dc52323bc23..9e90127cfed 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.zero.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.scale.zero.worker.js @@ -13,28 +13,27 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); - -ctx.save(); -ctx.translate(50, 0); -ctx.scale(0, 1); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.restore(); - -ctx.save(); -ctx.translate(0, 25); -ctx.scale(1, 0); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); -ctx.restore(); - -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + + ctx.save(); + ctx.translate(50, 0); + ctx.scale(0, 1); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.restore(); + + ctx.save(); + ctx.translate(0, 25); + ctx.scale(1, 0); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.restore(); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.multiple.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.multiple.html index e28710858b1..0395c561bf6 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.multiple.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.multiple.html @@ -15,23 +15,21 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.setTransform(1/2,0, 0,1/2, 0,0); -ctx.setTransform(); -ctx.setTransform(2,0, 0,2, 0,0); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 50, 25); -_assertPixel(canvas, 75,35, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.setTransform(1/2,0, 0,1/2, 0,0); + ctx.setTransform(); + ctx.setTransform(2,0, 0,2, 0,0); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 25); + _assertPixel(canvas, 75,35, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.multiple.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.multiple.worker.js index b6b004601fb..e3e6daf8784 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.multiple.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.multiple.worker.js @@ -13,19 +13,18 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.setTransform(1/2,0, 0,1/2, 0,0); -ctx.setTransform(); -ctx.setTransform(2,0, 0,2, 0,0); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 50, 25); -_assertPixel(canvas, 75,35, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.setTransform(1/2,0, 0,1/2, 0,0); + ctx.setTransform(); + ctx.setTransform(2,0, 0,2, 0,0); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 25); + _assertPixel(canvas, 75,35, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.nonfinite.html index 03c1b74579f..474b20a10b0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.nonfinite.html @@ -15,98 +15,96 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.translate(100, 10); -ctx.setTransform(Infinity, 0, 0, 0, 0, 0); -ctx.setTransform(-Infinity, 0, 0, 0, 0, 0); -ctx.setTransform(NaN, 0, 0, 0, 0, 0); -ctx.setTransform(0, Infinity, 0, 0, 0, 0); -ctx.setTransform(0, -Infinity, 0, 0, 0, 0); -ctx.setTransform(0, NaN, 0, 0, 0, 0); -ctx.setTransform(0, 0, Infinity, 0, 0, 0); -ctx.setTransform(0, 0, -Infinity, 0, 0, 0); -ctx.setTransform(0, 0, NaN, 0, 0, 0); -ctx.setTransform(0, 0, 0, Infinity, 0, 0); -ctx.setTransform(0, 0, 0, -Infinity, 0, 0); -ctx.setTransform(0, 0, 0, NaN, 0, 0); -ctx.setTransform(0, 0, 0, 0, Infinity, 0); -ctx.setTransform(0, 0, 0, 0, -Infinity, 0); -ctx.setTransform(0, 0, 0, 0, NaN, 0); -ctx.setTransform(0, 0, 0, 0, 0, Infinity); -ctx.setTransform(0, 0, 0, 0, 0, -Infinity); -ctx.setTransform(0, 0, 0, 0, 0, NaN); -ctx.setTransform(Infinity, Infinity, 0, 0, 0, 0); -ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, 0); -ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, 0); -ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, 0); -ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, Infinity); -ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, 0); -ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, Infinity); -ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, Infinity); -ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, 0); -ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, 0); -ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, Infinity); -ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, 0); -ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, Infinity); -ctx.setTransform(Infinity, Infinity, 0, 0, 0, Infinity); -ctx.setTransform(Infinity, 0, Infinity, 0, 0, 0); -ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, 0); -ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, 0); -ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, Infinity); -ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, Infinity); -ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, 0); -ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, Infinity); -ctx.setTransform(Infinity, 0, Infinity, 0, 0, Infinity); -ctx.setTransform(Infinity, 0, 0, Infinity, 0, 0); -ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, 0); -ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, Infinity); -ctx.setTransform(Infinity, 0, 0, Infinity, 0, Infinity); -ctx.setTransform(Infinity, 0, 0, 0, Infinity, 0); -ctx.setTransform(Infinity, 0, 0, 0, Infinity, Infinity); -ctx.setTransform(Infinity, 0, 0, 0, 0, Infinity); -ctx.setTransform(0, Infinity, Infinity, 0, 0, 0); -ctx.setTransform(0, Infinity, Infinity, Infinity, 0, 0); -ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, 0); -ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.setTransform(0, Infinity, Infinity, Infinity, 0, Infinity); -ctx.setTransform(0, Infinity, Infinity, 0, Infinity, 0); -ctx.setTransform(0, Infinity, Infinity, 0, Infinity, Infinity); -ctx.setTransform(0, Infinity, Infinity, 0, 0, Infinity); -ctx.setTransform(0, Infinity, 0, Infinity, 0, 0); -ctx.setTransform(0, Infinity, 0, Infinity, Infinity, 0); -ctx.setTransform(0, Infinity, 0, Infinity, Infinity, Infinity); -ctx.setTransform(0, Infinity, 0, Infinity, 0, Infinity); -ctx.setTransform(0, Infinity, 0, 0, Infinity, 0); -ctx.setTransform(0, Infinity, 0, 0, Infinity, Infinity); -ctx.setTransform(0, Infinity, 0, 0, 0, Infinity); -ctx.setTransform(0, 0, Infinity, Infinity, 0, 0); -ctx.setTransform(0, 0, Infinity, Infinity, Infinity, 0); -ctx.setTransform(0, 0, Infinity, Infinity, Infinity, Infinity); -ctx.setTransform(0, 0, Infinity, Infinity, 0, Infinity); -ctx.setTransform(0, 0, Infinity, 0, Infinity, 0); -ctx.setTransform(0, 0, Infinity, 0, Infinity, Infinity); -ctx.setTransform(0, 0, Infinity, 0, 0, Infinity); -ctx.setTransform(0, 0, 0, Infinity, Infinity, 0); -ctx.setTransform(0, 0, 0, Infinity, Infinity, Infinity); -ctx.setTransform(0, 0, 0, Infinity, 0, Infinity); -ctx.setTransform(0, 0, 0, 0, Infinity, Infinity); + ctx.translate(100, 10); + ctx.setTransform(Infinity, 0, 0, 0, 0, 0); + ctx.setTransform(-Infinity, 0, 0, 0, 0, 0); + ctx.setTransform(NaN, 0, 0, 0, 0, 0); + ctx.setTransform(0, Infinity, 0, 0, 0, 0); + ctx.setTransform(0, -Infinity, 0, 0, 0, 0); + ctx.setTransform(0, NaN, 0, 0, 0, 0); + ctx.setTransform(0, 0, Infinity, 0, 0, 0); + ctx.setTransform(0, 0, -Infinity, 0, 0, 0); + ctx.setTransform(0, 0, NaN, 0, 0, 0); + ctx.setTransform(0, 0, 0, Infinity, 0, 0); + ctx.setTransform(0, 0, 0, -Infinity, 0, 0); + ctx.setTransform(0, 0, 0, NaN, 0, 0); + ctx.setTransform(0, 0, 0, 0, Infinity, 0); + ctx.setTransform(0, 0, 0, 0, -Infinity, 0); + ctx.setTransform(0, 0, 0, 0, NaN, 0); + ctx.setTransform(0, 0, 0, 0, 0, Infinity); + ctx.setTransform(0, 0, 0, 0, 0, -Infinity); + ctx.setTransform(0, 0, 0, 0, 0, NaN); + ctx.setTransform(Infinity, Infinity, 0, 0, 0, 0); + ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, 0); + ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, 0); + ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, 0); + ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, Infinity); + ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, 0); + ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, Infinity); + ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, 0); + ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, 0); + ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, Infinity); + ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, 0); + ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.setTransform(Infinity, Infinity, 0, 0, 0, Infinity); + ctx.setTransform(Infinity, 0, Infinity, 0, 0, 0); + ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, 0); + ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, 0); + ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, Infinity); + ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, Infinity); + ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, 0); + ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, Infinity); + ctx.setTransform(Infinity, 0, Infinity, 0, 0, Infinity); + ctx.setTransform(Infinity, 0, 0, Infinity, 0, 0); + ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, 0); + ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, Infinity); + ctx.setTransform(Infinity, 0, 0, Infinity, 0, Infinity); + ctx.setTransform(Infinity, 0, 0, 0, Infinity, 0); + ctx.setTransform(Infinity, 0, 0, 0, Infinity, Infinity); + ctx.setTransform(Infinity, 0, 0, 0, 0, Infinity); + ctx.setTransform(0, Infinity, Infinity, 0, 0, 0); + ctx.setTransform(0, Infinity, Infinity, Infinity, 0, 0); + ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, 0); + ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.setTransform(0, Infinity, Infinity, Infinity, 0, Infinity); + ctx.setTransform(0, Infinity, Infinity, 0, Infinity, 0); + ctx.setTransform(0, Infinity, Infinity, 0, Infinity, Infinity); + ctx.setTransform(0, Infinity, Infinity, 0, 0, Infinity); + ctx.setTransform(0, Infinity, 0, Infinity, 0, 0); + ctx.setTransform(0, Infinity, 0, Infinity, Infinity, 0); + ctx.setTransform(0, Infinity, 0, Infinity, Infinity, Infinity); + ctx.setTransform(0, Infinity, 0, Infinity, 0, Infinity); + ctx.setTransform(0, Infinity, 0, 0, Infinity, 0); + ctx.setTransform(0, Infinity, 0, 0, Infinity, Infinity); + ctx.setTransform(0, Infinity, 0, 0, 0, Infinity); + ctx.setTransform(0, 0, Infinity, Infinity, 0, 0); + ctx.setTransform(0, 0, Infinity, Infinity, Infinity, 0); + ctx.setTransform(0, 0, Infinity, Infinity, Infinity, Infinity); + ctx.setTransform(0, 0, Infinity, Infinity, 0, Infinity); + ctx.setTransform(0, 0, Infinity, 0, Infinity, 0); + ctx.setTransform(0, 0, Infinity, 0, Infinity, Infinity); + ctx.setTransform(0, 0, Infinity, 0, 0, Infinity); + ctx.setTransform(0, 0, 0, Infinity, Infinity, 0); + ctx.setTransform(0, 0, 0, Infinity, Infinity, Infinity); + ctx.setTransform(0, 0, 0, Infinity, 0, Infinity); + ctx.setTransform(0, 0, 0, 0, Infinity, Infinity); -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -10, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -10, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.nonfinite.worker.js index bd48262ca7d..d99ea52deab 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.nonfinite.worker.js @@ -13,94 +13,93 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.translate(100, 10); -ctx.setTransform(Infinity, 0, 0, 0, 0, 0); -ctx.setTransform(-Infinity, 0, 0, 0, 0, 0); -ctx.setTransform(NaN, 0, 0, 0, 0, 0); -ctx.setTransform(0, Infinity, 0, 0, 0, 0); -ctx.setTransform(0, -Infinity, 0, 0, 0, 0); -ctx.setTransform(0, NaN, 0, 0, 0, 0); -ctx.setTransform(0, 0, Infinity, 0, 0, 0); -ctx.setTransform(0, 0, -Infinity, 0, 0, 0); -ctx.setTransform(0, 0, NaN, 0, 0, 0); -ctx.setTransform(0, 0, 0, Infinity, 0, 0); -ctx.setTransform(0, 0, 0, -Infinity, 0, 0); -ctx.setTransform(0, 0, 0, NaN, 0, 0); -ctx.setTransform(0, 0, 0, 0, Infinity, 0); -ctx.setTransform(0, 0, 0, 0, -Infinity, 0); -ctx.setTransform(0, 0, 0, 0, NaN, 0); -ctx.setTransform(0, 0, 0, 0, 0, Infinity); -ctx.setTransform(0, 0, 0, 0, 0, -Infinity); -ctx.setTransform(0, 0, 0, 0, 0, NaN); -ctx.setTransform(Infinity, Infinity, 0, 0, 0, 0); -ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, 0); -ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, 0); -ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, 0); -ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, Infinity); -ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, 0); -ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, Infinity); -ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, Infinity); -ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, 0); -ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, 0); -ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, Infinity); -ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, 0); -ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, Infinity); -ctx.setTransform(Infinity, Infinity, 0, 0, 0, Infinity); -ctx.setTransform(Infinity, 0, Infinity, 0, 0, 0); -ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, 0); -ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, 0); -ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, Infinity); -ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, Infinity); -ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, 0); -ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, Infinity); -ctx.setTransform(Infinity, 0, Infinity, 0, 0, Infinity); -ctx.setTransform(Infinity, 0, 0, Infinity, 0, 0); -ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, 0); -ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, Infinity); -ctx.setTransform(Infinity, 0, 0, Infinity, 0, Infinity); -ctx.setTransform(Infinity, 0, 0, 0, Infinity, 0); -ctx.setTransform(Infinity, 0, 0, 0, Infinity, Infinity); -ctx.setTransform(Infinity, 0, 0, 0, 0, Infinity); -ctx.setTransform(0, Infinity, Infinity, 0, 0, 0); -ctx.setTransform(0, Infinity, Infinity, Infinity, 0, 0); -ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, 0); -ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.setTransform(0, Infinity, Infinity, Infinity, 0, Infinity); -ctx.setTransform(0, Infinity, Infinity, 0, Infinity, 0); -ctx.setTransform(0, Infinity, Infinity, 0, Infinity, Infinity); -ctx.setTransform(0, Infinity, Infinity, 0, 0, Infinity); -ctx.setTransform(0, Infinity, 0, Infinity, 0, 0); -ctx.setTransform(0, Infinity, 0, Infinity, Infinity, 0); -ctx.setTransform(0, Infinity, 0, Infinity, Infinity, Infinity); -ctx.setTransform(0, Infinity, 0, Infinity, 0, Infinity); -ctx.setTransform(0, Infinity, 0, 0, Infinity, 0); -ctx.setTransform(0, Infinity, 0, 0, Infinity, Infinity); -ctx.setTransform(0, Infinity, 0, 0, 0, Infinity); -ctx.setTransform(0, 0, Infinity, Infinity, 0, 0); -ctx.setTransform(0, 0, Infinity, Infinity, Infinity, 0); -ctx.setTransform(0, 0, Infinity, Infinity, Infinity, Infinity); -ctx.setTransform(0, 0, Infinity, Infinity, 0, Infinity); -ctx.setTransform(0, 0, Infinity, 0, Infinity, 0); -ctx.setTransform(0, 0, Infinity, 0, Infinity, Infinity); -ctx.setTransform(0, 0, Infinity, 0, 0, Infinity); -ctx.setTransform(0, 0, 0, Infinity, Infinity, 0); -ctx.setTransform(0, 0, 0, Infinity, Infinity, Infinity); -ctx.setTransform(0, 0, 0, Infinity, 0, Infinity); -ctx.setTransform(0, 0, 0, 0, Infinity, Infinity); + ctx.translate(100, 10); + ctx.setTransform(Infinity, 0, 0, 0, 0, 0); + ctx.setTransform(-Infinity, 0, 0, 0, 0, 0); + ctx.setTransform(NaN, 0, 0, 0, 0, 0); + ctx.setTransform(0, Infinity, 0, 0, 0, 0); + ctx.setTransform(0, -Infinity, 0, 0, 0, 0); + ctx.setTransform(0, NaN, 0, 0, 0, 0); + ctx.setTransform(0, 0, Infinity, 0, 0, 0); + ctx.setTransform(0, 0, -Infinity, 0, 0, 0); + ctx.setTransform(0, 0, NaN, 0, 0, 0); + ctx.setTransform(0, 0, 0, Infinity, 0, 0); + ctx.setTransform(0, 0, 0, -Infinity, 0, 0); + ctx.setTransform(0, 0, 0, NaN, 0, 0); + ctx.setTransform(0, 0, 0, 0, Infinity, 0); + ctx.setTransform(0, 0, 0, 0, -Infinity, 0); + ctx.setTransform(0, 0, 0, 0, NaN, 0); + ctx.setTransform(0, 0, 0, 0, 0, Infinity); + ctx.setTransform(0, 0, 0, 0, 0, -Infinity); + ctx.setTransform(0, 0, 0, 0, 0, NaN); + ctx.setTransform(Infinity, Infinity, 0, 0, 0, 0); + ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, 0); + ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, 0); + ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, 0); + ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, Infinity); + ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, 0); + ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, Infinity); + ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, 0); + ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, 0); + ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, Infinity); + ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, 0); + ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.setTransform(Infinity, Infinity, 0, 0, 0, Infinity); + ctx.setTransform(Infinity, 0, Infinity, 0, 0, 0); + ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, 0); + ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, 0); + ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, Infinity); + ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, Infinity); + ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, 0); + ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, Infinity); + ctx.setTransform(Infinity, 0, Infinity, 0, 0, Infinity); + ctx.setTransform(Infinity, 0, 0, Infinity, 0, 0); + ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, 0); + ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, Infinity); + ctx.setTransform(Infinity, 0, 0, Infinity, 0, Infinity); + ctx.setTransform(Infinity, 0, 0, 0, Infinity, 0); + ctx.setTransform(Infinity, 0, 0, 0, Infinity, Infinity); + ctx.setTransform(Infinity, 0, 0, 0, 0, Infinity); + ctx.setTransform(0, Infinity, Infinity, 0, 0, 0); + ctx.setTransform(0, Infinity, Infinity, Infinity, 0, 0); + ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, 0); + ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.setTransform(0, Infinity, Infinity, Infinity, 0, Infinity); + ctx.setTransform(0, Infinity, Infinity, 0, Infinity, 0); + ctx.setTransform(0, Infinity, Infinity, 0, Infinity, Infinity); + ctx.setTransform(0, Infinity, Infinity, 0, 0, Infinity); + ctx.setTransform(0, Infinity, 0, Infinity, 0, 0); + ctx.setTransform(0, Infinity, 0, Infinity, Infinity, 0); + ctx.setTransform(0, Infinity, 0, Infinity, Infinity, Infinity); + ctx.setTransform(0, Infinity, 0, Infinity, 0, Infinity); + ctx.setTransform(0, Infinity, 0, 0, Infinity, 0); + ctx.setTransform(0, Infinity, 0, 0, Infinity, Infinity); + ctx.setTransform(0, Infinity, 0, 0, 0, Infinity); + ctx.setTransform(0, 0, Infinity, Infinity, 0, 0); + ctx.setTransform(0, 0, Infinity, Infinity, Infinity, 0); + ctx.setTransform(0, 0, Infinity, Infinity, Infinity, Infinity); + ctx.setTransform(0, 0, Infinity, Infinity, 0, Infinity); + ctx.setTransform(0, 0, Infinity, 0, Infinity, 0); + ctx.setTransform(0, 0, Infinity, 0, Infinity, Infinity); + ctx.setTransform(0, 0, Infinity, 0, 0, Infinity); + ctx.setTransform(0, 0, 0, Infinity, Infinity, 0); + ctx.setTransform(0, 0, 0, Infinity, Infinity, Infinity); + ctx.setTransform(0, 0, 0, Infinity, 0, Infinity); + ctx.setTransform(0, 0, 0, 0, Infinity, Infinity); -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -10, 100, 50); - -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -10, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.skewed.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.skewed.html index c49d9d8a298..2d24d61f4b0 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.skewed.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.skewed.html @@ -15,43 +15,41 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -// Create green with a red square ring inside it -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(20, 10, 60, 30); -ctx.fillStyle = '#0f0'; -ctx.fillRect(40, 20, 20, 10); + // Create green with a red square ring inside it + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(20, 10, 60, 30); + ctx.fillStyle = '#0f0'; + ctx.fillRect(40, 20, 20, 10); -// Draw a skewed shape to fill that gap, to make sure it is aligned correctly -ctx.setTransform(1,4, 2,3, 5,6); -// Post-transform coordinates: -// [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]]; -// Hence pre-transform coordinates: -var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2], - [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2], - [-7.4,11.2]]; -ctx.beginPath(); -ctx.moveTo(pts[0][0], pts[0][1]); -for (var i = 0; i < pts.length; ++i) - ctx.lineTo(pts[i][0], pts[i][1]); -ctx.fill(); -_assertPixel(canvas, 21,11, 0,255,0,255); -_assertPixel(canvas, 79,11, 0,255,0,255); -_assertPixel(canvas, 21,39, 0,255,0,255); -_assertPixel(canvas, 79,39, 0,255,0,255); -_assertPixel(canvas, 39,19, 0,255,0,255); -_assertPixel(canvas, 61,19, 0,255,0,255); -_assertPixel(canvas, 39,31, 0,255,0,255); -_assertPixel(canvas, 61,31, 0,255,0,255); -})(canvas, ctx); -t.done(); + // Draw a skewed shape to fill that gap, to make sure it is aligned correctly + ctx.setTransform(1,4, 2,3, 5,6); + // Post-transform coordinates: + // [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]]; + // Hence pre-transform coordinates: + var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2], + [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2], + [-7.4,11.2]]; + ctx.beginPath(); + ctx.moveTo(pts[0][0], pts[0][1]); + for (var i = 0; i < pts.length; ++i) + ctx.lineTo(pts[i][0], pts[i][1]); + ctx.fill(); + _assertPixel(canvas, 21,11, 0,255,0,255); + _assertPixel(canvas, 79,11, 0,255,0,255); + _assertPixel(canvas, 21,39, 0,255,0,255); + _assertPixel(canvas, 79,39, 0,255,0,255); + _assertPixel(canvas, 39,19, 0,255,0,255); + _assertPixel(canvas, 61,19, 0,255,0,255); + _assertPixel(canvas, 39,31, 0,255,0,255); + _assertPixel(canvas, 61,31, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.skewed.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.skewed.worker.js index 6f4b4769b61..161f4087e53 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.skewed.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.setTransform.skewed.worker.js @@ -13,39 +13,38 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -// Create green with a red square ring inside it -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(20, 10, 60, 30); -ctx.fillStyle = '#0f0'; -ctx.fillRect(40, 20, 20, 10); - -// Draw a skewed shape to fill that gap, to make sure it is aligned correctly -ctx.setTransform(1,4, 2,3, 5,6); -// Post-transform coordinates: -// [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]]; -// Hence pre-transform coordinates: -var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2], - [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2], - [-7.4,11.2]]; -ctx.beginPath(); -ctx.moveTo(pts[0][0], pts[0][1]); -for (var i = 0; i < pts.length; ++i) - ctx.lineTo(pts[i][0], pts[i][1]); -ctx.fill(); -_assertPixel(canvas, 21,11, 0,255,0,255); -_assertPixel(canvas, 79,11, 0,255,0,255); -_assertPixel(canvas, 21,39, 0,255,0,255); -_assertPixel(canvas, 79,39, 0,255,0,255); -_assertPixel(canvas, 39,19, 0,255,0,255); -_assertPixel(canvas, 61,19, 0,255,0,255); -_assertPixel(canvas, 39,31, 0,255,0,255); -_assertPixel(canvas, 61,31, 0,255,0,255); -t.done(); + // Create green with a red square ring inside it + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(20, 10, 60, 30); + ctx.fillStyle = '#0f0'; + ctx.fillRect(40, 20, 20, 10); + // Draw a skewed shape to fill that gap, to make sure it is aligned correctly + ctx.setTransform(1,4, 2,3, 5,6); + // Post-transform coordinates: + // [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]]; + // Hence pre-transform coordinates: + var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2], + [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2], + [-7.4,11.2]]; + ctx.beginPath(); + ctx.moveTo(pts[0][0], pts[0][1]); + for (var i = 0; i < pts.length; ++i) + ctx.lineTo(pts[i][0], pts[i][1]); + ctx.fill(); + _assertPixel(canvas, 21,11, 0,255,0,255); + _assertPixel(canvas, 79,11, 0,255,0,255); + _assertPixel(canvas, 21,39, 0,255,0,255); + _assertPixel(canvas, 79,39, 0,255,0,255); + _assertPixel(canvas, 39,19, 0,255,0,255); + _assertPixel(canvas, 61,19, 0,255,0,255); + _assertPixel(canvas, 39,31, 0,255,0,255); + _assertPixel(canvas, 61,31, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.identity.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.identity.html index 1efa306707c..d88b3bc03c5 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.identity.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.identity.html @@ -15,21 +15,19 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.transform(1,0, 0,1, 0,0); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.transform(1,0, 0,1, 0,0); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.identity.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.identity.worker.js index 51a11ee03de..67202628c67 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.identity.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.identity.worker.js @@ -13,17 +13,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.transform(1,0, 0,1, 0,0); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.transform(1,0, 0,1, 0,0); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.multiply.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.multiply.html index 05a1e7e5ead..a7dfbe5f344 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.multiply.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.multiply.html @@ -15,22 +15,20 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.transform(1,2, 3,4, 5,6); -ctx.transform(-2,1, 3/2,-1/2, 1,-2); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.transform(1,2, 3,4, 5,6); + ctx.transform(-2,1, 3/2,-1/2, 1,-2); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.multiply.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.multiply.worker.js index 61a5f052dc7..aa89a7d8caa 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.multiply.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.multiply.worker.js @@ -13,18 +13,17 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.transform(1,2, 3,4, 5,6); -ctx.transform(-2,1, 3/2,-1/2, 1,-2); -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.transform(1,2, 3,4, 5,6); + ctx.transform(-2,1, 3/2,-1/2, 1,-2); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.nonfinite.html index b81bda463bd..c4cd459c8bb 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.nonfinite.html @@ -15,98 +15,96 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.translate(100, 10); -ctx.transform(Infinity, 0, 0, 0, 0, 0); -ctx.transform(-Infinity, 0, 0, 0, 0, 0); -ctx.transform(NaN, 0, 0, 0, 0, 0); -ctx.transform(0, Infinity, 0, 0, 0, 0); -ctx.transform(0, -Infinity, 0, 0, 0, 0); -ctx.transform(0, NaN, 0, 0, 0, 0); -ctx.transform(0, 0, Infinity, 0, 0, 0); -ctx.transform(0, 0, -Infinity, 0, 0, 0); -ctx.transform(0, 0, NaN, 0, 0, 0); -ctx.transform(0, 0, 0, Infinity, 0, 0); -ctx.transform(0, 0, 0, -Infinity, 0, 0); -ctx.transform(0, 0, 0, NaN, 0, 0); -ctx.transform(0, 0, 0, 0, Infinity, 0); -ctx.transform(0, 0, 0, 0, -Infinity, 0); -ctx.transform(0, 0, 0, 0, NaN, 0); -ctx.transform(0, 0, 0, 0, 0, Infinity); -ctx.transform(0, 0, 0, 0, 0, -Infinity); -ctx.transform(0, 0, 0, 0, 0, NaN); -ctx.transform(Infinity, Infinity, 0, 0, 0, 0); -ctx.transform(Infinity, Infinity, Infinity, 0, 0, 0); -ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, 0); -ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, 0); -ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, Infinity); -ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, 0); -ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, Infinity); -ctx.transform(Infinity, Infinity, Infinity, 0, 0, Infinity); -ctx.transform(Infinity, Infinity, 0, Infinity, 0, 0); -ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, 0); -ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.transform(Infinity, Infinity, 0, Infinity, 0, Infinity); -ctx.transform(Infinity, Infinity, 0, 0, Infinity, 0); -ctx.transform(Infinity, Infinity, 0, 0, Infinity, Infinity); -ctx.transform(Infinity, Infinity, 0, 0, 0, Infinity); -ctx.transform(Infinity, 0, Infinity, 0, 0, 0); -ctx.transform(Infinity, 0, Infinity, Infinity, 0, 0); -ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, 0); -ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, Infinity); -ctx.transform(Infinity, 0, Infinity, Infinity, 0, Infinity); -ctx.transform(Infinity, 0, Infinity, 0, Infinity, 0); -ctx.transform(Infinity, 0, Infinity, 0, Infinity, Infinity); -ctx.transform(Infinity, 0, Infinity, 0, 0, Infinity); -ctx.transform(Infinity, 0, 0, Infinity, 0, 0); -ctx.transform(Infinity, 0, 0, Infinity, Infinity, 0); -ctx.transform(Infinity, 0, 0, Infinity, Infinity, Infinity); -ctx.transform(Infinity, 0, 0, Infinity, 0, Infinity); -ctx.transform(Infinity, 0, 0, 0, Infinity, 0); -ctx.transform(Infinity, 0, 0, 0, Infinity, Infinity); -ctx.transform(Infinity, 0, 0, 0, 0, Infinity); -ctx.transform(0, Infinity, Infinity, 0, 0, 0); -ctx.transform(0, Infinity, Infinity, Infinity, 0, 0); -ctx.transform(0, Infinity, Infinity, Infinity, Infinity, 0); -ctx.transform(0, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.transform(0, Infinity, Infinity, Infinity, 0, Infinity); -ctx.transform(0, Infinity, Infinity, 0, Infinity, 0); -ctx.transform(0, Infinity, Infinity, 0, Infinity, Infinity); -ctx.transform(0, Infinity, Infinity, 0, 0, Infinity); -ctx.transform(0, Infinity, 0, Infinity, 0, 0); -ctx.transform(0, Infinity, 0, Infinity, Infinity, 0); -ctx.transform(0, Infinity, 0, Infinity, Infinity, Infinity); -ctx.transform(0, Infinity, 0, Infinity, 0, Infinity); -ctx.transform(0, Infinity, 0, 0, Infinity, 0); -ctx.transform(0, Infinity, 0, 0, Infinity, Infinity); -ctx.transform(0, Infinity, 0, 0, 0, Infinity); -ctx.transform(0, 0, Infinity, Infinity, 0, 0); -ctx.transform(0, 0, Infinity, Infinity, Infinity, 0); -ctx.transform(0, 0, Infinity, Infinity, Infinity, Infinity); -ctx.transform(0, 0, Infinity, Infinity, 0, Infinity); -ctx.transform(0, 0, Infinity, 0, Infinity, 0); -ctx.transform(0, 0, Infinity, 0, Infinity, Infinity); -ctx.transform(0, 0, Infinity, 0, 0, Infinity); -ctx.transform(0, 0, 0, Infinity, Infinity, 0); -ctx.transform(0, 0, 0, Infinity, Infinity, Infinity); -ctx.transform(0, 0, 0, Infinity, 0, Infinity); -ctx.transform(0, 0, 0, 0, Infinity, Infinity); + ctx.translate(100, 10); + ctx.transform(Infinity, 0, 0, 0, 0, 0); + ctx.transform(-Infinity, 0, 0, 0, 0, 0); + ctx.transform(NaN, 0, 0, 0, 0, 0); + ctx.transform(0, Infinity, 0, 0, 0, 0); + ctx.transform(0, -Infinity, 0, 0, 0, 0); + ctx.transform(0, NaN, 0, 0, 0, 0); + ctx.transform(0, 0, Infinity, 0, 0, 0); + ctx.transform(0, 0, -Infinity, 0, 0, 0); + ctx.transform(0, 0, NaN, 0, 0, 0); + ctx.transform(0, 0, 0, Infinity, 0, 0); + ctx.transform(0, 0, 0, -Infinity, 0, 0); + ctx.transform(0, 0, 0, NaN, 0, 0); + ctx.transform(0, 0, 0, 0, Infinity, 0); + ctx.transform(0, 0, 0, 0, -Infinity, 0); + ctx.transform(0, 0, 0, 0, NaN, 0); + ctx.transform(0, 0, 0, 0, 0, Infinity); + ctx.transform(0, 0, 0, 0, 0, -Infinity); + ctx.transform(0, 0, 0, 0, 0, NaN); + ctx.transform(Infinity, Infinity, 0, 0, 0, 0); + ctx.transform(Infinity, Infinity, Infinity, 0, 0, 0); + ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, 0); + ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, 0); + ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, Infinity); + ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, 0); + ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.transform(Infinity, Infinity, Infinity, 0, 0, Infinity); + ctx.transform(Infinity, Infinity, 0, Infinity, 0, 0); + ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, 0); + ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.transform(Infinity, Infinity, 0, Infinity, 0, Infinity); + ctx.transform(Infinity, Infinity, 0, 0, Infinity, 0); + ctx.transform(Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.transform(Infinity, Infinity, 0, 0, 0, Infinity); + ctx.transform(Infinity, 0, Infinity, 0, 0, 0); + ctx.transform(Infinity, 0, Infinity, Infinity, 0, 0); + ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, 0); + ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, Infinity); + ctx.transform(Infinity, 0, Infinity, Infinity, 0, Infinity); + ctx.transform(Infinity, 0, Infinity, 0, Infinity, 0); + ctx.transform(Infinity, 0, Infinity, 0, Infinity, Infinity); + ctx.transform(Infinity, 0, Infinity, 0, 0, Infinity); + ctx.transform(Infinity, 0, 0, Infinity, 0, 0); + ctx.transform(Infinity, 0, 0, Infinity, Infinity, 0); + ctx.transform(Infinity, 0, 0, Infinity, Infinity, Infinity); + ctx.transform(Infinity, 0, 0, Infinity, 0, Infinity); + ctx.transform(Infinity, 0, 0, 0, Infinity, 0); + ctx.transform(Infinity, 0, 0, 0, Infinity, Infinity); + ctx.transform(Infinity, 0, 0, 0, 0, Infinity); + ctx.transform(0, Infinity, Infinity, 0, 0, 0); + ctx.transform(0, Infinity, Infinity, Infinity, 0, 0); + ctx.transform(0, Infinity, Infinity, Infinity, Infinity, 0); + ctx.transform(0, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.transform(0, Infinity, Infinity, Infinity, 0, Infinity); + ctx.transform(0, Infinity, Infinity, 0, Infinity, 0); + ctx.transform(0, Infinity, Infinity, 0, Infinity, Infinity); + ctx.transform(0, Infinity, Infinity, 0, 0, Infinity); + ctx.transform(0, Infinity, 0, Infinity, 0, 0); + ctx.transform(0, Infinity, 0, Infinity, Infinity, 0); + ctx.transform(0, Infinity, 0, Infinity, Infinity, Infinity); + ctx.transform(0, Infinity, 0, Infinity, 0, Infinity); + ctx.transform(0, Infinity, 0, 0, Infinity, 0); + ctx.transform(0, Infinity, 0, 0, Infinity, Infinity); + ctx.transform(0, Infinity, 0, 0, 0, Infinity); + ctx.transform(0, 0, Infinity, Infinity, 0, 0); + ctx.transform(0, 0, Infinity, Infinity, Infinity, 0); + ctx.transform(0, 0, Infinity, Infinity, Infinity, Infinity); + ctx.transform(0, 0, Infinity, Infinity, 0, Infinity); + ctx.transform(0, 0, Infinity, 0, Infinity, 0); + ctx.transform(0, 0, Infinity, 0, Infinity, Infinity); + ctx.transform(0, 0, Infinity, 0, 0, Infinity); + ctx.transform(0, 0, 0, Infinity, Infinity, 0); + ctx.transform(0, 0, 0, Infinity, Infinity, Infinity); + ctx.transform(0, 0, 0, Infinity, 0, Infinity); + ctx.transform(0, 0, 0, 0, Infinity, Infinity); -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -10, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -10, 100, 50); -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.nonfinite.worker.js index ee675151b3a..c96af44b59d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.nonfinite.worker.js @@ -13,94 +13,93 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.translate(100, 10); -ctx.transform(Infinity, 0, 0, 0, 0, 0); -ctx.transform(-Infinity, 0, 0, 0, 0, 0); -ctx.transform(NaN, 0, 0, 0, 0, 0); -ctx.transform(0, Infinity, 0, 0, 0, 0); -ctx.transform(0, -Infinity, 0, 0, 0, 0); -ctx.transform(0, NaN, 0, 0, 0, 0); -ctx.transform(0, 0, Infinity, 0, 0, 0); -ctx.transform(0, 0, -Infinity, 0, 0, 0); -ctx.transform(0, 0, NaN, 0, 0, 0); -ctx.transform(0, 0, 0, Infinity, 0, 0); -ctx.transform(0, 0, 0, -Infinity, 0, 0); -ctx.transform(0, 0, 0, NaN, 0, 0); -ctx.transform(0, 0, 0, 0, Infinity, 0); -ctx.transform(0, 0, 0, 0, -Infinity, 0); -ctx.transform(0, 0, 0, 0, NaN, 0); -ctx.transform(0, 0, 0, 0, 0, Infinity); -ctx.transform(0, 0, 0, 0, 0, -Infinity); -ctx.transform(0, 0, 0, 0, 0, NaN); -ctx.transform(Infinity, Infinity, 0, 0, 0, 0); -ctx.transform(Infinity, Infinity, Infinity, 0, 0, 0); -ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, 0); -ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, 0); -ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, Infinity); -ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, 0); -ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, Infinity); -ctx.transform(Infinity, Infinity, Infinity, 0, 0, Infinity); -ctx.transform(Infinity, Infinity, 0, Infinity, 0, 0); -ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, 0); -ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, Infinity); -ctx.transform(Infinity, Infinity, 0, Infinity, 0, Infinity); -ctx.transform(Infinity, Infinity, 0, 0, Infinity, 0); -ctx.transform(Infinity, Infinity, 0, 0, Infinity, Infinity); -ctx.transform(Infinity, Infinity, 0, 0, 0, Infinity); -ctx.transform(Infinity, 0, Infinity, 0, 0, 0); -ctx.transform(Infinity, 0, Infinity, Infinity, 0, 0); -ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, 0); -ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, Infinity); -ctx.transform(Infinity, 0, Infinity, Infinity, 0, Infinity); -ctx.transform(Infinity, 0, Infinity, 0, Infinity, 0); -ctx.transform(Infinity, 0, Infinity, 0, Infinity, Infinity); -ctx.transform(Infinity, 0, Infinity, 0, 0, Infinity); -ctx.transform(Infinity, 0, 0, Infinity, 0, 0); -ctx.transform(Infinity, 0, 0, Infinity, Infinity, 0); -ctx.transform(Infinity, 0, 0, Infinity, Infinity, Infinity); -ctx.transform(Infinity, 0, 0, Infinity, 0, Infinity); -ctx.transform(Infinity, 0, 0, 0, Infinity, 0); -ctx.transform(Infinity, 0, 0, 0, Infinity, Infinity); -ctx.transform(Infinity, 0, 0, 0, 0, Infinity); -ctx.transform(0, Infinity, Infinity, 0, 0, 0); -ctx.transform(0, Infinity, Infinity, Infinity, 0, 0); -ctx.transform(0, Infinity, Infinity, Infinity, Infinity, 0); -ctx.transform(0, Infinity, Infinity, Infinity, Infinity, Infinity); -ctx.transform(0, Infinity, Infinity, Infinity, 0, Infinity); -ctx.transform(0, Infinity, Infinity, 0, Infinity, 0); -ctx.transform(0, Infinity, Infinity, 0, Infinity, Infinity); -ctx.transform(0, Infinity, Infinity, 0, 0, Infinity); -ctx.transform(0, Infinity, 0, Infinity, 0, 0); -ctx.transform(0, Infinity, 0, Infinity, Infinity, 0); -ctx.transform(0, Infinity, 0, Infinity, Infinity, Infinity); -ctx.transform(0, Infinity, 0, Infinity, 0, Infinity); -ctx.transform(0, Infinity, 0, 0, Infinity, 0); -ctx.transform(0, Infinity, 0, 0, Infinity, Infinity); -ctx.transform(0, Infinity, 0, 0, 0, Infinity); -ctx.transform(0, 0, Infinity, Infinity, 0, 0); -ctx.transform(0, 0, Infinity, Infinity, Infinity, 0); -ctx.transform(0, 0, Infinity, Infinity, Infinity, Infinity); -ctx.transform(0, 0, Infinity, Infinity, 0, Infinity); -ctx.transform(0, 0, Infinity, 0, Infinity, 0); -ctx.transform(0, 0, Infinity, 0, Infinity, Infinity); -ctx.transform(0, 0, Infinity, 0, 0, Infinity); -ctx.transform(0, 0, 0, Infinity, Infinity, 0); -ctx.transform(0, 0, 0, Infinity, Infinity, Infinity); -ctx.transform(0, 0, 0, Infinity, 0, Infinity); -ctx.transform(0, 0, 0, 0, Infinity, Infinity); + ctx.translate(100, 10); + ctx.transform(Infinity, 0, 0, 0, 0, 0); + ctx.transform(-Infinity, 0, 0, 0, 0, 0); + ctx.transform(NaN, 0, 0, 0, 0, 0); + ctx.transform(0, Infinity, 0, 0, 0, 0); + ctx.transform(0, -Infinity, 0, 0, 0, 0); + ctx.transform(0, NaN, 0, 0, 0, 0); + ctx.transform(0, 0, Infinity, 0, 0, 0); + ctx.transform(0, 0, -Infinity, 0, 0, 0); + ctx.transform(0, 0, NaN, 0, 0, 0); + ctx.transform(0, 0, 0, Infinity, 0, 0); + ctx.transform(0, 0, 0, -Infinity, 0, 0); + ctx.transform(0, 0, 0, NaN, 0, 0); + ctx.transform(0, 0, 0, 0, Infinity, 0); + ctx.transform(0, 0, 0, 0, -Infinity, 0); + ctx.transform(0, 0, 0, 0, NaN, 0); + ctx.transform(0, 0, 0, 0, 0, Infinity); + ctx.transform(0, 0, 0, 0, 0, -Infinity); + ctx.transform(0, 0, 0, 0, 0, NaN); + ctx.transform(Infinity, Infinity, 0, 0, 0, 0); + ctx.transform(Infinity, Infinity, Infinity, 0, 0, 0); + ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, 0); + ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, 0); + ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, Infinity); + ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, 0); + ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, Infinity); + ctx.transform(Infinity, Infinity, Infinity, 0, 0, Infinity); + ctx.transform(Infinity, Infinity, 0, Infinity, 0, 0); + ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, 0); + ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, Infinity); + ctx.transform(Infinity, Infinity, 0, Infinity, 0, Infinity); + ctx.transform(Infinity, Infinity, 0, 0, Infinity, 0); + ctx.transform(Infinity, Infinity, 0, 0, Infinity, Infinity); + ctx.transform(Infinity, Infinity, 0, 0, 0, Infinity); + ctx.transform(Infinity, 0, Infinity, 0, 0, 0); + ctx.transform(Infinity, 0, Infinity, Infinity, 0, 0); + ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, 0); + ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, Infinity); + ctx.transform(Infinity, 0, Infinity, Infinity, 0, Infinity); + ctx.transform(Infinity, 0, Infinity, 0, Infinity, 0); + ctx.transform(Infinity, 0, Infinity, 0, Infinity, Infinity); + ctx.transform(Infinity, 0, Infinity, 0, 0, Infinity); + ctx.transform(Infinity, 0, 0, Infinity, 0, 0); + ctx.transform(Infinity, 0, 0, Infinity, Infinity, 0); + ctx.transform(Infinity, 0, 0, Infinity, Infinity, Infinity); + ctx.transform(Infinity, 0, 0, Infinity, 0, Infinity); + ctx.transform(Infinity, 0, 0, 0, Infinity, 0); + ctx.transform(Infinity, 0, 0, 0, Infinity, Infinity); + ctx.transform(Infinity, 0, 0, 0, 0, Infinity); + ctx.transform(0, Infinity, Infinity, 0, 0, 0); + ctx.transform(0, Infinity, Infinity, Infinity, 0, 0); + ctx.transform(0, Infinity, Infinity, Infinity, Infinity, 0); + ctx.transform(0, Infinity, Infinity, Infinity, Infinity, Infinity); + ctx.transform(0, Infinity, Infinity, Infinity, 0, Infinity); + ctx.transform(0, Infinity, Infinity, 0, Infinity, 0); + ctx.transform(0, Infinity, Infinity, 0, Infinity, Infinity); + ctx.transform(0, Infinity, Infinity, 0, 0, Infinity); + ctx.transform(0, Infinity, 0, Infinity, 0, 0); + ctx.transform(0, Infinity, 0, Infinity, Infinity, 0); + ctx.transform(0, Infinity, 0, Infinity, Infinity, Infinity); + ctx.transform(0, Infinity, 0, Infinity, 0, Infinity); + ctx.transform(0, Infinity, 0, 0, Infinity, 0); + ctx.transform(0, Infinity, 0, 0, Infinity, Infinity); + ctx.transform(0, Infinity, 0, 0, 0, Infinity); + ctx.transform(0, 0, Infinity, Infinity, 0, 0); + ctx.transform(0, 0, Infinity, Infinity, Infinity, 0); + ctx.transform(0, 0, Infinity, Infinity, Infinity, Infinity); + ctx.transform(0, 0, Infinity, Infinity, 0, Infinity); + ctx.transform(0, 0, Infinity, 0, Infinity, 0); + ctx.transform(0, 0, Infinity, 0, Infinity, Infinity); + ctx.transform(0, 0, Infinity, 0, 0, Infinity); + ctx.transform(0, 0, 0, Infinity, Infinity, 0); + ctx.transform(0, 0, 0, Infinity, Infinity, Infinity); + ctx.transform(0, 0, 0, Infinity, 0, Infinity); + ctx.transform(0, 0, 0, 0, Infinity, Infinity); -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -10, 100, 50); - -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -10, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.skewed.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.skewed.html index 9cb6dfcc52e..2f3c0453e33 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.skewed.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.skewed.html @@ -15,43 +15,41 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -// Create green with a red square ring inside it -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(20, 10, 60, 30); -ctx.fillStyle = '#0f0'; -ctx.fillRect(40, 20, 20, 10); + // Create green with a red square ring inside it + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(20, 10, 60, 30); + ctx.fillStyle = '#0f0'; + ctx.fillRect(40, 20, 20, 10); -// Draw a skewed shape to fill that gap, to make sure it is aligned correctly -ctx.transform(1,4, 2,3, 5,6); -// Post-transform coordinates: -// [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]]; -// Hence pre-transform coordinates: -var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2], - [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2], - [-7.4,11.2]]; -ctx.beginPath(); -ctx.moveTo(pts[0][0], pts[0][1]); -for (var i = 0; i < pts.length; ++i) - ctx.lineTo(pts[i][0], pts[i][1]); -ctx.fill(); -_assertPixel(canvas, 21,11, 0,255,0,255); -_assertPixel(canvas, 79,11, 0,255,0,255); -_assertPixel(canvas, 21,39, 0,255,0,255); -_assertPixel(canvas, 79,39, 0,255,0,255); -_assertPixel(canvas, 39,19, 0,255,0,255); -_assertPixel(canvas, 61,19, 0,255,0,255); -_assertPixel(canvas, 39,31, 0,255,0,255); -_assertPixel(canvas, 61,31, 0,255,0,255); -})(canvas, ctx); -t.done(); + // Draw a skewed shape to fill that gap, to make sure it is aligned correctly + ctx.transform(1,4, 2,3, 5,6); + // Post-transform coordinates: + // [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]]; + // Hence pre-transform coordinates: + var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2], + [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2], + [-7.4,11.2]]; + ctx.beginPath(); + ctx.moveTo(pts[0][0], pts[0][1]); + for (var i = 0; i < pts.length; ++i) + ctx.lineTo(pts[i][0], pts[i][1]); + ctx.fill(); + _assertPixel(canvas, 21,11, 0,255,0,255); + _assertPixel(canvas, 79,11, 0,255,0,255); + _assertPixel(canvas, 21,39, 0,255,0,255); + _assertPixel(canvas, 79,39, 0,255,0,255); + _assertPixel(canvas, 39,19, 0,255,0,255); + _assertPixel(canvas, 61,19, 0,255,0,255); + _assertPixel(canvas, 39,31, 0,255,0,255); + _assertPixel(canvas, 61,31, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.skewed.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.skewed.worker.js index 638adc14c44..c7ebaf9a832 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.skewed.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.transform.skewed.worker.js @@ -13,39 +13,38 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -// Create green with a red square ring inside it -ctx.fillStyle = '#0f0'; -ctx.fillRect(0, 0, 100, 50); -ctx.fillStyle = '#f00'; -ctx.fillRect(20, 10, 60, 30); -ctx.fillStyle = '#0f0'; -ctx.fillRect(40, 20, 20, 10); - -// Draw a skewed shape to fill that gap, to make sure it is aligned correctly -ctx.transform(1,4, 2,3, 5,6); -// Post-transform coordinates: -// [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]]; -// Hence pre-transform coordinates: -var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2], - [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2], - [-7.4,11.2]]; -ctx.beginPath(); -ctx.moveTo(pts[0][0], pts[0][1]); -for (var i = 0; i < pts.length; ++i) - ctx.lineTo(pts[i][0], pts[i][1]); -ctx.fill(); -_assertPixel(canvas, 21,11, 0,255,0,255); -_assertPixel(canvas, 79,11, 0,255,0,255); -_assertPixel(canvas, 21,39, 0,255,0,255); -_assertPixel(canvas, 79,39, 0,255,0,255); -_assertPixel(canvas, 39,19, 0,255,0,255); -_assertPixel(canvas, 61,19, 0,255,0,255); -_assertPixel(canvas, 39,31, 0,255,0,255); -_assertPixel(canvas, 61,31, 0,255,0,255); -t.done(); + // Create green with a red square ring inside it + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(20, 10, 60, 30); + ctx.fillStyle = '#0f0'; + ctx.fillRect(40, 20, 20, 10); + // Draw a skewed shape to fill that gap, to make sure it is aligned correctly + ctx.transform(1,4, 2,3, 5,6); + // Post-transform coordinates: + // [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]]; + // Hence pre-transform coordinates: + var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2], + [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2], + [-7.4,11.2]]; + ctx.beginPath(); + ctx.moveTo(pts[0][0], pts[0][1]); + for (var i = 0; i < pts.length; ++i) + ctx.lineTo(pts[i][0], pts[i][1]); + ctx.fill(); + _assertPixel(canvas, 21,11, 0,255,0,255); + _assertPixel(canvas, 79,11, 0,255,0,255); + _assertPixel(canvas, 21,39, 0,255,0,255); + _assertPixel(canvas, 79,39, 0,255,0,255); + _assertPixel(canvas, 39,19, 0,255,0,255); + _assertPixel(canvas, 61,19, 0,255,0,255); + _assertPixel(canvas, 39,31, 0,255,0,255); + _assertPixel(canvas, 61,31, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.translate.basic.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.translate.basic.html index 51a7527b5cc..f68225c0776 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.translate.basic.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.translate.basic.html @@ -15,21 +15,19 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); -ctx.translate(100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -50, 100, 50); -_assertPixel(canvas, 90,40, 0,255,0,255); -})(canvas, ctx); -t.done(); + ctx.translate(100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -50, 100, 50); + _assertPixel(canvas, 90,40, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.translate.basic.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.translate.basic.worker.js index 11e8bd897b4..f377ab8a48c 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.translate.basic.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.translate.basic.worker.js @@ -13,17 +13,16 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.translate(100, 50); -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -50, 100, 50); -_assertPixel(canvas, 90,40, 0,255,0,255); -t.done(); + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + ctx.translate(100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -50, 100, 50); + _assertPixel(canvas, 90,40, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.translate.nonfinite.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.translate.nonfinite.html index 010b28f3c6a..ebab949b4cf 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.translate.nonfinite.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.translate.nonfinite.html @@ -15,30 +15,28 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { - -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -await (function(canvas, ctx) { -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.translate(100, 10); -ctx.translate(Infinity, 0.1); -ctx.translate(-Infinity, 0.1); -ctx.translate(NaN, 0.1); -ctx.translate(0.1, Infinity); -ctx.translate(0.1, -Infinity); -ctx.translate(0.1, NaN); -ctx.translate(Infinity, Infinity); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -10, 100, 50); - -_assertPixel(canvas, 50,25, 0,255,0,255); -})(canvas, ctx); -t.done(); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.translate(100, 10); + ctx.translate(Infinity, 0.1); + ctx.translate(-Infinity, 0.1); + ctx.translate(NaN, 0.1); + ctx.translate(0.1, Infinity); + ctx.translate(0.1, -Infinity); + ctx.translate(0.1, NaN); + ctx.translate(Infinity, Infinity); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -10, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.translate.nonfinite.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.translate.nonfinite.worker.js index c3ff3a31a8c..7ad6fce2ba3 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.translate.nonfinite.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/transformations/2d.transformation.translate.nonfinite.worker.js @@ -13,26 +13,25 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d'); - -ctx.fillStyle = '#f00'; -ctx.fillRect(0, 0, 100, 50); - -ctx.translate(100, 10); -ctx.translate(Infinity, 0.1); -ctx.translate(-Infinity, 0.1); -ctx.translate(NaN, 0.1); -ctx.translate(0.1, Infinity); -ctx.translate(0.1, -Infinity); -ctx.translate(0.1, NaN); -ctx.translate(Infinity, Infinity); - -ctx.fillStyle = '#0f0'; -ctx.fillRect(-100, -10, 100, 50); - -_assertPixel(canvas, 50,25, 0,255,0,255); -t.done(); - + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#f00'; + ctx.fillRect(0, 0, 100, 50); + + ctx.translate(100, 10); + ctx.translate(Infinity, 0.1); + ctx.translate(-Infinity, 0.1); + ctx.translate(NaN, 0.1); + ctx.translate(0.1, Infinity); + ctx.translate(0.1, -Infinity); + ctx.translate(0.1, NaN); + ctx.translate(Infinity, Infinity); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(-100, -10, 100, 50); + + _assertPixel(canvas, 50,25, 0,255,0,255); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.p3.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.p3.html index d307dbe96d9..e1391e9010e 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.p3.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.p3.html @@ -15,27 +15,25 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d', {colorSpace: "display-p3"}); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d', {colorSpace: "display-p3"}); -await (function(canvas, ctx) { -var color_style = 'rgb(50, 100, 150)'; -// [0.24304, 0.38818, 0.57227, 1.0] * 255 = [62, 99, 146, 255] -var pixel_expected = [62, 99, 146, 255]; -var epsilon = 2; -ctx.fillStyle = color_style; -ctx.fillRect(0, 0, 10, 10); + var color_style = 'rgb(50, 100, 150)'; + // [0.24304, 0.38818, 0.57227, 1.0] * 255 = [62, 99, 146, 255] + var pixel_expected = [62, 99, 146, 255]; + var epsilon = 2; + ctx.fillStyle = color_style; + ctx.fillRect(0, 0, 10, 10); -var pixel = ctx.getImageData(5, 5, 1, 1, {colorSpace: "display-p3", storageFormat: "uint8"}).data; -_assertSame(pixel.length, pixel_expected.length, "pixel.length", "pixel_expected.length"); -assert_approx_equals(pixel[0], pixel_expected[0], 2); -assert_approx_equals(pixel[1], pixel_expected[1], 2); -assert_approx_equals(pixel[2], pixel_expected[2], 2); -assert_approx_equals(pixel[3], pixel_expected[3], 2); -})(canvas, ctx); -t.done(); + var pixel = ctx.getImageData(5, 5, 1, 1, {colorSpace: "display-p3", storageFormat: "uint8"}).data; + _assertSame(pixel.length, pixel_expected.length, "pixel.length", "pixel_expected.length"); + assert_approx_equals(pixel[0], pixel_expected[0], 2); + assert_approx_equals(pixel[1], pixel_expected[1], 2); + assert_approx_equals(pixel[2], pixel_expected[2], 2); + assert_approx_equals(pixel[3], pixel_expected[3], 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.p3.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.p3.worker.js index c5242daab6b..844cd93f813 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.p3.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.p3.worker.js @@ -13,23 +13,22 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d', {colorSpace: "display-p3"}); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d', {colorSpace: "display-p3"}); -var color_style = 'rgb(50, 100, 150)'; -// [0.24304, 0.38818, 0.57227, 1.0] * 255 = [62, 99, 146, 255] -var pixel_expected = [62, 99, 146, 255]; -var epsilon = 2; -ctx.fillStyle = color_style; -ctx.fillRect(0, 0, 10, 10); - -var pixel = ctx.getImageData(5, 5, 1, 1, {colorSpace: "display-p3", storageFormat: "uint8"}).data; -_assertSame(pixel.length, pixel_expected.length, "pixel.length", "pixel_expected.length"); -assert_approx_equals(pixel[0], pixel_expected[0], 2); -assert_approx_equals(pixel[1], pixel_expected[1], 2); -assert_approx_equals(pixel[2], pixel_expected[2], 2); -assert_approx_equals(pixel[3], pixel_expected[3], 2); -t.done(); + var color_style = 'rgb(50, 100, 150)'; + // [0.24304, 0.38818, 0.57227, 1.0] * 255 = [62, 99, 146, 255] + var pixel_expected = [62, 99, 146, 255]; + var epsilon = 2; + ctx.fillStyle = color_style; + ctx.fillRect(0, 0, 10, 10); + var pixel = ctx.getImageData(5, 5, 1, 1, {colorSpace: "display-p3", storageFormat: "uint8"}).data; + _assertSame(pixel.length, pixel_expected.length, "pixel.length", "pixel_expected.length"); + assert_approx_equals(pixel[0], pixel_expected[0], 2); + assert_approx_equals(pixel[1], pixel_expected[1], 2); + assert_approx_equals(pixel[2], pixel_expected[2], 2); + assert_approx_equals(pixel[3], pixel_expected[3], 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.srgb.html b/tests/wpt/web-platform-tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.srgb.html index 8427a752b09..06287444210 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.srgb.html +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.srgb.html @@ -15,26 +15,24 @@ var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); -t.step(async function() { +t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d', {colorSpace: "display-p3"}); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d', {colorSpace: "display-p3"}); -await (function(canvas, ctx) { -var color_style = 'rgb(50, 100, 150)'; -var pixel_expected = [50, 100, 150, 255]; -var epsilon = 2; -ctx.fillStyle = color_style; -ctx.fillRect(0, 0, 10, 10); + var color_style = 'rgb(50, 100, 150)'; + var pixel_expected = [50, 100, 150, 255]; + var epsilon = 2; + ctx.fillStyle = color_style; + ctx.fillRect(0, 0, 10, 10); -var pixel = ctx.getImageData(5, 5, 1, 1, {colorSpace: "srgb", storageFormat: "uint8"}).data; -_assertSame(pixel.length, pixel_expected.length, "pixel.length", "pixel_expected.length"); -assert_approx_equals(pixel[0], pixel_expected[0], 2); -assert_approx_equals(pixel[1], pixel_expected[1], 2); -assert_approx_equals(pixel[2], pixel_expected[2], 2); -assert_approx_equals(pixel[3], pixel_expected[3], 2); -})(canvas, ctx); -t.done(); + var pixel = ctx.getImageData(5, 5, 1, 1, {colorSpace: "srgb", storageFormat: "uint8"}).data; + _assertSame(pixel.length, pixel_expected.length, "pixel.length", "pixel_expected.length"); + assert_approx_equals(pixel[0], pixel_expected[0], 2); + assert_approx_equals(pixel[1], pixel_expected[1], 2); + assert_approx_equals(pixel[2], pixel_expected[2], 2); + assert_approx_equals(pixel[3], pixel_expected[3], 2); + t.done(); }); </script> diff --git a/tests/wpt/web-platform-tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.srgb.worker.js b/tests/wpt/web-platform-tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.srgb.worker.js index 3f8fb4b289c..619c59076da 100644 --- a/tests/wpt/web-platform-tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.srgb.worker.js +++ b/tests/wpt/web-platform-tests/html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.srgb.worker.js @@ -13,22 +13,21 @@ var t_fail = t.step_func(function(reason) { }); t.step(function() { -var canvas = new OffscreenCanvas(100, 50); -var ctx = canvas.getContext('2d', {colorSpace: "display-p3"}); + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d', {colorSpace: "display-p3"}); -var color_style = 'rgb(50, 100, 150)'; -var pixel_expected = [50, 100, 150, 255]; -var epsilon = 2; -ctx.fillStyle = color_style; -ctx.fillRect(0, 0, 10, 10); - -var pixel = ctx.getImageData(5, 5, 1, 1, {colorSpace: "srgb", storageFormat: "uint8"}).data; -_assertSame(pixel.length, pixel_expected.length, "pixel.length", "pixel_expected.length"); -assert_approx_equals(pixel[0], pixel_expected[0], 2); -assert_approx_equals(pixel[1], pixel_expected[1], 2); -assert_approx_equals(pixel[2], pixel_expected[2], 2); -assert_approx_equals(pixel[3], pixel_expected[3], 2); -t.done(); + var color_style = 'rgb(50, 100, 150)'; + var pixel_expected = [50, 100, 150, 255]; + var epsilon = 2; + ctx.fillStyle = color_style; + ctx.fillRect(0, 0, 10, 10); + var pixel = ctx.getImageData(5, 5, 1, 1, {colorSpace: "srgb", storageFormat: "uint8"}).data; + _assertSame(pixel.length, pixel_expected.length, "pixel.length", "pixel_expected.length"); + assert_approx_equals(pixel[0], pixel_expected[0], 2); + assert_approx_equals(pixel[1], pixel_expected[1], 2); + assert_approx_equals(pixel[2], pixel_expected[2], 2); + assert_approx_equals(pixel[3], pixel_expected[3], 2); + t.done(); }); done(); diff --git a/tests/wpt/web-platform-tests/html/canvas/tools/gentestutilsunion.py b/tests/wpt/web-platform-tests/html/canvas/tools/gentestutilsunion.py index bb734b31c66..e923a0777ba 100644 --- a/tests/wpt/web-platform-tests/html/canvas/tools/gentestutilsunion.py +++ b/tests/wpt/web-platform-tests/html/canvas/tools/gentestutilsunion.py @@ -287,18 +287,30 @@ def _write_reference_test(is_js_ref: bool, templates: Mapping[str, str], def _write_testharness_test(templates: Mapping[str, str], template_params: MutableMapping[str, str], + test_type: str, canvas_path: Optional[str], offscreen_path: Optional[str]): - # Create test cases for canvas and offscreencanvas. + code = template_params['code'] + template_params['code'] = textwrap.indent(code, ' ') if canvas_path: + template_name = 'element' + if test_type: + template_name += '-' + test_type + pathlib.Path(f'{canvas_path}.html').write_text( - templates['element'] % template_params, 'utf-8') + templates[template_name] % template_params, 'utf-8') if offscreen_path: - code = template_params['code'] - offscreen_template = templates['offscreen'] - worker_template = templates['worker'] + offscreen_template_name = 'offscreen' + worker_template_name = 'worker' + if test_type: + offscreen_template_name += '-' + test_type + worker_template_name += '-' + test_type + + offscreen_template = templates[offscreen_template_name] + worker_template = templates[worker_template_name] + if ('then(t_pass, t_fail);' in code): offscreen_template = offscreen_template.replace('t.done();\n', '') worker_template = worker_template.replace('t.done();\n', '') @@ -443,6 +455,19 @@ def _generate_test(test: Mapping[str, Any], templates: Mapping[str, str], f'Test {name} is invalid, "reference" and "html_reference" can\'t ' 'both be specified at the same time.') + test_type = '' + if 'test_type' in test: + test_type = test['test_type'] + if test_type != 'promise': + raise InvalidTestDefinitionError( + f'Test {name}\' test_type is invalid, it only accepts ' + '"promise" now for creating promise test type in the template ' + 'file.') + if js_reference is not None or html_reference is not None: + raise InvalidTestDefinitionError( + f'Test {name}: promise test type cannot be used together with ' + 'html_reference or js_reference.') + ref_code = js_reference or html_reference if ref_code is not None: _write_reference_test( @@ -451,7 +476,7 @@ def _generate_test(test: Mapping[str, Any], templates: Mapping[str, str], offscreen_path if offscreen_canvas_cfg.enabled else None) else: _write_testharness_test( - templates, template_params, + templates, template_params, test_type, canvas_path if html_canvas_cfg.enabled else None, offscreen_path if offscreen_canvas_cfg.enabled else None) diff --git a/tests/wpt/web-platform-tests/html/canvas/tools/templates-new.yaml b/tests/wpt/web-platform-tests/html/canvas/tools/templates-new.yaml index 703af3c2cb3..0940471dd4d 100644 --- a/tests/wpt/web-platform-tests/html/canvas/tools/templates-new.yaml +++ b/tests/wpt/web-platform-tests/html/canvas/tools/templates-new.yaml @@ -16,19 +16,39 @@ offscreen: | var t_fail = t.step_func(function(reason) { throw reason; }); - t.step(async function() { + t.step(function() { - var canvas = new OffscreenCanvas(%(width)s, %(height)s); - var ctx = canvas.getContext(%(context_args)s); + var canvas = new OffscreenCanvas(%(width)s, %(height)s); + var ctx = canvas.getContext(%(context_args)s); - await (function(canvas, ctx) { %(code)s - })(canvas, ctx); - t.done(); + t.done(); }); </script> +offscreen-promise: | + <!DOCTYPE html> + <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> + <title>OffscreenCanvas test: %(name)s</title>%(timeout)s + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/html/canvas/resources/canvas-tests.js"></script> + + <h1>%(name)s</h1> + <p class="desc">%(desc)s</p> + + %(notes)s + <script> + promise_test(async t => { + + var canvas = new OffscreenCanvas(%(width)s, %(height)s); + var ctx = canvas.getContext(%(context_args)s); + + %(code)s + + }, "%(desc)s"); + </script> worker: | %(timeout_js)s// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. @@ -46,16 +66,34 @@ worker: | }); t.step(function() { - var canvas = new OffscreenCanvas(%(width)s, %(height)s); - var ctx = canvas.getContext(%(context_args)s); + var canvas = new OffscreenCanvas(%(width)s, %(height)s); + var ctx = canvas.getContext(%(context_args)s); %(code)s - t.done(); - + t.done(); }); done(); +worker-promise: | + %(timeout_js)s// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. + // OffscreenCanvas test in a worker:%(name)s + // Description:%(desc)s + // Note:%(notes)s + + importScripts("/resources/testharness.js"); + importScripts("/html/canvas/resources/canvas-tests.js"); + + promise_test(async t => { + + var canvas = new OffscreenCanvas(%(width)s, %(height)s); + var ctx = canvas.getContext(%(context_args)s); + + %(code)s + t.done(); + }, "%(desc)s"); + done(); + element: | <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> @@ -80,11 +118,39 @@ element: | %(code)s - }%(attributes)s); </script> %(images)s +element-promise: | + <!DOCTYPE html> + <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> + <title>Canvas test: %(name)s</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/html/canvas/resources/canvas-tests.js"></script> + <link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css"> + %(fonts)s<body class="show_output"> + + <h1>%(name)s</h1> + <p class="desc">%(desc)s</p> + + %(notes)s + %(fonthack)s<p class="output">Actual output:</p> + <canvas id="c" class="output" width="%(width)s" height="%(height)s"%(canvas)s>%(fallback)s</canvas> + %(expected)s + <ul id="d"></ul> + <script> + promise_test(async t => { + + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'%(attributes)s); + + %(code)s + + }, "%(desc)s"); + </script> + %(images)s offscreen_ref_test: |- <!DOCTYPE html> diff --git a/tests/wpt/web-platform-tests/html/canvas/tools/yaml-new/compositing.yaml b/tests/wpt/web-platform-tests/html/canvas/tools/yaml-new/compositing.yaml index e808206bdab..0051f07db23 100644 --- a/tests/wpt/web-platform-tests/html/canvas/tools/yaml-new/compositing.yaml +++ b/tests/wpt/web-platform-tests/html/canvas/tools/yaml-new/compositing.yaml @@ -1,7 +1,10 @@ - name: 2d.composite.globalAlpha.range code: | ctx.globalAlpha = 0.5; - var a = ctx.globalAlpha; // might not be exactly 0.5, if it is rounded/quantised, so remember for future comparisons + // This may not set it to exactly 0.5 if it is rounded/quantised, so + // remember for future comparisons. + var a = ctx.globalAlpha; + @assert ctx.globalAlpha === a; ctx.globalAlpha = 1.1; @assert ctx.globalAlpha === a; ctx.globalAlpha = -0.1; @@ -14,7 +17,9 @@ - name: 2d.composite.globalAlpha.invalid code: | ctx.globalAlpha = 0.5; - var a = ctx.globalAlpha; // might not be exactly 0.5, if it is rounded/quantised, so remember for future comparisons + // This may not set it to exactly 0.5 if it is rounded/quantised, so + // remember for future comparisons. + var a = ctx.globalAlpha; ctx.globalAlpha = Infinity; @assert ctx.globalAlpha === a; ctx.globalAlpha = -Infinity; @@ -30,7 +35,8 @@ code: | ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 100, 50); - ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; ctx.fillStyle = '#f00'; ctx.fillRect(0, 0, 100, 50); @assert pixel 50,25 ==~ 2,253,0,255; @@ -48,7 +54,8 @@ ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 100, 50); - ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; ctx.drawImage(canvas2, 0, 0); @assert pixel 50,25 ==~ 2,253,0,255; expected: green @@ -66,7 +73,8 @@ ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 100, 50); ctx.fillStyle = ctx.createPattern(canvas2, 'no-repeat'); - ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; ctx.fillRect(0, 0, 100, 50); @assert pixel 50,25 ==~ 2,253,0,255; expected: green @@ -150,21 +158,18 @@ - name: 2d.composite.globalAlpha.image - canvasType: ['OffscreenCanvas'] + test_type: promise code: | ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 100, 50); - ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations - fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - @assert pixel 50,25 ==~ 2,253,0,255; - }); - }); + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + @assert pixel 50,25 ==~ 2,253,0,255; expected: green - name: 2d.composite.globalAlpha.canvas @@ -176,27 +181,25 @@ ctx2.fillRect(0, 0, 100, 50); ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 100, 50); - ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; ctx.drawImage(offscreenCanvas2, 0, 0); @assert pixel 50,25 ==~ 2,253,0,255; - name: 2d.composite.globalAlpha.imagepattern - canvasType: ['OffscreenCanvas'] + test_type: promise code: | ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 100, 50); - fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - - createImageBitmap(blob) - .then(bitmap => { - ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); - ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations - ctx.fillRect(0, 0, 100, 50); - @assert pixel 50,25 ==~ 2,253,0,255; - }); - }); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.fillStyle = ctx.createPattern(bitmap, 'no-repeat'); + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; + ctx.fillRect(0, 0, 100, 50); + @assert pixel 50,25 ==~ 2,253,0,255; expected: green - name: 2d.composite.globalAlpha.canvaspattern @@ -209,7 +212,8 @@ ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 100, 50); ctx.fillStyle = ctx.createPattern(offscreenCanvas2, 'no-repeat'); - ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimisations + // Avoiding any potential alpha = 0 optimisations. + ctx.globalAlpha = 0.01; ctx.fillRect(0, 0, 100, 50); @assert pixel 50,25 ==~ 2,253,0,255; diff --git a/tests/wpt/web-platform-tests/html/canvas/tools/yaml-new/drawing-images-to-the-canvas.yaml b/tests/wpt/web-platform-tests/html/canvas/tools/yaml-new/drawing-images-to-the-canvas.yaml index 4442f1ad481..e1837342e6a 100644 --- a/tests/wpt/web-platform-tests/html/canvas/tools/yaml-new/drawing-images-to-the-canvas.yaml +++ b/tests/wpt/web-platform-tests/html/canvas/tools/yaml-new/drawing-images-to-the-canvas.yaml @@ -1,78 +1,3 @@ -- name: 2d.drawImage.3arg - canvasType: ['HTMLCanvas'] - images: - - red.png - - green.png - code: | - ctx.drawImage(document.getElementById('green.png'), 0, 0); - ctx.drawImage(document.getElementById('red.png'), -100, 0); - ctx.drawImage(document.getElementById('red.png'), 100, 0); - ctx.drawImage(document.getElementById('red.png'), 0, -50); - ctx.drawImage(document.getElementById('red.png'), 0, 50); - - @assert pixel 0,0 ==~ 0,255,0,255; - @assert pixel 99,0 ==~ 0,255,0,255; - @assert pixel 0,49 ==~ 0,255,0,255; - @assert pixel 99,49 ==~ 0,255,0,255; - expected: green - -- name: 2d.drawImage.5arg - canvasType: ['HTMLCanvas'] - images: - - red.png - - green.png - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.drawImage(document.getElementById('green.png'), 50, 0, 50, 50); - ctx.drawImage(document.getElementById('red.png'), 0, 0, 50, 50); - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 50, 50); - - @assert pixel 0,0 ==~ 0,255,0,255; - @assert pixel 99,0 ==~ 0,255,0,255; - @assert pixel 0,49 ==~ 0,255,0,255; - @assert pixel 99,49 ==~ 0,255,0,255; - expected: green - -- name: 2d.drawImage.9arg.destpos - canvasType: ['HTMLCanvas'] - images: - - red.png - - green.png - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.drawImage(document.getElementById('green.png'), 0, 0, 100, 50, 0, 0, 100, 50); - ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, -100, 0, 100, 50); - ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, 100, 0, 100, 50); - ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, 0, -50, 100, 50); - ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, 0, 50, 100, 50); - @assert pixel 0,0 ==~ 0,255,0,255; - @assert pixel 99,0 ==~ 0,255,0,255; - @assert pixel 0,49 ==~ 0,255,0,255; - @assert pixel 99,49 ==~ 0,255,0,255; - expected: green - -- name: 2d.drawImage.9arg.destsize - canvasType: ['HTMLCanvas'] - images: - - red.png - - green.png - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.drawImage(document.getElementById('green.png'), 1, 1, 1, 1, 0, 0, 100, 50); - ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, -50, 0, 50, 50); - ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, 100, 0, 50, 50); - ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, 0, -25, 100, 25); - ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, 0, 50, 100, 25); - @assert pixel 0,0 ==~ 0,255,0,255; - @assert pixel 99,0 ==~ 0,255,0,255; - @assert pixel 0,49 ==~ 0,255,0,255; - @assert pixel 99,49 ==~ 0,255,0,255; - expected: green - - name: 2d.drawImage.canvas canvasType: ['HTMLCanvas'] code: | @@ -149,28 +74,6 @@ code: | @assert throws TypeError ctx.drawImage(document.createElement('p'), 0, 0); -- name: 2d.drawImage.outsidesource - DISABLED: fix this to match the current spec (transparent black outside source) - canvasType: ['HTMLCanvas'] - mozilla: {throws: !!null ''} - images: - - green.png - - red.png - code: | - ctx.drawImage(document.getElementById('green.png'), 10.5, 10.5, 89.5, 39.5, 0, 0, 100, 50); - ctx.drawImage(document.getElementById('green.png'), 5.5, 5.5, -5.5, -5.5, 0, 0, 100, 50); - ctx.drawImage(document.getElementById('green.png'), 100, 50, -5, -5, 0, 0, 100, 50); - @assert throws INDEX_SIZE_ERR ctx.drawImage(document.getElementById('red.png'), -0.001, 0, 100, 50, 0, 0, 100, 50); - @assert throws INDEX_SIZE_ERR ctx.drawImage(document.getElementById('red.png'), 0, -0.001, 100, 50, 0, 0, 100, 50); - @assert throws INDEX_SIZE_ERR ctx.drawImage(document.getElementById('red.png'), 0, 0, 100.001, 50, 0, 0, 100, 50); - @assert throws INDEX_SIZE_ERR ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50.001, 0, 0, 100, 50); - @assert throws INDEX_SIZE_ERR ctx.drawImage(document.getElementById('red.png'), 50, 0, 50.001, 50, 0, 0, 100, 50); @moz-todo - @assert throws INDEX_SIZE_ERR ctx.drawImage(document.getElementById('red.png'), 0, 0, -5, 5, 0, 0, 100, 50); - @assert throws INDEX_SIZE_ERR ctx.drawImage(document.getElementById('red.png'), 0, 0, 5, -5, 0, 0, 100, 50); - @assert throws INDEX_SIZE_ERR ctx.drawImage(document.getElementById('red.png'), 110, 60, -20, -20, 0, 0, 100, 50); - @assert pixel 50,25 ==~ 0,255,0,255; @moz-todo - expected: green - - name: 2d.drawImage.incomplete.nosrc canvasType: ['HTMLCanvas'] mozilla: {throws: !!null ''} @@ -300,247 +203,147 @@ # TODO: drawImage shadows - name: 2d.drawImage.3arg - canvasType: ['OffscreenCanvas'] - timeout: long - images: - - red.png - - green.png - code: | - var promise1 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/red.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; - }); - var promise2 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/green.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; - }); - Promise.all([promise1, promise2]).then(function(response1, response2) { - var promise3 = createImageBitmap(response1); - var promise4 = createImageBitmap(response2); - Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { - ctx.drawImage(bitmap2, 0, 0); - ctx.drawImage(bitmap1, -100, 0); - ctx.drawImage(bitmap1, 100, 0); - ctx.drawImage(bitmap1, 0, -50); - ctx.drawImage(bitmap1, 0, 50); - @assert pixel 0,0 ==~ 0,255,0,255; - @assert pixel 99,0 ==~ 0,255,0,255; - @assert pixel 0,49 ==~ 0,255,0,255; - @assert pixel 99,49 ==~ 0,255,0,255; - }, t_fail); - }).then(t_pass, t_fail); + test_type: promise + code: | + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.drawImage(bitmap_green, 0, 0); + ctx.drawImage(bitmap_red, -100, 0); + ctx.drawImage(bitmap_red, 100, 0); + ctx.drawImage(bitmap_red, 0, -50); + ctx.drawImage(bitmap_red, 0, 50); + @assert pixel 0,0 ==~ 0,255,0,255; + @assert pixel 99,0 ==~ 0,255,0,255; + @assert pixel 0,49 ==~ 0,255,0,255; + @assert pixel 99,49 ==~ 0,255,0,255; - name: 2d.drawImage.5arg - images: - - red.png - - green.png - canvasType: ['OffscreenCanvas'] - timeout: long + test_type: promise code: | ctx.fillStyle = '#f00'; ctx.fillRect(0, 0, 100, 50); - var promise1 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/red.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; - }); - var promise2 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/green.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; - }); - Promise.all([promise1, promise2]).then(function(response1, response2) { - var promise3 = createImageBitmap(response1); - var promise4 = createImageBitmap(response2); - Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { - ctx.drawImage(bitmap2, 50, 0, 50, 50); - ctx.drawImage(bitmap1, 0, 0, 50, 50); - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 50, 50); - @assert pixel 0,0 ==~ 0,255,0,255; - @assert pixel 99,0 ==~ 0,255,0,255; - @assert pixel 0,49 ==~ 0,255,0,255; - @assert pixel 99,49 ==~ 0,255,0,255; - }, t_fail); - }).then(t_pass, t_fail); + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.drawImage(bitmap_green, 50, 0, 50, 50); + ctx.drawImage(bitmap_red, 0, 0, 50, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 50, 50); + @assert pixel 0,0 ==~ 0,255,0,255; + @assert pixel 99,0 ==~ 0,255,0,255; + @assert pixel 0,49 ==~ 0,255,0,255; + @assert pixel 99,49 ==~ 0,255,0,255; - name: 2d.drawImage.9arg.basic - images: - - green.png - timeout: long + test_type: promise code: | ctx.fillStyle = '#f00'; ctx.fillRect(0, 0, 100, 50); - fetch('/images/green.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, 50); - @assert pixel 0,0 ==~ 0,255,0,255; - @assert pixel 99,0 ==~ 0,255,0,255; - @assert pixel 0,49 ==~ 0,255,0,255; - @assert pixel 99,49 ==~ 0,255,0,255; - }); - }); + const response = await fetch('/images/green.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, 100, 50); + @assert pixel 0,0 ==~ 0,255,0,255; + @assert pixel 99,0 ==~ 0,255,0,255; + @assert pixel 0,49 ==~ 0,255,0,255; + @assert pixel 99,49 ==~ 0,255,0,255; expected: green - name: 2d.drawImage.9arg.sourcepos - images: - - rgrg-256x256.png - timeout: long + test_type: promise code: | ctx.fillStyle = '#f00'; ctx.fillRect(0, 0, 100, 50); - fetch('/images/rgrg-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 140, 20, 100, 50, 0, 0, 100, 50); - @assert pixel 0,0 ==~ 0,255,0,255; - @assert pixel 99,0 ==~ 0,255,0,255; - @assert pixel 0,49 ==~ 0,255,0,255; - @assert pixel 99,49 ==~ 0,255,0,255; - }); - }); + const response = await fetch('/images/rgrg-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 140, 20, 100, 50, 0, 0, 100, 50); + @assert pixel 0,0 ==~ 0,255,0,255; + @assert pixel 99,0 ==~ 0,255,0,255; + @assert pixel 0,49 ==~ 0,255,0,255; + @assert pixel 99,49 ==~ 0,255,0,255; expected: green - name: 2d.drawImage.9arg.sourcesize - images: - - rgrg-256x256.png - timeout: long + test_type: promise code: | ctx.fillStyle = '#f00'; ctx.fillRect(0, 0, 100, 50); - fetch('/images/rgrg-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0, 256, 256, 0, 0, 100, 50); - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 51, 26); - ctx.fillRect(49, 24, 51, 26); - @assert pixel 0,0 ==~ 0,255,0,255; - @assert pixel 99,0 ==~ 0,255,0,255; - @assert pixel 0,49 ==~ 0,255,0,255; - @assert pixel 99,49 ==~ 0,255,0,255; - @assert pixel 20,20 ==~ 0,255,0,255; - @assert pixel 80,20 ==~ 0,255,0,255; - @assert pixel 20,30 ==~ 0,255,0,255; - @assert pixel 80,30 ==~ 0,255,0,255; - }); - }); + const response = await fetch('/images/rgrg-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 0, 0, 256, 256, 0, 0, 100, 50); + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 51, 26); + ctx.fillRect(49, 24, 51, 26); + @assert pixel 0,0 ==~ 0,255,0,255; + @assert pixel 99,0 ==~ 0,255,0,255; + @assert pixel 0,49 ==~ 0,255,0,255; + @assert pixel 99,49 ==~ 0,255,0,255; + @assert pixel 20,20 ==~ 0,255,0,255; + @assert pixel 80,20 ==~ 0,255,0,255; + @assert pixel 20,30 ==~ 0,255,0,255; + @assert pixel 80,30 ==~ 0,255,0,255; expected: green - name: 2d.drawImage.9arg.destpos - canvasType: ['OffscreenCanvas'] - images: - - red.png - - green.png - timeout: long + test_type: promise code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - var promise1 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/red.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; - }); - var promise2 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/green.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; - }); - Promise.all([promise1, promise2]).then(function(response1, response2) { - var promise3 = createImageBitmap(response1); - var promise4 = createImageBitmap(response2); - Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { - ctx.drawImage(bitmap2, 0, 0, 100, 50, 0, 0, 100, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, -100, 0, 100, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, 100, 0, 100, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, -50, 100, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, 50, 100, 50); - @assert pixel 0,0 ==~ 0,255,0,255; - @assert pixel 99,0 ==~ 0,255,0,255; - @assert pixel 0,49 ==~ 0,255,0,255; - @assert pixel 99,49 ==~ 0,255,0,255; - }, t_fail); - }).then(t_pass, t_fail); + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + + ctx.drawImage(bitmap_green, 0, 0, 100, 50, 0, 0, 100, 50); + ctx.drawImage(bitmap_green, 0, 0, 100, 50, -100, 0, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 100, 0, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, -50, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, 50, 100, 50); + @assert pixel 0,0 ==~ 0,255,0,255; + @assert pixel 99,0 ==~ 0,255,0,255; + @assert pixel 0,49 ==~ 0,255,0,255; + @assert pixel 99,49 ==~ 0,255,0,255; - name: 2d.drawImage.9arg.destsize - canvasType: ['OffscreenCanvas'] - images: - - red.png - - green.png - timeout: long + test_type: promise code: | + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + ctx.fillStyle = '#f00'; ctx.fillRect(0, 0, 100, 50); - var promise1 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/red.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; - }); - var promise2 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/green.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; - }); - Promise.all([promise1, promise2]).then(function(response1, response2) { - var promise3 = createImageBitmap(response1); - var promise4 = createImageBitmap(response2); - Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { - ctx.drawImage(bitmap2, 1, 1, 1, 1, 0, 0, 100, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, -50, 0, 50, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, 100, 0, 50, 50); - ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, -25, 100, 25); - ctx.drawImage(bitmap1, 0, 0, 100, 50, 0, 50, 100, 25); - @assert pixel 0,0 ==~ 0,255,0,255; - @assert pixel 99,0 ==~ 0,255,0,255; - @assert pixel 0,49 ==~ 0,255,0,255; - @assert pixel 99,49 ==~ 0,255,0,255; - }, t_fail); - }).then(t_pass, t_fail); + ctx.drawImage(bitmap_green, 1, 1, 1, 1, 0, 0, 100, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, -50, 0, 50, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 100, 0, 50, 50); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, -25, 100, 25); + ctx.drawImage(bitmap_red, 0, 0, 100, 50, 0, 50, 100, 25); + @assert pixel 0,0 ==~ 0,255,0,255; + @assert pixel 99,0 ==~ 0,255,0,255; + @assert pixel 0,49 ==~ 0,255,0,255; + @assert pixel 99,49 ==~ 0,255,0,255; - name: 2d.drawImage.canvas canvasType: ['OffscreenCanvas'] - timeout: long code: | var offscreenCanvas2 = new OffscreenCanvas(100, 50); var ctx2 = offscreenCanvas2.getContext('2d'); @@ -555,7 +358,6 @@ - name: 2d.drawImage.zerocanvas canvasType: ['OffscreenCanvas'] - timeout: long code: | var offscreenCanvas2 = new OffscreenCanvas(0, 10); @assert throws INVALID_STATE_ERR ctx.drawImage(offscreenCanvas2, 0, 0); @@ -569,380 +371,341 @@ @assert throws INVALID_STATE_ERR ctx.drawImage(offscreenCanvas2, 0, 0); - name: 2d.drawImage.floatsource - timeout: long - code: | - fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 10.1, 10.1, 0.1, 0.1, 0, 0, 100, 50); - @assert pixel 50,25 ==~ 0,255,0,255; - }); - }); + test_type: promise + code: | + const response = await fetch('/images/green.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 10.1, 10.1, 0.1, 0.1, 0, 0, 100, 50); + @assert pixel 50,25 ==~ 0,255,0,255; Expected: green - name: 2d.drawImage.zerosource desc: drawImage with zero-sized source rectangle draws nothing without exception - timeout: long - images: - - red.png + test_type: promise + code: | + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 10, 10, 0, 1, 0, 0, 100, 50); + ctx.drawImage(bitmap, 10, 10, 1, 0, 0, 0, 100, 50); + ctx.drawImage(bitmap, 10, 10, 0, 0, 0, 0, 100, 50); + @assert pixel 50,25 ==~ 0,255,0,255; + expected: green + +- name: 2d.drawImage.zerosource.image + desc: drawImage with zero-sized source rectangle from image draws nothing without exception + test_type: promise + canvasType: ['HTMLCanvas'] code: | ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 100, 50); - const red = async () => await createImageBitmap(await (await fetch("/images/red.png")).blob()); - fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 10, 10, 0, 1, 0, 0, 100, 50); - ctx.drawImage(bitmap, 10, 10, 1, 0, 0, 0, 100, 50); - ctx.drawImage(bitmap, 10, 10, 0, 0, 0, 0, 100, 50); - @assert pixel 50,25 ==~ 0,255,0,255; - }); + + function loadImage(src) { + return new Promise((resolve, reject) => { + const img = new Image(); + img.onload = () => resolve(img); + img.onerror = (err) => reject(err); + img.src = src; }); + } + const img1 = await loadImage('/images/red-zerowidth.svg'); + const img2 = await loadImage('/images/red-zeroheight.svg'); + const img3 = await loadImage('/images/red-zerosize.svg'); + + ctx.drawImage(img1, 0, 0, 100, 50); + ctx.drawImage(img2, 0, 0, 100, 50); + ctx.drawImage(img3, 0, 0, 100, 50); + _assertPixel(canvas, 50, 25, 0, 255, 0, 255); expected: green - name: 2d.drawImage.zerosource.image desc: drawImage with zero-sized source rectangle from image draws nothing without exception - images: - - red-zerowidth.svg - - red-zeroheight.svg - - red-zerosize.svg - timeout: long + test_type: promise + canvasType: ['OffscreenCanvas'] code: | ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 100, 50); - fetch('/images/red-zerowidth.svg') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0, 100, 50); - ctx.drawImage(bitmap, 0, 0, 100, 50); - ctx.drawImage(bitmap, 0, 0, 100, 50); - @assert pixel 50,25 == 0,255,0,255; - }); + var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/red-zerowidth.svg'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; + }); + promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0, 100, 50); + _assertPixel(canvas, 50,25, 0,255,0,255); + }); }); expected: green - name: 2d.drawImage.negativesource desc: Negative source width/height represents the correct rectangle mozilla: {throws: !!null ''} - images: - - ggrr-256x256.png - timeout: long + test_type: promise code: | ctx.fillStyle = '#f00'; ctx.fillRect(0, 0, 100, 50); - fetch('/images/ggrr-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 100, 78, -100, 50, 0, 0, 50, 50); - ctx.drawImage(bitmap, 100, 128, -100, -50, 50, 0, 50, 50); - @assert pixel 1,1 ==~ 0,255,0,255; - @assert pixel 1,48 ==~ 0,255,0,255; - @assert pixel 98,1 ==~ 0,255,0,255; - @assert pixel 98,48 ==~ 0,255,0,255; - @assert pixel 48,1 ==~ 0,255,0,255; - @assert pixel 48,48 ==~ 0,255,0,255; - @assert pixel 51,1 ==~ 0,255,0,255; - @assert pixel 51,48 ==~ 0,255,0,255; - @assert pixel 25,25 ==~ 0,255,0,255; - @assert pixel 75,25 ==~ 0,255,0,255; - }); - }); + const response = await fetch('/images/ggrr-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 100, 78, -100, 50, 0, 0, 50, 50); + ctx.drawImage(bitmap, 100, 128, -100, -50, 50, 0, 50, 50); + @assert pixel 1,1 ==~ 0,255,0,255; + @assert pixel 1,48 ==~ 0,255,0,255; + @assert pixel 98,1 ==~ 0,255,0,255; + @assert pixel 98,48 ==~ 0,255,0,255; + @assert pixel 48,1 ==~ 0,255,0,255; + @assert pixel 48,48 ==~ 0,255,0,255; + @assert pixel 51,1 ==~ 0,255,0,255; + @assert pixel 51,48 ==~ 0,255,0,255; + @assert pixel 25,25 ==~ 0,255,0,255; + @assert pixel 75,25 ==~ 0,255,0,255; expected: green - name: 2d.drawImage.negativedest desc: Negative destination width/height represents the correct rectangle mozilla: {throws: !!null ''} - timeout: long - images: - - ggrr-256x256.png + test_type: promise code: | ctx.fillStyle = '#f00'; ctx.fillRect(0, 0, 100, 50); - fetch('/images/ggrr-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 100, 78, 50, 50, 0, 50, 50, -50); - ctx.drawImage(bitmap, 100, 128, 50, -50, 100, 50, -50, -50); - @assert pixel 1,1 ==~ 0,255,0,255; - @assert pixel 1,48 ==~ 0,255,0,255; - @assert pixel 98,1 ==~ 0,255,0,255; - @assert pixel 98,48 ==~ 0,255,0,255; - @assert pixel 48,1 ==~ 0,255,0,255; - @assert pixel 48,48 ==~ 0,255,0,255; - @assert pixel 51,1 ==~ 0,255,0,255; - @assert pixel 51,48 ==~ 0,255,0,255; - @assert pixel 25,25 ==~ 0,255,0,255; - @assert pixel 75,25 ==~ 0,255,0,255; - }); - }); + const response = await fetch('/images/ggrr-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 100, 78, 50, 50, 0, 50, 50, -50); + ctx.drawImage(bitmap, 100, 128, 50, -50, 100, 50, -50, -50); + @assert pixel 1,1 ==~ 0,255,0,255; + @assert pixel 1,48 ==~ 0,255,0,255; + @assert pixel 98,1 ==~ 0,255,0,255; + @assert pixel 98,48 ==~ 0,255,0,255; + @assert pixel 48,1 ==~ 0,255,0,255; + @assert pixel 48,48 ==~ 0,255,0,255; + @assert pixel 51,1 ==~ 0,255,0,255; + @assert pixel 51,48 ==~ 0,255,0,255; + @assert pixel 25,25 ==~ 0,255,0,255; + @assert pixel 75,25 ==~ 0,255,0,255; expected: green - name: 2d.drawImage.negativedir desc: Negative dimensions do not affect the direction of the image mozilla: {throws: !!null ''} - timeout: long - images: - - ggrr-256x256.png + test_type: promise code: | ctx.fillStyle = '#f00'; ctx.fillRect(0, 0, 100, 50); - fetch('/images/ggrr-256x256.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 178, 50, -100, 0, 0, 50, 100); - ctx.drawImage(bitmap, 0, 78, 50, 100, 50, 100, 50, -100); - @assert pixel 1,1 ==~ 0,255,0,255; - @assert pixel 1,48 ==~ 0,255,0,255; - @assert pixel 98,1 ==~ 0,255,0,255; - @assert pixel 98,48 ==~ 0,255,0,255; - @assert pixel 48,1 ==~ 0,255,0,255; - @assert pixel 48,48 ==~ 0,255,0,255; - @assert pixel 51,1 ==~ 0,255,0,255; - @assert pixel 51,48 ==~ 0,255,0,255; - @assert pixel 25,25 ==~ 0,255,0,255; - @assert pixel 75,25 ==~ 0,255,0,255; - }); - }); + const response = await fetch('/images/ggrr-256x256.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + ctx.drawImage(bitmap, 0, 178, 50, -100, 0, 0, 50, 100); + ctx.drawImage(bitmap, 0, 78, 50, 100, 50, 100, 50, -100); + @assert pixel 1,1 ==~ 0,255,0,255; + @assert pixel 1,48 ==~ 0,255,0,255; + @assert pixel 98,1 ==~ 0,255,0,255; + @assert pixel 98,48 ==~ 0,255,0,255; + @assert pixel 48,1 ==~ 0,255,0,255; + @assert pixel 48,48 ==~ 0,255,0,255; + @assert pixel 51,1 ==~ 0,255,0,255; + @assert pixel 51,48 ==~ 0,255,0,255; + @assert pixel 25,25 ==~ 0,255,0,255; + @assert pixel 75,25 ==~ 0,255,0,255; expected: green - name: 2d.drawImage.outsidesource DISABLED: fix this to match the current spec (transparent black outside source) canvasType: ['OffscreenCanvas'] code: | - var promise1 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/red.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; - }); - var promise2 = new Promise(function(resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", '/images/green.png'); - xhr.responseType = 'blob'; - xhr.send(); - xhr.onload = function() { - resolve(xhr.response); - }; - }); - Promise.all([promise1, promise2]).then(function(response1, response2) { - var promise3 = createImageBitmap(response1); - var promise4 = createImageBitmap(response2); - Promise.all([promise3, promise4]).then(function(bitmap1, bitmap2) { - ctx.drawImage(bitmap2, 10.5, 10.5, 89.5, 39.5, 0, 0, 100, 50); - ctx.drawImage(bitmap2, 5.5, 5.5, -5.5, -5.5, 0, 0, 100, 50); - ctx.drawImage(bitmap2, 100, 50, -5, -5, 0, 0, 100, 50); - @assert throws INDEX_SIZE_ERR ctx.drawImage(bitmap1, -0.001, 0, 100, 50, 0, 0, 100, 50); - @assert throws INDEX_SIZE_ERR ctx.drawImage(bitmap1, 0, -0.001, 100, 50, 0, 0, 100, 50); - @assert throws INDEX_SIZE_ERR ctx.drawImage(bitmap1, 0, 0, 100.001, 50, 0, 0, 100, 50); - @assert throws INDEX_SIZE_ERR ctx.drawImage(bitmap1, 0, 0, 100, 50.001, 0, 0, 100, 50); - @assert throws INDEX_SIZE_ERR ctx.drawImage(bitmap1, 50, 0, 50.001, 50, 0, 0, 100, 50); @moz-todo - @assert throws INDEX_SIZE_ERR ctx.drawImage(bitmap1, 0, 0, -5, 5, 0, 0, 100, 50); - @assert throws INDEX_SIZE_ERR ctx.drawImage(bitmap1, 0, 0, 5, -5, 0, 0, 100, 50); - @assert throws INDEX_SIZE_ERR ctx.drawImage(bitmap1, 110, 60, -20, -20, 0, 0, 100, 50); - @assert pixel 50,25 ==~ 0,255,0,255; @moz-todo - }); - }); + const response_red = await fetch('/images/red.png'); + const blob_red = await response_red.blob(); + const bitmap_red = await createImageBitmap(blob_red); + + const response_green = await fetch('/images/green.png'); + const blob_green = await response_green.blob(); + const bitmap_green = await createImageBitmap(blob_green); + ctx.drawImage(bitmap_green, 10.5, 10.5, 89.5, 39.5, 0, 0, 100, 50); + ctx.drawImage(bitmap_green, 5.5, 5.5, -5.5, -5.5, 0, 0, 100, 50); + ctx.drawImage(bitmap_green, 100, 50, -5, -5, 0, 0, 100, 50); + @assert throws INDEX_SIZE_ERR ctx.drawImage(bitmap1, -0.001, 0, 100, 50, 0, 0, 100, 50); + @assert throws INDEX_SIZE_ERR ctx.drawImage(bitmap1, 0, -0.001, 100, 50, 0, 0, 100, 50); + @assert throws INDEX_SIZE_ERR ctx.drawImage(bitmap1, 0, 0, 100.001, 50, 0, 0, 100, 50); + @assert throws INDEX_SIZE_ERR ctx.drawImage(bitmap1, 0, 0, 100, 50.001, 0, 0, 100, 50); + @assert throws INDEX_SIZE_ERR ctx.drawImage(bitmap1, 50, 0, 50.001, 50, 0, 0, 100, 50); @moz-todo + @assert throws INDEX_SIZE_ERR ctx.drawImage(bitmap1, 0, 0, -5, 5, 0, 0, 100, 50); + @assert throws INDEX_SIZE_ERR ctx.drawImage(bitmap1, 0, 0, 5, -5, 0, 0, 100, 50); + @assert throws INDEX_SIZE_ERR ctx.drawImage(bitmap1, 110, 60, -20, -20, 0, 0, 100, 50); + @assert pixel 50,25 ==~ 0,255,0,255; @moz-todo expected: green - name: 2d.drawImage.broken - timeout: long - code: | - fetch('/images/broken.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.drawImage(bitmap, 0, 0); - @assert pixel 50,25 ==~ 0,255,0,255; @moz-todo - }); + test_type: promise + code: | + const response = await fetch('/images/broken.png'); + const blob = await response.blob(); + + await promise_rejects_dom(t, 'InvalidStateError', createImageBitmap(blob), 'The source image could not be decoded.'); + expected: green + +- name: 2d.drawImage.svg + desc: drawImage() of an SVG image + test_type: promise + canvasType: ['HTMLCanvas'] + code: | + const img = new Image(); + const imageLoadPromise = new Promise((resolve, reject) => { + img.onload = () => resolve(); + img.onerror = (err) => reject(err); }); + img.src = '/images/green.svg'; + await imageLoadPromise; + + ctx.drawImage(img, 0, 0); + _assertPixelApprox(canvas, 50, 25, 0, 255, 0, 255, 2); expected: green + - name: 2d.drawImage.svg desc: drawImage() of an SVG image - timeout: long - code: | - fetch('/images/green.svg') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - @assert pixel 50,25 ==~ 0,255,0,255; - }); + test_type: promise + canvasType: ['OffscreenCanvas'] + code: | + var promise = new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", '/images/green.svg'); + xhr.responseType = 'blob'; + xhr.send(); + xhr.onload = function() { + resolve(xhr.response); + }; + }); + promise.then(function(response) { + createImageBitmap(response).then(bitmap => { + ctx.drawImage(bitmap, 0, 0); + _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); + }); }); expected: green - name: 2d.drawImage.animated.poster desc: drawImage() of an APNG draws the poster frame - images: - - anim-poster-gr.png - timeout: long - code: | - fetch('anim-poster-gr.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - @assert pixel 50,25 ==~ 0,255,0,255; @moz-todo - }); - }); + test_type: promise + code: | + const response = await fetch('/images/anim-poster-gr.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + @assert pixel 50,25 ==~ 0,255,0,255; @moz-todo expected: green - name: 2d.drawImage.path - timeout: long + test_type: promise code: | ctx.fillStyle = '#0f0'; ctx.rect(0, 0, 100, 50); - fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - ctx.fill(); - @assert pixel 50,25 ==~ 0,255,0,255; - }); - }); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + ctx.fill(); + @assert pixel 50,25 ==~ 0,255,0,255; expected: green - name: 2d.drawImage.transform - images: - - red.png - timeout: long + test_type: promise code: | ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 100, 50); ctx.translate(100, 0); - fetch('red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - @assert pixel 50,25 ==~ 0,255,0,255; - }); - }); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + @assert pixel 50,25 ==~ 0,255,0,255; expected: green - name: 2d.drawImage.alpha - images: - - red.png - timeout: long + test_type: promise code: | ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 100, 50); ctx.globalAlpha = 0; - fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - @assert pixel 50,25 ==~ 0,255,0,255; - }); - }); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + @assert pixel 50,25 ==~ 0,255,0,255; expected: green - name: 2d.drawImage.clip - images: - - red.png - timeout: long + test_type: promise code: | ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 100, 50); ctx.rect(-10, -10, 1, 1); ctx.clip(); - fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.rect(-10, -10, 1, 1); - ctx.clip(); - ctx.drawImage(document.getElementById('red.png'), 0, 0); - @assert pixel 50,25 ==~ 0,255,0,255; - }); - }); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.fillStyle = '#0f0'; + ctx.fillRect(0, 0, 100, 50); + ctx.rect(-10, -10, 1, 1); + ctx.clip(); + ctx.drawImage(bitmap, 0, 0); + @assert pixel 50,25 ==~ 0,255,0,255; expected: green - name: 2d.drawImage.composite - images: - - red.png - timeout: long + test_type: promise code: | ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 100, 50); ctx.globalCompositeOperation = 'destination-over'; - fetch('/images/red.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, 0, 0); - @assert pixel 50,25 ==~ 0,255,0,255; - }); - }); + const response = await fetch('/images/red.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, 0, 0); + @assert pixel 50,25 ==~ 0,255,0,255; expected: green - name: 2d.drawImage.nowrap desc: Stretched images do not get pixels wrapping around the edges - images: - - redtransparent.png - timeout: long + test_type: promise code: | ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 100, 50); - fetch('/images/redtransparent.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - ctx.drawImage(bitmap, -1950, 0, 2000, 50); - @assert pixel 45,25 ==~ 0,255,0,255; - @assert pixel 50,25 ==~ 0,255,0,255; - @assert pixel 55,25 ==~ 0,255,0,255; - }); - }); + const response = await fetch('/images/redtransparent.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + ctx.drawImage(bitmap, -1950, 0, 2000, 50); + @assert pixel 45,25 ==~ 0,255,0,255; + @assert pixel 50,25 ==~ 0,255,0,255; + @assert pixel 55,25 ==~ 0,255,0,255; expected: green - name: 2d.drawImage.nonfinite desc: drawImage() with Infinity/NaN is ignored - images: - - red.png - timeout: long + test_type: promise code: | ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 100, 50); - fetch('/images/redtransparent.png') - .then(response => response.blob()) - .then(blob => { - createImageBitmap(blob) - .then(bitmap => { - @nonfinite ctx.drawImage(<bitmap>, <0 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>); - @nonfinite ctx.drawImage(<bitmap>, <0 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>, <100 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>); - @nonfinite ctx.drawImage(<bitmap>, <0 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>, <100 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>, <100 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>); - @assert pixel 50,25 == 0,255,0,255; - }); - }); + const response = await fetch('/images/redtransparent.png'); + const blob = await response.blob(); + const bitmap = await createImageBitmap(blob); + + @nonfinite ctx.drawImage(<bitmap>, <0 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>); + @nonfinite ctx.drawImage(<bitmap>, <0 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>, <100 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>); + @nonfinite ctx.drawImage(<bitmap>, <0 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>, <100 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>, <100 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>); + @assert pixel 50,25 == 0,255,0,255; expected: green diff --git a/tests/wpt/web-platform-tests/html/canvas/tools/yaml-new/layers.yaml b/tests/wpt/web-platform-tests/html/canvas/tools/yaml-new/layers.yaml index 6889e164bfb..d398ef2b5a2 100644 --- a/tests/wpt/web-platform-tests/html/canvas/tools/yaml-new/layers.yaml +++ b/tests/wpt/web-platform-tests/html/canvas/tools/yaml-new/layers.yaml @@ -8,10 +8,14 @@ circle.arc(90, 90, 45, 0, 2 * Math.PI); ctx.fill(circle); - %(render_states)s + %(render-states)s ctx.beginLayer(); + // Enable compositing in the layer to validate that draw calls in the layer + // won't individually composite with the background. + ctx.globalCompositeOperation = 'screen'; + ctx.fillStyle = 'rgba(225, 0, 0, 1)'; ctx.fillRect(50, 50, 75, 50); ctx.fillStyle = 'rgba(0, 255, 0, 1)'; @@ -25,65 +29,140 @@ circle.arc(90, 90, 45, 0, 2 * Math.PI); ctx.fill(circle); - %(render_states)s + %(render-states)s canvas2 = document.createElement("canvas"); ctx2 = canvas2.getContext("2d"); + ctx2.globalCompositeOperation = 'screen'; ctx2.fillStyle = 'rgba(225, 0, 0, 1)'; ctx2.fillRect(50, 50, 75, 50); ctx2.fillStyle = 'rgba(0, 255, 0, 1)'; ctx2.fillRect(70, 70, 75, 50); ctx.drawImage(canvas2, 0, 0); - variants: - no_global_states: - render_states: // No global states. + variants: &global-state-variants + no-global-states: + render-states: // No global states. alpha: - render_states: ctx.globalAlpha = 0.6; - globalcompositeoperation: - render_states: ctx.globalCompositeOperation = 'source-in'; + render-states: ctx.globalAlpha = 0.6; + blending: + render-states: ctx.globalCompositeOperation = 'multiply'; + composite: + render-states: ctx.globalCompositeOperation = 'source-in'; shadow: - render_states: |- + render-states: |- ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'orange'; - filter: - render_states: ctx.filter = 'sepia(1) opacity(30%)'; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + alpha.blending: + render-states: |- + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'multiply'; + alpha.composite: + render-states: |- + ctx.globalAlpha = 0.6; + ctx.globalCompositeOperation = 'source-in'; alpha.shadow: - render_states: |- + render-states: |- ctx.globalAlpha = 0.5; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'orange'; - alpha.filter: - render_states: |- + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + alpha.blending.shadow: + render-states: |- ctx.globalAlpha = 0.6; - ctx.filter = 'drop-shadow(-9px 9px 0px #e81)'; - alpha.filter.shadow: - fuzzy: maxDifference=0-2; totalPixels=0-5824 - render_states: |- - ctx.globalAlpha = 0.5; - ctx.filter = 'sepia(0.5) drop-shadow(5px 5px 0px #81e)'; + ctx.globalCompositeOperation = 'multiply'; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'orange'; - alpha.filter.globalcompositeoperation: - render_states: |- + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + alpha.composite.shadow: + render-states: |- ctx.globalAlpha = 0.6; ctx.globalCompositeOperation = 'source-in'; - ctx.filter = 'drop-shadow(-9px 9px 0px #e81)'; - filter.shadow: - fuzzy: maxDifference=0-1; totalPixels=0-49 - render_states: |- - ctx.filter = 'sepia(1) opacity(70%)'; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; - ctx.shadowColor = 'rgba(0,1,0,0.5)'; - filter.globalcompositeoperation: - render_states: |- + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + blending.shadow: + render-states: |- + ctx.globalCompositeOperation = 'multiply'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + composite.shadow: + render-states: |- ctx.globalCompositeOperation = 'source-in'; - ctx.filter = 'drop-shadow(-9px 9px 0px #e81)'; + ctx.shadowOffsetX = -10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'rgba(255, 165, 0, 0.5)'; + + +- name: 2d.layer.global-states.filter + desc: Checks that layers with filters correctly use global render states. + size: 200, 200 + code: | + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + %(render-states)s + + ctx.beginLayer([ + {filter: 'colorMatrix', values: [0.393, 0.769, 0.189, 0, 0, + 0.349, 0.686, 0.168, 0, 0, + 0.272, 0.534, 0.131, 0, 0, + 0, 0, 0, 1, 0]}, + {filter: 'componentTransfer', + funcA: {type: "table", tableValues: [0, 0.7]}}, + {filter: 'dropShadow', dx: 5, dy: 5, floodColor: '#81e'}]); + + ctx.fillStyle = 'rgba(200, 0, 0, 1)'; + ctx.fillRect(50, 50, 75, 50); + ctx.fillStyle = 'rgba(0, 200, 0, 1)'; + ctx.fillRect(70, 70, 75, 50); + + ctx.endLayer(); + reference: | + const svg = ` + <svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%%" y="-100%%" width="300%%" height="300%%"> + <feColorMatrix + type="matrix" + values="0.393 0.769 0.189 0 0 + 0.349 0.686 0.168 0 0 + 0.272 0.534 0.131 0 0 + 0 0 0 1 0" /> + <feComponentTransfer> + <feFuncA type="table" tableValues="0 0.7"></feFuncA> + </feComponentTransfer> + <feDropShadow dx="5" dy="5" flood-color="#81e" /> + </filter> + <g filter="url(#filter)"> + <rect x="50" y="50" width="75" height="50" fill="rgba(200, 0, 0, 1)"/> + <rect x="70" y="70" width="75" height="50" fill="rgba(0, 200, 0, 1)"/> + </g> + </svg>`; + + const img = new Image(); + img.width = 200; + img.height = 200; + img.onload = () => { + ctx.fillStyle = 'rgba(0, 0, 255, 1)'; + + var circle = new Path2D(); + circle.arc(90, 90, 45, 0, 2 * Math.PI); + ctx.fill(circle); + + %(render-states)s + + ctx.drawImage(img, 0, 0); + }; + img.src = 'data:image/svg+xml;base64,' + btoa(svg); + variants: *global-state-variants - name: 2d.layer.nested @@ -179,7 +258,6 @@ ctx.fillRect(50, 50, 95, 70); ctx.globalAlpha = 0.5; - ctx.filter = 'sepia(0.5)'; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; ctx.shadowColor = 'orange'; @@ -200,7 +278,6 @@ ctx.fillRect(50, 50, 95, 70); ctx.globalAlpha = 0.5; - ctx.filter = 'sepia(0.5)'; ctx.shadowOffsetX = -10; ctx.shadowOffsetY = 10; ctx.shadowColor = 'orange'; diff --git a/tests/wpt/web-platform-tests/html/canvas/tools/yaml/element/path-objects.yaml b/tests/wpt/web-platform-tests/html/canvas/tools/yaml-new/path-objects.yaml index eec142c7692..eec142c7692 100644 --- a/tests/wpt/web-platform-tests/html/canvas/tools/yaml/element/path-objects.yaml +++ b/tests/wpt/web-platform-tests/html/canvas/tools/yaml-new/path-objects.yaml diff --git a/tests/wpt/web-platform-tests/html/canvas/tools/yaml/offscreen/path-objects.yaml b/tests/wpt/web-platform-tests/html/canvas/tools/yaml/offscreen/path-objects.yaml deleted file mode 100644 index 9c70daf59fc..00000000000 --- a/tests/wpt/web-platform-tests/html/canvas/tools/yaml/offscreen/path-objects.yaml +++ /dev/null @@ -1,3073 +0,0 @@ -- name: 2d.path.initial - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.closePath(); - ctx.fillStyle = '#f00'; - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.beginPath - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.rect(0, 0, 100, 50); - ctx.beginPath(); - ctx.fillStyle = '#f00'; - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.moveTo.basic - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.rect(0, 0, 10, 50); - ctx.moveTo(100, 0); - ctx.lineTo(10, 0); - ctx.lineTo(10, 50); - ctx.lineTo(100, 50); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 90,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.moveTo.newsubpath - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.beginPath(); - ctx.moveTo(0, 0); - ctx.moveTo(100, 0); - ctx.moveTo(100, 50); - ctx.moveTo(0, 50); - ctx.fillStyle = '#f00'; - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.moveTo.multiple - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.moveTo(0, 25); - ctx.moveTo(100, 25); - ctx.moveTo(0, 25); - ctx.lineTo(100, 25); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 50; - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.moveTo.nonfinite - desc: moveTo() with Infinity/NaN is ignored - code: | - ctx.moveTo(0, 0); - ctx.lineTo(100, 0); - @nonfinite ctx.moveTo(<0 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>); - ctx.lineTo(100, 50); - ctx.lineTo(0, 50); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.closePath.empty - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.closePath(); - ctx.fillStyle = '#f00'; - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.closePath.newline - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 50; - ctx.moveTo(-100, 25); - ctx.lineTo(-100, -100); - ctx.lineTo(200, -100); - ctx.lineTo(200, 25); - ctx.closePath(); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.closePath.nextpoint - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 50; - ctx.moveTo(-100, 25); - ctx.lineTo(-100, -1000); - ctx.closePath(); - ctx.lineTo(1000, 25); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.lineTo.ensuresubpath.1 - desc: If there is no subpath, the point is added and nothing is drawn - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 50; - ctx.beginPath(); - ctx.lineTo(100, 50); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.lineTo.ensuresubpath.2 - desc: If there is no subpath, the point is added and used for subsequent drawing - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 50; - ctx.beginPath(); - ctx.lineTo(0, 25); - ctx.lineTo(100, 25); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.lineTo.basic - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 50; - ctx.beginPath(); - ctx.moveTo(0, 25); - ctx.lineTo(100, 25); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.lineTo.nextpoint - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 50; - ctx.beginPath(); - ctx.moveTo(-100, -100); - ctx.lineTo(0, 25); - ctx.lineTo(100, 25); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.lineTo.nonfinite - desc: lineTo() with Infinity/NaN is ignored - code: | - ctx.moveTo(0, 0); - ctx.lineTo(100, 0); - @nonfinite ctx.lineTo(<0 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>); - ctx.lineTo(100, 50); - ctx.lineTo(0, 50); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 90,45 == 0,255,0,255; - t.done(); - -- name: 2d.path.lineTo.nonfinite.details - desc: lineTo() with Infinity/NaN for first arg still converts the second arg - code: | - for (var arg1 of [Infinity, -Infinity, NaN]) { - var converted = false; - ctx.lineTo(arg1, { valueOf: function() { converted = true; return 0; } }); - @assert converted; - } - t.done(); - -- name: 2d.path.quadraticCurveTo.ensuresubpath.1 - desc: If there is no subpath, the first control point is added (and nothing is drawn - up to it) - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 50; - ctx.beginPath(); - ctx.quadraticCurveTo(100, 50, 200, 50); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 95,45 == 0,255,0,255; @moz-todo - t.done(); - -- name: 2d.path.quadraticCurveTo.ensuresubpath.2 - desc: If there is no subpath, the first control point is added - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 50; - ctx.beginPath(); - ctx.quadraticCurveTo(0, 25, 100, 25); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 5,45 == 0,255,0,255; @moz-todo - t.done(); - -- name: 2d.path.quadraticCurveTo.basic - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 50; - ctx.beginPath(); - ctx.moveTo(0, 25); - ctx.quadraticCurveTo(100, 25, 100, 25); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.quadraticCurveTo.shape - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 55; - ctx.beginPath(); - ctx.moveTo(-1000, 1050); - ctx.quadraticCurveTo(0, -1000, 1200, 1050); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.quadraticCurveTo.scaled - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.scale(1000, 1000); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 0.055; - ctx.beginPath(); - ctx.moveTo(-1, 1.05); - ctx.quadraticCurveTo(0, -1, 1.2, 1.05); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.quadraticCurveTo.nonfinite - desc: quadraticCurveTo() with Infinity/NaN is ignored - code: | - ctx.moveTo(0, 0); - ctx.lineTo(100, 0); - @nonfinite ctx.quadraticCurveTo(<0 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>); - ctx.lineTo(100, 50); - ctx.lineTo(0, 50); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 90,45 == 0,255,0,255; - t.done(); - -- name: 2d.path.bezierCurveTo.ensuresubpath.1 - desc: If there is no subpath, the first control point is added (and nothing is drawn - up to it) - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 50; - ctx.beginPath(); - ctx.bezierCurveTo(100, 50, 200, 50, 200, 50); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 95,45 == 0,255,0,255; - t.done(); - -- name: 2d.path.bezierCurveTo.ensuresubpath.2 - desc: If there is no subpath, the first control point is added - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 50; - ctx.beginPath(); - ctx.bezierCurveTo(0, 25, 100, 25, 100, 25); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 5,45 == 0,255,0,255; - t.done(); - -- name: 2d.path.bezierCurveTo.basic - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 50; - ctx.beginPath(); - ctx.moveTo(0, 25); - ctx.bezierCurveTo(100, 25, 100, 25, 100, 25); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.bezierCurveTo.shape - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 55; - ctx.beginPath(); - ctx.moveTo(-2000, 3100); - ctx.bezierCurveTo(-2000, -1000, 2100, -1000, 2100, 3100); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.bezierCurveTo.scaled - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.scale(1000, 1000); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 0.055; - ctx.beginPath(); - ctx.moveTo(-2, 3.1); - ctx.bezierCurveTo(-2, -1, 2.1, -1, 2.1, 3.1); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.bezierCurveTo.nonfinite - desc: bezierCurveTo() with Infinity/NaN is ignored - code: | - ctx.moveTo(0, 0); - ctx.lineTo(100, 0); - @nonfinite ctx.bezierCurveTo(<0 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>); - ctx.lineTo(100, 50); - ctx.lineTo(0, 50); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 90,45 == 0,255,0,255; - t.done(); - -- name: 2d.path.arcTo.ensuresubpath.1 - desc: If there is no subpath, the first control point is added (and nothing is drawn - up to it) - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.strokeStyle = '#f00'; - ctx.beginPath(); - ctx.arcTo(100, 50, 200, 50, 0.1); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.arcTo.ensuresubpath.2 - desc: If there is no subpath, the first control point is added - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.arcTo(0, 25, 50, 250, 0.1); // adds (x1,y1), draws nothing - ctx.lineTo(100, 25); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.arcTo.coincide.1 - desc: arcTo() has no effect if P0 = P1 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(0, 25); - ctx.arcTo(0, 25, 50, 1000, 1); - ctx.lineTo(100, 25); - ctx.stroke(); - ctx.strokeStyle = '#f00'; - ctx.beginPath(); - ctx.moveTo(50, 25); - ctx.arcTo(50, 25, 100, 25, 1); - ctx.stroke(); - @assert pixel 50,1 == 0,255,0,255; - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 50,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.arcTo.coincide.2 - desc: arcTo() draws a straight line to P1 if P1 = P2 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(0, 25); - ctx.arcTo(100, 25, 100, 25, 1); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.arcTo.collinear.1 - desc: arcTo() with all points on a line, and P1 between P0/P2, draws a straight - line to P1 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(0, 25); - ctx.arcTo(100, 25, 200, 25, 1); - ctx.stroke(); - ctx.strokeStyle = '#f00'; - ctx.beginPath(); - ctx.moveTo(-100, 25); - ctx.arcTo(0, 25, 100, 25, 1); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.arcTo.collinear.2 - desc: arcTo() with all points on a line, and P2 between P0/P1, draws a straight - line to P1 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(0, 25); - ctx.arcTo(100, 25, 10, 25, 1); - ctx.stroke(); - ctx.strokeStyle = '#f00'; - ctx.beginPath(); - ctx.moveTo(100, 25); - ctx.arcTo(200, 25, 110, 25, 1); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.arcTo.collinear.3 - desc: arcTo() with all points on a line, and P0 between P1/P2, draws a straight - line to P1 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(0, 25); - ctx.arcTo(100, 25, -100, 25, 1); - ctx.stroke(); - ctx.strokeStyle = '#f00'; - ctx.beginPath(); - ctx.moveTo(100, 25); - ctx.arcTo(200, 25, 0, 25, 1); - ctx.stroke(); - ctx.beginPath(); - ctx.moveTo(-100, 25); - ctx.arcTo(0, 25, -200, 25, 1); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.arcTo.shape.curve1 - desc: arcTo() curves in the right kind of shape - code: | - var tol = 1.5; // tolerance to avoid antialiasing artifacts - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 10; - ctx.beginPath(); - ctx.moveTo(10, 25); - ctx.arcTo(75, 25, 75, 60, 20); - ctx.stroke(); - ctx.fillStyle = '#0f0'; - ctx.beginPath(); - ctx.rect(10, 20, 45, 10); - ctx.moveTo(80, 45); - ctx.arc(55, 45, 25+tol, 0, -Math.PI/2, true); - ctx.arc(55, 45, 15-tol, -Math.PI/2, 0, false); - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 55,19 == 0,255,0,255; - @assert pixel 55,20 == 0,255,0,255; - @assert pixel 55,21 == 0,255,0,255; - @assert pixel 64,22 == 0,255,0,255; - @assert pixel 65,21 == 0,255,0,255; - @assert pixel 72,28 == 0,255,0,255; - @assert pixel 73,27 == 0,255,0,255; - @assert pixel 78,36 == 0,255,0,255; - @assert pixel 79,35 == 0,255,0,255; - @assert pixel 80,44 == 0,255,0,255; - @assert pixel 80,45 == 0,255,0,255; - @assert pixel 80,46 == 0,255,0,255; - @assert pixel 65,45 == 0,255,0,255; - t.done(); - -- name: 2d.path.arcTo.shape.curve2 - desc: arcTo() curves in the right kind of shape - code: | - var tol = 1.5; // tolerance to avoid antialiasing artifacts - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#f00'; - ctx.beginPath(); - ctx.rect(10, 20, 45, 10); - ctx.moveTo(80, 45); - ctx.arc(55, 45, 25-tol, 0, -Math.PI/2, true); - ctx.arc(55, 45, 15+tol, -Math.PI/2, 0, false); - ctx.fill(); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 10; - ctx.beginPath(); - ctx.moveTo(10, 25); - ctx.arcTo(75, 25, 75, 60, 20); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 55,19 == 0,255,0,255; - @assert pixel 55,20 == 0,255,0,255; - @assert pixel 55,21 == 0,255,0,255; - @assert pixel 64,22 == 0,255,0,255; - @assert pixel 65,21 == 0,255,0,255; - @assert pixel 72,28 == 0,255,0,255; - @assert pixel 73,27 == 0,255,0,255; - @assert pixel 78,36 == 0,255,0,255; - @assert pixel 79,35 == 0,255,0,255; - @assert pixel 80,44 == 0,255,0,255; - @assert pixel 80,45 == 0,255,0,255; - @assert pixel 80,46 == 0,255,0,255; - t.done(); - -- name: 2d.path.arcTo.shape.start - desc: arcTo() draws a straight line from P0 to P1 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 50; - ctx.beginPath(); - ctx.moveTo(0, 25); - ctx.arcTo(200, 25, 200, 50, 10); - ctx.stroke(); - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.arcTo.shape.end - desc: arcTo() does not draw anything from P1 to P2 - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 50; - ctx.beginPath(); - ctx.moveTo(-100, -100); - ctx.arcTo(-100, 25, 200, 25, 10); - ctx.stroke(); - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.arcTo.negative - desc: arcTo() with negative radius throws an exception - code: | - @assert throws INDEX_SIZE_ERR ctx.arcTo(0, 0, 0, 0, -1); - t.done(); - -- name: 2d.path.arcTo.zero.1 - desc: arcTo() with zero radius draws a straight line from P0 to P1 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(0, 25); - ctx.arcTo(100, 25, 100, 100, 0); - ctx.stroke(); - ctx.strokeStyle = '#f00'; - ctx.beginPath(); - ctx.moveTo(0, -25); - ctx.arcTo(50, -25, 50, 50, 0); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.arcTo.zero.2 - desc: arcTo() with zero radius draws a straight line from P0 to P1, even when all - points are collinear - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(0, 25); - ctx.arcTo(100, 25, -100, 25, 0); - ctx.stroke(); - ctx.strokeStyle = '#f00'; - ctx.beginPath(); - ctx.moveTo(100, 25); - ctx.arcTo(200, 25, 50, 25, 0); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.arcTo.transformation - desc: arcTo joins up to the last subpath point correctly - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(0, 50); - ctx.translate(100, 0); - ctx.arcTo(50, 50, 50, 0, 50); - ctx.lineTo(-100, 0); - ctx.fill(); - @assert pixel 0,0 == 0,255,0,255; - @assert pixel 50,0 == 0,255,0,255; - @assert pixel 99,0 == 0,255,0,255; - @assert pixel 0,25 == 0,255,0,255; - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 99,25 == 0,255,0,255; - @assert pixel 0,49 == 0,255,0,255; - @assert pixel 50,49 == 0,255,0,255; - @assert pixel 99,49 == 0,255,0,255; - t.done(); - -- name: 2d.path.arcTo.scale - desc: arcTo scales the curve, not just the control points - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(0, 50); - ctx.translate(100, 0); - ctx.scale(0.1, 1); - ctx.arcTo(50, 50, 50, 0, 50); - ctx.lineTo(-1000, 0); - ctx.fill(); - @assert pixel 0,0 == 0,255,0,255; - @assert pixel 50,0 == 0,255,0,255; - @assert pixel 99,0 == 0,255,0,255; - @assert pixel 0,25 == 0,255,0,255; - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 99,25 == 0,255,0,255; - @assert pixel 0,49 == 0,255,0,255; - @assert pixel 50,49 == 0,255,0,255; - @assert pixel 99,49 == 0,255,0,255; - t.done(); - -- name: 2d.path.arcTo.nonfinite - desc: arcTo() with Infinity/NaN is ignored - code: | - ctx.moveTo(0, 0); - ctx.lineTo(100, 0); - @nonfinite ctx.arcTo(<0 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>); - ctx.lineTo(100, 50); - ctx.lineTo(0, 50); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 90,45 == 0,255,0,255; - t.done(); - - -- name: 2d.path.arc.empty - desc: arc() with an empty path does not draw a straight line to the start point - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.strokeStyle = '#f00'; - ctx.beginPath(); - ctx.arc(200, 25, 5, 0, 2*Math.PI, true); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.nonempty - desc: arc() with a non-empty path does draw a straight line to the start point - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(0, 25); - ctx.arc(200, 25, 5, 0, 2*Math.PI, true); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.end - desc: arc() adds the end point of the arc to the subpath - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(-100, 0); - ctx.arc(-100, 0, 25, -Math.PI/2, Math.PI/2, true); - ctx.lineTo(100, 25); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.default - desc: arc() with missing last argument defaults to clockwise - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#f00'; - ctx.beginPath(); - ctx.moveTo(100, 0); - ctx.arc(100, 0, 150, -Math.PI, Math.PI/2); - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.angle.1 - desc: arc() draws pi/2 .. -pi anticlockwise correctly - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#f00'; - ctx.beginPath(); - ctx.moveTo(100, 0); - ctx.arc(100, 0, 150, Math.PI/2, -Math.PI, true); - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.angle.2 - desc: arc() draws -3pi/2 .. -pi anticlockwise correctly - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#f00'; - ctx.beginPath(); - ctx.moveTo(100, 0); - ctx.arc(100, 0, 150, -3*Math.PI/2, -Math.PI, true); - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.angle.3 - desc: arc() wraps angles mod 2pi when anticlockwise and end > start+2pi - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#f00'; - ctx.beginPath(); - ctx.moveTo(100, 0); - ctx.arc(100, 0, 150, (512+1/2)*Math.PI, (1024-1)*Math.PI, true); - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.angle.4 - desc: arc() draws a full circle when clockwise and end > start+2pi - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(50, 25); - ctx.arc(50, 25, 60, (512+1/2)*Math.PI, (1024-1)*Math.PI, false); - ctx.fill(); - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.angle.5 - desc: arc() wraps angles mod 2pi when clockwise and start > end+2pi - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#f00'; - ctx.beginPath(); - ctx.moveTo(100, 0); - ctx.arc(100, 0, 150, (1024-1)*Math.PI, (512+1/2)*Math.PI, false); - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.angle.6 - desc: arc() draws a full circle when anticlockwise and start > end+2pi - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(50, 25); - ctx.arc(50, 25, 60, (1024-1)*Math.PI, (512+1/2)*Math.PI, true); - ctx.fill(); - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.zero.1 - desc: arc() draws nothing when startAngle = endAngle and anticlockwise - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 100; - ctx.beginPath(); - ctx.arc(50, 25, 50, 0, 0, true); - ctx.stroke(); - @assert pixel 50,20 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.zero.2 - desc: arc() draws nothing when startAngle = endAngle and clockwise - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 100; - ctx.beginPath(); - ctx.arc(50, 25, 50, 0, 0, false); - ctx.stroke(); - @assert pixel 50,20 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.twopie.1 - desc: arc() draws nothing when end = start + 2pi-e and anticlockwise - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 100; - ctx.beginPath(); - ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, true); - ctx.stroke(); - @assert pixel 50,20 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.twopie.2 - desc: arc() draws a full circle when end = start + 2pi-e and clockwise - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 100; - ctx.beginPath(); - ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, false); - ctx.stroke(); - @assert pixel 50,20 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.twopie.3 - desc: arc() draws a full circle when end = start + 2pi+e and anticlockwise - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 100; - ctx.beginPath(); - ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, true); - ctx.stroke(); - @assert pixel 50,20 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.twopie.4 - desc: arc() draws nothing when end = start + 2pi+e and clockwise - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 100; - ctx.beginPath(); - ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, false); - ctx.stroke(); - @assert pixel 50,20 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.shape.1 - desc: arc() from 0 to pi does not draw anything in the wrong half - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.strokeStyle = '#f00'; - ctx.beginPath(); - ctx.arc(50, 50, 50, 0, Math.PI, false); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - @assert pixel 20,48 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.shape.2 - desc: arc() from 0 to pi draws stuff in the right half - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 100; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.arc(50, 50, 50, 0, Math.PI, true); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - @assert pixel 20,48 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.shape.3 - desc: arc() from 0 to -pi/2 does not draw anything in the wrong quadrant - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 100; - ctx.strokeStyle = '#f00'; - ctx.beginPath(); - ctx.arc(0, 50, 50, 0, -Math.PI/2, false); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; @moz-todo - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.shape.4 - desc: arc() from 0 to -pi/2 draws stuff in the right quadrant - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 150; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.arc(-50, 50, 100, 0, -Math.PI/2, true); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.shape.5 - desc: arc() from 0 to 5pi does not draw crazy things - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 200; - ctx.strokeStyle = '#f00'; - ctx.beginPath(); - ctx.arc(300, 0, 100, 0, 5*Math.PI, false); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.selfintersect.1 - desc: arc() with lineWidth > 2*radius is drawn sensibly - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 200; - ctx.strokeStyle = '#f00'; - ctx.beginPath(); - ctx.arc(100, 50, 25, 0, -Math.PI/2, true); - ctx.stroke(); - ctx.beginPath(); - ctx.arc(0, 0, 25, 0, -Math.PI/2, true); - ctx.stroke(); - @assert pixel 1,1 == 0,255,0,255; @moz-todo - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.selfintersect.2 - desc: arc() with lineWidth > 2*radius is drawn sensibly - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 180; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.arc(-50, 50, 25, 0, -Math.PI/2, true); - ctx.stroke(); - ctx.beginPath(); - ctx.arc(100, 0, 25, 0, -Math.PI/2, true); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 90,10 == 0,255,0,255; - @assert pixel 97,1 == 0,255,0,255; - @assert pixel 97,2 == 0,255,0,255; - @assert pixel 97,3 == 0,255,0,255; - @assert pixel 2,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.negative - desc: arc() with negative radius throws INDEX_SIZE_ERR - code: | - @assert throws INDEX_SIZE_ERR ctx.arc(0, 0, -1, 0, 0, true); - t.done(); - -- name: 2d.path.arc.zeroradius - desc: arc() with zero radius draws a line to the start point - code: | - ctx.fillStyle = '#f00' - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(0, 25); - ctx.arc(200, 25, 0, 0, Math.PI, true); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.scale.1 - desc: Non-uniformly scaled arcs are the right shape - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.scale(2, 0.5); - ctx.fillStyle = '#0f0'; - ctx.beginPath(); - ctx.arc(25, 50, 56, 0, 2*Math.PI, false); - ctx.fill(); - ctx.fillStyle = '#f00'; - ctx.beginPath(); - ctx.moveTo(-25, 50); - ctx.arc(-25, 50, 24, 0, 2*Math.PI, false); - ctx.moveTo(75, 50); - ctx.arc(75, 50, 24, 0, 2*Math.PI, false); - ctx.moveTo(25, -25); - ctx.arc(25, -25, 24, 0, 2*Math.PI, false); - ctx.moveTo(25, 125); - ctx.arc(25, 125, 24, 0, 2*Math.PI, false); - ctx.fill(); - @assert pixel 0,0 == 0,255,0,255; - @assert pixel 50,0 == 0,255,0,255; - @assert pixel 99,0 == 0,255,0,255; - @assert pixel 0,25 == 0,255,0,255; - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 99,25 == 0,255,0,255; - @assert pixel 0,49 == 0,255,0,255; - @assert pixel 50,49 == 0,255,0,255; - @assert pixel 99,49 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.scale.2 - desc: Highly scaled arcs are the right shape - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.scale(100, 100); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 1.2; - ctx.beginPath(); - ctx.arc(0, 0, 0.6, 0, Math.PI/2, false); - ctx.stroke(); - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 50,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,25 == 0,255,0,255; - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 98,25 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - @assert pixel 50,48 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.arc.nonfinite - desc: arc() with Infinity/NaN is ignored - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.moveTo(0, 0); - ctx.lineTo(100, 0); - @nonfinite ctx.arc(<0 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>, <2*Math.PI Infinity -Infinity NaN>, <true>); - ctx.lineTo(100, 50); - ctx.lineTo(0, 50); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 90,45 == 0,255,0,255; - t.done(); - - -- name: 2d.path.rect.basic - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#0f0'; - ctx.rect(0, 0, 100, 50); - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.rect.newsubpath - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.beginPath(); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 50; - ctx.moveTo(-100, 25); - ctx.lineTo(-50, 25); - ctx.rect(200, 25, 1, 1); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.rect.closed - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 200; - ctx.lineJoin = 'miter'; - ctx.rect(100, 50, 100, 100); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.rect.end.1 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 100; - ctx.rect(200, 100, 400, 1000); - ctx.lineTo(-2000, -1000); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.rect.end.2 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 450; - ctx.lineCap = 'round'; - ctx.lineJoin = 'bevel'; - ctx.rect(150, 150, 2000, 2000); - ctx.lineTo(160, 160); - ctx.stroke(); - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.rect.zero.1 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 100; - ctx.beginPath(); - ctx.rect(0, 50, 100, 0); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.rect.zero.2 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 100; - ctx.beginPath(); - ctx.rect(50, -100, 0, 250); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.rect.zero.3 - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 100; - ctx.beginPath(); - ctx.rect(50, 25, 0, 0); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.rect.zero.4 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 50; - ctx.rect(100, 25, 0, 0); - ctx.lineTo(0, 25); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.rect.zero.5 - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 50; - ctx.moveTo(0, 0); - ctx.rect(100, 25, 0, 0); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.rect.zero.6 - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineJoin = 'miter'; - ctx.miterLimit = 1.5; - ctx.lineWidth = 200; - ctx.beginPath(); - ctx.rect(100, 25, 1000, 0); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; @moz-todo - t.done(); - -- name: 2d.path.rect.negative - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.beginPath(); - ctx.fillStyle = '#0f0'; - ctx.rect(0, 0, 50, 25); - ctx.rect(100, 0, -50, 25); - ctx.rect(0, 50, 50, -25); - ctx.rect(100, 50, -50, -25); - ctx.fill(); - @assert pixel 25,12 == 0,255,0,255; - @assert pixel 75,12 == 0,255,0,255; - @assert pixel 25,37 == 0,255,0,255; - @assert pixel 75,37 == 0,255,0,255; - t.done(); - -- name: 2d.path.rect.winding - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.beginPath(); - ctx.fillStyle = '#f00'; - ctx.rect(0, 0, 50, 50); - ctx.rect(100, 50, -50, -50); - ctx.rect(0, 25, 100, -25); - ctx.rect(100, 25, -100, 25); - ctx.fill(); - @assert pixel 25,12 == 0,255,0,255; - @assert pixel 75,12 == 0,255,0,255; - @assert pixel 25,37 == 0,255,0,255; - @assert pixel 75,37 == 0,255,0,255; - t.done(); - -- name: 2d.path.rect.selfintersect - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 90; - ctx.beginPath(); - ctx.rect(45, 20, 10, 10); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; @moz-todo - t.done(); - -- name: 2d.path.rect.nonfinite - desc: rect() with Infinity/NaN is ignored - code: | - ctx.moveTo(0, 0); - ctx.lineTo(100, 0); - @nonfinite ctx.rect(<0 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>, <1 Infinity -Infinity NaN>, <1 Infinity -Infinity NaN>); - ctx.lineTo(100, 50); - ctx.lineTo(0, 50); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 90,45 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.newsubpath - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.beginPath(); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 50; - ctx.moveTo(-100, 25); - ctx.lineTo(-50, 25); - ctx.roundRect(200, 25, 1, 1, [0]); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - expected: green - -- name: 2d.path.roundrect.closed - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 200; - ctx.lineJoin = 'miter'; - ctx.roundRect(100, 50, 100, 100, [0]); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - expected: green - -- name: 2d.path.roundrect.end.1 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 100; - ctx.roundRect(200, 100, 400, 1000, [0]); - ctx.lineTo(-2000, -1000); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - expected: green - -- name: 2d.path.roundrect.end.2 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 450; - ctx.lineCap = 'round'; - ctx.lineJoin = 'bevel'; - ctx.roundRect(150, 150, 2000, 2000, [0]); - ctx.lineTo(160, 160); - ctx.stroke(); - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - expected: green - -- name: 2d.path.roundrect.end.3 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 100; - ctx.roundRect(101, 51, 2000, 2000, [500, 500, 500, 500]); - ctx.lineTo(-1, -1); - ctx.stroke(); - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - expected: green - -- name: 2d.path.roundrect.end.4 - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 10; - ctx.roundRect(-1, -1, 2000, 2000, [1000, 1000, 1000, 1000]); - ctx.lineTo(-150, -150); - ctx.stroke(); - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - expected: green - -- name: 2d.path.roundrect.zero.1 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 100; - ctx.beginPath(); - ctx.roundRect(0, 50, 100, 0, [0]); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - expected: green - -- name: 2d.path.roundrect.zero.2 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 100; - ctx.beginPath(); - ctx.roundRect(50, -100, 0, 250, [0]); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - expected: green - -- name: 2d.path.roundrect.zero.3 - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 100; - ctx.beginPath(); - ctx.roundRect(50, 25, 0, 0, [0]); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - expected: green - -- name: 2d.path.roundrect.zero.4 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 50; - ctx.roundRect(100, 25, 0, 0, [0]); - ctx.lineTo(0, 25); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - expected: green - -- name: 2d.path.roundrect.zero.5 - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 50; - ctx.moveTo(0, 0); - ctx.roundRect(100, 25, 0, 0, [0]); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - expected: green - -- name: 2d.path.roundrect.zero.6 - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineJoin = 'miter'; - ctx.miterLimit = 1.5; - ctx.lineWidth = 200; - ctx.beginPath(); - ctx.roundRect(100, 25, 1000, 0, [0]); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - expected: green - -- name: 2d.path.roundrect.negative - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.beginPath(); - ctx.fillStyle = '#0f0'; - ctx.roundRect(0, 0, 50, 25, [10, 0, 0, 0]); - ctx.roundRect(100, 0, -50, 25, [10, 0, 0, 0]); - ctx.roundRect(0, 50, 50, -25, [10, 0, 0, 0]); - ctx.roundRect(100, 50, -50, -25, [10, 0, 0, 0]); - ctx.fill(); - // All rects drawn - @assert pixel 25,12 == 0,255,0,255; - @assert pixel 75,12 == 0,255,0,255; - @assert pixel 25,37 == 0,255,0,255; - @assert pixel 75,37 == 0,255,0,255; - // Correct corners are rounded. - @assert pixel 1,1 == 255,0,0,255; - @assert pixel 98,1 == 255,0,0,255; - @assert pixel 1,48 == 255,0,0,255; - @assert pixel 98,48 == 255,0,0,255; - t.done(); - -- name: 2d.path.roundrect.winding - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.beginPath(); - ctx.fillStyle = '#f00'; - ctx.roundRect(0, 0, 50, 50, [0]); - ctx.roundRect(100, 50, -50, -50, [0]); - ctx.roundRect(0, 25, 100, -25, [0]); - ctx.roundRect(100, 25, -100, 25, [0]); - ctx.fill(); - @assert pixel 25,12 == 0,255,0,255; - @assert pixel 75,12 == 0,255,0,255; - @assert pixel 25,37 == 0,255,0,255; - @assert pixel 75,37 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.selfintersect - code: | - ctx.fillStyle = '#f00'; - ctx.roundRect(0, 0, 100, 50, [0]); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 90; - ctx.beginPath(); - ctx.roundRect(45, 20, 10, 10, [0]); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - expected: green - -- name: 2d.path.roundrect.nonfinite - desc: roundRect() with Infinity/NaN is ignored - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50) - ctx.moveTo(0, 0); - ctx.lineTo(100, 0); - @nonfinite ctx.roundRect(<0 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>, <1 Infinity -Infinity NaN>, <1 Infinity -Infinity NaN>, <[0] [Infinity] [-Infinity] [NaN] [Infinity,0] [-Infinity,0] [NaN,0] [0,Infinity] [0,-Infinity] [0,NaN] [Infinity,0,0] [-Infinity,0,0] [NaN,0,0] [0,Infinity,0] [0,-Infinity,0] [0,NaN,0] [0,0,Infinity] [0,0,-Infinity] [0,0,NaN] [Infinity,0,0,0] [-Infinity,0,0,0] [NaN,0,0,0] [0,Infinity,0,0] [0,-Infinity,0,0] [0,NaN,0,0] [0,0,Infinity,0] [0,0,-Infinity,0] [0,0,NaN,0] [0,0,0,Infinity] [0,0,0,-Infinity] [0,0,0,NaN]>); - ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, Infinity)]); - ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, -Infinity)]); - ctx.roundRect(0, 0, 100, 100, [new DOMPoint(10, NaN)]); - ctx.roundRect(0, 0, 100, 100, [new DOMPoint(Infinity, 10)]); - ctx.roundRect(0, 0, 100, 100, [new DOMPoint(-Infinity, 10)]); - ctx.roundRect(0, 0, 100, 100, [new DOMPoint(NaN, 10)]); - ctx.roundRect(0, 0, 100, 100, [{x: 10, y: Infinity}]); - ctx.roundRect(0, 0, 100, 100, [{x: 10, y: -Infinity}]); - ctx.roundRect(0, 0, 100, 100, [{x: 10, y: NaN}]); - ctx.roundRect(0, 0, 100, 100, [{x: Infinity, y: 10}]); - ctx.roundRect(0, 0, 100, 100, [{x: -Infinity, y: 10}]); - ctx.roundRect(0, 0, 100, 100, [{x: NaN, y: 10}]); - ctx.lineTo(100, 50); - ctx.lineTo(0, 50); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 90,45 == 0,255,0,255; - t.done(); - expected: green - -- name: 2d.path.roundrect.4.radii.1.double - desc: Verify that when four radii are given to roundRect(), the first radius, specified as a double, applies to the top-left corner. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [20, 0, 0, 0]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 1,1 == 255,0,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.4.radii.1.dompoint - desc: Verify that when four radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left corner. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0, 0, 0]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // top-left corner - @assert pixel 20,1 == 255,0,0,255; - @assert pixel 41,1 == 0,255,0,255; - @assert pixel 1,10 == 255,0,0,255; - @assert pixel 1,21 == 0,255,0,255; - - // other corners - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.4.radii.1.dompointinit - desc: Verify that when four radii are given to roundRect(), the first radius, specified as a DOMPointInit, applies to the top-left corner. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0, 0, 0]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // top-left corner - @assert pixel 20,1 == 255,0,0,255; - @assert pixel 41,1 == 0,255,0,255; - @assert pixel 1,10 == 255,0,0,255; - @assert pixel 1,21 == 0,255,0,255; - - // other corners - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.4.radii.2.double - desc: Verify that when four radii are given to roundRect(), the second radius, specified as a double, applies to the top-right corner. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [0, 20, 0, 0]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 255,0,0,255; - @assert pixel 98,48 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.4.radii.2.dompoint - desc: Verify that when four radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right corner. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20), 0, 0]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // top-right corner - @assert pixel 79,1 == 255,0,0,255; - @assert pixel 58,1 == 0,255,0,255; - @assert pixel 98,10 == 255,0,0,255; - @assert pixel 98,21 == 0,255,0,255; - - // other corners - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.4.radii.2.dompointinit - desc: Verify that when four radii are given to roundRect(), the second radius, specified as a DOMPointInit, applies to the top-right corner. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}, 0, 0]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // top-right corner - @assert pixel 79,1 == 255,0,0,255; - @assert pixel 58,1 == 0,255,0,255; - @assert pixel 98,10 == 255,0,0,255; - @assert pixel 98,21 == 0,255,0,255; - - // other corners - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.4.radii.3.double - desc: Verify that when four radii are given to roundRect(), the third radius, specified as a double, applies to the bottom-right corner. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [0, 0, 20, 0]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 98,48 == 255,0,0,255; - @assert pixel 1,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.4.radii.3.dompoint - desc: Verify that when four radii are given to roundRect(), the third radius, specified as a DOMPoint, applies to the bottom-right corner. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [0, 0, new DOMPoint(40, 20), 0]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // bottom-right corner - @assert pixel 79,48 == 255,0,0,255; - @assert pixel 58,48 == 0,255,0,255; - @assert pixel 98,39 == 255,0,0,255; - @assert pixel 98,28 == 0,255,0,255; - - // other corners - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.4.radii.3.dompointinit - desc: Verify that when four radii are given to roundRect(), the third radius, specified as a DOMPointInit, applies to the bottom-right corner. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [0, 0, {x: 40, y: 20}, 0]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // bottom-right corner - @assert pixel 79,48 == 255,0,0,255; - @assert pixel 58,48 == 0,255,0,255; - @assert pixel 98,39 == 255,0,0,255; - @assert pixel 98,28 == 0,255,0,255; - - // other corners - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.4.radii.4.double - desc: Verify that when four radii are given to roundRect(), the fourth radius, specified as a double, applies to the bottom-left corner. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [0, 0, 0, 20]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - @assert pixel 1,48 == 255,0,0,255; - t.done(); - -- name: 2d.path.roundrect.4.radii.4.dompoint - desc: Verify that when four radii are given to roundRect(), the fourth radius, specified as a DOMPoint, applies to the bottom-left corner. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [0, 0, 0, new DOMPoint(40, 20)]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // bottom-left corner - @assert pixel 20,48 == 255,0,0,255; - @assert pixel 41,48 == 0,255,0,255; - @assert pixel 1,39 == 255,0,0,255; - @assert pixel 1,28 == 0,255,0,255; - - // other corners - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.4.radii.4.dompointinit - desc: Verify that when four radii are given to roundRect(), the fourth radius, specified as a DOMPointInit, applies to the bottom-left corner. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [0, 0, 0, {x: 40, y: 20}]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // bottom-left corner - @assert pixel 20,48 == 255,0,0,255; - @assert pixel 41,48 == 0,255,0,255; - @assert pixel 1,39 == 255,0,0,255; - @assert pixel 1,28 == 0,255,0,255; - - // other corners - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.3.radii.1.double - desc: Verify that when three radii are given to roundRect(), the first radius, specified as a double, applies to the top-left corner. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [20, 0, 0]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 1,1 == 255,0,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.3.radii.1.dompoint - desc: Verify that when three radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left corner. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0, 0]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // top-left corner - @assert pixel 20,1 == 255,0,0,255; - @assert pixel 41,1 == 0,255,0,255; - @assert pixel 1,10 == 255,0,0,255; - @assert pixel 1,21 == 0,255,0,255; - - // other corners - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.3.radii.1.dompointinit - desc: Verify that when three radii are given to roundRect(), the first radius, specified as a DOMPointInit, applies to the top-left corner. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0, 0]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // top-left corner - @assert pixel 20,1 == 255,0,0,255; - @assert pixel 41,1 == 0,255,0,255; - @assert pixel 1,10 == 255,0,0,255; - @assert pixel 1,21 == 0,255,0,255; - - // other corners - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.3.radii.2.double - desc: Verify that when three radii are given to roundRect(), the second radius, specified as a double, applies to the top-right and bottom-left corners. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [0, 20, 0]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 255,0,0,255; - @assert pixel 98,48 == 0,255,0,255; - @assert pixel 1,48 == 255,0,0,255; - t.done(); - -- name: 2d.path.roundrect.3.radii.2.dompoint - desc: Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottom-left corners. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20), 0]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // top-right corner - @assert pixel 79,1 == 255,0,0,255; - @assert pixel 58,1 == 0,255,0,255; - @assert pixel 98,10 == 255,0,0,255; - @assert pixel 98,21 == 0,255,0,255; - - // bottom-left corner - @assert pixel 20,48 == 255,0,0,255; - @assert pixel 41,48 == 0,255,0,255; - @assert pixel 1,39 == 255,0,0,255; - @assert pixel 1,28 == 0,255,0,255; - - // other corners - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.3.radii.2.dompointinit - desc: Verify that when three radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottomInit-left corners. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}, 0]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // top-right corner - @assert pixel 79,1 == 255,0,0,255; - @assert pixel 58,1 == 0,255,0,255; - @assert pixel 98,10 == 255,0,0,255; - @assert pixel 98,21 == 0,255,0,255; - - // bottom-left corner - @assert pixel 20,48 == 255,0,0,255; - @assert pixel 41,48 == 0,255,0,255; - @assert pixel 1,39 == 255,0,0,255; - @assert pixel 1,28 == 0,255,0,255; - - // other corners - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.3.radii.3.double - desc: Verify that when three radii are given to roundRect(), the third radius, specified as a double, applies to the bottom-right corner. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [0, 0, 20]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 98,48 == 255,0,0,255; - @assert pixel 1,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.3.radii.3.dompoint - desc: Verify that when three radii are given to roundRect(), the third radius, specified as a DOMPoint, applies to the bottom-right corner. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [0, 0, new DOMPoint(40, 20)]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // bottom-right corner - @assert pixel 79,48 == 255,0,0,255; - @assert pixel 58,48 == 0,255,0,255; - @assert pixel 98,39 == 255,0,0,255; - @assert pixel 98,28 == 0,255,0,255; - - // other corners - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.3.radii.3.dompointinit - desc: Verify that when three radii are given to roundRect(), the third radius, specified as a DOMPointInit, applies to the bottom-right corner. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [0, 0, {x: 40, y: 20}]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // bottom-right corner - @assert pixel 79,48 == 255,0,0,255; - @assert pixel 58,48 == 0,255,0,255; - @assert pixel 98,39 == 255,0,0,255; - @assert pixel 98,28 == 0,255,0,255; - - // other corners - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.2.radii.1.double - desc: Verify that when two radii are given to roundRect(), the first radius, specified as a double, applies to the top-left and bottom-right corners. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [20, 0]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 1,1 == 255,0,0,255; - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 98,48 == 255,0,0,255; - @assert pixel 1,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.2.radii.1.dompoint - desc: Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottom-right corners. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20), 0]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // top-left corner - @assert pixel 20,1 == 255,0,0,255; - @assert pixel 41,1 == 0,255,0,255; - @assert pixel 1,10 == 255,0,0,255; - @assert pixel 1,21 == 0,255,0,255; - - // bottom-right corner - @assert pixel 79,48 == 255,0,0,255; - @assert pixel 58,48 == 0,255,0,255; - @assert pixel 98,39 == 255,0,0,255; - @assert pixel 98,28 == 0,255,0,255; - - // other corners - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.2.radii.1.dompointinit - desc: Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottomInit-right corners. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}, 0]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // top-left corner - @assert pixel 20,1 == 255,0,0,255; - @assert pixel 41,1 == 0,255,0,255; - @assert pixel 1,10 == 255,0,0,255; - @assert pixel 1,21 == 0,255,0,255; - - // bottom-right corner - @assert pixel 79,48 == 255,0,0,255; - @assert pixel 58,48 == 0,255,0,255; - @assert pixel 98,39 == 255,0,0,255; - @assert pixel 98,28 == 0,255,0,255; - - // other corners - @assert pixel 98,1 == 0,255,0,255; - @assert pixel 1,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.2.radii.2.double - desc: Verify that when two radii are given to roundRect(), the second radius, specified as a double, applies to the top-right and bottom-left corners. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [0, 20]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,1 == 255,0,0,255; - @assert pixel 98,48 == 0,255,0,255; - @assert pixel 1,48 == 255,0,0,255; - t.done(); - -- name: 2d.path.roundrect.2.radii.2.dompoint - desc: Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottom-left corners. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [0, new DOMPoint(40, 20)]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // top-right corner - @assert pixel 79,1 == 255,0,0,255; - @assert pixel 58,1 == 0,255,0,255; - @assert pixel 98,10 == 255,0,0,255; - @assert pixel 98,21 == 0,255,0,255; - - // bottom-left corner - @assert pixel 20,48 == 255,0,0,255; - @assert pixel 41,48 == 0,255,0,255; - @assert pixel 1,39 == 255,0,0,255; - @assert pixel 1,28 == 0,255,0,255; - - // other corners - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.2.radii.2.dompointinit - desc: Verify that when two radii are given to roundRect(), the second radius, specified as a DOMPoint, applies to the top-right and bottomInit-left corners. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [0, {x: 40, y: 20}]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // top-right corner - @assert pixel 79,1 == 255,0,0,255; - @assert pixel 58,1 == 0,255,0,255; - @assert pixel 98,10 == 255,0,0,255; - @assert pixel 98,21 == 0,255,0,255; - - // bottom-left corner - @assert pixel 20,48 == 255,0,0,255; - @assert pixel 41,48 == 0,255,0,255; - @assert pixel 1,39 == 255,0,0,255; - @assert pixel 1,28 == 0,255,0,255; - - // other corners - @assert pixel 1,1 == 0,255,0,255; - @assert pixel 98,48 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.1.radius.double - desc: Verify that when one radius is given to roundRect(), specified as a double, it applies to all corners. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [20]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 1,1 == 255,0,0,255; - @assert pixel 98,1 == 255,0,0,255; - @assert pixel 98,48 == 255,0,0,255; - @assert pixel 1,48 == 255,0,0,255; - t.done(); - -- name: 2d.path.roundrect.1.radius.dompoint - desc: Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottom-left corners. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [new DOMPoint(40, 20)]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // top-left corner - @assert pixel 20,1 == 255,0,0,255; - @assert pixel 41,1 == 0,255,0,255; - @assert pixel 1,10 == 255,0,0,255; - @assert pixel 1,21 == 0,255,0,255; - - // top-right corner - @assert pixel 79,1 == 255,0,0,255; - @assert pixel 58,1 == 0,255,0,255; - @assert pixel 98,10 == 255,0,0,255; - @assert pixel 98,21 == 0,255,0,255; - - // bottom-right corner - @assert pixel 79,48 == 255,0,0,255; - @assert pixel 58,48 == 0,255,0,255; - @assert pixel 98,39 == 255,0,0,255; - @assert pixel 98,28 == 0,255,0,255; - - // bottom-left corner - @assert pixel 20,48 == 255,0,0,255; - @assert pixel 41,48 == 0,255,0,255; - @assert pixel 1,39 == 255,0,0,255; - @assert pixel 1,28 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.1.radius.dompointinit - desc: Verify that when two radii are given to roundRect(), the first radius, specified as a DOMPoint, applies to the top-left and bottomInit-left corners. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [{x: 40, y: 20}]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - - // top-left corner - @assert pixel 20,1 == 255,0,0,255; - @assert pixel 41,1 == 0,255,0,255; - @assert pixel 1,10 == 255,0,0,255; - @assert pixel 1,21 == 0,255,0,255; - - // top-right corner - @assert pixel 79,1 == 255,0,0,255; - @assert pixel 58,1 == 0,255,0,255; - @assert pixel 98,10 == 255,0,0,255; - @assert pixel 98,21 == 0,255,0,255; - - // bottom-right corner - @assert pixel 79,48 == 255,0,0,255; - @assert pixel 58,48 == 0,255,0,255; - @assert pixel 98,39 == 255,0,0,255; - @assert pixel 98,28 == 0,255,0,255; - - // bottom-left corner - @assert pixel 20,48 == 255,0,0,255; - @assert pixel 41,48 == 0,255,0,255; - @assert pixel 1,39 == 255,0,0,255; - @assert pixel 1,28 == 0,255,0,255; - t.done(); - -- name: 2d.path.roundrect.radius.intersecting.1 - desc: Check that roundRects with intersecting corner arcs are rendered correctly. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [40, 40, 40, 40]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 2,25 == 0,255,0,255; - @assert pixel 50,1 == 0,255,0,255; - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 50,48 == 0,255,0,255; - @assert pixel 97,25 == 0,255,0,255; - @assert pixel 1,1 == 255,0,0,255; - @assert pixel 98,1 == 255,0,0,255; - @assert pixel 1,48 == 255,0,0,255; - @assert pixel 98,48 == 255,0,0,255; - t.done(); - -- name: 2d.path.roundrect.radius.intersecting.2 - desc: Check that roundRects with intersecting corner arcs are rendered correctly. - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.roundRect(0, 0, 100, 50, [1000, 1000, 1000, 1000]); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 2,25 == 0,255,0,255; - @assert pixel 50,1 == 0,255,0,255; - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 50,48 == 0,255,0,255; - @assert pixel 97,25 == 0,255,0,255; - @assert pixel 1,1 == 255,0,0,255; - @assert pixel 98,1 == 255,0,0,255; - @assert pixel 1,48 == 255,0,0,255; - @assert pixel 98,48 == 255,0,0,255; - t.done(); - -- name: 2d.path.roundrect.radius.none - desc: Check that roundRect throws an RangeError if radii is an empty array. - code: | - assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 100, 50, [])}); - t.done(); - -- name: 2d.path.roundrect.radius.toomany - desc: Check that roundRect throws an IndeSizeError if radii has more than four items. - code: | - assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 100, 50, [0, 0, 0, 0, 0])}); - t.done(); - -- name: 2d.path.roundrect.radius.negative - desc: roundRect() with negative radius throws an exception - code: | - assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [-1])}); - assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [1, -1])}); - assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [new DOMPoint(-1, 1), 1])}); - assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [new DOMPoint(1, -1)])}); - assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [{x: -1, y: 1}, 1])}); - assert_throws_js(RangeError, () => { ctx.roundRect(0, 0, 0, 0, [{x: 1, y: -1}])}); - t.done(); - -- name: 2d.path.fill.overlap - code: | - ctx.fillStyle = '#000'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = 'rgba(0, 255, 0, 0.5)'; - ctx.rect(0, 0, 100, 50); - ctx.closePath(); - ctx.rect(10, 10, 80, 30); - ctx.fill(); - @assert pixel 50,25 ==~ 0,127,0,255 +/- 1; - t.done(); - -- name: 2d.path.fill.winding.add - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#0f0'; - ctx.moveTo(-10, -10); - ctx.lineTo(110, -10); - ctx.lineTo(110, 60); - ctx.lineTo(-10, 60); - ctx.lineTo(-10, -10); - ctx.lineTo(0, 0); - ctx.lineTo(100, 0); - ctx.lineTo(100, 50); - ctx.lineTo(0, 50); - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.fill.winding.subtract.1 - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#f00'; - ctx.moveTo(-10, -10); - ctx.lineTo(110, -10); - ctx.lineTo(110, 60); - ctx.lineTo(-10, 60); - ctx.lineTo(-10, -10); - ctx.lineTo(0, 0); - ctx.lineTo(0, 50); - ctx.lineTo(100, 50); - ctx.lineTo(100, 0); - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.fill.winding.subtract.2 - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#f00'; - ctx.moveTo(-10, -10); - ctx.lineTo(110, -10); - ctx.lineTo(110, 60); - ctx.lineTo(-10, 60); - ctx.moveTo(0, 0); - ctx.lineTo(0, 50); - ctx.lineTo(100, 50); - ctx.lineTo(100, 0); - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.fill.winding.subtract.3 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#0f0'; - ctx.moveTo(-10, -10); - ctx.lineTo(110, -10); - ctx.lineTo(110, 60); - ctx.lineTo(-10, 60); - ctx.lineTo(-10, -10); - ctx.lineTo(-20, -20); - ctx.lineTo(120, -20); - ctx.lineTo(120, 70); - ctx.lineTo(-20, 70); - ctx.lineTo(-20, -20); - ctx.lineTo(0, 0); - ctx.lineTo(0, 50); - ctx.lineTo(100, 50); - ctx.lineTo(100, 0); - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.fill.closed.basic - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#0f0'; - ctx.moveTo(0, 0); - ctx.lineTo(100, 0); - ctx.lineTo(100, 50); - ctx.lineTo(0, 50); - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.fill.closed.unaffected - code: | - ctx.fillStyle = '#00f'; - ctx.fillRect(0, 0, 100, 50); - ctx.moveTo(0, 0); - ctx.lineTo(100, 0); - ctx.lineTo(100, 50); - ctx.fillStyle = '#f00'; - ctx.fill(); - ctx.lineTo(0, 50); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 90,10 == 0,255,0,255; - @assert pixel 10,40 == 0,255,0,255; - t.done(); - -- name: 2d.path.stroke.overlap - desc: Stroked subpaths are combined before being drawn - code: | - ctx.fillStyle = '#000'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = 'rgba(0, 255, 0, 0.5)'; - ctx.lineWidth = 50; - ctx.moveTo(0, 20); - ctx.lineTo(100, 20); - ctx.moveTo(0, 30); - ctx.lineTo(100, 30); - ctx.stroke(); - @assert pixel 50,25 ==~ 0,127,0,255 +/- 1; - t.done(); - -- name: 2d.path.stroke.union - desc: Strokes in opposite directions are unioned, not subtracted - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 40; - ctx.moveTo(0, 10); - ctx.lineTo(100, 10); - ctx.moveTo(100, 40); - ctx.lineTo(0, 40); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.stroke.unaffected - desc: Stroking does not start a new path or subpath - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.moveTo(-100, 25); - ctx.lineTo(-100, -100); - ctx.lineTo(200, -100); - ctx.lineTo(200, 25); - ctx.strokeStyle = '#f00'; - ctx.stroke(); - ctx.closePath(); - ctx.strokeStyle = '#0f0'; - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.stroke.scale1 - desc: Stroke line widths are scaled by the current transformation matrix - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.beginPath(); - ctx.rect(25, 12.5, 50, 25); - ctx.save(); - ctx.scale(50, 25); - ctx.strokeStyle = '#0f0'; - ctx.stroke(); - ctx.restore(); - ctx.beginPath(); - ctx.rect(-25, -12.5, 150, 75); - ctx.save(); - ctx.scale(50, 25); - ctx.strokeStyle = '#f00'; - ctx.stroke(); - ctx.restore(); - @assert pixel 0,0 == 0,255,0,255; - @assert pixel 50,0 == 0,255,0,255; - @assert pixel 99,0 == 0,255,0,255; - @assert pixel 0,25 == 0,255,0,255; - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 99,25 == 0,255,0,255; - @assert pixel 0,49 == 0,255,0,255; - @assert pixel 50,49 == 0,255,0,255; - @assert pixel 99,49 == 0,255,0,255; - t.done(); - -- name: 2d.path.stroke.scale2 - desc: Stroke line widths are scaled by the current transformation matrix - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.beginPath(); - ctx.rect(25, 12.5, 50, 25); - ctx.save(); - ctx.rotate(Math.PI/2); - ctx.scale(25, 50); - ctx.strokeStyle = '#0f0'; - ctx.stroke(); - ctx.restore(); - ctx.beginPath(); - ctx.rect(-25, -12.5, 150, 75); - ctx.save(); - ctx.rotate(Math.PI/2); - ctx.scale(25, 50); - ctx.strokeStyle = '#f00'; - ctx.stroke(); - ctx.restore(); - @assert pixel 0,0 == 0,255,0,255; - @assert pixel 50,0 == 0,255,0,255; - @assert pixel 99,0 == 0,255,0,255; - @assert pixel 0,25 == 0,255,0,255; - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 99,25 == 0,255,0,255; - @assert pixel 0,49 == 0,255,0,255; - @assert pixel 50,49 == 0,255,0,255; - @assert pixel 99,49 == 0,255,0,255; - t.done(); - -- name: 2d.path.stroke.skew - desc: Strokes lines are skewed by the current transformation matrix - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.save(); - ctx.beginPath(); - ctx.moveTo(49, -50); - ctx.lineTo(201, -50); - ctx.rotate(Math.PI/4); - ctx.scale(1, 283); - ctx.strokeStyle = '#0f0'; - ctx.stroke(); - ctx.restore(); - ctx.save(); - ctx.beginPath(); - ctx.translate(-150, 0); - ctx.moveTo(49, -50); - ctx.lineTo(199, -50); - ctx.rotate(Math.PI/4); - ctx.scale(1, 142); - ctx.strokeStyle = '#f00'; - ctx.stroke(); - ctx.restore(); - ctx.save(); - ctx.beginPath(); - ctx.translate(-150, 0); - ctx.moveTo(49, -50); - ctx.lineTo(199, -50); - ctx.rotate(Math.PI/4); - ctx.scale(1, 142); - ctx.strokeStyle = '#f00'; - ctx.stroke(); - ctx.restore(); - @assert pixel 0,0 == 0,255,0,255; - @assert pixel 50,0 == 0,255,0,255; - @assert pixel 99,0 == 0,255,0,255; - @assert pixel 0,25 == 0,255,0,255; - @assert pixel 50,25 == 0,255,0,255; - @assert pixel 99,25 == 0,255,0,255; - @assert pixel 0,49 == 0,255,0,255; - @assert pixel 50,49 == 0,255,0,255; - @assert pixel 99,49 == 0,255,0,255; - t.done(); - -- name: 2d.path.stroke.empty - desc: Empty subpaths are not stroked - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 100; - ctx.lineCap = 'round'; - ctx.lineJoin = 'round'; - ctx.beginPath(); - ctx.moveTo(40, 25); - ctx.moveTo(60, 25); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.stroke.prune.line - desc: Zero-length line segments from lineTo are removed before stroking - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 100; - ctx.lineCap = 'round'; - ctx.lineJoin = 'round'; - ctx.beginPath(); - ctx.moveTo(50, 25); - ctx.lineTo(50, 25); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; @moz-todo - t.done(); - -- name: 2d.path.stroke.prune.closed - desc: Zero-length line segments from closed paths are removed before stroking - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 100; - ctx.lineCap = 'round'; - ctx.lineJoin = 'round'; - ctx.beginPath(); - ctx.moveTo(50, 25); - ctx.lineTo(50, 25); - ctx.closePath(); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; @moz-todo - t.done(); - -- name: 2d.path.stroke.prune.curve - desc: Zero-length line segments from quadraticCurveTo and bezierCurveTo are removed - before stroking - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 100; - ctx.lineCap = 'round'; - ctx.lineJoin = 'round'; - ctx.beginPath(); - ctx.moveTo(50, 25); - ctx.quadraticCurveTo(50, 25, 50, 25); - ctx.stroke(); - ctx.beginPath(); - ctx.moveTo(50, 25); - ctx.bezierCurveTo(50, 25, 50, 25, 50, 25); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; @moz-todo - t.done(); - -- name: 2d.path.stroke.prune.arc - desc: Zero-length line segments from arcTo and arc are removed before stroking - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 100; - ctx.lineCap = 'round'; - ctx.lineJoin = 'round'; - ctx.beginPath(); - ctx.moveTo(50, 25); - ctx.arcTo(50, 25, 150, 25, 10); - ctx.stroke(); - ctx.beginPath(); - ctx.moveTo(60, 25); - ctx.arc(50, 25, 10, 0, 0, false); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; @moz-todo - t.done(); - -- name: 2d.path.stroke.prune.rect - desc: Zero-length line segments from rect and strokeRect are removed before stroking - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 100; - ctx.lineCap = 'round'; - ctx.lineJoin = 'round'; - ctx.beginPath(); - ctx.rect(50, 25, 0, 0); - ctx.stroke(); - ctx.strokeRect(50, 25, 0, 0); - @assert pixel 50,25 == 0,255,0,255; @moz-todo - t.done(); - -- name: 2d.path.stroke.prune.corner - desc: Zero-length line segments are removed before stroking with miters - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 400; - ctx.lineJoin = 'miter'; - ctx.miterLimit = 1.4; - ctx.beginPath(); - ctx.moveTo(-1000, 200); - ctx.lineTo(-100, 200); - ctx.lineTo(-100, 200); - ctx.lineTo(-100, 200); - ctx.lineTo(-100, 1000); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.transformation.basic - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.translate(-100, 0); - ctx.rect(100, 0, 100, 50); - ctx.translate(0, -100); - ctx.fillStyle = '#0f0'; - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.transformation.multiple - desc: Transformations are applied while building paths, not when drawing - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#f00'; - ctx.translate(-100, 0); - ctx.rect(0, 0, 100, 50); - ctx.fill(); - ctx.translate(100, 0); - ctx.fill(); - ctx.beginPath(); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 50; - ctx.translate(0, -50); - ctx.moveTo(0, 25); - ctx.lineTo(100, 25); - ctx.stroke(); - ctx.translate(0, 50); - ctx.stroke(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.transformation.changing - desc: Transformations are applied while building paths, not when drawing - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#0f0'; - ctx.moveTo(0, 0); - ctx.translate(100, 0); - ctx.lineTo(0, 0); - ctx.translate(0, 50); - ctx.lineTo(0, 0); - ctx.translate(-100, 0); - ctx.lineTo(0, 0); - ctx.translate(1000, 1000); - ctx.rotate(Math.PI/2); - ctx.scale(0.1, 0.1); - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.clip.empty - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.beginPath(); - ctx.clip(); - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.clip.basic.1 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.beginPath(); - ctx.rect(0, 0, 100, 50); - ctx.clip(); - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.clip.basic.2 - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.beginPath(); - ctx.rect(-100, 0, 100, 50); - ctx.clip(); - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.clip.intersect - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.beginPath(); - ctx.rect(0, 0, 50, 50); - ctx.clip(); - ctx.beginPath(); - ctx.rect(50, 0, 50, 50) - ctx.clip(); - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.clip.winding.1 - code: | - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.beginPath(); - ctx.moveTo(-10, -10); - ctx.lineTo(110, -10); - ctx.lineTo(110, 60); - ctx.lineTo(-10, 60); - ctx.lineTo(-10, -10); - ctx.lineTo(0, 0); - ctx.lineTo(0, 50); - ctx.lineTo(100, 50); - ctx.lineTo(100, 0); - ctx.clip(); - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.clip.winding.2 - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.beginPath(); - ctx.moveTo(-10, -10); - ctx.lineTo(110, -10); - ctx.lineTo(110, 60); - ctx.lineTo(-10, 60); - ctx.lineTo(-10, -10); - ctx.clip(); - ctx.beginPath(); - ctx.moveTo(0, 0); - ctx.lineTo(0, 50); - ctx.lineTo(100, 50); - ctx.lineTo(100, 0); - ctx.lineTo(0, 0); - ctx.clip(); - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.clip.unaffected - code: | - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(0, 0); - ctx.lineTo(0, 50); - ctx.lineTo(100, 50); - ctx.lineTo(100, 0); - ctx.clip(); - ctx.lineTo(0, 0); - ctx.fill(); - @assert pixel 50,25 == 0,255,0,255; - t.done(); - -- name: 2d.path.isPointInPath.basic.1 - desc: isPointInPath() detects whether the point is inside the path - code: | - ctx.rect(0, 0, 20, 20); - @assert ctx.isPointInPath(10, 10) === true; - @assert ctx.isPointInPath(30, 10) === false; - t.done(); - -- name: 2d.path.isPointInPath.basic.2 - desc: isPointInPath() detects whether the point is inside the path - code: | - ctx.rect(20, 0, 20, 20); - @assert ctx.isPointInPath(10, 10) === false; - @assert ctx.isPointInPath(30, 10) === true; - t.done(); - -- name: 2d.path.isPointInPath.edge - desc: isPointInPath() counts points on the path as being inside - code: | - ctx.rect(0, 0, 20, 20); - @assert ctx.isPointInPath(0, 0) === true; - @assert ctx.isPointInPath(10, 0) === true; - @assert ctx.isPointInPath(20, 0) === true; - @assert ctx.isPointInPath(20, 10) === true; - @assert ctx.isPointInPath(20, 20) === true; - @assert ctx.isPointInPath(10, 20) === true; - @assert ctx.isPointInPath(0, 20) === true; - @assert ctx.isPointInPath(0, 10) === true; - @assert ctx.isPointInPath(10, -0.01) === false; - @assert ctx.isPointInPath(10, 20.01) === false; - @assert ctx.isPointInPath(-0.01, 10) === false; - @assert ctx.isPointInPath(20.01, 10) === false; - t.done(); - -- name: 2d.path.isPointInPath.empty - desc: isPointInPath() works when there is no path - code: | - @assert ctx.isPointInPath(0, 0) === false; - t.done(); - -- name: 2d.path.isPointInPath.subpath - desc: isPointInPath() uses the current path, not just the subpath - code: | - ctx.rect(0, 0, 20, 20); - ctx.beginPath(); - ctx.rect(20, 0, 20, 20); - ctx.closePath(); - ctx.rect(40, 0, 20, 20); - @assert ctx.isPointInPath(10, 10) === false; - @assert ctx.isPointInPath(30, 10) === true; - @assert ctx.isPointInPath(50, 10) === true; - t.done(); - -- name: 2d.path.isPointInPath.outside - desc: isPointInPath() works on paths outside the canvas - code: | - ctx.rect(0, -100, 20, 20); - ctx.rect(20, -10, 20, 20); - @assert ctx.isPointInPath(10, -110) === false; - @assert ctx.isPointInPath(10, -90) === true; - @assert ctx.isPointInPath(10, -70) === false; - @assert ctx.isPointInPath(30, -20) === false; - @assert ctx.isPointInPath(30, 0) === true; - @assert ctx.isPointInPath(30, 20) === false; - t.done(); - -- name: 2d.path.isPointInPath.unclosed - desc: isPointInPath() works on unclosed subpaths - code: | - ctx.moveTo(0, 0); - ctx.lineTo(20, 0); - ctx.lineTo(20, 20); - ctx.lineTo(0, 20); - @assert ctx.isPointInPath(10, 10) === true; - @assert ctx.isPointInPath(30, 10) === false; - t.done(); - -- name: 2d.path.isPointInPath.arc - desc: isPointInPath() works on arcs - code: | - ctx.arc(50, 25, 10, 0, Math.PI, false); - @assert ctx.isPointInPath(50, 10) === false; - @assert ctx.isPointInPath(50, 20) === false; - @assert ctx.isPointInPath(50, 30) === true; - @assert ctx.isPointInPath(50, 40) === false; - @assert ctx.isPointInPath(30, 20) === false; - @assert ctx.isPointInPath(70, 20) === false; - @assert ctx.isPointInPath(30, 30) === false; - @assert ctx.isPointInPath(70, 30) === false; - t.done(); - -- name: 2d.path.isPointInPath.bigarc - desc: isPointInPath() works on unclosed arcs larger than 2pi - opera: {bug: 320937} - code: | - ctx.arc(50, 25, 10, 0, 7, false); - @assert ctx.isPointInPath(50, 10) === false; - @assert ctx.isPointInPath(50, 20) === true; - @assert ctx.isPointInPath(50, 30) === true; - @assert ctx.isPointInPath(50, 40) === false; - @assert ctx.isPointInPath(30, 20) === false; - @assert ctx.isPointInPath(70, 20) === false; - @assert ctx.isPointInPath(30, 30) === false; - @assert ctx.isPointInPath(70, 30) === false; - t.done(); - -- name: 2d.path.isPointInPath.bezier - desc: isPointInPath() works on Bezier curves - code: | - ctx.moveTo(25, 25); - ctx.bezierCurveTo(50, -50, 50, 100, 75, 25); - @assert ctx.isPointInPath(25, 20) === false; - @assert ctx.isPointInPath(25, 30) === false; - @assert ctx.isPointInPath(30, 20) === true; - @assert ctx.isPointInPath(30, 30) === false; - @assert ctx.isPointInPath(40, 2) === false; - @assert ctx.isPointInPath(40, 20) === true; - @assert ctx.isPointInPath(40, 30) === false; - @assert ctx.isPointInPath(40, 47) === false; - @assert ctx.isPointInPath(45, 20) === true; - @assert ctx.isPointInPath(45, 30) === false; - @assert ctx.isPointInPath(55, 20) === false; - @assert ctx.isPointInPath(55, 30) === true; - @assert ctx.isPointInPath(60, 2) === false; - @assert ctx.isPointInPath(60, 20) === false; - @assert ctx.isPointInPath(60, 30) === true; - @assert ctx.isPointInPath(60, 47) === false; - @assert ctx.isPointInPath(70, 20) === false; - @assert ctx.isPointInPath(70, 30) === true; - @assert ctx.isPointInPath(75, 20) === false; - @assert ctx.isPointInPath(75, 30) === false; - t.done(); - -- name: 2d.path.isPointInPath.winding - desc: isPointInPath() uses the non-zero winding number rule - code: | - // Create a square ring, using opposite windings to make a hole in the centre - ctx.moveTo(0, 0); - ctx.lineTo(50, 0); - ctx.lineTo(50, 50); - ctx.lineTo(0, 50); - ctx.lineTo(0, 0); - ctx.lineTo(10, 10); - ctx.lineTo(10, 40); - ctx.lineTo(40, 40); - ctx.lineTo(40, 10); - ctx.lineTo(10, 10); - @assert ctx.isPointInPath(5, 5) === true; - @assert ctx.isPointInPath(25, 5) === true; - @assert ctx.isPointInPath(45, 5) === true; - @assert ctx.isPointInPath(5, 25) === true; - @assert ctx.isPointInPath(25, 25) === false; - @assert ctx.isPointInPath(45, 25) === true; - @assert ctx.isPointInPath(5, 45) === true; - @assert ctx.isPointInPath(25, 45) === true; - @assert ctx.isPointInPath(45, 45) === true; - t.done(); - -- name: 2d.path.isPointInPath.transform.1 - desc: isPointInPath() handles transformations correctly - code: | - ctx.translate(50, 0); - ctx.rect(0, 0, 20, 20); - @assert ctx.isPointInPath(-40, 10) === false; - @assert ctx.isPointInPath(10, 10) === false; - @assert ctx.isPointInPath(49, 10) === false; - @assert ctx.isPointInPath(51, 10) === true; - @assert ctx.isPointInPath(69, 10) === true; - @assert ctx.isPointInPath(71, 10) === false; - t.done(); - -- name: 2d.path.isPointInPath.transform.2 - desc: isPointInPath() handles transformations correctly - code: | - ctx.rect(50, 0, 20, 20); - ctx.translate(50, 0); - @assert ctx.isPointInPath(-40, 10) === false; - @assert ctx.isPointInPath(10, 10) === false; - @assert ctx.isPointInPath(49, 10) === false; - @assert ctx.isPointInPath(51, 10) === true; - @assert ctx.isPointInPath(69, 10) === true; - @assert ctx.isPointInPath(71, 10) === false; - t.done(); - -- name: 2d.path.isPointInPath.transform.3 - desc: isPointInPath() handles transformations correctly - code: | - ctx.scale(-1, 1); - ctx.rect(-70, 0, 20, 20); - @assert ctx.isPointInPath(-40, 10) === false; - @assert ctx.isPointInPath(10, 10) === false; - @assert ctx.isPointInPath(49, 10) === false; - @assert ctx.isPointInPath(51, 10) === true; - @assert ctx.isPointInPath(69, 10) === true; - @assert ctx.isPointInPath(71, 10) === false; - t.done(); - -- name: 2d.path.isPointInPath.transform.4 - desc: isPointInPath() handles transformations correctly - code: | - ctx.translate(50, 0); - ctx.rect(50, 0, 20, 20); - ctx.translate(0, 50); - @assert ctx.isPointInPath(60, 10) === false; - @assert ctx.isPointInPath(110, 10) === true; - @assert ctx.isPointInPath(110, 60) === false; - t.done(); - -- name: 2d.path.isPointInPath.nonfinite - desc: isPointInPath() returns false for non-finite arguments - code: | - ctx.rect(-100, -50, 200, 100); - @assert ctx.isPointInPath(Infinity, 0) === false; - @assert ctx.isPointInPath(-Infinity, 0) === false; - @assert ctx.isPointInPath(NaN, 0) === false; - @assert ctx.isPointInPath(0, Infinity) === false; - @assert ctx.isPointInPath(0, -Infinity) === false; - @assert ctx.isPointInPath(0, NaN) === false; - @assert ctx.isPointInPath(NaN, NaN) === false; - t.done(); - -- name: 2d.path.isPointInStroke.basic - desc: detects whether point is in the area contained by the stroke of the path - code: | - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.rect(0, 0, 20, 20); - @assert ctx.isPointInStroke(0, 0) === true; - @assert ctx.isPointInStroke(30, 10) === false; - - var path = new Path2D(); - path.rect(20, 20, 100, 100); - @assert ctx.isPointInStroke(path, 20, 20) === true; - @assert ctx.isPointInStroke(path, 120, 20) === true; - t.done(); diff --git a/tests/wpt/web-platform-tests/html/embedded-content/the-img-element/attr-img-fetchpriority.html b/tests/wpt/web-platform-tests/html/embedded-content/the-img-element/attr-img-fetchpriority.html index 996aa4d1567..40daf958705 100644 --- a/tests/wpt/web-platform-tests/html/embedded-content/the-img-element/attr-img-fetchpriority.html +++ b/tests/wpt/web-platform-tests/html/embedded-content/the-img-element/attr-img-fetchpriority.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<title>Priority Hints - Image element</title> +<title>Fetch Priority - Image element</title> <meta name="author" title="Dominic Farolino" href="mailto:domfarolino@gmail.com"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> diff --git a/tests/wpt/web-platform-tests/html/rendering/widgets/input-checkbox-no-centering.html b/tests/wpt/web-platform-tests/html/rendering/widgets/input-checkbox-no-centering.html new file mode 100644 index 00000000000..7dba149c75f --- /dev/null +++ b/tests/wpt/web-platform-tests/html/rendering/widgets/input-checkbox-no-centering.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1441341"> +<link rel="match" href="input-no-centering-ref.html"> +<style> +input { + appearance: none; + margin: 0; + width: 200px; + height: 200px; +} +input:before { + content: ""; + display: block; + width: 100px; + height: 100px; + background: green; +} +</style> +<input type="checkbox"> diff --git a/tests/wpt/web-platform-tests/html/rendering/widgets/input-no-centering-ref.html b/tests/wpt/web-platform-tests/html/rendering/widgets/input-no-centering-ref.html new file mode 100644 index 00000000000..5b2ea91fe5f --- /dev/null +++ b/tests/wpt/web-platform-tests/html/rendering/widgets/input-no-centering-ref.html @@ -0,0 +1,2 @@ +<!DOCTYPE html> +<div style="width: 100px; height: 100px; background: green;"></div> diff --git a/tests/wpt/web-platform-tests/html/rendering/widgets/input-radio-no-centering.html b/tests/wpt/web-platform-tests/html/rendering/widgets/input-radio-no-centering.html new file mode 100644 index 00000000000..6a714f84600 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/rendering/widgets/input-radio-no-centering.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1441341"> +<link rel="match" href="input-no-centering-ref.html"> +<style> +input { + appearance: none; + margin: 0; + width: 200px; + height: 200px; +} +input:before { + content: ""; + display: block; + width: 100px; + height: 100px; + background: green; +} +</style> +<input type="radio"> diff --git a/tests/wpt/web-platform-tests/html/scripting/the-script-element/attr-script-fetchpriority.html b/tests/wpt/web-platform-tests/html/scripting/the-script-element/attr-script-fetchpriority.html index 8639d04d86a..738c9eab747 100644 --- a/tests/wpt/web-platform-tests/html/scripting/the-script-element/attr-script-fetchpriority.html +++ b/tests/wpt/web-platform-tests/html/scripting/the-script-element/attr-script-fetchpriority.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<title>Priority Hints - Script element</title> +<title>Fetch Priority - Script element</title> <meta name="author" title="Patrick Meenan" href="mailto:patmeenan@gmail.com"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-selectmenu-element/selectmenu-disabled.tentative.html b/tests/wpt/web-platform-tests/html/semantics/forms/the-selectmenu-element/selectmenu-disabled.tentative.html new file mode 100644 index 00000000000..0fe722fdfed --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/forms/the-selectmenu-element/selectmenu-disabled.tentative.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="/resources/testdriver-vendor.js"></script> + +<script> +focused_element_id = null; + +function OnFocus(event) { + focused_element_id = event.target.id; +} +</script> + +<selectmenu id="selectmenu" onfocus="OnFocus(event)" disabled> + <option>one</option> + <option>two</option> + <option>three</option> +</selectmenu> + +<script> +promise_test(async () => { + const selectmenu = document.getElementById("selectmenu"); + selectmenu.focus(); + assert_equals(focused_element_id, null); +}, "Check that disabled <selectmenu> cannot be focused"); +</script> diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-selectmenu-element/selectmenu-events.tentative.html b/tests/wpt/web-platform-tests/html/semantics/forms/the-selectmenu-element/selectmenu-events.tentative.html index 7e572b5418c..830daaabc38 100644 --- a/tests/wpt/web-platform-tests/html/semantics/forms/the-selectmenu-element/selectmenu-events.tentative.html +++ b/tests/wpt/web-platform-tests/html/semantics/forms/the-selectmenu-element/selectmenu-events.tentative.html @@ -41,6 +41,20 @@ <option id="selectMenu4-option2">two</option> </selectmenu> +<selectmenu id="selectMenu5WithTabIndex" tabindex="1"> + <option>one</option> + <option>two</option> +</selectmenu> + +<input id="input6"/> +<selectmenu id="selectMenu7"> + <button slot="button" behavior="button" id="selectMenu7-button"> + selectMenu7-button + </button> + <option>one</option> + <option>two</option> +</selectmenu> + <script> function clickOn(element) { @@ -79,10 +93,11 @@ // See https://w3c.github.io/webdriver/#keyboard-actions const KEY_CODE_MAP = { + 'Tab': '\uE004', 'Enter': '\uE007', 'Space': '\uE00D', 'ArrowUp': '\uE013', - 'ArrowDown': '\uE015' + 'ArrowDown': '\uE015', }; promise_test(async () => { @@ -204,4 +219,39 @@ assert_equals(input_event_count, 1, "input event shouldn't fire when selected option didn't change"); assert_equals(change_event_count, 1, "change event shouldn't fire when selected option didn't change"); }, "<selectmenu> should fire input and change events when option in listbox is clicked"); + + promise_test(async() => { + const selectMenu = document.getElementById("selectMenu2"); + await test_driver.send_keys(selectMenu, " "); + assert_true(selectMenu.open, "<Space> should open selectmenu"); + await test_driver.send_keys(selectMenu, KEY_CODE_MAP.Enter); + assert_false(selectMenu.open, "<Enter> should close selectmenu"); + }, "Check that <Space> opens <selectmenu>."); + + promise_test(async() => { + const selectMenu = document.getElementById("selectMenu5WithTabIndex"); + await test_driver.send_keys(selectMenu, " "); + assert_true(selectMenu.open, "<Space> should open selectmenu"); + await test_driver.send_keys(selectMenu, KEY_CODE_MAP.Enter); + assert_false(selectMenu.open, "<Enter> should close selectmenu"); + }, "Check that <Space> opens <selectmenu> when <selectmenu> specifies tabindex"); + + promise_test(async() => { + const input6 = document.getElementById("input6"); + const selectMenu = document.getElementById("selectMenu7"); + const selectMenuButton = document.getElementById("selectMenu7-button") + + var keydown_count = 0; + selectMenuButton.addEventListener("keydown", (e) => { + keydown_count++; + }); + + // Focus selectmenu via Tab traversal because focus() does not work when selectmenu + // has custom slot. + // TODO(http://crbug.com/1440573) Fix this. + await test_driver.send_keys(input6, KEY_CODE_MAP.Tab); + + await test_driver.send_keys(selectMenu, "a"); + assert_equals(keydown_count, 1, "button in shadowroot should have observed keydown"); +}, "Test that <selectmenu> button slot receives key events."); </script> diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-selectmenu-element/selectmenu-tab-navigation.tentative.html b/tests/wpt/web-platform-tests/html/semantics/forms/the-selectmenu-element/selectmenu-tab-navigation.tentative.html new file mode 100644 index 00000000000..3d583335ed1 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/forms/the-selectmenu-element/selectmenu-tab-navigation.tentative.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="/resources/testdriver-vendor.js"></script> + +<input id="input1"> +<selectmenu id="selectmenu"> + <option>one</option> + <option>two</option> + <option>three</option> +</selectmenu> +<input id="input3"> + +<script> +promise_test(async () => { + const TAB_KEY = "\uE004"; + + const input1 = document.getElementById("input1"); + const selectmenu = document.getElementById("selectmenu"); + + input1.focus(); + assert_equals(document.activeElement.id, "input1", "input1 should be active"); + + await test_driver.send_keys(input1, TAB_KEY); + assert_equals(document.activeElement.id, "selectmenu", "selectmenu should be active"); + + await test_driver.send_keys(selectmenu, TAB_KEY); + assert_equals(document.activeElement.id, "input3", "input3 should be active"); +}, "Check that <selectmenu> occupies just one slot in tab navigation."); +</script> + diff --git a/tests/wpt/web-platform-tests/html/semantics/forms/the-selectmenu-element/selectmenu-tabindex-order.tentative.html b/tests/wpt/web-platform-tests/html/semantics/forms/the-selectmenu-element/selectmenu-tabindex-order.tentative.html new file mode 100644 index 00000000000..b4fa2a1e757 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/forms/the-selectmenu-element/selectmenu-tabindex-order.tentative.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="/resources/testdriver-vendor.js"></script> + +<input id="input1"> +<selectmenu id="selectmenu" tabindex="2"> + <option>one</option> + <option>two</option> + <option>three</option> +</selectmenu> +<input id="input3" tabindex="1"> + +<script> +promise_test(async () => { + const TAB_KEY = "\uE004"; + + const input1 = document.getElementById("input1"); + const input3 = document.getElementById("input3"); + + input1.focus(); + assert_equals(document.activeElement.id, "input1", "input1 should be active"); + + await test_driver.send_keys(input1, TAB_KEY); + assert_equals(document.activeElement.id, "input3", "input3 should be active"); + + await test_driver.send_keys(input3, TAB_KEY); + assert_equals(document.activeElement.id, "selectmenu", "selectmenu should be active"); +}, "Check that tabindex applies to <selectmenu>"); +</script> + diff --git a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-attribute-all-elements.html b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-attribute-all-elements.html index 9ee659962b8..5a536f026ee 100644 --- a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-attribute-all-elements.html +++ b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-attribute-all-elements.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <meta charset="utf-8"> <link rel="author" href="mailto:masonf@chromium.org"> -<link rel=help href="https://open-ui.org/components/popup.research.explainer"> +<link rel=help href="https://open-ui.org/components/popover.research.explainer"> <meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> diff --git a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-attribute-basic.html b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-attribute-basic.html index 335f817e75d..eab61407c8b 100644 --- a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-attribute-basic.html +++ b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-attribute-basic.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <meta charset="utf-8"> <link rel="author" href="mailto:masonf@chromium.org"> -<link rel=help href="https://open-ui.org/components/popup.research.explainer"> +<link rel=help href="https://open-ui.org/components/popover.research.explainer"> <meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -11,11 +11,11 @@ <script src="resources/popover-utils.js"></script> <div id=popovers> - <div popover id=boolean>Pop up</div> - <div popover="">Pop up</div> - <div popover=auto>Pop up</div> - <div popover=hint>Pop up</div> - <div popover=manual>Pop up</div> + <div popover id=boolean>Popover</div> + <div popover="">Popover</div> + <div popover=auto>Popover</div> + <div popover=hint>Popover</div> + <div popover=manual>Popover</div> <article popover>Different element type</article> <header popover>Different element type</header> <nav popover>Different element type</nav> diff --git a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-css-properties.tentative.html b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-css-properties.tentative.html new file mode 100644 index 00000000000..93d388b02b5 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-css-properties.tentative.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Popover API CSS parsing with computed values</title> +<link rel="author" href="mailto:masonf@chromium.org"> +<link rel=help href="https://open-ui.org/components/popover.research.explainer"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +<script src="/css/support/computed-testcommon.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<div id=target></div> +<div id=scratch></div> + +<script> +function testprop(prop) { + // Computed values: + test_computed_value(prop, '0s'); + test_computed_value(prop, '0ms', '0s'); + test_computed_value(prop, '32s'); + test_computed_value(prop, '123ms', '0.123s'); + + // Valid values: + test_valid_value(prop, '0s'); + test_valid_value(prop, '0ms'); + test_valid_value(prop, '32s'); + test_valid_value(prop, '123ms'); + test_valid_value(prop, 'inherit'); + + // Invalid values: + test_invalid_value(prop, '0'); + test_invalid_value(prop, 'foo'); + test_invalid_value(prop, '-1s'); + test_invalid_value(prop, 'none'); + test_invalid_value(prop, 'auto'); + + // Animations: + test_interpolation({ + property: prop, + from: '1s', + to: '2000ms', + }, [ + {at: -1.5, expect: '0s'}, // Clamping at 0 + {at: -0.3, expect: '0.7s'}, + {at: 0, expect: '1s'}, + {at: 0.5, expect: '1.5s'}, + {at: 1, expect: '2s'}, + {at: 1.5, expect: '2.5s'}, + ]); +} + +testprop('popover-show-delay'); +testprop('popover-hide-delay'); +</script> diff --git a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-events.html b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-events.html index 4d58001f7dd..eb5b21b15e1 100644 --- a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-events.html +++ b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-events.html @@ -86,7 +86,7 @@ window.onload = () => { assert_equals(0,hideCount); assert_equals(0,afterShowCount); assert_equals(0,afterHideCount); - await waitForRender(); + await waitForTick(); assert_equals(1,afterShowCount,'toggle show is fired asynchronously'); assert_equals(0,afterHideCount); assert_true(popover.matches(':popover-open')); @@ -96,12 +96,12 @@ window.onload = () => { assert_equals(1,hideCount); assert_equals(1,afterShowCount); assert_equals(0,afterHideCount); - await waitForRender(); + await waitForTick(); assert_equals(1,afterShowCount); assert_equals(1,afterHideCount,'toggle hide is fired asynchronously'); // No additional events - await waitForRender(); - await waitForRender(); + await waitForTick(); + await waitForTick(); assert_false(popover.matches(':popover-open')); assert_equals(1,showCount); assert_equals(1,hideCount); @@ -139,8 +139,8 @@ window.onload = () => { assert_true(popover.matches(':popover-open')); t.add_cleanup(() => {document.body.appendChild(popover);}); popover.remove(); - await waitForRender(); // Check for async events also - await waitForRender(); // Check for async events also + await waitForTick(); // Check for async events also + await waitForTick(); // Check for async events also assert_false(popover.matches(':popover-open')); }, 'The "beforetoggle" event is not fired for element removal'); @@ -188,27 +188,27 @@ window.onload = () => { assertOnly('none'); assert_false(popover.matches(':popover-open')); popover.showPopover(); - await waitForRender(); + await waitForTick(); assert_true(popover.matches(':popover-open')); assertOnly('singleShow','Single event should have been fired, which is a "show"'); resetEvents(); popover.hidePopover(); popover.showPopover(); // Immediate re-show - await waitForRender(); + await waitForTick(); assert_true(popover.matches(':popover-open')); assertOnly('coalescedShow','Single coalesced event should have been fired, which is a "show"'); resetEvents(); popover.hidePopover(); - await waitForRender(); + await waitForTick(); assertOnly('singleHide','Single event should have been fired, which is a "hide"'); assert_false(popover.matches(':popover-open')); resetEvents(); popover.showPopover(); popover.hidePopover(); // Immediate re-hide - await waitForRender(); + await waitForTick(); assertOnly('coalescedHide','Single coalesced event should have been fired, which is a "hide"'); assert_false(popover.matches(':popover-open')); }, 'The "toggle" event is coalesced'); diff --git a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-focus-2.html b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-focus-2.html index 5a7f5da8f7b..be6923e604a 100644 --- a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-focus-2.html +++ b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-focus-2.html @@ -11,23 +11,23 @@ <script src="resources/popover-utils.js"></script> <div id=fixup> - <button id=button1>Button1</button> + <button id=button1 tabindex="0">Button1</button> <div popover id=popover1 style="top:100px"> - <button id=inside_popover1>Inside1</button> - <button id=invoker2 popovertarget=popover2>Nested Invoker 2</button> - <button id=inside_popover2>Inside2</button> + <button id=inside_popover1 tabindex="0">Inside1</button> + <button id=invoker2 popovertarget=popover2 tabindex="0">Nested Invoker 2</button> + <button id=inside_popover2 tabindex="0">Inside2</button> </div> - <button id=button2>Button2</button> - <button popovertarget=popover1 id=invoker1>Invoker1</button> - <button id=button3>Button3</button> + <button id=button2 tabindex="0">Button2</button> + <button popovertarget=popover1 id=invoker1 tabindex="0">Invoker1</button> + <button id=button3 tabindex="0">Button3</button> <div popover id=popover2 style="top:200px"> - <button id=inside_popover3>Inside3</button> - <button id=invoker3 popovertarget=popover3>Nested Invoker 3</button> + <button id=inside_popover3 tabindex="0">Inside3</button> + <button id=invoker3 popovertarget=popover3 tabindex="0">Nested Invoker 3</button> </div> <div popover id=popover3 style="top:300px"> Non-focusable popover </div> - <button id=button4>Button4</button> + <button id=button4 tabindex="0">Button4</button> </div> <style> #fixup [popover] { @@ -90,11 +90,11 @@ promise_test(async t => { }, "Popover focus navigation"); </script> -<button id=circular0 popovertarget=popover4>Invoker</button> +<button id=circular0 popovertarget=popover4 tabindex="0">Invoker</button> <div id=popover4 popover> - <button id=circular1 autofocus popovertarget=popover4 popovertargetaction=hide></button> - <button id=circular2 popovertarget=popover4 popovertargetaction=show></button> - <button id=circular3 popovertarget=popover4></button> + <button id=circular1 autofocus popovertarget=popover4 popovertargetaction=hide tabindex="0"></button> + <button id=circular2 popovertarget=popover4 popovertargetaction=show tabindex="0"></button> + <button id=circular3 popovertarget=popover4 tabindex="0"></button> </div> <button id=circular4>after</button> <script> @@ -107,9 +107,9 @@ promise_test(async t => { </script> <div id=focus-return1> - <button popovertarget=focus-return1-p popovertargetaction=show>Show popover</button> + <button popovertarget=focus-return1-p popovertargetaction=show tabindex="0">Show popover</button> <div popover id=focus-return1-p> - <button popovertarget=focus-return1-p popovertargetaction=hide autofocus>Hide popover</button> + <button popovertarget=focus-return1-p popovertargetaction=hide autofocus tabindex="0">Hide popover</button> </div> </div> <script> @@ -129,8 +129,8 @@ promise_test(async t => { </script> <div id=focus-return2> - <button popovertarget=focus-return2-p>Toggle popover</button> - <div popover id=focus-return2-p>Popover with <button>focusable element</button></div> + <button popovertarget=focus-return2-p tabindex="0">Toggle popover</button> + <div popover id=focus-return2-p>Popover with <button tabindex="0">focusable element</button></div> <span tabindex=0>Other focusable element</span> </div> <script> diff --git a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-focus.html b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-focus.html index 915a1bcade3..df7c046e003 100644 --- a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-focus.html +++ b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-focus.html @@ -13,7 +13,7 @@ <div popover data-test='default behavior - popover is not focused' data-no-focus> <p>This is a popover</p> - <button>first button</button> + <button tabindex="0">first button</button> </div> <div popover data-test='autofocus popover' autofocus tabindex=-1 class=should-be-focused> @@ -24,29 +24,29 @@ <div popover data-test='autofocus popover with button' autofocus tabindex=-1 class=should-be-focused> <p>This is a popover</p> - <button>button</button> + <button tabindex="0">button</button> </div> <div popover data-test='autofocus child'> <p>This is a popover</p> - <button autofocus class=should-be-focused>autofocus button</button> + <button autofocus class=should-be-focused tabindex="0">autofocus button</button> </div> <div popover data-test='autofocus on tabindex=0 element'> <p autofocus tabindex=0 class=should-be-focused>This is a popover with autofocus on a tabindex=0 element</p> - <button>button</button> + <button tabindex="0">button</button> </div> <div popover data-test='autofocus multiple children'> <p>This is a popover</p> - <button autofocus class=should-be-focused>autofocus button</button> - <button autofocus>second autofocus button</button> + <button autofocus class=should-be-focused tabindex="0">autofocus button</button> + <button autofocus tabindex="0">second autofocus button</button> </div> <div popover autofocus tabindex=-1 data-test='autofocus popover and multiple autofocus children' class=should-be-focused> <p>This is a popover</p> - <button autofocus>autofocus button</button> - <button autofocus>second autofocus button</button> + <button autofocus tabindex="0">autofocus button</button> + <button autofocus tabindex="0">second autofocus button</button> </div> <style> @@ -71,11 +71,13 @@ button.remove(); }); popover.id = popoverId; + button.setAttribute('tabindex', '0'); button.setAttribute('popovertarget', popoverId); return button; } function addPriorFocus(t) { const priorFocus = document.createElement('button'); + priorFocus.setAttribute("tabindex", "0"); priorFocus.id = 'priorFocus'; document.body.appendChild(priorFocus); t.add_cleanup(() => priorFocus.remove()); @@ -218,6 +220,7 @@ // Same thing, but the button is unrelated (no popovertarget) button = document.createElement('button'); + button.setAttribute("tabindex", "0"); document.body.appendChild(button); priorFocus.focus(); popover.showPopover(); diff --git a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-hide-crash.html b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-hide-crash.html new file mode 100644 index 00000000000..3e0c694976c --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-hide-crash.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html class='reftest-wait'> +<meta charset='utf-8' /> +<title>Popover hide crash test</title> +<link rel='author' href="mailto:cathiechen@iglaia.com"> +<link rel=help href="https://github.com/whatwg/html/issues/9197"> + +<p>This test passes if it does not crash.</p> +<div id='popover1' popover='auto'> + <div id='popover2' popover='auto'></div> + <div id='popover3' popover='auto'></div> +</div> + +<script> +var showedPopover2 = false; +popover1.showPopover(); +popover3.showPopover(); +popover3.addEventListener('beforetoggle', (e) => { + if (e.newState != 'open' && !showedPopover2) { + showedPopover2 = true; + popover2.showPopover(); + } +}); +popover1.hidePopover(); +</script> diff --git a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-hover-hide.tentative.html b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-hover-hide.tentative.html new file mode 100644 index 00000000000..ed647a7d7d8 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-hover-hide.tentative.html @@ -0,0 +1,129 @@ +<!DOCTYPE html> +<meta charset="utf-8" /> +<title>The popover-hide-delay CSS property</title> +<link rel="author" href="mailto:masonf@chromium.org"> +<link rel=help href="https://open-ui.org/components/popover.research.explainer"> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="resources/popover-utils.js"></script> + +<style> + [popover] { + top:100px; + popover-hide-delay: 100ms; + } + [popovertargetaction=hover] { + top:200px; + popover-show-delay: 100ms; + } + #unrelated {top: 300px;} + div { + /* Fixed position everything to ensure nothing overlaps */ + position: fixed; + } +</style> +<div id=unrelated>Unrelated element</div> + +<div popover id=example1>Popover</div> +<button popovertarget=example1 popovertargetaction=hover id=invoker1>Hover me</button> + +<script> +const hoverDelays = 100; // This needs to match the style block above. +const hoverWaitTime = 200; // How long to wait to cover the delay for sure. + +// NOTE about testing methodology: +// This test checks whether popovers are hidden *after* the appropriate de-hover +// delay. The delay used for testing is kept low, to avoid this test taking too +// long, but that means that sometimes on a slow bot/client, the delay can +// elapse before we are able to check the popover status. And that can make this +// test flaky. To avoid that, the msSinceMouseOver() function is used to check +// that not-too-much time has passed, and if it has, the test is simply skipped. + +const unrelated = document.getElementById('unrelated'); + +function getComputedStyleTimeMs(element,property) { + // Times are in seconds, so just strip off the 's'. + return Number(getComputedStyle(element)[property].slice(0,-1))*1000; +} + +promise_test(async (t) => { + await mouseOver(unrelated); + const popover = document.getElementById('example1'); + assert_false(popover.matches(':popover-open')); + popover.showPopover(); + assert_true(popover.matches(':popover-open')); + await waitForHoverTime(hoverWaitTime); + assert_false(popover.matches(':popover-open')); + assert_true(msSinceMouseOver() >= hoverWaitTime,'waitForHoverTime should wait the specified time'); + assert_true(hoverWaitTime > hoverDelays,'hoverDelays is the value from CSS, hoverWaitTime should be longer than that'); + assert_equals(getComputedStyleTimeMs(invoker1,'popoverShowDelay'),hoverDelays,'popover-show-delay is incorrect'); + assert_equals(getComputedStyleTimeMs(popover,'popoverHideDelay'),hoverDelays,'popover-hide-delay is incorrect'); +},`The popover-hide-delay causes a popover to be hidden after a delay`); + +promise_test(async (t) => { + await mouseOver(unrelated); + const popover = document.getElementById('example1'); + assert_false(popover.matches(':popover-open')); + popover.showPopover(); + await mouseOver(popover); + await waitForHoverTime(hoverWaitTime); + assert_true(popover.matches(':popover-open'),'hovering the popover should keep it showing'); + await mouseOver(unrelated); + let showing = popover.matches(':popover-open'); + if (msSinceMouseOver() >= hoverDelays) + return; // The WPT runner was too slow. + assert_true(showing,'hovering unrelated element shouldn\'t immediately hide the popover'); + await waitForHoverTime(hoverWaitTime); + assert_false(popover.matches(':popover-open'),'hovering unrelated element should hide popover after delay'); +},`hovering the popover keeps it from being hidden`); + +promise_test(async (t) => { + await mouseOver(unrelated); + const popover = document.getElementById('example1'); + const invoker = document.getElementById('invoker1'); + assert_false(popover.matches(':popover-open')); + await mouseOver(invoker); + await waitForHoverTime(hoverWaitTime); + assert_true(popover.matches(':popover-open')); + await waitForHoverTime(hoverWaitTime); + assert_true(popover.matches(':popover-open'),'While still hovering the invoker, popover should not be hidden'); + await mouseOver(popover); + await waitForHoverTime(hoverWaitTime); + await mouseOver(invoker); + await waitForHoverTime(hoverWaitTime); + assert_true(popover.matches(':popover-open'),'Moving hover between invoker and popover should keep popover from being hidden'); + await mouseOver(unrelated); + await waitForHoverTime(hoverWaitTime); + assert_false(popover.matches(':popover-open'),'Moving hover to unrelated should finally hide the popover'); +},`hovering a popovertargetaction=hover invoking element keeps the popover from being hidden`); +</script> + + +<div popover id=example2>Popover</div> +<button popovertarget=example2 popovertargetaction=toggle><span><span data-note=nested_element id=invoker2>Click me</span></span></button> + +<script> +promise_test(async (t) => { + await mouseOver(unrelated); + const popover = document.getElementById('example2'); + const invoker = document.getElementById('invoker2'); + assert_equals(getComputedStyleTimeMs(popover,'popoverHideDelay'),hoverDelays,'popover-hide-delay is incorrect'); + assert_false(popover.matches(':popover-open')); + await mouseOver(invoker); + popover.showPopover(); + await waitForHoverTime(hoverWaitTime); + assert_true(popover.matches(':popover-open'),'While hovering an invoker element, popover should not be hidden'); + await mouseOver(popover); + await waitForHoverTime(hoverWaitTime); + await mouseOver(invoker); + await waitForHoverTime(hoverWaitTime); + assert_true(popover.matches(':popover-open'),'Moving hover between invoker and popover should keep popover from being hidden'); + await mouseOver(unrelated); + await waitForHoverTime(hoverWaitTime); + assert_false(popover.matches(':popover-open'),'Moving hover to unrelated should finally hide the popover'); +},`hovering a popovertargetaction=toggle invoking element keeps the popover from being hidden`); +</script> diff --git a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-invoker-reset.html b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-invoker-reset.html index 4b1ac6b588f..bfc79fd6291 100644 --- a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-invoker-reset.html +++ b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-invoker-reset.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <meta charset="utf-8"> <link rel="author" href="mailto:masonf@chromium.org"> -<link rel=help href="https://open-ui.org/components/popup.research.explainer"> +<link rel=help href="https://open-ui.org/components/popover.research.explainer"> <link rel=help href="https://github.com/whatwg/html/issues/9152"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> diff --git a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-light-dismiss.html b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-light-dismiss.html index f913aaa357e..4411d0b7e38 100644 --- a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-light-dismiss.html +++ b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-light-dismiss.html @@ -3,7 +3,7 @@ <title>Popover light dismiss behavior</title> <meta name="timeout" content="long"> <link rel="author" href="mailto:masonf@chromium.org"> -<link rel=help href="https://open-ui.org/components/popup.research.explainer"> +<link rel=help href="https://open-ui.org/components/popover.research.explainer"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/resources/testdriver.js"></script> @@ -13,7 +13,7 @@ <button id=b1t popovertarget='p1'>Popover 1</button> <button id=b1s popovertarget='p1' popovertargetaction=show>Popover 1</button> -<button id=p1anchor>Popover1 anchor (no action)</button> +<button id=p1anchor tabindex="0">Popover1 anchor (no action)</button> <span id=outside>Outside all popovers</span> <div popover id=p1 anchor=p1anchor> <span id=inside1>Inside popover 1</span> @@ -23,7 +23,7 @@ <div popover id=p2 anchor=b2> <span id=inside2>Inside popover 2</span> </div> -<button id=after_p1>Next control after popover1</button> +<button id=after_p1 tabindex="0">Next control after popover1</button> <style> #p1 {top: 50px;} #p2 {top: 120px;} @@ -332,7 +332,7 @@ <my-element id="myElement"> <template shadowrootmode="open"> - <button id=b7 onclick='showPopover7()'>Popover7</button> + <button id=b7 onclick='showPopover7()' tabindex="0">Popover7</button> <div popover id=p7 anchor=b7 style="top: 100px;"> <p>Popover content.</p> <input id="inside7" type="text" placeholder="some text"> @@ -364,10 +364,10 @@ </script> <div popover id=p8 anchor=p8anchor> - <button>Button</button> + <button tabindex="0">Button</button> <span id=inside8after>Inside popover 8 after button</span> </div> -<button id=p8anchor>Popover8 anchor (no action)</button> +<button id=p8anchor tabindex="0">Popover8 anchor (no action)</button> <script> promise_test(async () => { const popover8 = document.querySelector('#p8'); @@ -398,7 +398,7 @@ <div popover id=convoluted_p3 anchor=convoluted_anchor>Popover 3 <button popovertarget=convoluted_p4>Open Popover 4</button> </div> -<button onclick="convoluted_p1.showPopover()">Open convoluted popover</button> +<button onclick="convoluted_p1.showPopover()" tabindex="0">Open convoluted popover</button> <style> #convoluted_p1 {top:50px;} #convoluted_p2 {top:150px;} @@ -565,7 +565,7 @@ promise_test(async () => { <div id=p19 popover>Popover 19</div> <div id=p20 popover>Popover 20</div> -<button id=example2>Example 2</button> +<button id=example2 tabindex="0">Example 2</button> <script> promise_test(async () => { diff --git a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-not-keyboard-focusable.html b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-not-keyboard-focusable.html index 5246073c960..55c70aa643e 100644 --- a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-not-keyboard-focusable.html +++ b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-not-keyboard-focusable.html @@ -10,11 +10,11 @@ <script src="/resources/testdriver-actions.js"></script> <script src="/resources/testdriver-vendor.js"></script> -<button id=firstfocus>Button 1</button> +<button id=firstfocus tabindex="0">Button 1</button> <div popover> <p>This is a popover without a focusable element</p> </div> -<button id=secondfocus>Button 2</button> +<button id=secondfocus tabindex="0">Button 2</button> <script> promise_test(async () => { @@ -34,6 +34,7 @@ promise_test(async () => { // Add a focusable button to the popover and make sure we can focus that const button = document.createElement('button'); + button.setAttribute("tabindex", "0"); popover.appendChild(button); b1.focus(); popover.showPopover(); diff --git a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-target-action-hover.tentative.html b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-target-action-hover.tentative.html new file mode 100644 index 00000000000..b03ec78ebf1 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-target-action-hover.tentative.html @@ -0,0 +1,180 @@ +<!DOCTYPE html> +<meta charset="utf-8" /> +<title>The popovertargetaction=hover behavior</title> +<link rel="author" href="mailto:masonf@chromium.org"> +<link rel=help href="https://open-ui.org/components/popover.research.explainer"> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="resources/popover-utils.js"></script> + +<body> +<style> +.unrelated {top:0;} +.invoker {top:100px; width:fit-content; height:fit-content;} +[popover] {top: 200px;} +.offset-child {top:300px; left:300px;} +</style> + +<script> +const popoverShowDelay = 100; // The CSS delay setting. +const hoverWaitTime = 200; // How long to wait to cover the delay for sure. +async function makePopoverAndInvoker(test, popoverType, invokerType, delayMs) { + delayMs = delayMs || popoverShowDelay; + const popover = Object.assign(document.createElement('div'),{popover: popoverType}); + document.body.appendChild(popover); + popover.textContent = 'Popover'; + // Set popover-show-delay on the popover to 0 - it should be ignored. + popover.setAttribute('style',`popover-show-delay: 0; popover-hide-delay: 1000s;`); + let invoker = document.createElement('button'); + invoker.setAttribute('class','invoker'); + invoker.popoverTargetElement = popover; + invoker.popoverTargetAction = "hover"; + // Set popover-hide-delay on the invoker to 0 - it should be ignored. + invoker.setAttribute('style',`popover-show-delay: ${delayMs}ms; popover-hide-delay: 0;`); + document.body.appendChild(invoker); + const actualHoverDelay = Number(getComputedStyle(invoker)['popoverShowDelay'].slice(0,-1))*1000; + assert_equals(actualHoverDelay,delayMs,'popover-show-delay is incorrect'); + const originalInvoker = invoker; + const reassignPopoverFn = (p) => {originalInvoker.popoverTargetElement = p}; + switch (invokerType) { + case 'plain': + // Invoker is just a button. + invoker.textContent = 'Invoker'; + break; + case 'nested': + // Invoker is just a button containing a div. + const child1 = invoker.appendChild(document.createElement('div')); + child1.textContent = 'Invoker'; + break; + case 'nested-offset': + // Invoker is a child of the invoking button, and is not contained within + // the bounds of the popovertarget element. + invoker.textContent = 'Invoker'; + // Reassign invoker to the child: + invoker = invoker.appendChild(document.createElement('div')); + invoker.textContent = 'Invoker child'; + invoker.setAttribute('class','offset-child'); + break; + case 'none': + // No invoker. + invoker.remove(); + break; + default: + assert_unreached(`Invalid invokerType ${invokerType}`); + } + const unrelated = document.createElement('div'); + document.body.appendChild(unrelated); + unrelated.textContent = 'Unrelated'; + unrelated.setAttribute('class','unrelated'); + test.add_cleanup(async () => { + popover.remove(); + invoker.remove(); + originalInvoker.remove(); + unrelated.remove(); + await waitForRender(); + }); + await mouseOver(unrelated); // Start by mousing over the unrelated element + await waitForRender(); + return {popover,invoker,reassignPopoverFn}; +} + +// NOTE about testing methodology: +// This test checks whether popovers are triggered *after* the appropriate hover +// delay. The delay used for testing is kept low, to avoid this test taking too +// long, but that means that sometimes on a slow bot/client, the hover delay can +// elapse before we are able to check the popover status. And that can make this +// test flaky. To avoid that, the msSinceMouseOver() function is used to check +// that not-too-much time has passed, and if it has, the test is simply skipped. + +["auto","hint","manual"].forEach(type => { + ["plain","nested","nested-offset"].forEach(invokerType => { + promise_test(async (t) => { + const {popover,invoker} = await makePopoverAndInvoker(t,type,invokerType); + assert_false(popover.matches(':popover-open')); + await mouseOver(invoker); + let showing = popover.matches(':popover-open'); + // See NOTE above. + if (msSinceMouseOver() < popoverShowDelay) + assert_false(showing,'popover should not show immediately'); + await waitForHoverTime(hoverWaitTime); + assert_true(msSinceMouseOver() >= hoverWaitTime,'waitForHoverTime should wait the specified time'); + assert_true(popover.matches(':popover-open'),'popover should show after delay'); + assert_true(hoverWaitTime > popoverShowDelay,'popoverShowDelay is the CSS setting, hoverWaitTime should be longer than that'); + popover.hidePopover(); // Cleanup + },`popovertargetaction=hover shows a popover with popover=${type}, invokerType=${invokerType}`); + + promise_test(async (t) => { + const {popover,invoker} = await makePopoverAndInvoker(t,type,invokerType); + assert_false(popover.matches(':popover-open')); + invoker.click(); // Click the invoker + assert_true(popover.matches(':popover-open'),'Clicking the invoker should show the popover, even when popovertargetaction=hover'); + popover.hidePopover(); // Cleanup + },`popovertargetaction=hover should also allow click activation, for popover=${type}, invokerType=${invokerType}`); + + promise_test(async (t) => { + const longerHoverDelay = hoverWaitTime*2; + const {popover,invoker} = await makePopoverAndInvoker(t,type,invokerType,longerHoverDelay); + await mouseOver(invoker); + let showing = popover.matches(':popover-open'); + // See NOTE above. + if (msSinceMouseOver() >= longerHoverDelay) + return; // The WPT runner was too slow. + assert_false(showing,'popover should not show immediately'); + await waitForHoverTime(hoverWaitTime); + showing = popover.matches(':popover-open'); + if (msSinceMouseOver() >= longerHoverDelay) + return; // The WPT runner was too slow. + assert_false(showing,'popover should not show after not long enough of a delay'); + },`popovertargetaction=hover popover-show-delay is respected (popover=${type}, invokerType=${invokerType})`); + + promise_test(async (t) => { + const {popover,invoker} = await makePopoverAndInvoker(t,type,invokerType); + popover.showPopover(); + assert_true(popover.matches(':popover-open')); + await mouseOver(invoker); + assert_true(popover.matches(':popover-open'),'popover should stay showing on mouseover'); + await waitForHoverTime(hoverWaitTime); + assert_true(popover.matches(':popover-open'),'popover should stay showing after delay'); + popover.hidePopover(); // Cleanup + },`popovertargetaction=hover does nothing when popover is already showing (popover=${type}, invokerType=${invokerType})`); + + promise_test(async (t) => { + const {popover,invoker} = await makePopoverAndInvoker(t,type,invokerType); + await mouseOver(invoker); + let showing = popover.matches(':popover-open'); + popover.remove(); + // See NOTE above. + if (msSinceMouseOver() >= popoverShowDelay) + return; // The WPT runner was too slow. + assert_false(showing,'popover should not show immediately'); + await waitForHoverTime(hoverWaitTime); + assert_false(popover.matches(':popover-open'),'popover should not show even after a delay'); + // Now put it back in the document and make sure it doesn't trigger. + document.body.appendChild(popover); + await waitForHoverTime(hoverWaitTime); + assert_false(popover.matches(':popover-open'),'popover should not show even when returned to the document'); + },`popovertargetaction=hover does nothing when popover is moved out of the document (popover=${type}, invokerType=${invokerType})`); + + promise_test(async (t) => { + const {popover,invoker,reassignPopoverFn} = await makePopoverAndInvoker(t,type,invokerType); + const popover2 = Object.assign(document.createElement('div'),{popover: type}); + document.body.appendChild(popover2); + t.add_cleanup(() => popover2.remove()); + await mouseOver(invoker); + let eitherShowing = popover.matches(':popover-open') || popover2.matches(':popover-open'); + reassignPopoverFn(popover2); + // See NOTE above. + if (msSinceMouseOver() >= popoverShowDelay) + return; // The WPT runner was too slow. + assert_false(eitherShowing,'popover should not show immediately'); + await waitForHoverTime(hoverWaitTime); + assert_false(popover.matches(':popover-open'),'popover #1 should not show since popovertarget was reassigned'); + assert_false(popover2.matches(':popover-open'),'popover #2 should not show since popovertarget was reassigned'); + },`popovertargetaction=hover does nothing when target changes (popover=${type}, invokerType=${invokerType})`); + }); +}); +</script> diff --git a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-types-with-hints.tentative.html b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-types-with-hints.tentative.html index 06282a2aa1f..7a73efb50fc 100644 --- a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-types-with-hints.tentative.html +++ b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-types-with-hints.tentative.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <meta charset="utf-8"> <link rel="author" href="mailto:masonf@chromium.org"> -<link rel=help href="https://open-ui.org/components/popup.research.explainer"> +<link rel=help href="https://open-ui.org/components/popover.research.explainer"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -73,7 +73,7 @@ <div popover>popover 3</div> </div> </div> - <div popover=hint anchor=anchorid>Hint anchored to pop-up</div> + <div popover=hint anchor=anchorid>Hint anchored to popover</div> <script> { const popover1 = document.currentScript.parentElement.querySelectorAll('[popover=""]')[0]; @@ -116,7 +116,7 @@ assert_false(hint1.matches(':popover-open')); assert_true(hint2.matches(':popover-open')); hint2.hidePopover(); - },'If a popover=hint is shown, it should hide any other open popover=hint pop-ups, including ancestral pop-ups. (You can\'t nest popover=hint)'); + },'If a popover=hint is shown, it should hide any other open popover=hint popovers, including ancestral popovers. (You can\'t nest popover=hint)'); </script> </div> @@ -135,7 +135,7 @@ assert_false(hint.matches(':popover-open')); assert_true(auto.matches(':popover-open')); auto.hidePopover(); - },'If a popover=auto is shown, it should hide any open popover=hint, including if the popover=hint is an ancestral pop-up of the popover=auto. (You can\'t nest a popover=auto inside a popover=hint)'); + },'If a popover=auto is shown, it should hide any open popover=hint, including if the popover=hint is an ancestral popover of the popover=auto. (You can\'t nest a popover=auto inside a popover=hint)'); </script> </div> diff --git a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-types.html b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-types.html index e6d7d967bbc..d4ad81e52bf 100644 --- a/tests/wpt/web-platform-tests/html/semantics/popovers/popover-types.html +++ b/tests/wpt/web-platform-tests/html/semantics/popovers/popover-types.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <meta charset="utf-8"> <link rel="author" href="mailto:masonf@chromium.org"> -<link rel=help href="https://open-ui.org/components/popup.research.explainer"> +<link rel=help href="https://open-ui.org/components/popover.research.explainer"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> diff --git a/tests/wpt/web-platform-tests/html/semantics/popovers/resources/popover-utils.js b/tests/wpt/web-platform-tests/html/semantics/popovers/resources/popover-utils.js index ee69ca1e016..39de6aa99b1 100644 --- a/tests/wpt/web-platform-tests/html/semantics/popovers/resources/popover-utils.js +++ b/tests/wpt/web-platform-tests/html/semantics/popovers/resources/popover-utils.js @@ -1,6 +1,11 @@ function waitForRender() { return new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve))); } + +function waitForTick() { + return new Promise(resolve => step_timeout(resolve, 0)); +} + async function clickOn(element) { const actions = new test_driver.Actions(); await waitForRender(); diff --git a/tests/wpt/web-platform-tests/html/semantics/the-link-element/attr-link-fetchpriority.html b/tests/wpt/web-platform-tests/html/semantics/the-link-element/attr-link-fetchpriority.html index 32c318b7605..8aa515fa4c2 100644 --- a/tests/wpt/web-platform-tests/html/semantics/the-link-element/attr-link-fetchpriority.html +++ b/tests/wpt/web-platform-tests/html/semantics/the-link-element/attr-link-fetchpriority.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<title>Priority Hints - Link element</title> +<title>Fetch Priority - Link element</title> <meta name="author" title="Dominic Farolino" href="mailto:domfarolino@gmail.com"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> diff --git a/tests/wpt/web-platform-tests/html/syntax/parsing/html5lib_tables01.html b/tests/wpt/web-platform-tests/html/syntax/parsing/html5lib_tables01.html index a22bfe0b2b2..bcc8a949380 100644 --- a/tests/wpt/web-platform-tests/html/syntax/parsing/html5lib_tables01.html +++ b/tests/wpt/web-platform-tests/html/syntax/parsing/html5lib_tables01.html @@ -18,9 +18,9 @@ <script src="/resources/testharnessreport.js"></script> <script> var num_iframes = 8; - var order = ['86a267778d1960b41f887b7bd2cd3ebf691d2e42','b6c1142484570bb90c36e454ee193cca17bb618a','7c507b825650f9721ea9656b1e844752a2424271','d10316cac9d03820ecfbc85ab373632e12d70c75','331a8c15a2f1dd3a9a1c31f5c65b99d356a65f30','6cdb83f12cb37a56f5ebad018ec3b07c2ad5b89f','9d01d4a7d7519e410e10493c8b108298b6733c31','b4615709ab72b6aa6cbf836582bd40fd93c0deb5','24132334bffa9eea4c8e29c940a8201f4253baf5','103784c31b8e3280b19e30f3b26f467585fbc304','0787e31440ae020f6f6e6207c364e9a2daec1c6f','1c40461886d4fdfca6ac5ef1d766b6fbf360ff9c','aea3c063f853938a36184825893e0820b700e241','6595dc192b10c479a543dbe25e67e6e0b6923ea8','9fcd09d757401684bcc28eaec005ed82718e836f','4be18eaaf0aa53f224b4ff8aeaf47d44ba854260','8e743c4f0ab5783b8973533640f669c92acb3797',]; + var order = ['86a267778d1960b41f887b7bd2cd3ebf691d2e42','b6c1142484570bb90c36e454ee193cca17bb618a','7c507b825650f9721ea9656b1e844752a2424271','d10316cac9d03820ecfbc85ab373632e12d70c75','331a8c15a2f1dd3a9a1c31f5c65b99d356a65f30','6cdb83f12cb37a56f5ebad018ec3b07c2ad5b89f','9d01d4a7d7519e410e10493c8b108298b6733c31','b4615709ab72b6aa6cbf836582bd40fd93c0deb5','24132334bffa9eea4c8e29c940a8201f4253baf5','103784c31b8e3280b19e30f3b26f467585fbc304','0787e31440ae020f6f6e6207c364e9a2daec1c6f','1c40461886d4fdfca6ac5ef1d766b6fbf360ff9c','aea3c063f853938a36184825893e0820b700e241','6595dc192b10c479a543dbe25e67e6e0b6923ea8','9fcd09d757401684bcc28eaec005ed82718e836f','4be18eaaf0aa53f224b4ff8aeaf47d44ba854260','8e743c4f0ab5783b8973533640f669c92acb3797','201737ac5662941cdf6ece5d6721ea8b0647f0ce',]; var tests = { - "86a267778d1960b41f887b7bd2cd3ebf691d2e42":[async_test('html5lib_tables01.html 86a267778d1960b41f887b7bd2cd3ebf691d2e42'), "%3Ctable%3E%3Cth%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Cth%3E"],"b6c1142484570bb90c36e454ee193cca17bb618a":[async_test('html5lib_tables01.html b6c1142484570bb90c36e454ee193cca17bb618a'), "%3Ctable%3E%3Ctd%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E"],"7c507b825650f9721ea9656b1e844752a2424271":[async_test('html5lib_tables01.html 7c507b825650f9721ea9656b1e844752a2424271'), "%3Ctable%3E%3Ccol%20foo%3D%27bar%27%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ccolgroup%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ccol%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20foo%3D%22bar%22"],"d10316cac9d03820ecfbc85ab373632e12d70c75":[async_test('html5lib_tables01.html d10316cac9d03820ecfbc85ab373632e12d70c75'), "%3Ctable%3E%3Ccolgroup%3E%3C/html%3Efoo", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%22foo%22%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ccolgroup%3E"],"331a8c15a2f1dd3a9a1c31f5c65b99d356a65f30":[async_test('html5lib_tables01.html 331a8c15a2f1dd3a9a1c31f5c65b99d356a65f30'), "%3Ctable%3E%3C/table%3E%3Cp%3Efoo", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%3Cp%3E%0A%7C%20%20%20%20%20%20%20%22foo%22"],"6cdb83f12cb37a56f5ebad018ec3b07c2ad5b89f":[async_test('html5lib_tables01.html 6cdb83f12cb37a56f5ebad018ec3b07c2ad5b89f'), "%3Ctable%3E%3C/body%3E%3C/caption%3E%3C/col%3E%3C/colgroup%3E%3C/html%3E%3C/tbody%3E%3C/td%3E%3C/tfoot%3E%3C/th%3E%3C/thead%3E%3C/tr%3E%3Ctd%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E"],"9d01d4a7d7519e410e10493c8b108298b6733c31":[async_test('html5lib_tables01.html 9d01d4a7d7519e410e10493c8b108298b6733c31'), "%3Ctable%3E%3Cselect%3E%3Coption%3E3%3C/select%3E%3C/table%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cselect%3E%0A%7C%20%20%20%20%20%20%20%3Coption%3E%0A%7C%20%20%20%20%20%20%20%20%20%223%22%0A%7C%20%20%20%20%20%3Ctable%3E"],"b4615709ab72b6aa6cbf836582bd40fd93c0deb5":[async_test('html5lib_tables01.html b4615709ab72b6aa6cbf836582bd40fd93c0deb5'), "%3Ctable%3E%3Cselect%3E%3Ctable%3E%3C/table%3E%3C/select%3E%3C/table%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cselect%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%3Ctable%3E"],"24132334bffa9eea4c8e29c940a8201f4253baf5":[async_test('html5lib_tables01.html 24132334bffa9eea4c8e29c940a8201f4253baf5'), "%3Ctable%3E%3Cselect%3E%3C/table%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cselect%3E%0A%7C%20%20%20%20%20%3Ctable%3E"],"103784c31b8e3280b19e30f3b26f467585fbc304":[async_test('html5lib_tables01.html 103784c31b8e3280b19e30f3b26f467585fbc304'), "%3Ctable%3E%3Cselect%3E%3Coption%3EA%3Ctr%3E%3Ctd%3EB%3C/td%3E%3C/tr%3E%3C/table%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cselect%3E%0A%7C%20%20%20%20%20%20%20%3Coption%3E%0A%7C%20%20%20%20%20%20%20%20%20%22A%22%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%22B%22"],"0787e31440ae020f6f6e6207c364e9a2daec1c6f":[async_test('html5lib_tables01.html 0787e31440ae020f6f6e6207c364e9a2daec1c6f'), "%3Ctable%3E%3Ctd%3E%3C/body%3E%3C/caption%3E%3C/col%3E%3C/colgroup%3E%3C/html%3Efoo", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%22foo%22"],"1c40461886d4fdfca6ac5ef1d766b6fbf360ff9c":[async_test('html5lib_tables01.html 1c40461886d4fdfca6ac5ef1d766b6fbf360ff9c'), "%3Ctable%3E%3Ctd%3EA%3C/table%3EB", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%22A%22%0A%7C%20%20%20%20%20%22B%22"],"aea3c063f853938a36184825893e0820b700e241":[async_test('html5lib_tables01.html aea3c063f853938a36184825893e0820b700e241'), "%3Ctable%3E%3Ctr%3E%3Ccaption%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%3Ccaption%3E"],"6595dc192b10c479a543dbe25e67e6e0b6923ea8":[async_test('html5lib_tables01.html 6595dc192b10c479a543dbe25e67e6e0b6923ea8'), "%3Ctable%3E%3Ctr%3E%3C/body%3E%3C/caption%3E%3C/col%3E%3C/colgroup%3E%3C/html%3E%3C/td%3E%3C/th%3E%3Ctd%3Efoo", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%22foo%22"],"9fcd09d757401684bcc28eaec005ed82718e836f":[async_test('html5lib_tables01.html 9fcd09d757401684bcc28eaec005ed82718e836f'), "%3Ctable%3E%3Ctd%3E%3Ctr%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E"],"4be18eaaf0aa53f224b4ff8aeaf47d44ba854260":[async_test('html5lib_tables01.html 4be18eaaf0aa53f224b4ff8aeaf47d44ba854260'), "%3Ctable%3E%3Ctd%3E%3Cbutton%3E%3Ctd%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cbutton%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E"],"8e743c4f0ab5783b8973533640f669c92acb3797":[async_test('html5lib_tables01.html 8e743c4f0ab5783b8973533640f669c92acb3797'), "%3Ctable%3E%3Ctr%3E%3Ctd%3E%3Csvg%3E%3Cdesc%3E%3Ctd%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%3Csvg%20svg%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Csvg%20desc%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E"], + "86a267778d1960b41f887b7bd2cd3ebf691d2e42":[async_test('html5lib_tables01.html 86a267778d1960b41f887b7bd2cd3ebf691d2e42'), "%3Ctable%3E%3Cth%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Cth%3E"],"b6c1142484570bb90c36e454ee193cca17bb618a":[async_test('html5lib_tables01.html b6c1142484570bb90c36e454ee193cca17bb618a'), "%3Ctable%3E%3Ctd%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E"],"7c507b825650f9721ea9656b1e844752a2424271":[async_test('html5lib_tables01.html 7c507b825650f9721ea9656b1e844752a2424271'), "%3Ctable%3E%3Ccol%20foo%3D%27bar%27%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ccolgroup%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ccol%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20foo%3D%22bar%22"],"d10316cac9d03820ecfbc85ab373632e12d70c75":[async_test('html5lib_tables01.html d10316cac9d03820ecfbc85ab373632e12d70c75'), "%3Ctable%3E%3Ccolgroup%3E%3C/html%3Efoo", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%22foo%22%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ccolgroup%3E"],"331a8c15a2f1dd3a9a1c31f5c65b99d356a65f30":[async_test('html5lib_tables01.html 331a8c15a2f1dd3a9a1c31f5c65b99d356a65f30'), "%3Ctable%3E%3C/table%3E%3Cp%3Efoo", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%3Cp%3E%0A%7C%20%20%20%20%20%20%20%22foo%22"],"6cdb83f12cb37a56f5ebad018ec3b07c2ad5b89f":[async_test('html5lib_tables01.html 6cdb83f12cb37a56f5ebad018ec3b07c2ad5b89f'), "%3Ctable%3E%3C/body%3E%3C/caption%3E%3C/col%3E%3C/colgroup%3E%3C/html%3E%3C/tbody%3E%3C/td%3E%3C/tfoot%3E%3C/th%3E%3C/thead%3E%3C/tr%3E%3Ctd%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E"],"9d01d4a7d7519e410e10493c8b108298b6733c31":[async_test('html5lib_tables01.html 9d01d4a7d7519e410e10493c8b108298b6733c31'), "%3Ctable%3E%3Cselect%3E%3Coption%3E3%3C/select%3E%3C/table%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cselect%3E%0A%7C%20%20%20%20%20%20%20%3Coption%3E%0A%7C%20%20%20%20%20%20%20%20%20%223%22%0A%7C%20%20%20%20%20%3Ctable%3E"],"b4615709ab72b6aa6cbf836582bd40fd93c0deb5":[async_test('html5lib_tables01.html b4615709ab72b6aa6cbf836582bd40fd93c0deb5'), "%3Ctable%3E%3Cselect%3E%3Ctable%3E%3C/table%3E%3C/select%3E%3C/table%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cselect%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%3Ctable%3E"],"24132334bffa9eea4c8e29c940a8201f4253baf5":[async_test('html5lib_tables01.html 24132334bffa9eea4c8e29c940a8201f4253baf5'), "%3Ctable%3E%3Cselect%3E%3C/table%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cselect%3E%0A%7C%20%20%20%20%20%3Ctable%3E"],"103784c31b8e3280b19e30f3b26f467585fbc304":[async_test('html5lib_tables01.html 103784c31b8e3280b19e30f3b26f467585fbc304'), "%3Ctable%3E%3Cselect%3E%3Coption%3EA%3Ctr%3E%3Ctd%3EB%3C/td%3E%3C/tr%3E%3C/table%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cselect%3E%0A%7C%20%20%20%20%20%20%20%3Coption%3E%0A%7C%20%20%20%20%20%20%20%20%20%22A%22%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%22B%22"],"0787e31440ae020f6f6e6207c364e9a2daec1c6f":[async_test('html5lib_tables01.html 0787e31440ae020f6f6e6207c364e9a2daec1c6f'), "%3Ctable%3E%3Ctd%3E%3C/body%3E%3C/caption%3E%3C/col%3E%3C/colgroup%3E%3C/html%3Efoo", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%22foo%22"],"1c40461886d4fdfca6ac5ef1d766b6fbf360ff9c":[async_test('html5lib_tables01.html 1c40461886d4fdfca6ac5ef1d766b6fbf360ff9c'), "%3Ctable%3E%3Ctd%3EA%3C/table%3EB", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%22A%22%0A%7C%20%20%20%20%20%22B%22"],"aea3c063f853938a36184825893e0820b700e241":[async_test('html5lib_tables01.html aea3c063f853938a36184825893e0820b700e241'), "%3Ctable%3E%3Ctr%3E%3Ccaption%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%3Ccaption%3E"],"6595dc192b10c479a543dbe25e67e6e0b6923ea8":[async_test('html5lib_tables01.html 6595dc192b10c479a543dbe25e67e6e0b6923ea8'), "%3Ctable%3E%3Ctr%3E%3C/body%3E%3C/caption%3E%3C/col%3E%3C/colgroup%3E%3C/html%3E%3C/td%3E%3C/th%3E%3Ctd%3Efoo", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%22foo%22"],"9fcd09d757401684bcc28eaec005ed82718e836f":[async_test('html5lib_tables01.html 9fcd09d757401684bcc28eaec005ed82718e836f'), "%3Ctable%3E%3Ctd%3E%3Ctr%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E"],"4be18eaaf0aa53f224b4ff8aeaf47d44ba854260":[async_test('html5lib_tables01.html 4be18eaaf0aa53f224b4ff8aeaf47d44ba854260'), "%3Ctable%3E%3Ctd%3E%3Cbutton%3E%3Ctd%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cbutton%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E"],"8e743c4f0ab5783b8973533640f669c92acb3797":[async_test('html5lib_tables01.html 8e743c4f0ab5783b8973533640f669c92acb3797'), "%3Ctable%3E%3Ctr%3E%3Ctd%3E%3Csvg%3E%3Cdesc%3E%3Ctd%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%3Csvg%20svg%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Csvg%20desc%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E"],"201737ac5662941cdf6ece5d6721ea8b0647f0ce":[async_test('html5lib_tables01.html 201737ac5662941cdf6ece5d6721ea8b0647f0ce'), "%3Cdiv%3E%3Ctable%3E%3Csvg%3E%3CforeignObject%3E%3Cselect%3E%3Ctable%3E%3Cs%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cdiv%3E%0A%7C%20%20%20%20%20%20%20%3Csvg%20svg%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Csvg%20foreignObject%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Cselect%3E%0A%7C%20%20%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Cs%3E%0A%7C%20%20%20%20%20%20%20%3Ctable%3E"], } init_tests(get_type()); </script> diff --git a/tests/wpt/web-platform-tests/html/syntax/parsing/html5lib_webkit02.html b/tests/wpt/web-platform-tests/html/syntax/parsing/html5lib_webkit02.html index 5c9bf4efc86..51900fa54a2 100644 --- a/tests/wpt/web-platform-tests/html/syntax/parsing/html5lib_webkit02.html +++ b/tests/wpt/web-platform-tests/html/syntax/parsing/html5lib_webkit02.html @@ -18,9 +18,9 @@ <script src="/resources/testharnessreport.js"></script> <script> var num_iframes = 8; - var order = ['f50b8c15847159a6d2c6ecc2bd1e4a944ba5aae6','326328ea805a2ebdde707e08567713f88a4cf8ab','05138397908cfdad69a3bfe5da5a06098320b504','2aaa2ac0d7cec6144633d8f82f3bcaafa7498cd9','4a256d7ef602c7c917c758e15981b9710f9b4130','98cea04429ddbe4ffaaa0b91fe77b8c0b1f7c1f4','209ad7d6f6c9c53cb856c7d78b2bc4a7f38abd5f','cb9a86fbac96b08a6e708a2dbcd9f78539dfe9c6','c46a4badc6b1ebc524e6f90ea56183310e93ab25','464eeaecc49646ff810cadad537880c9b473a262','7b4eb6981451ede406f2f4112e83a8584e7adbf5','73aed96d7cd3116e4a3e701104616c07d1ec5e0c','139a546c72bfcedf638d031f33da43f24995f688','6e33515b4dc011dd390d433a6358bf68b786b1fd','b6d2377b0dd710ca812c97b2b65cb5d2e93b0e5b','21a5b2b413c4db8ed588334b9a50dea9872bbcfa','90d3f6f2dff994f63293ca46f7cd50a75cde96a6','3e6b37a5fd0b16769f71f8e6a022ef6a972769d0','66c5e72324003827309d3590a9ba56412ba68f79','329d2522353afa12afea478bbfafdb0ff0656572',]; + var order = ['f50b8c15847159a6d2c6ecc2bd1e4a944ba5aae6','326328ea805a2ebdde707e08567713f88a4cf8ab','05138397908cfdad69a3bfe5da5a06098320b504','2aaa2ac0d7cec6144633d8f82f3bcaafa7498cd9','4a256d7ef602c7c917c758e15981b9710f9b4130','98cea04429ddbe4ffaaa0b91fe77b8c0b1f7c1f4','209ad7d6f6c9c53cb856c7d78b2bc4a7f38abd5f','cb9a86fbac96b08a6e708a2dbcd9f78539dfe9c6','c46a4badc6b1ebc524e6f90ea56183310e93ab25','464eeaecc49646ff810cadad537880c9b473a262','7b4eb6981451ede406f2f4112e83a8584e7adbf5','73aed96d7cd3116e4a3e701104616c07d1ec5e0c','139a546c72bfcedf638d031f33da43f24995f688','6e33515b4dc011dd390d433a6358bf68b786b1fd','b6d2377b0dd710ca812c97b2b65cb5d2e93b0e5b','21a5b2b413c4db8ed588334b9a50dea9872bbcfa','90d3f6f2dff994f63293ca46f7cd50a75cde96a6','3e6b37a5fd0b16769f71f8e6a022ef6a972769d0','66c5e72324003827309d3590a9ba56412ba68f79','329d2522353afa12afea478bbfafdb0ff0656572','5463526d91a8677b27b6967866d6605f1bb03aac','4879f476053094cf5602d325724675378856a902','44c88b90236f01ebc8e0123363b527640a07070c','cfb304e8f2d3cbdecc362226e7775cab452d5489','3fc625e7cb9b6ea72a9e252ede84c6fdd9680d87','ecd089f9b5193fad306c5b475c4711547fe5e209','cee2230c74671c594a1140a68d16e3d3e5ae005a','22b9fe36797d70a3b71a6aadc6ad7cff23c3fc90','a82c3bf49c381b5f58c5c8a4bbbe0cef2458e28a','61f8d527795dc8044a95a3e2437de81e16597ceb',]; var tests = { - "f50b8c15847159a6d2c6ecc2bd1e4a944ba5aae6":[async_test('html5lib_webkit02.html f50b8c15847159a6d2c6ecc2bd1e4a944ba5aae6'), "%3Cfoo%20bar%3Dqux/%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20bar%3D%22qux/%22"],"326328ea805a2ebdde707e08567713f88a4cf8ab":[async_test('html5lib_webkit02.html 326328ea805a2ebdde707e08567713f88a4cf8ab'), "%3Cp%20id%3D%22status%22%3E%3Cnoscript%3E%3Cstrong%3EA%3C/strong%3E%3C/noscript%3E%3Cspan%3EB%3C/span%3E%3C/p%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cp%3E%0A%7C%20%20%20%20%20%20%20id%3D%22status%22%0A%7C%20%20%20%20%20%20%20%3Cnoscript%3E%0A%7C%20%20%20%20%20%20%20%20%20%22%3Cstrong%3EA%3C/strong%3E%22%0A%7C%20%20%20%20%20%20%20%3Cspan%3E%0A%7C%20%20%20%20%20%20%20%20%20%22B%22"],"05138397908cfdad69a3bfe5da5a06098320b504":[async_test('html5lib_webkit02.html 05138397908cfdad69a3bfe5da5a06098320b504'), "%3Cdiv%3E%3Csarcasm%3E%3Cdiv%3E%3C/div%3E%3C/sarcasm%3E%3C/div%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cdiv%3E%0A%7C%20%20%20%20%20%20%20%3Csarcasm%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Cdiv%3E"],"2aaa2ac0d7cec6144633d8f82f3bcaafa7498cd9":[async_test('html5lib_webkit02.html 2aaa2ac0d7cec6144633d8f82f3bcaafa7498cd9'), "%3Chtml%3E%3Cbody%3E%3Cimg%20src%3D%22%22%20border%3D%220%22%20alt%3D%22%3E%3Cdiv%3EA%3C/div%3E%3C/body%3E%3C/html%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E"],"4a256d7ef602c7c917c758e15981b9710f9b4130":[async_test('html5lib_webkit02.html 4a256d7ef602c7c917c758e15981b9710f9b4130'), "%3Ctable%3E%3Ctd%3E%3C/tbody%3EA", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%22A%22%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E"],"98cea04429ddbe4ffaaa0b91fe77b8c0b1f7c1f4":[async_test('html5lib_webkit02.html 98cea04429ddbe4ffaaa0b91fe77b8c0b1f7c1f4'), "%3Ctable%3E%3Ctd%3E%3C/thead%3EA", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%22A%22"],"209ad7d6f6c9c53cb856c7d78b2bc4a7f38abd5f":[async_test('html5lib_webkit02.html 209ad7d6f6c9c53cb856c7d78b2bc4a7f38abd5f'), "%3Ctable%3E%3Ctd%3E%3C/tfoot%3EA", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%22A%22"],"cb9a86fbac96b08a6e708a2dbcd9f78539dfe9c6":[async_test('html5lib_webkit02.html cb9a86fbac96b08a6e708a2dbcd9f78539dfe9c6'), "%3Ctable%3E%3Cthead%3E%3Ctd%3E%3C/tbody%3EA", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Cthead%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%22A%22"],"c46a4badc6b1ebc524e6f90ea56183310e93ab25":[async_test('html5lib_webkit02.html c46a4badc6b1ebc524e6f90ea56183310e93ab25'), "%3Clegend%3Etest%3C/legend%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Clegend%3E%0A%7C%20%20%20%20%20%20%20%22test%22"],"464eeaecc49646ff810cadad537880c9b473a262":[async_test('html5lib_webkit02.html 464eeaecc49646ff810cadad537880c9b473a262'), "%3Ctable%3E%3Cinput%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cinput%3E%0A%7C%20%20%20%20%20%3Ctable%3E"],"7b4eb6981451ede406f2f4112e83a8584e7adbf5":[async_test('html5lib_webkit02.html 7b4eb6981451ede406f2f4112e83a8584e7adbf5'), "%3Cb%3E%3Cem%3E%3Cfoo%3E%3Cfoo%3E%3Caside%3E%3C/b%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cb%3E%0A%7C%20%20%20%20%20%20%20%3Cem%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%3Cem%3E%0A%7C%20%20%20%20%20%20%20%3Caside%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Cb%3E"],"73aed96d7cd3116e4a3e701104616c07d1ec5e0c":[async_test('html5lib_webkit02.html 73aed96d7cd3116e4a3e701104616c07d1ec5e0c'), "%3Cb%3E%3Cem%3E%3Cfoo%3E%3Cfoo%3E%3Caside%3E%3C/b%3E%3C/em%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cb%3E%0A%7C%20%20%20%20%20%20%20%3Cem%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%3Cem%3E%0A%7C%20%20%20%20%20%3Caside%3E%0A%7C%20%20%20%20%20%20%20%3Cem%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Cb%3E"],"139a546c72bfcedf638d031f33da43f24995f688":[async_test('html5lib_webkit02.html 139a546c72bfcedf638d031f33da43f24995f688'), "%3Cb%3E%3Cem%3E%3Cfoo%3E%3Cfoo%3E%3Cfoo%3E%3Caside%3E%3C/b%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cb%3E%0A%7C%20%20%20%20%20%20%20%3Cem%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%3Caside%3E%0A%7C%20%20%20%20%20%20%20%3Cb%3E"],"6e33515b4dc011dd390d433a6358bf68b786b1fd":[async_test('html5lib_webkit02.html 6e33515b4dc011dd390d433a6358bf68b786b1fd'), "%3Cb%3E%3Cem%3E%3Cfoo%3E%3Cfoo%3E%3Cfoo%3E%3Caside%3E%3C/b%3E%3C/em%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cb%3E%0A%7C%20%20%20%20%20%20%20%3Cem%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%3Caside%3E%0A%7C%20%20%20%20%20%20%20%3Cb%3E"],"b6d2377b0dd710ca812c97b2b65cb5d2e93b0e5b":[async_test('html5lib_webkit02.html b6d2377b0dd710ca812c97b2b65cb5d2e93b0e5b'), "%3Csvg%3E%3CforeignObject%3E%3Cdiv%3Efoo%3C/div%3E%3Cplaintext%3E%3C/foreignObject%3E%3C/svg%3E%3Cdiv%3Ebar%3C/div%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Csvg%20svg%3E%0A%7C%20%20%20%20%20%20%20%3Csvg%20foreignObject%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Cdiv%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%22foo%22%0A%7C%20%20%20%20%20%20%20%20%20%3Cplaintext%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%22%3C/foreignObject%3E%3C/svg%3E%3Cdiv%3Ebar%3C/div%3E%22"],"21a5b2b413c4db8ed588334b9a50dea9872bbcfa":[async_test('html5lib_webkit02.html 21a5b2b413c4db8ed588334b9a50dea9872bbcfa'), "%3Csvg%3E%3CforeignObject%3E%3C/foreignObject%3E%3Ctitle%3E%3C/svg%3Efoo", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Csvg%20svg%3E%0A%7C%20%20%20%20%20%20%20%3Csvg%20foreignObject%3E%0A%7C%20%20%20%20%20%20%20%3Csvg%20title%3E%0A%7C%20%20%20%20%20%22foo%22"],"90d3f6f2dff994f63293ca46f7cd50a75cde96a6":[async_test('html5lib_webkit02.html 90d3f6f2dff994f63293ca46f7cd50a75cde96a6'), "%3C/foreignObject%3E%3Cplaintext%3E%3Cdiv%3Efoo%3C/div%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cplaintext%3E%0A%7C%20%20%20%20%20%20%20%22%3Cdiv%3Efoo%3C/div%3E%22"],"3e6b37a5fd0b16769f71f8e6a022ef6a972769d0":[async_test('html5lib_webkit02.html 3e6b37a5fd0b16769f71f8e6a022ef6a972769d0'), "%3Csvg%20xml%3Abase%20xml%3Alang%20xml%3Aspace%20xml%3Abaaah%20definitionurl%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Csvg%20svg%3E%0A%7C%20%20%20%20%20%20%20definitionurl%3D%22%22%0A%7C%20%20%20%20%20%20%20xml%20lang%3D%22%22%0A%7C%20%20%20%20%20%20%20xml%20space%3D%22%22%0A%7C%20%20%20%20%20%20%20xml%3Abaaah%3D%22%22%0A%7C%20%20%20%20%20%20%20xml%3Abase%3D%22%22"],"66c5e72324003827309d3590a9ba56412ba68f79":[async_test('html5lib_webkit02.html 66c5e72324003827309d3590a9ba56412ba68f79'), "%3Cmath%20definitionurl%20xlink%3Atitle%20xlink%3Ashow%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cmath%20math%3E%0A%7C%20%20%20%20%20%20%20definitionURL%3D%22%22%0A%7C%20%20%20%20%20%20%20xlink%20show%3D%22%22%0A%7C%20%20%20%20%20%20%20xlink%20title%3D%22%22"],"329d2522353afa12afea478bbfafdb0ff0656572":[async_test('html5lib_webkit02.html 329d2522353afa12afea478bbfafdb0ff0656572'), "%3Cmath%20DEFINITIONURL%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cmath%20math%3E%0A%7C%20%20%20%20%20%20%20definitionURL%3D%22%22"], + "f50b8c15847159a6d2c6ecc2bd1e4a944ba5aae6":[async_test('html5lib_webkit02.html f50b8c15847159a6d2c6ecc2bd1e4a944ba5aae6'), "%3Cfoo%20bar%3Dqux/%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20bar%3D%22qux/%22"],"326328ea805a2ebdde707e08567713f88a4cf8ab":[async_test('html5lib_webkit02.html 326328ea805a2ebdde707e08567713f88a4cf8ab'), "%3Cp%20id%3D%22status%22%3E%3Cnoscript%3E%3Cstrong%3EA%3C/strong%3E%3C/noscript%3E%3Cspan%3EB%3C/span%3E%3C/p%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cp%3E%0A%7C%20%20%20%20%20%20%20id%3D%22status%22%0A%7C%20%20%20%20%20%20%20%3Cnoscript%3E%0A%7C%20%20%20%20%20%20%20%20%20%22%3Cstrong%3EA%3C/strong%3E%22%0A%7C%20%20%20%20%20%20%20%3Cspan%3E%0A%7C%20%20%20%20%20%20%20%20%20%22B%22"],"05138397908cfdad69a3bfe5da5a06098320b504":[async_test('html5lib_webkit02.html 05138397908cfdad69a3bfe5da5a06098320b504'), "%3Cdiv%3E%3Csarcasm%3E%3Cdiv%3E%3C/div%3E%3C/sarcasm%3E%3C/div%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cdiv%3E%0A%7C%20%20%20%20%20%20%20%3Csarcasm%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Cdiv%3E"],"2aaa2ac0d7cec6144633d8f82f3bcaafa7498cd9":[async_test('html5lib_webkit02.html 2aaa2ac0d7cec6144633d8f82f3bcaafa7498cd9'), "%3Chtml%3E%3Cbody%3E%3Cimg%20src%3D%22%22%20border%3D%220%22%20alt%3D%22%3E%3Cdiv%3EA%3C/div%3E%3C/body%3E%3C/html%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E"],"4a256d7ef602c7c917c758e15981b9710f9b4130":[async_test('html5lib_webkit02.html 4a256d7ef602c7c917c758e15981b9710f9b4130'), "%3Ctable%3E%3Ctd%3E%3C/tbody%3EA", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%22A%22%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E"],"98cea04429ddbe4ffaaa0b91fe77b8c0b1f7c1f4":[async_test('html5lib_webkit02.html 98cea04429ddbe4ffaaa0b91fe77b8c0b1f7c1f4'), "%3Ctable%3E%3Ctd%3E%3C/thead%3EA", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%22A%22"],"209ad7d6f6c9c53cb856c7d78b2bc4a7f38abd5f":[async_test('html5lib_webkit02.html 209ad7d6f6c9c53cb856c7d78b2bc4a7f38abd5f'), "%3Ctable%3E%3Ctd%3E%3C/tfoot%3EA", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%22A%22"],"cb9a86fbac96b08a6e708a2dbcd9f78539dfe9c6":[async_test('html5lib_webkit02.html cb9a86fbac96b08a6e708a2dbcd9f78539dfe9c6'), "%3Ctable%3E%3Cthead%3E%3Ctd%3E%3C/tbody%3EA", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Cthead%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%22A%22"],"c46a4badc6b1ebc524e6f90ea56183310e93ab25":[async_test('html5lib_webkit02.html c46a4badc6b1ebc524e6f90ea56183310e93ab25'), "%3Clegend%3Etest%3C/legend%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Clegend%3E%0A%7C%20%20%20%20%20%20%20%22test%22"],"464eeaecc49646ff810cadad537880c9b473a262":[async_test('html5lib_webkit02.html 464eeaecc49646ff810cadad537880c9b473a262'), "%3Ctable%3E%3Cinput%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cinput%3E%0A%7C%20%20%20%20%20%3Ctable%3E"],"7b4eb6981451ede406f2f4112e83a8584e7adbf5":[async_test('html5lib_webkit02.html 7b4eb6981451ede406f2f4112e83a8584e7adbf5'), "%3Cb%3E%3Cem%3E%3Cfoo%3E%3Cfoo%3E%3Caside%3E%3C/b%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cb%3E%0A%7C%20%20%20%20%20%20%20%3Cem%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%3Cem%3E%0A%7C%20%20%20%20%20%20%20%3Caside%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Cb%3E"],"73aed96d7cd3116e4a3e701104616c07d1ec5e0c":[async_test('html5lib_webkit02.html 73aed96d7cd3116e4a3e701104616c07d1ec5e0c'), "%3Cb%3E%3Cem%3E%3Cfoo%3E%3Cfoo%3E%3Caside%3E%3C/b%3E%3C/em%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cb%3E%0A%7C%20%20%20%20%20%20%20%3Cem%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%3Cem%3E%0A%7C%20%20%20%20%20%3Caside%3E%0A%7C%20%20%20%20%20%20%20%3Cem%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Cb%3E"],"139a546c72bfcedf638d031f33da43f24995f688":[async_test('html5lib_webkit02.html 139a546c72bfcedf638d031f33da43f24995f688'), "%3Cb%3E%3Cem%3E%3Cfoo%3E%3Cfoo%3E%3Cfoo%3E%3Caside%3E%3C/b%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cb%3E%0A%7C%20%20%20%20%20%20%20%3Cem%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%3Caside%3E%0A%7C%20%20%20%20%20%20%20%3Cb%3E"],"6e33515b4dc011dd390d433a6358bf68b786b1fd":[async_test('html5lib_webkit02.html 6e33515b4dc011dd390d433a6358bf68b786b1fd'), "%3Cb%3E%3Cem%3E%3Cfoo%3E%3Cfoo%3E%3Cfoo%3E%3Caside%3E%3C/b%3E%3C/em%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cb%3E%0A%7C%20%20%20%20%20%20%20%3Cem%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cfoo%3E%0A%7C%20%20%20%20%20%3Caside%3E%0A%7C%20%20%20%20%20%20%20%3Cb%3E"],"b6d2377b0dd710ca812c97b2b65cb5d2e93b0e5b":[async_test('html5lib_webkit02.html b6d2377b0dd710ca812c97b2b65cb5d2e93b0e5b'), "%3Csvg%3E%3CforeignObject%3E%3Cdiv%3Efoo%3C/div%3E%3Cplaintext%3E%3C/foreignObject%3E%3C/svg%3E%3Cdiv%3Ebar%3C/div%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Csvg%20svg%3E%0A%7C%20%20%20%20%20%20%20%3Csvg%20foreignObject%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Cdiv%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%22foo%22%0A%7C%20%20%20%20%20%20%20%20%20%3Cplaintext%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%22%3C/foreignObject%3E%3C/svg%3E%3Cdiv%3Ebar%3C/div%3E%22"],"21a5b2b413c4db8ed588334b9a50dea9872bbcfa":[async_test('html5lib_webkit02.html 21a5b2b413c4db8ed588334b9a50dea9872bbcfa'), "%3Csvg%3E%3CforeignObject%3E%3C/foreignObject%3E%3Ctitle%3E%3C/svg%3Efoo", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Csvg%20svg%3E%0A%7C%20%20%20%20%20%20%20%3Csvg%20foreignObject%3E%0A%7C%20%20%20%20%20%20%20%3Csvg%20title%3E%0A%7C%20%20%20%20%20%22foo%22"],"90d3f6f2dff994f63293ca46f7cd50a75cde96a6":[async_test('html5lib_webkit02.html 90d3f6f2dff994f63293ca46f7cd50a75cde96a6'), "%3C/foreignObject%3E%3Cplaintext%3E%3Cdiv%3Efoo%3C/div%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cplaintext%3E%0A%7C%20%20%20%20%20%20%20%22%3Cdiv%3Efoo%3C/div%3E%22"],"3e6b37a5fd0b16769f71f8e6a022ef6a972769d0":[async_test('html5lib_webkit02.html 3e6b37a5fd0b16769f71f8e6a022ef6a972769d0'), "%3Csvg%20xml%3Abase%20xml%3Alang%20xml%3Aspace%20xml%3Abaaah%20definitionurl%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Csvg%20svg%3E%0A%7C%20%20%20%20%20%20%20definitionurl%3D%22%22%0A%7C%20%20%20%20%20%20%20xml%20lang%3D%22%22%0A%7C%20%20%20%20%20%20%20xml%20space%3D%22%22%0A%7C%20%20%20%20%20%20%20xml%3Abaaah%3D%22%22%0A%7C%20%20%20%20%20%20%20xml%3Abase%3D%22%22"],"66c5e72324003827309d3590a9ba56412ba68f79":[async_test('html5lib_webkit02.html 66c5e72324003827309d3590a9ba56412ba68f79'), "%3Cmath%20definitionurl%20xlink%3Atitle%20xlink%3Ashow%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cmath%20math%3E%0A%7C%20%20%20%20%20%20%20definitionURL%3D%22%22%0A%7C%20%20%20%20%20%20%20xlink%20show%3D%22%22%0A%7C%20%20%20%20%20%20%20xlink%20title%3D%22%22"],"329d2522353afa12afea478bbfafdb0ff0656572":[async_test('html5lib_webkit02.html 329d2522353afa12afea478bbfafdb0ff0656572'), "%3Cmath%20DEFINITIONURL%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cmath%20math%3E%0A%7C%20%20%20%20%20%20%20definitionURL%3D%22%22"],"5463526d91a8677b27b6967866d6605f1bb03aac":[async_test('html5lib_webkit02.html 5463526d91a8677b27b6967866d6605f1bb03aac'), "%3Cselect%3E%3Chr%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cselect%3E%0A%7C%20%20%20%20%20%20%20%3Chr%3E"],"4879f476053094cf5602d325724675378856a902":[async_test('html5lib_webkit02.html 4879f476053094cf5602d325724675378856a902'), "%3Cselect%3E%3Coption%3E%3Chr%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cselect%3E%0A%7C%20%20%20%20%20%20%20%3Coption%3E%0A%7C%20%20%20%20%20%20%20%3Chr%3E"],"44c88b90236f01ebc8e0123363b527640a07070c":[async_test('html5lib_webkit02.html 44c88b90236f01ebc8e0123363b527640a07070c'), "%3Cselect%3E%3Coptgroup%3E%3Coption%3E%3Chr%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cselect%3E%0A%7C%20%20%20%20%20%20%20%3Coptgroup%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Coption%3E%0A%7C%20%20%20%20%20%20%20%3Chr%3E"],"cfb304e8f2d3cbdecc362226e7775cab452d5489":[async_test('html5lib_webkit02.html cfb304e8f2d3cbdecc362226e7775cab452d5489'), "%3Cselect%3E%3Coptgroup%3E%3Chr%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cselect%3E%0A%7C%20%20%20%20%20%20%20%3Coptgroup%3E%0A%7C%20%20%20%20%20%20%20%3Chr%3E"],"3fc625e7cb9b6ea72a9e252ede84c6fdd9680d87":[async_test('html5lib_webkit02.html 3fc625e7cb9b6ea72a9e252ede84c6fdd9680d87'), "%3Cselect%3E%3Coption%3E%3Coptgroup%3E%3Chr%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Cselect%3E%0A%7C%20%20%20%20%20%20%20%3Coption%3E%0A%7C%20%20%20%20%20%20%20%3Coptgroup%3E%0A%7C%20%20%20%20%20%20%20%3Chr%3E"],"ecd089f9b5193fad306c5b475c4711547fe5e209":[async_test('html5lib_webkit02.html ecd089f9b5193fad306c5b475c4711547fe5e209'), "%3Ctable%3E%3Ctr%3E%3Ctd%3E%3Cselect%3E%3Chr%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cselect%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Chr%3E"],"cee2230c74671c594a1140a68d16e3d3e5ae005a":[async_test('html5lib_webkit02.html cee2230c74671c594a1140a68d16e3d3e5ae005a'), "%3Ctable%3E%3Ctr%3E%3Ctd%3E%3Cselect%3E%3Coption%3E%3Chr%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cselect%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Coption%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Chr%3E"],"22b9fe36797d70a3b71a6aadc6ad7cff23c3fc90":[async_test('html5lib_webkit02.html 22b9fe36797d70a3b71a6aadc6ad7cff23c3fc90'), "%3Ctable%3E%3Ctr%3E%3Ctd%3E%3Cselect%3E%3Coptgroup%3E%3Coption%3E%3Chr%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cselect%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Coptgroup%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Coption%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Chr%3E"],"a82c3bf49c381b5f58c5c8a4bbbe0cef2458e28a":[async_test('html5lib_webkit02.html a82c3bf49c381b5f58c5c8a4bbbe0cef2458e28a'), "%3Ctable%3E%3Ctr%3E%3Ctd%3E%3Cselect%3E%3Coptgroup%3E%3Chr%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cselect%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Coptgroup%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Chr%3E"],"61f8d527795dc8044a95a3e2437de81e16597ceb":[async_test('html5lib_webkit02.html 61f8d527795dc8044a95a3e2437de81e16597ceb'), "%3Ctable%3E%3Ctr%3E%3Ctd%3E%3Cselect%3E%3Coption%3E%3Coptgroup%3E%3Chr%3E", "%23document%0A%7C%20%3Chtml%3E%0A%7C%20%20%20%3Chead%3E%0A%7C%20%20%20%3Cbody%3E%0A%7C%20%20%20%20%20%3Ctable%3E%0A%7C%20%20%20%20%20%20%20%3Ctbody%3E%0A%7C%20%20%20%20%20%20%20%20%20%3Ctr%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%3Ctd%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cselect%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Coption%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Coptgroup%3E%0A%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Chr%3E"], } init_tests(get_type()); </script> diff --git a/tests/wpt/web-platform-tests/html/tools/README b/tests/wpt/web-platform-tests/html/tools/README new file mode 100644 index 00000000000..2ebde65fcdf --- /dev/null +++ b/tests/wpt/web-platform-tests/html/tools/README @@ -0,0 +1 @@ +See ../syntax/parsing/README. diff --git a/tests/wpt/web-platform-tests/html/tools/html5lib_tests_revision b/tests/wpt/web-platform-tests/html/tools/html5lib_tests_revision index dae44a04416..4af32678e53 100644 --- a/tests/wpt/web-platform-tests/html/tools/html5lib_tests_revision +++ b/tests/wpt/web-platform-tests/html/tools/html5lib_tests_revision @@ -1 +1 @@ -251b2efff71c914dd184c868fdd70b9d9e54aed4 +c67f90eacac14e022b1f2c2e5ac559879581e9ff |