-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the test definition directly usable as template parameters.
This is done by better leveraging the Jinja templates, which removes the need for manually processing the data in the Python script. It also makes the generator more flexible because now, we can control the template parameters directly form the Yaml test definition. This unlocks very interesting follow-ups, like allowing fields in the Yaml test definition to refer to each other using Jinja templating. Change-Id: Iebbd125fff37d6d0c77a7188bcbc57c64c60115c Bug: 1275750 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4556171 Reviewed-by: Yi Xu <yiyix@chromium.org> Commit-Queue: Jean-Philippe Gravel <jpgravel@chromium.org> Cr-Commit-Position: refs/heads/main@{#1150253}
- Loading branch information
Showing
10 changed files
with
120 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 6 additions & 7 deletions
13
third_party/blink/web_tests/external/wpt/html/canvas/tools/templates/reftest.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
<!DOCTYPE html> | ||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
{% if ref_link %}<link rel="match" href="{{ ref_link }}"> | ||
{% endif %} | ||
{% if fuzzy %}<meta name=fuzzy content="{{ fuzzy }}"> | ||
{% endif %} | ||
{% if timeout %}<meta name="timeout" content="{{ timeout }}"> | ||
{% endif %} | ||
<title>Canvas test: {{ name }}</title> | ||
<h1>{{ name }}</h1> | ||
<p class="desc">{{ desc }}</p> | ||
{% if notes %}<p class="notes">{{ notes }}{% endif %} | ||
|
||
{{ code | trim }} | ||
{{ images -}} | ||
{% for image in images %} | ||
<img src="/images/{{ image }}" id="{{ image }}" class="resource"> | ||
{% endfor -%} | ||
{% for svgimage in svgimages %} | ||
<svg><image xlink:href="/images/{{ svgimage }}" id="{{ svgimage }}" class="resource"></svg> | ||
{% endfor -%} |
22 changes: 14 additions & 8 deletions
22
third_party/blink/web_tests/external/wpt/html/canvas/tools/templates/reftest_element.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,34 @@ | ||
<!DOCTYPE html> | ||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
{% if promise_test %}<html class="reftest-wait"> | ||
{% endif %} | ||
{% if ref_link %}<link rel="match" href="{{ ref_link }}"> | ||
{% if test_type == 'promise' %}<html class="reftest-wait"> | ||
{% endif %} | ||
{% if not is_test_reference %} | ||
<link rel="match" href="{{ name }}-expected.html"> | ||
{% if fuzzy %}<meta name=fuzzy content="{{ fuzzy }}"> | ||
{% endif %} | ||
{% endif %} | ||
{% if timeout %}<meta name="timeout" content="{{ timeout }}"> | ||
{% endif %} | ||
<title>Canvas test: {{ name }}</title> | ||
<h1>{{ name }}</h1> | ||
<p class="desc">{{ desc }}</p> | ||
{% if notes %}<p class="notes">{{ notes }}{% endif %} | ||
<canvas id="canvas" width="{{ width }}" height="{{ height }}"{{ canvas }}> | ||
<canvas id="canvas" width="{{ size[0] }}" height="{{ size[1] }}"{{ canvas }}> | ||
<p class="fallback">FAIL (fallback content)</p> | ||
</canvas> | ||
<script{% if promise_test %} type="module"{% endif %}> | ||
<script{% if test_type == 'promise' %} type="module"{% endif %}> | ||
const canvas = document.getElementById("canvas"); | ||
const ctx = canvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %}); | ||
|
||
{{ code | trim | indent(2) }} | ||
{% if promise_test %} | ||
{% if test_type == 'promise' %} | ||
document.documentElement.classList.remove("reftest-wait"); | ||
{% endif %} | ||
</script> | ||
{{ images -}} | ||
{% if promise_test %}</html>{% endif %} | ||
{% for image in images %} | ||
<img src="/images/{{ image }}" id="{{ image }}" class="resource"> | ||
{% endfor -%} | ||
{% for svgimage in svgimages %} | ||
<svg><image xlink:href="/images/{{ svgimage }}" id="{{ svgimage }}" class="resource"></svg> | ||
{% endfor -%} | ||
{% if test_type == 'promise' %}</html>{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.