Bug 1932347 - Adjust positioning of tab preview for vertical tabs r=tabbrowser-review...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / extra / readpixels-after-alert.html
blob0fbb9cb1594099455097d13bb4b0365cf27b394e
1 <!--
2 Copyright (c) 2019 The Khronos Group Inc.
3 Use of this source code is governed by an MIT-style license that can be
4 found in the LICENSE.txt file.
5 -->
7 <!DOCTYPE html>
8 <html>
9 <head>
10 <meta charset="utf-8">
11 <title>WebGL Behavior After Alert and Read Pixels Test</title>
12 <link rel="stylesheet" href="../resources/js-test-style.css"/>
13 <script src="../../devtools/src/debug/webgl-debug.js"></script>
14 <script src="../js/js-test-pre.js"></script>
15 <script src="../js/webgl-test-utils.js"></script>
16 </head>
17 <body>
18 <canvas id="canvas" width="100" height="100"> </canvas>
19 <div id="description">Verify WebGL behavior after an alert and then a readPixels()</div>
20 <div id="console"></div>
21 <script>
22 "use strict";
24 function checkPixels(buf, width, height, thresh) {
25 for (var yy = 0; yy < height; ++yy) {
26 for (var xx = 0; xx < width; ++xx) {
27 var offset = (yy * width + xx) * 4;
28 if (Math.abs(buf[offset] - 255) > thresh ||
29 Math.abs(buf[offset + 1] - 0) > thresh ||
30 Math.abs(buf[offset + 2] - 0) > thresh) {
31 testFailed("Checking pixels");
32 return false;
36 testPassed("Checking pixels");
37 return true;
40 var wtu = WebGLTestUtils;
41 var gl = wtu.create3DContext("canvas");
42 gl.clearColor(1, 0, 0, 1);
43 gl.clear(gl.COLOR_BUFFER_BIT);
44 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "setup should succeed");
46 wtu.checkCanvas(gl, [255, 0, 0, 255], undefined, 3);
48 alert("Click me to continue");
50 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "setup should succeed");
51 wtu.checkCanvas(gl, [255, 0, 0, 255], undefined, 3);
53 alert("Click me to continue");
55 gl.clearColor(1, 0, 0, 1);
56 gl.clear(gl.COLOR_BUFFER_BIT);
57 wtu.checkCanvas(gl, [255, 0, 0, 255], undefined, 3);
59 debug("");
60 var successfullyParsed = true;
61 </script>
62 <script src="../js/js-test-post.js"></script>
64 </body>
65 </html>