Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / rendering / default-texture-draw-bug.html
blob0d71a0aaa52cf913e6328c37c8a100abb9e2c166
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 <html>
8 <head>
9 <meta charset="utf-8">
10 <title>WebGL Default Texture Draw Bug Conformance Tests</title>
11 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
12 <script src="../../js/js-test-pre.js"></script>
13 <script src="../../js/webgl-test-utils.js"></script>
15 </head>
16 <body>
17 <canvas id="c"></canvas>
18 <div id="description"></div>
19 <div id="console"></div>
20 <script>
21 "use strict";
22 description("This test attempts to provoke a Chrome bug that occured when drawing with textures when one was never bound. <a href='http://crbug.com/524144'>crbug.com/524144</a>");
24 debug("");
26 var wtu = WebGLTestUtils;
27 var gl = wtu.create3DContext("c");
28 var canvas = gl.canvas;
30 if (!gl) {
31 testFailed("WebGL context does not exist");
32 } else {
33 testPassed("WebGL context exists");
35 runDrawTests();
37 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors");
40 function runDrawTests(drawType) {
41 debug("Test that drawing with a texture when no textures have been bound gives the expected black output");
42 canvas.width = 50; canvas.height = 50;
43 gl.viewport(0, 0, canvas.width, canvas.height);
45 // Set up a program that will draw with a texture
46 var program = wtu.setupNoTexCoordTextureProgram(gl);
48 wtu.setupIndexedQuad(gl);
49 for (var i = 0 ; i < 100 && _bufferedConsoleLogs != null; ++i) {
50 // Clear to white.
51 gl.clearColor(1.0, 1.0, 1.0, 1.0);
52 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
54 // Draw without binding any textures.
55 gl.drawElements(gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0);
57 // Check to ensure the entire canvas is black.
58 wtu.checkCanvasRect(gl, 0.0, 0.0, canvas.width, canvas.height,
59 [0.0, 0.0, 0.0], "Draw should pass", 2);
63 debug("");
64 var successfullyParsed = true;
65 </script>
66 <script src="../../js/js-test-post.js"></script>
68 </body>
69 </html>