-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1921829 [wpt PR 48382] - Add a new canvas WPT template using pyca…
…iro-generated reference images, a=testonly Automatic update from web-platform-tests Add a new canvas WPT template using pycairo-generated reference images Using the "cairo_reference:" key in the YAML config, we can now express the expected result of a test using pycairo code. Contrary to the existing "expected:" key which produces an image that is only used for "informational" purpose, "cairo_reference:" produces a reference test, meaning that the test runner automatically compares the test result with that generated image and fails the test if the result differs. Both single variant tests (non-variant or tests with a single variant per file) and variant grids are supported. For single variant, the generated reference file is an HMTL page with a single <img> tag pointing to the PNG generated with pycairo. To cut down on the number of files generated for variant grids, all the reference images for all of the cells of the grid are packed into a single PNG file, 3d-model-texture-style. The reference HTML file is a grid of <img> tags, each framing a different portion of the PNG image. Bug: 364549423 Change-Id: Icb3c246b22347054b7cc9b5e5cc40d21b30565bd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5894774 Reviewed-by: Andres Ricardo Perez <[email protected]> Commit-Queue: Jean-Philippe Gravel <[email protected]> Cr-Commit-Position: refs/heads/main@{#1369396} -- wpt-commits: 2af17a84e98cd28940d2882c68ff824d6e98f4b7 wpt-pr: 48382
- Loading branch information
1 parent
66f4afa
commit 1694c02
Showing
3 changed files
with
130 additions
and
17 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
8 changes: 8 additions & 0 deletions
8
testing/web-platform/tests/html/canvas/tools/templates/reftest_img.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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!DOCTYPE html> | ||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<title>Canvas test: {{ name }}</title> | ||
<h1>{{ name }}</h1> | ||
<p>{{ desc }}</p> | ||
{% if notes %}<p>{{ notes }}</p>{% endif %} | ||
|
||
<img src="{{ img_reference }}"> |
27 changes: 27 additions & 0 deletions
27
testing/web-platform/tests/html/canvas/tools/templates/reftest_img_grid.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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<title>Canvas test: {{ name }}</title> | ||
<h1 style="font-size: 20px;">{{ name }}</h1> | ||
<p>{{ desc }}</p> | ||
{% if notes %}<p>{{ notes }}</p>{% endif %} | ||
|
||
<div style="display: grid; grid-gap: 4px; | ||
grid-template-columns: repeat({{ grid_width }}, max-content); | ||
font-size: 13px; text-align: center;"> | ||
{% for variant in element_variants %} | ||
<span> | ||
{% for variant_name in variant.grid_variant_names %} | ||
<div>{{ variant_name }}</div> | ||
{% endfor %} | ||
{% set x_pos = ((loop.index0 % grid_width) | int) * variant.size[0] %} | ||
{% set y_pos = ((loop.index0 / grid_width) | int) * variant.size[1] %} | ||
<img src="{{ img_reference }}" | ||
style="outline: 1px solid; | ||
width: {{ variant.size[0] }}px; | ||
height: {{ variant.size[1] }}px; | ||
object-position: {{ -x_pos }}px {{ -y_pos }}px; | ||
object-fit: none;"> | ||
</span> | ||
|
||
{% endfor %} | ||
</div> |