blob: 7d8ebfccf565a293138aecc3eaecc54d0176c573 [file] [log] [blame]
offscreen: |
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<title>OffscreenCanvas test: %(name)s</title>
%(timeout)s\
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/html/canvas/resources/canvas-tests.js"></script>
<h1>%(name)s</h1>
<p class="desc">%(desc)s</p>
%(notes)s
<script>\
## Promise vs. async test header:
{% if promise_test %}\
promise_test(async t => {
{% else %}\
var t = async_test("%(escaped_desc)s");
var t_pass = t.done.bind(t);
var t_fail = t.step_func(function(reason) {
throw reason;
});
t.step(function() {
{% endif %}\
## Test body:
var canvas = new OffscreenCanvas(%(width)s, %(height)s);
var ctx = canvas.getContext(%(context_args)s);
%(code)s\
## Promise vs. async test footer:
{% if promise_test %}\
}, "%(desc)s");
{% else %}\
t.done();
});
{% endif %}\
</script>
worker: |
%(timeout_js)s\
// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
// OffscreenCanvas test in a worker:%(name)s
// Description:%(desc)s
// Note:%(notes)s
importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");
## Promise vs. async test header:
{% if promise_test %}\
promise_test(async t => {
{% else %}\
var t = async_test("%(escaped_desc)s");
var t_pass = t.done.bind(t);
var t_fail = t.step_func(function(reason) {
throw reason;
});
t.step(function() {
{% endif %}\
## Test body:
var canvas = new OffscreenCanvas(%(width)s, %(height)s);
var ctx = canvas.getContext(%(context_args)s);
%(code)s
t.done();\
## Promise vs. async test footer:
{% if promise_test %}\
}, "%(desc)s");
{% else %}\
});
{% endif %}\
done();
element: |
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<title>Canvas test: %(name)s</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/html/canvas/resources/canvas-tests.js"></script>
<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
%(fonts)s\
<body class="show_output">
<h1>%(name)s</h1>
<p class="desc">%(desc)s</p>
%(notes)s
%(fonthack)s\
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="%(width)s" height="%(height)s"%(canvas)s>\-
%(fallback)s\
</canvas>
%(expected)s
<ul id="d"></ul>\
<script>\
## Promise vs. async test header:
{% if promise_test %}\
promise_test(async t => {
var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d'%(attributes)s);
{% else %}\
var t = async_test("%(escaped_desc)s");
_addTest(function(canvas, ctx) {
{% endif %}\
## Test body:
%(code)s
## Promise vs. async test footer:
{% if promise_test %}\
}, "%(desc)s");
{% else %}\
}%(attributes)s);
{% endif %}\
\
</script>
%(images)s
offscreen_ref_test: |-
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
{% if promise_test %}\
<html class="reftest-wait">
{% endif %}\
%(links)s\
%(fuzzy)s\
%(timeout)s\
<title>Canvas test: %(name)s</title>
<h1>%(name)s</h1>
<p class="desc">%(desc)s</p>
%(fonts)s%(fonthack)s%(notes)s<canvas id="canvas" width="%(width)s" height="%(height)s"%(canvas)s>
%(fallback)s
</canvas>
<script{% if promise_test %} type="module"{% endif %}>
const canvas = new OffscreenCanvas(%(width)s, %(height)s);
const ctx = canvas.getContext(%(context_args)s);
%(code)s
const outputCanvas = document.getElementById("canvas");
outputCanvas.getContext(%(context_args)s).drawImage(canvas, 0, 0);
{% if promise_test %}\
document.documentElement.classList.remove("reftest-wait");
{% endif %}\
</script>
%(images)s\
{% if promise_test %}</html>{% endif %}
worker_ref_test: |
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<html class="reftest-wait">
%(links)s\
%(fuzzy)s\
%(timeout)s\
<title>Canvas test: %(name)s</title>
<h1>%(name)s</h1>
<p class="desc">%(desc)s</p>
%(fonts)s%(fonthack)s%(notes)s<canvas id="canvas" width="%(width)s" height="%(height)s"%(canvas)s>
%(fallback)s
</canvas>
<script id='myWorker' type='text/worker'>
self.onmessage = {% if promise_test %}async {% endif %}function(e) {
const canvas = new OffscreenCanvas(%(width)s, %(height)s);
const ctx = canvas.getContext('2d');
%(code)s
const bitmap = canvas.transferToImageBitmap();
self.postMessage(bitmap, bitmap);
};
</script>
<script>
const blob = new Blob([document.getElementById('myWorker').textContent]);
const worker = new Worker(URL.createObjectURL(blob));
worker.addEventListener('message', msg => {
const outputCtx = document.getElementById("canvas").getContext('2d');
outputCtx.drawImage(msg.data, 0, 0);
document.documentElement.classList.remove("reftest-wait");
});
worker.postMessage(null);
</script>
%(images)s\
</html>
element_ref_test: |-
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
{% if promise_test %}\
<html class="reftest-wait">
{% endif %}\
%(links)s\
%(fuzzy)s\
%(timeout)s\
<title>Canvas test: %(name)s</title>
<h1>%(name)s</h1>
<p class="desc">%(desc)s</p>
%(fonts)s%(fonthack)s%(notes)s<canvas id="canvas" width="%(width)s" height="%(height)s"%(canvas)s>
%(fallback)s
</canvas>
<script{% if promise_test %} type="module"{% endif %}>
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext(%(context_args)s);
%(code)s
{% if promise_test %}\
document.documentElement.classList.remove("reftest-wait");
{% endif %}\
</script>
%(images)s\
{% if promise_test %}</html>{% endif %}
html_ref_test: |-
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
%(links)s\
%(fuzzy)s\
%(timeout)s\
<title>Canvas test: %(name)s</title>
<h1>%(name)s</h1>
<p class="desc">%(desc)s</p>
%(fonts)s%(fonthack)s%(notes)s
%(code)s
%(images)s