From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- .../tests/html/canvas/tools/templates/reftest.html | 2 +- .../canvas/tools/templates/reftest_element.html | 3 ++- .../canvas/tools/templates/reftest_offscreen.html | 2 +- .../canvas/tools/templates/reftest_worker.html | 2 +- .../tools/templates/testharness_element.html | 24 ++++++++++++++-------- .../tools/templates/testharness_offscreen.html | 18 ++++++++++------ .../canvas/tools/templates/testharness_worker.js | 17 +++++++++------ 7 files changed, 44 insertions(+), 24 deletions(-) (limited to 'testing/web-platform/tests/html/canvas/tools/templates') diff --git a/testing/web-platform/tests/html/canvas/tools/templates/reftest.html b/testing/web-platform/tests/html/canvas/tools/templates/reftest.html index 4c9affbbbb..f68d4c4621 100644 --- a/testing/web-platform/tests/html/canvas/tools/templates/reftest.html +++ b/testing/web-platform/tests/html/canvas/tools/templates/reftest.html @@ -5,7 +5,7 @@

{{ desc }}

{% if notes %}

{{ notes }}{% endif %} -{{ code | trim }} +{{ html_reference | trim }} {% for image in images %} {% endfor -%} diff --git a/testing/web-platform/tests/html/canvas/tools/templates/reftest_element.html b/testing/web-platform/tests/html/canvas/tools/templates/reftest_element.html index 6684e9c615..6f7a8c8507 100644 --- a/testing/web-platform/tests/html/canvas/tools/templates/reftest_element.html +++ b/testing/web-platform/tests/html/canvas/tools/templates/reftest_element.html @@ -20,7 +20,8 @@ const canvas = document.getElementById("canvas"); const ctx = canvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %}); - {{ code | trim | indent(2) }} + {{ reference | trim | indent(2) if is_test_reference else + code_element | trim | indent(2) }} {% if test_type == 'promise' %} document.documentElement.classList.remove("reftest-wait"); {% endif %} diff --git a/testing/web-platform/tests/html/canvas/tools/templates/reftest_offscreen.html b/testing/web-platform/tests/html/canvas/tools/templates/reftest_offscreen.html index 1d0d93dfa1..abc840159f 100644 --- a/testing/web-platform/tests/html/canvas/tools/templates/reftest_offscreen.html +++ b/testing/web-platform/tests/html/canvas/tools/templates/reftest_offscreen.html @@ -18,7 +18,7 @@ const canvas = new OffscreenCanvas({{ size[0] }}, {{ size[1] }}); const ctx = canvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %}); - {{ code | trim | indent(2) }} + {{ code_offscreen | trim | indent(2) }} const outputCanvas = document.getElementById("canvas"); outputCanvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %}).drawImage(canvas, 0, 0); diff --git a/testing/web-platform/tests/html/canvas/tools/templates/reftest_worker.html b/testing/web-platform/tests/html/canvas/tools/templates/reftest_worker.html index e636d3634b..02281af5d1 100644 --- a/testing/web-platform/tests/html/canvas/tools/templates/reftest_worker.html +++ b/testing/web-platform/tests/html/canvas/tools/templates/reftest_worker.html @@ -18,7 +18,7 @@ const canvas = new OffscreenCanvas({{ size[0] }}, {{ size[1] }}); const ctx = canvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %}); - {{ code | trim | indent(4) }} + {{ code_worker | trim | indent(4) }} const bitmap = canvas.transferToImageBitmap(); self.postMessage(bitmap, bitmap); diff --git a/testing/web-platform/tests/html/canvas/tools/templates/testharness_element.html b/testing/web-platform/tests/html/canvas/tools/templates/testharness_element.html index 56cde7936a..c8de772ea6 100644 --- a/testing/web-platform/tests/html/canvas/tools/templates/testharness_element.html +++ b/testing/web-platform/tests/html/canvas/tools/templates/testharness_element.html @@ -42,21 +42,29 @@ {% if test_type == 'promise' %} promise_test(async t => { - var canvas = document.getElementById('c'); - var ctx = canvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %}); -{% else %} +{% elif test_type == 'async' %} +async_test(t => { +{% elif test_type == 'sync' %} +test(t => { +{% endif %} +{% if not test_type %} var t = async_test("{{ desc | double_quote_escape }}"); _addTest(function(canvas, ctx) { + +{% else %} + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %}); + {% endif %} - {# Test body: #} - {{ code | trim | indent(2) }} + {#- Test body: #} + {{ code_element | trim | indent(2) }} {# Promise vs. async test footer: #} -{% if test_type == 'promise' %} -}, "{{ desc }}"); -{% else %} +{% if not test_type %} }{% if attributes %}, {{ attributes }}{% endif %}); +{% else %} +}, "{{ desc | double_quote_escape }}"); {% endif -%} diff --git a/testing/web-platform/tests/html/canvas/tools/templates/testharness_offscreen.html b/testing/web-platform/tests/html/canvas/tools/templates/testharness_offscreen.html index 8ebbff77a6..68147680e1 100644 --- a/testing/web-platform/tests/html/canvas/tools/templates/testharness_offscreen.html +++ b/testing/web-platform/tests/html/canvas/tools/templates/testharness_offscreen.html @@ -15,6 +15,11 @@ {#- Promise vs. async test header: +#} {% if test_type == 'promise' %} promise_test(async t => { + +{% elif test_type == 'async' %} +async_test(t => { +{% elif test_type == 'sync' %} +test(t => { {% else %} var t = async_test("{{ desc | double_quote_escape }}"); var t_pass = t.done.bind(t); @@ -22,22 +27,23 @@ var t_fail = t.step_func(function(reason) { throw reason; }); t.step(function() { + {% endif %} -{# Test body: #} +{#- Test body: #} var canvas = new OffscreenCanvas({{ size[0] }}, {{ size[1] }}); var ctx = canvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %}); - {{ code | trim | indent(2)}} + {{ code_offscreen | trim | indent(2)}} {#- Promise vs. async test footer: +#} -{% if test_type == 'promise' %} - -}, "{{ desc }}"); -{% else %} +{% if not test_type %} t.done(); }); +{% else %} + +}, "{{ desc | double_quote_escape }}"); {% endif %} {% for svgimage in svgimages %} diff --git a/testing/web-platform/tests/html/canvas/tools/templates/testharness_worker.js b/testing/web-platform/tests/html/canvas/tools/templates/testharness_worker.js index f1f04e7bb6..570d479a0a 100644 --- a/testing/web-platform/tests/html/canvas/tools/templates/testharness_worker.js +++ b/testing/web-platform/tests/html/canvas/tools/templates/testharness_worker.js @@ -10,6 +10,10 @@ importScripts("/html/canvas/resources/canvas-tests.js"); {# Promise vs. async test header: #} {% if test_type == 'promise' %} promise_test(async t => { +{% elif test_type == 'async' %} +async_test(t => { +{% elif test_type == 'sync' %} +test(t => { {% else %} var t = async_test("{{ desc | double_quote_escape }}"); var t_pass = t.done.bind(t); @@ -17,19 +21,20 @@ var t_fail = t.step_func(function(reason) { throw reason; }); t.step(function() { + {% endif %} -{# Test body: #} +{#- Test body: #} var canvas = new OffscreenCanvas({{ size[0] }}, {{ size[1] }}); var ctx = canvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %}); - {{ code | trim | indent(2)}} - t.done(); + {{ code_worker | trim | indent(2)}} {#- Promise vs. async test footer: +#} -{% if test_type == 'promise' %} -}, "{{ desc }}"); -{% else %} +{% if not test_type %} + t.done(); }); +{% else %} +}, "{{ desc | double_quote_escape }}"); {% endif %} done(); -- cgit v1.2.3