1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/canvas/test/webgl-conformance/conformance/misc/delayed-drawing.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,62 @@ 1.4 +<!-- 1.5 +Copyright (c) 2011 The Chromium Authors. All rights reserved. 1.6 +Use of this source code is governed by a BSD-style license that can be 1.7 +found in the LICENSE file. 1.8 + --> 1.9 +<!DOCTYPE html> 1.10 +<html> 1.11 +<head> 1.12 +<meta charset="utf-8"> 1.13 +<title>WebGL Delayed Drawing test.</title> 1.14 +<link rel="stylesheet" href="../../resources/js-test-style.css"/> 1.15 +<script src="../../resources/js-test-pre.js"></script> 1.16 +<script src="../resources/webgl-test.js"> </script> 1.17 +<script src="../resources/webgl-test-utils.js"> </script> 1.18 +</head> 1.19 +<body> 1.20 +<canvas id="example" width="4" height="4" style="width: 40px; height: 30px;"></canvas> 1.21 +<div id="description"></div> 1.22 +<div id="console"></div> 1.23 +<script> 1.24 +description(document.title); 1.25 +var wtu = WebGLTestUtils; 1.26 +var gl = wtu.create3DContext("example"); 1.27 +var program = wtu.setupTexturedQuad(gl); 1.28 + 1.29 +glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup."); 1.30 + 1.31 +var tex = gl.createTexture(); 1.32 +wtu.fillTexture(gl, tex, 5, 3, [0, 192, 128, 255]); 1.33 + 1.34 +var loc = gl.getUniformLocation(program, "tex"); 1.35 +gl.uniform1i(loc, 0); 1.36 + 1.37 +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); 1.38 +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); 1.39 +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); 1.40 +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); 1.41 + 1.42 + 1.43 +drawAndCheck(); 1.44 + 1.45 +setTimeout(step2, 1000); 1.46 + 1.47 +function step2() { 1.48 + drawAndCheck(); 1.49 + finishTest(); 1.50 +} 1.51 + 1.52 +function drawAndCheck() { 1.53 + glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors before drawing."); 1.54 + wtu.drawQuad(gl); 1.55 + glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from drawing."); 1.56 + wtu.checkCanvas( 1.57 + gl, [0, 192, 128, 255], 1.58 + "draw should be 0, 192, 128, 255"); 1.59 +} 1.60 + 1.61 +successfullyParsed = true; 1.62 +</script> 1.63 +</body> 1.64 +</html> 1.65 +