gecko/content/canvas/test/webgl/conformance/bug-32619.html
2010-06-04 12:03:40 -07:00

89 lines
2.8 KiB
HTML

<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>WebKit Bug #32619 regression test</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<script src="resources/testrunner.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<canvas id="canvas" width="2" height="2"> </canvas>
<script><!--
description("WebKit Bug #32619 regression test.");
var canvas = document.getElementById("canvas");
var gl = create3DContext(canvas);
if (!gl)
testFailed("Context created.");
else
testPassed("Context created.");
/* object containing all tests in this testsuite */
var bug32619_tests = {
setup: function () {
bug32619_tests.tex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, bug32619_tests.tex);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 64, 64, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
},
teardown: function () {
gl.deleteTexture(bug32619_tests.tex);
},
"Passing a buffer not large enough to texImage2D should generate an INVALID_OPERATION" : function () {
this.setup = function () {
var tooSmall = new WebGLUnsignedByteArray(64);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 64, 64, 0, gl.RGBA, gl.UNSIGNED_BYTE, tooSmall);
};
this.expects = gl.INVALID_OPERATION;
},
"Passing texImage2D parameter data of Number type should throw a TypeError" : function () {
this.setup = function () {
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 64, 64, 0, gl.RGBA, gl.UNSIGNED_BYTE, 42);
};
this.expects = "TypeError";
},
"Passing texImage2D parameter data of String type should throw a TypeError" : function () {
this.setup = function () {
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 64, 64, 0, gl.RGBA, gl.UNSIGNED_BYTE, "not a buffer");
};
this.expects = "TypeError";
},
"Passing a buffer not large enough to texSubImage2D should generate an INVALID_OPERATION" : function () {
this.setup = function () {
var tooSmall = new WebGLUnsignedByteArray(64);
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 64, 64, gl.RGBA, gl.UNSIGNED_BYTE, tooSmall);
};
this.expects = gl.INVALID_OPERATION;
},
"Passing texSubImage2D parameter data of Number type should throw a TypeError" : function () {
this.setup = function () {
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 64, 64, gl.RGBA, gl.UNSIGNED_BYTE, 42);
};
this.expects = "TypeError";
},
"Passing texSubImage2D parameter data of String type should throw a TypeError" : function () {
this.setup = function () {
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 64, 64, gl.RGBA, gl.UNSIGNED_BYTE, "not a buffer");
};
this.expects = "TypeError";
},
}
runTestsuite(bug32619_tests);
debug("");
successfullyParsed = true;
--></script>
<script src="../resources/js-test-post.js"></script>
<script>
</script>
</body>
</html>