testharness_element.html (2216B)
1 <!DOCTYPE html> 2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> 3 <meta charset="UTF-8"> 4 <title>Canvas test: {{ name }}</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/html/canvas/resources/canvas-tests.js"></script> 8 <link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css"> 9 {% if fonts %} 10 <style> 11 {% for font in fonts %} 12 @font-face { 13 font-family: {{ font }}; 14 src: url("/fonts/{{ font }}.ttf"); 15 } 16 {% endfor %} 17 </style> 18 {% endif %} 19 <body class="show_output"> 20 21 <h1>{{ name }}</h1> 22 <p class="desc">{{ desc }}</p> 23 24 {% if notes %}<p class="notes">{{ notes }} 25 {% else %} 26 27 {% endif %} 28 {% if fonts and not font_unused_in_dom %} 29 {% for font in fonts %} 30 <span style="font-family: {{ font }}; position: absolute; visibility: hidden">A</span> 31 {% endfor %} 32 {% endif %} 33 <p class="output">Actual output:</p> 34 <canvas id="c" class="output" width="{{ size[0] }}" height="{{ size[1] }}" 35 {{- canvas}}><p class="fallback">FAIL (fallback content)</p></canvas> 36 {% if expected_img %} 37 <p class="output expectedtext">Expected output:<p><img src="{{ expected_img }}" class="output expected" id="expected" alt=""> 38 {%- endif +%} 39 <ul id="d"></ul> 40 <script> 41 42 {#- Promise vs. async test header: +#} 43 {% if test_type == 'promise' %} 44 promise_test(async t => { 45 46 {% elif test_type == 'async' %} 47 async_test(t => { 48 {% elif test_type == 'sync' %} 49 test(t => { 50 {% endif %} 51 {% if not test_type %} 52 var t = async_test("{{ desc | double_quote_escape }}"); 53 _addTest(function(canvas, ctx) { 54 55 {% else %} 56 var canvas = document.getElementById('c'); 57 var ctx = canvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %}); 58 59 {% endif %} 60 61 {#- Test body: #} 62 {{ code | trim | indent(2) }} 63 64 {# Promise vs. async test footer: #} 65 {% if not test_type %} 66 }{% if attributes %}, {{ attributes }}{% endif %}); 67 {% else %} 68 }, "{{ desc | double_quote_escape }}"); 69 {% endif -%} 70 71 </script> 72 {% for image in images %} 73 <img src="/images/{{ image }}" id="{{ image }}" class="resource"> 74 {% endfor -%} 75 {% for svgimage in svgimages %} 76 <svg><image xlink:href="/images/{{ svgimage }}" id="{{ svgimage }}" class="resource"></svg> 77 {% endfor +%}