3 <script src="../../js/resources/js-test-pre.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>
12 var wtu = WebGLTestUtils;
13 description("Tests calling WebGL APIs with wrong argument types");
15 var context = wtu.create3DContext();
16 var program = wtu.loadStandardProgram(context);
17 var shader = wtu.loadStandardVertexShader(context);
18 var shouldGenerateGLError = wtu.shouldGenerateGLError;
20 assertMsg(program != null, "Program Compiled");
21 assertMsg(shader != null, "Shader Compiled");
23 var loc = context.getUniformLocation(program, "u_modelViewProjMatrix");
24 assertMsg(loc != null, "getUniformLocation succeeded");
39 function shouldBeEmptyString(command) {
40 shouldBe(command, "''");
43 for (var i = 0; i < arguments.length; ++i) {
44 var func, func2, func3;
45 if (arguments[i].throw) {
50 func = shouldBeUndefined;
52 func3 = shouldBeEmptyString;
54 argument = arguments[i].value;
55 func("context.compileShader(argument)");
56 func("context.linkProgram(argument)");
57 func("context.attachShader(program, argument)");
58 func("context.attachShader(argument, shader)");
59 func("context.detachShader(program, argument)");
60 func("context.detachShader(argument, shader)");
61 func("context.useProgram(argument)");
62 func("context.shaderSource(argument, 'foo')");
63 func("context.bindAttribLocation(argument, 0, 'foo')");
64 func("context.bindBuffer(context.ARRAY_BUFFER, argument)");
65 func("context.bindFramebuffer(context.FRAMEBUFFER, argument)");
66 func("context.bindRenderbuffer(context.RENDERBUFFER, argument)");
67 func("context.bindTexture(context.TEXTURE_2D, argument)");
68 func("context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, argument)");
69 func("context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, argument, 0)");
70 func("context.uniform2fv(argument, new Float32Array([0.0, 0.0]))");
71 func("context.uniform2iv(argument, new Int32Array([0, 0]))");
72 func("context.uniformMatrix2fv(argument, false, new Float32Array([0.0, 0.0, 0.0, 0.0]))");
74 func2("context.getProgramParameter(argument, 0)");
75 func2("context.getShaderParameter(argument, 0)");
76 func2("context.getUniform(argument, loc)");
77 func2("context.getUniform(program, argument)");
78 func2("context.getUniformLocation(argument, 'u_modelViewProjMatrix')");
80 func3("context.getProgramInfoLog(argument)");
81 func3("context.getShaderInfoLog(argument)");
82 func3("context.getShaderSource(argument)");
86 <script src="../../js/resources/js-test-post.js"></script>