content/canvas/test/reftest/webgl-orientation-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-orientation-test.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,57 @@
     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 +/* Orientation Test
    1.12 + *
    1.13 + * Clear the canvas to black, and clear the upper-left quadrant
    1.14 + * to white. If this doesn't pass, but the Clear test does, then
    1.15 + * likely y-flip is wrong.
    1.16 + */
    1.17 +
    1.18 +"use strict";
    1.19 +
    1.20 +function renderGL(gl) {
    1.21 +  gl.clearColor(0.0, 0.0, 0.0, 1.0);
    1.22 +  gl.clear(gl.COLOR_BUFFER_BIT);
    1.23 +
    1.24 +  gl.enable(gl.SCISSOR_TEST);
    1.25 +  gl.scissor(0, 128, 128, 128);
    1.26 +  gl.clearColor(1.0, 1.0, 1.0, 1.0);
    1.27 +  gl.clear(gl.COLOR_BUFFER_BIT);
    1.28 +
    1.29 +  gl.finish();
    1.30 +}
    1.31 +
    1.32 +function renderFailure(canvas) {
    1.33 +  // This will also trigger RAF for us.
    1.34 +  var context = canvas.getContext("2d");
    1.35 +  context.fillText('WebGL failed.', 64, 64);
    1.36 +}
    1.37 +
    1.38 +function runTest() {
    1.39 +  var canvas = document.getElementById("canvas");
    1.40 +  var gl = initGL(canvas);
    1.41 +
    1.42 +  if (gl)
    1.43 +    renderGL(gl);
    1.44 +  else
    1.45 +    renderFailure(canvas);
    1.46 +
    1.47 +  waitForComposite(testComplete);
    1.48 +}
    1.49 +
    1.50 +function testComplete() {
    1.51 +  document.documentElement.removeAttribute("class");
    1.52 +}
    1.53 +</script>
    1.54 +</head>
    1.55 +
    1.56 +<body onload="rAF(runTest);">
    1.57 +  <canvas id="canvas" width="256" height="256"></canvas>
    1.58 +</body>
    1.59 +
    1.60 +</html>

mercurial