summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/canvas/tools/templates/reftest_element_grid.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/canvas/tools/templates/reftest_element_grid.html')
-rw-r--r--testing/web-platform/tests/html/canvas/tools/templates/reftest_element_grid.html56
1 files changed, 56 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/canvas/tools/templates/reftest_element_grid.html b/testing/web-platform/tests/html/canvas/tools/templates/reftest_element_grid.html
new file mode 100644
index 0000000000..d1c90bd993
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/tools/templates/reftest_element_grid.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+{% if test_type == 'promise' %}<html class="reftest-wait">
+<script>pending_tests = {{ element_variants | length }};</script>
+{% endif %}
+{% if not is_test_reference %}
+<link rel="match" href="{{ reference_file }}">
+{% if fuzzy %}<meta name=fuzzy content="{{ fuzzy }}">
+{% endif %}
+{% endif %}
+{% if timeout %}<meta name="timeout" content="{{ timeout }}">
+{% endif %}
+<title>Canvas test: {{ name }}</title>
+<h1 style="font-size: 20px;">{{ name }}</h1>
+<p class="desc">{{ desc }}</p>
+{% if notes %}<p class="notes">{{ notes }}{% 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 %}
+
+<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 %}
+ <canvas id="canvas{{ variant.id
+ }}" width="{{ variant.size[0]
+ }}" height="{{ variant.size[1]
+ }}" style="outline: 1px solid"{{ variant.canvas }}>
+ <p class="fallback">FAIL (fallback content)</p>
+ </canvas>
+ <script type="module">
+ const canvas = document.getElementById("canvas{{ variant.id }}");
+ const ctx = canvas.getContext('2d'{%
+ if variant.attributes %}, {{ variant.attributes }}{% endif %});
+
+ {{ variant.reference | trim | indent(4) if is_test_reference else
+ variant.code_element | trim | indent(4) }}
+ {% if test_type == 'promise' %}
+ if (--pending_tests == 0) {
+ document.documentElement.classList.remove("reftest-wait");
+ }
+ {% endif %}
+ </script>
+</span>
+
+{% endfor %}
+</div>
+{% if test_type == 'promise' %}</html>{% endif %}