Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / rendering / scissor-rect-repeated-rendering.html
blobf76da1614ae0e17b4e8b9af6975b98416bbf0067
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>Scissor Rectangle Repeated Rendering Test</title>
12 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
13 <script src="../../js/js-test-pre.js"></script>
14 <script src="../../js/webgl-test-utils.js"> </script>
15 </head>
16 <body>
17 <canvas id="example" width="128" height="128"></canvas>
18 <div id="description"></div>
19 <div id="console"></div>
20 <script>
21 "use strict";
23 description();
24 debug('Regression test for <a href="https://code.google.com/p/chromium/issues/detail?id=778770">Chromium bug 778770</a>');
26 var wtu = WebGLTestUtils;
28 // These context creation attributes are significant to reproduce the bug.
29 var gl = wtu.create3DContext("example", {alpha: false, antialias: false});
31 // Draw into the upper right quadrant.
32 var x = 64;
33 var y = 64;
34 var width = 64;
35 var height = 64;
37 var numRenders = 10;
39 function render() {
40 gl.viewport(x, y, width, height);
41 gl.scissor(x, y, width, height);
42 gl.enable(gl.SCISSOR_TEST);
43 gl.clearColor(0.0, 1.0, 0.0, 1.0);
44 gl.clear(gl.COLOR_BUFFER_BIT);
46 // If anything but black is ever seen in the un-drawn region of
47 // the canvas, the test fails.
48 var black = [0, 0, 0, 255];
49 wtu.checkCanvasRect(gl, 10, 10, 10, 10, black, "should be black", 1);
51 if (--numRenders > 0) {
52 window.requestAnimationFrame(render);
53 } else {
54 finishTest();
58 window.requestAnimationFrame(render);
60 var successfullyParsed = true;
61 </script>
62 </body>
63 </html>