commit 48c1e082e4e9f273387a7db044debb3ecbdbbd1a parent 0ef18063317934e94023bd3781384bc6be279788 Author: Jean-Philippe Gravel <jpgravel@chromium.org> Date: Mon, 1 Dec 2025 07:22:38 +0000 Bug 2003085 [wpt PR 56339] - Set the canvas size in WPT's generated canvas grid tests, a=testonly Automatic update from web-platform-tests Set the canvas size in WPT's generated canvas grid tests The Offscreen and Worker version of these tests already have their size set, but the HTMLCanvasElement tests were using the default canvas size. This difference could cause issues, with the HTMLCanvasElement test behaving unexpectedly. Change-Id: I826ded56843acadf231c778d4ef4abe99b6eed5a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7210510 Reviewed-by: Andres Ricardo Perez <andresrperez@chromium.org> Commit-Queue: Jean-Philippe Gravel <jpgravel@chromium.org> Cr-Commit-Position: refs/heads/main@{#1551634} -- wpt-commits: d8b1476d6895a16f5999dcb0f70f30e5c5788fda wpt-pr: 56339 Diffstat:
8 files changed, 184 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.malformed-operations-with-promises.html b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.malformed-operations-with-promises.html @@ -13,6 +13,8 @@ promise_test(async t => { const canvas = document.createElement('canvas'); + canvas.width = 200; + canvas.height = 200; const ctx = canvas.getContext('2d'); // Shouldn't throw on its own. @@ -27,6 +29,8 @@ promise_test(async t => { promise_test(async t => { const canvas = document.createElement('canvas'); + canvas.width = 200; + canvas.height = 200; const ctx = canvas.getContext('2d'); // Shouldn't throw on its own. diff --git a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.malformed-operations.html b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.malformed-operations.html @@ -13,6 +13,8 @@ test(t => { const canvas = document.createElement('canvas'); + canvas.width = 200; + canvas.height = 200; const ctx = canvas.getContext('2d'); // Shouldn't throw on its own. @@ -27,6 +29,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 200; + canvas.height = 200; const ctx = canvas.getContext('2d'); const canvas2 = new OffscreenCanvas(200, 200); @@ -43,6 +47,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 200; + canvas.height = 200; const ctx = canvas.getContext('2d'); // Shouldn't throw on its own. @@ -57,6 +63,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 200; + canvas.height = 200; const ctx = canvas.getContext('2d'); const canvas2 = new OffscreenCanvas(200, 200); @@ -74,6 +82,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 200; + canvas.height = 200; const ctx = canvas.getContext('2d'); // Shouldn't throw on its own. diff --git a/testing/web-platform/tests/html/canvas/element/text/2d.text.measure.getActualBoundingBox-full-text.tentative.html b/testing/web-platform/tests/html/canvas/element/text/2d.text.measure.getActualBoundingBox-full-text.tentative.html @@ -13,6 +13,8 @@ test(t => { const canvas = document.createElement('canvas'); + canvas.width = 800; + canvas.height = 200; const ctx = canvas.getContext('2d'); // Use measureText to create a rect for the whole text @@ -75,6 +77,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 800; + canvas.height = 200; const ctx = canvas.getContext('2d'); // Use measureText to create a rect for the whole text @@ -137,6 +141,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 800; + canvas.height = 200; const ctx = canvas.getContext('2d'); // Use measureText to create a rect for the whole text @@ -211,6 +217,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 800; + canvas.height = 200; const ctx = canvas.getContext('2d'); // Use measureText to create a rect for the whole text diff --git a/testing/web-platform/tests/html/canvas/element/text/2d.text.measure.getActualBoundingBox.tentative.html b/testing/web-platform/tests/html/canvas/element/text/2d.text.measure.getActualBoundingBox.tentative.html @@ -21,6 +21,8 @@ promise_test(async t => { const canvas = document.createElement('canvas'); + canvas.width = 800; + canvas.height = 200; const ctx = canvas.getContext('2d'); // Use measureText to create a rect for the whole text @@ -101,6 +103,8 @@ promise_test(async t => { promise_test(async t => { const canvas = document.createElement('canvas'); + canvas.width = 800; + canvas.height = 200; const ctx = canvas.getContext('2d'); // Use measureText to create a rect for the whole text @@ -181,6 +185,8 @@ promise_test(async t => { promise_test(async t => { const canvas = document.createElement('canvas'); + canvas.width = 800; + canvas.height = 200; const ctx = canvas.getContext('2d'); // Use measureText to create a rect for the whole text @@ -261,6 +267,8 @@ promise_test(async t => { promise_test(async t => { const canvas = document.createElement('canvas'); + canvas.width = 800; + canvas.height = 200; const ctx = canvas.getContext('2d'); // Use measureText to create a rect for the whole text @@ -341,6 +349,8 @@ promise_test(async t => { promise_test(async t => { const canvas = document.createElement('canvas'); + canvas.width = 800; + canvas.height = 200; const ctx = canvas.getContext('2d'); // Use measureText to create a rect for the whole text @@ -421,6 +431,8 @@ promise_test(async t => { promise_test(async t => { const canvas = document.createElement('canvas'); + canvas.width = 800; + canvas.height = 200; const ctx = canvas.getContext('2d'); // Use measureText to create a rect for the whole text diff --git a/testing/web-platform/tests/html/canvas/element/text/2d.text.measure.index-from-offset-edges.tentative.html b/testing/web-platform/tests/html/canvas/element/text/2d.text.measure.index-from-offset-edges.tentative.html @@ -13,6 +13,8 @@ test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function computeExpected(text, text_width, offset) { @@ -83,6 +85,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function computeExpected(text, text_width, offset) { @@ -153,6 +157,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function computeExpected(text, text_width, offset) { @@ -223,6 +229,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function computeExpected(text, text_width, offset) { @@ -293,6 +301,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function computeExpected(text, text_width, offset) { @@ -363,6 +373,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function computeExpected(text, text_width, offset) { @@ -433,6 +445,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function computeExpected(text, text_width, offset) { @@ -503,6 +517,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function computeExpected(text, text_width, offset) { @@ -573,6 +589,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function computeExpected(text, text_width, offset) { @@ -643,6 +661,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function computeExpected(text, text_width, offset) { diff --git a/testing/web-platform/tests/html/canvas/element/text/2d.text.measure.index-from-offset.tentative.html b/testing/web-platform/tests/html/canvas/element/text/2d.text.measure.index-from-offset.tentative.html @@ -13,6 +13,8 @@ test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -119,6 +121,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -225,6 +229,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -331,6 +337,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -437,6 +445,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -543,6 +553,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -649,6 +661,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -755,6 +769,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -861,6 +877,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -967,6 +985,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -1073,6 +1093,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -1179,6 +1201,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -1285,6 +1309,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -1391,6 +1417,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -1497,6 +1525,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -1603,6 +1633,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -1709,6 +1741,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -1815,6 +1849,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -1921,6 +1957,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -2027,6 +2065,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -2133,6 +2173,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -2250,6 +2292,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -2367,6 +2411,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -2484,6 +2530,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -2601,6 +2649,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -2718,6 +2768,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -2835,6 +2887,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -2952,6 +3006,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -3069,6 +3125,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -3186,6 +3244,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -3303,6 +3363,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -3420,6 +3482,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -3537,6 +3601,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -3654,6 +3720,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -3771,6 +3839,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -3888,6 +3958,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -4005,6 +4077,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -4122,6 +4196,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -4239,6 +4315,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { @@ -4356,6 +4434,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function alignOffset(offset, width) { diff --git a/testing/web-platform/tests/html/canvas/element/text/2d.text.measure.selection-rects.tentative.html b/testing/web-platform/tests/html/canvas/element/text/2d.text.measure.selection-rects.tentative.html @@ -13,6 +13,8 @@ test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -127,6 +129,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -241,6 +245,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -355,6 +361,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -469,6 +477,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -583,6 +593,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -697,6 +709,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -811,6 +825,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -925,6 +941,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -1039,6 +1057,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -1153,6 +1173,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -1267,6 +1289,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -1381,6 +1405,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -1507,6 +1533,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -1633,6 +1661,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -1759,6 +1789,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -1885,6 +1917,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -2011,6 +2045,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -2137,6 +2173,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -2263,6 +2301,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -2389,6 +2429,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -2515,6 +2557,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -2641,6 +2685,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { @@ -2767,6 +2813,8 @@ test(t => { test(t => { const canvas = document.createElement('canvas'); + canvas.width = 100; + canvas.height = 50; const ctx = canvas.getContext('2d'); function placeAndSelectTextInDOM(text, from, to) { diff --git a/testing/web-platform/tests/html/canvas/tools/templates/testharness_element_grid.html b/testing/web-platform/tests/html/canvas/tools/templates/testharness_element_grid.html @@ -45,6 +45,8 @@ async_test(t => { test(t => { {% endif %} const canvas = document.createElement('canvas'); + canvas.width = {{ variant.size[0] }}; + canvas.height = {{ variant.size[1] }}; const ctx = canvas.getContext('2d'{% if variant.attributes %}, {{ variant.attributes }}{% endif %});