content/canvas/test/reftest/webgl-clear-test.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/canvas/test/reftest/webgl-clear-test.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,50 @@
     1.4 +<!DOCTYPE html>
     1.5 +<html class="reftest-wait">
     1.6 +<head>
     1.7 +<meta charset="UTF-8">
     1.8 +
     1.9 +<script type="text/javascript" src="webgl-utils.js"></script>
    1.10 +<script type="text/javascript">
    1.11 +/* Clear Test
    1.12 + *
    1.13 + * Clear the canvas to green to test that we get pixels to the screen.
    1.14 + */
    1.15 +
    1.16 +"use strict";
    1.17 +
    1.18 +function renderGL(gl) {
    1.19 +  gl.clearColor(0.0, 1.0, 0.0, 1.0);
    1.20 +  gl.clear(gl.COLOR_BUFFER_BIT);
    1.21 +  gl.finish();
    1.22 +}
    1.23 +
    1.24 +function renderFailure(canvas) {
    1.25 +  // This will also trigger RAF for us.
    1.26 +  var context = canvas.getContext("2d");
    1.27 +  context.fillText('WebGL failed.', 64, 64);
    1.28 +}
    1.29 +
    1.30 +function runTest() {
    1.31 +  var canvas = document.getElementById("canvas");
    1.32 +  var gl = initGL(canvas);
    1.33 +
    1.34 +  if (gl)
    1.35 +    renderGL(gl);
    1.36 +  else
    1.37 +    renderFailure(canvas);
    1.38 +
    1.39 +  waitForComposite(testComplete);
    1.40 +}
    1.41 +
    1.42 +function testComplete() {
    1.43 +  document.documentElement.removeAttribute("class");
    1.44 +}
    1.45 +
    1.46 +</script>
    1.47 +</head>
    1.48 +
    1.49 +<body onload="rAF(runTest);">
    1.50 +  <canvas id="canvas" width="256" height="256"></canvas>
    1.51 +</body>
    1.52 +
    1.53 +</html>

mercurial