Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / dom / canvas / test / reftest / webgl-resize-test.html
blob0917e997de9b54a52b94716d9a3960280258cf67
1 <!DOCTYPE html>
2 <html class='reftest-wait'>
3 <head>
4 <meta charset='UTF-8'>
5 <script type='text/javascript' src='webgl-utils.js'></script>
6 </head>
8 <body>
9 <canvas id='e_canvas'></canvas>
10 <br>
11 <div id='e_log'></div>
12 <script>
13 /* Resize Test
15 * Create canvas of wrong size.
16 * Clear the canvas to red.
17 * Resize to correct size.
18 * Clear to green.
21 'use strict';
23 async function awaitComposite() {
24 await new Promise((res, rej) => {
25 waitForComposite(res);
26 });
29 function testComplete() {
30 document.documentElement.removeAttribute('class');
33 (async function() {
34 const gl = initGL(e_canvas);
35 if (!gl) {
36 e_log.textContent = 'WebGL failed.';
37 } else {
38 gl.clearColor(1.0, 0.0, 0.0, 1.0); // red
39 gl.clear(gl.COLOR_BUFFER_BIT);
40 await awaitComposite();
42 gl.canvas.width = 256;
43 gl.canvas.height = 256;
44 gl.clearColor(0.0, 1.0, 0.0, 1.0); // green
45 gl.clear(gl.COLOR_BUFFER_BIT);
48 await awaitComposite();
49 testComplete();
50 })();
51 </script>
52 </body>
53 </html>