blob: 35c4f870c1c01c9b9df67578b5dd2f262084bc23 [file] [log] [blame]
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
<script src="resources/webgl-test-utils.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<canvas id="canvas">
<script>
var wtu;
var canvas;
var gl;
var shouldGenerateGLError;
var buffer;
var framebuffer;
var program;
var renderbuffer;
var shader;
var texture;
description("Tests 'is' calls against non-bound and deleted objects");
wtu = WebGLTestUtils;
canvas = document.getElementById("canvas");
gl = wtu.create3DContext(canvas);
shouldGenerateGLError = wtu.shouldGenerateGLError;
shouldGenerateGLError(gl, gl.NO_ERROR, "buffer = gl.createBuffer()");
shouldBeFalse("gl.isBuffer(buffer)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, buffer)");
shouldBeTrue("gl.isBuffer(buffer)");
debug("");
shouldGenerateGLError(gl, gl.NO_ERROR, "framebuffer = gl.createFramebuffer()");
shouldBeFalse("gl.isFramebuffer(framebuffer)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer)");
shouldBeTrue("gl.isFramebuffer(framebuffer)");
debug("");
shouldGenerateGLError(gl, gl.NO_ERROR, "renderbuffer = gl.createRenderbuffer()");
shouldBeFalse("gl.isRenderbuffer(renderbuffer)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer)");
shouldBeTrue("gl.isRenderbuffer(renderbuffer)");
debug("");
shouldGenerateGLError(gl, gl.NO_ERROR, "texture = gl.createTexture()");
shouldBeFalse("gl.isTexture(texture)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_2D, texture)");
shouldBeTrue("gl.isTexture(texture)");
debug("");
shouldGenerateGLError(gl, gl.NO_ERROR, "program = gl.createProgram()");
shouldBeTrue("gl.isProgram(program)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteProgram(program)");
shouldBeFalse("gl.isProgram(program)");
debug("");
shouldGenerateGLError(gl, gl.NO_ERROR, "shader = gl.createShader(gl.VERTEX_SHADER)");
shouldBeTrue("gl.isShader(shader)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteShader(shader)");
shouldBeFalse("gl.isShader(shader)");
debug("");
</script>
</body>
</html>