3 <link rel="stylesheet" href="../../js/resources/js-test-style.css"/>
4 <script src="../../js/resources/js-test-pre.js"></script>
5 <script src="resources/webgl-test.js"></script>
6 <script src="resources/webgl-test-utils.js"></script>
9 <div id="description"></div>
10 <div id="console"></div>
13 var wtu = WebGLTestUtils;
14 description("Tests calling WebGL APIs with wrong argument types");
16 var context = wtu.create3DContext();
17 var program = wtu.loadStandardProgram(context);
18 var shader = wtu.loadStandardVertexShader(context);
19 var shouldGenerateGLError = wtu.shouldGenerateGLError;
21 assertMsg(program != null, "Program Compiled");
22 assertMsg(shader != null, "Shader Compiled");
24 var loc = context.getUniformLocation(program, "u_modelViewProjMatrix");
25 assertMsg(loc != null, "getUniformLocation succeeded");
40 function shouldBeEmptyString(command) {
41 shouldBe(command, "''");
44 for (var i = 0; i < arguments.length; ++i) {
45 var func, func2, func3;
46 if (arguments[i].throw) {
51 func = shouldBeUndefined;
53 func3 = shouldBeEmptyString;
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.getProgramParameter(argument, 0)");
76 func2("context.getShaderParameter(argument, 0)");
77 func2("context.getUniform(argument, loc)");
78 func2("context.getUniform(program, argument)");
79 func2("context.getUniformLocation(argument, 'u_modelViewProjMatrix')");
81 func3("context.getProgramInfoLog(argument)");
82 func3("context.getShaderInfoLog(argument)");
83 func3("context.getShaderSource(argument)");
86 successfullyParsed = true;
89 <script src="../../js/resources/js-test-post.js"></script>