Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / dom / canvas / test / reftest / visible-occluded.html
blob6beae5f1324c9b886b6d81a118ce985b09852831
1 <!DOCTYPE html>
2 <meta charset='UTF-8'>
3 <!--
4 Color Test
6 Clear the four quadrants of the canvas as follows:
7 +------+------+
8 | blue |black |
9 | | |
10 +------+------+
11 | red |green |
12 | | |
13 +------+------+
15 Clear with a given alpha value. What effect this has depends on the
16 context-creation args passed to this page.
17 -->
18 <html class='reftest-wait'>
20 <head>
21 <script type='text/javascript' src='webgl-utils.js'></script>
22 <script type='text/javascript'>
23 'use strict';
25 var COLOR_VALUE = 127.0 / 255.0;
26 var ALPHA_VALUE = 127.0 / 255.0;
28 function renderFrame(gl) {
29 gl.enable(gl.SCISSOR_TEST);
31 gl.scissor(0, 0, 100, 100);
32 gl.clearColor(COLOR_VALUE, 0.0, 0.0, ALPHA_VALUE);
33 gl.clear(gl.COLOR_BUFFER_BIT);
35 gl.scissor(100, 0, 100, 100);
36 gl.clearColor(0.0, COLOR_VALUE, 0.0, ALPHA_VALUE);
37 gl.clear(gl.COLOR_BUFFER_BIT);
39 gl.scissor(0, 100, 100, 100);
40 gl.clearColor(0.0, 0.0, COLOR_VALUE, ALPHA_VALUE);
41 gl.clear(gl.COLOR_BUFFER_BIT);
43 gl.scissor(100, 100, 100, 100);
44 gl.clearColor(0.0, 0.0, 0.0, ALPHA_VALUE);
45 gl.clear(gl.COLOR_BUFFER_BIT);
48 ////////////////////////////////////////////////////////////////////////////////
49 // Boilerplate
51 var TIMEOUT_MS = 30 * 1000;
53 function setStatus(text) {
54 var elem = document.getElementById('status');
55 elem.innerHTML = text;
58 var gIsComplete = false;
60 function markComplete(statusText) {
61 if (!statusText)
62 statusText = '';
64 if (gIsComplete)
65 return;
66 gIsComplete = true;
68 setStatus(statusText);
69 document.documentElement.removeAttribute('class');
72 function markError(text) {
73 markComplete('Error: ' + text);
76 function markTimedOut() {
77 markError('Timed out waiting on test completion.');
80 function runFrame(gl, frameCount, maxFrameCount) {
81 renderFrame(gl);
82 frameCount++;
84 if (frameCount >= maxFrameCount) {
85 console.log('Rendered ' + frameCount + ' frames.');
86 markComplete();
87 return;
90 requestAnimationFrame(function(){
91 runFrame(gl, frameCount, maxFrameCount);
92 });
95 function runTest() {
96 var canvas = document.getElementById('canvas');
98 var gl = initGL(canvas);
99 if (!gl) {
100 markError('WebGL context creation failed.');
101 return;
104 var maxFrameCount = arg('frame', 1);
105 if (maxFrameCount < 1) {
106 markError('Invalid `frame` arg: ' + maxFrameCount);
107 return;
110 setStatus('Waiting...');
112 runFrame(gl, 0, maxFrameCount);
113 setTimeout(markTimedOut, TIMEOUT_MS);
115 </script>
116 </head>
118 <body onload='runTest();'>
119 <canvas style="position:fixed; left: 0px; top: 0px;" id='canvas' width='200' height='200'></canvas>
120 <div style="display:block; background-color: blue; position: fixed; top: 75px; left: 0px; width: 50px; height: 50px;"></div>
121 <div id='status'></div>
122 </body>
124 </html>