3 <script src=
"../../../resources/js-test.js"></script>
4 <script src=
"resources/webgl-test.js"></script>
5 <script src=
"resources/webgl-test-utils.js"></script>
8 <div id=
"description"></div>
9 <div id=
"console"></div>
13 window
.internals
.settings
.setWebGLErrorsToConsoleEnabled(false);
15 var wtu
= WebGLTestUtils
;
16 description("Tests calling WebGL APIs with wrong argument types");
18 var context
= wtu
.create3DContext();
19 var program
= wtu
.loadStandardProgram(context
);
20 var shader
= wtu
.loadStandardVertexShader(context
);
21 var shouldGenerateGLError
= wtu
.shouldGenerateGLError
;
23 assertMsg(program
!= null, "Program Compiled");
24 assertMsg(shader
!= null, "Shader Compiled");
26 var loc
= context
.getUniformLocation(program
, "u_modelViewProjMatrix");
27 assertMsg(loc
!= null, "getUniformLocation succeeded");
42 function shouldBeEmptyString(command
) {
43 shouldBe(command
, "''");
46 for (var i
= 0; i
< arguments
.length
; ++i
) {
48 if (arguments
[i
].throw) {
52 func
= shouldBeUndefined
;
55 argument
= arguments
[i
].value
;
56 func("context.compileShader(argument)");
57 func("context.linkProgram(argument)");
58 func("context.attachShader(program, argument)");
59 func("context.attachShader(argument, shader)");
60 func("context.detachShader(program, argument)");
61 func("context.detachShader(argument, shader)");
62 func("context.useProgram(argument)");
63 func("context.shaderSource(argument, 'foo')");
64 func("context.bindAttribLocation(argument, 0, 'foo')");
65 func("context.bindBuffer(context.ARRAY_BUFFER, argument)");
66 func("context.bindFramebuffer(context.FRAMEBUFFER, argument)");
67 func("context.bindRenderbuffer(context.RENDERBUFFER, argument)");
68 func("context.bindTexture(context.TEXTURE_2D, argument)");
69 func("context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, argument)");
70 func("context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, argument, 0)");
71 func("context.uniform2fv(argument, new Float32Array([0.0, 0.0]))");
72 func("context.uniform2iv(argument, new Int32Array([0, 0]))");
73 func("context.uniformMatrix2fv(argument, false, new Float32Array([0.0, 0.0, 0.0, 0.0]))");
75 func2("context.getProgramInfoLog(argument)");
76 func2("context.getProgramParameter(argument, 0)");
77 func2("context.getShaderInfoLog(argument)");
78 func2("context.getShaderParameter(argument, 0)");
79 func2("context.getShaderSource(argument)");
80 func2("context.getUniform(argument, loc)");
81 func2("context.getUniform(program, argument)");
82 func2("context.getUniformLocation(argument, 'u_modelViewProjMatrix')");