Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / webgl / null-uniform-location.html
blob09d03bb75bfde52c61816cc38c33ab074113edf7
1 <html>
2 <head>
3 <script src="../../../resources/js-test.js"></script>
4 <script src="resources/webgl-test.js"></script>
5 </head>
6 <body>
7 <div id="description"></div>
8 <div id="console"></div>
10 <script>
11 description("Tests calling the various uniform[Matrix]* APIs with a null uniform location");
13 var gl = create3DContext();
14 var program = loadStandardProgram(gl);
16 shouldBe("gl.getError()", "gl.NO_ERROR");
17 shouldBeUndefined("gl.useProgram(program)");
18 var floatArray = new Float32Array([1, 2, 3, 4]);
19 var intArray = new Int32Array([1, 2, 3, 4]);
21 function callUniformFunction(name) {
22 var isArrayVariant = (name.charAt(name.length - 1) == 'v');
23 var isMatrix = (name.indexOf("Matrix") != -1);
24 var isFloat =
25 (name.charAt(name.length - 1) == 'f' ||
26 name.charAt(name.length - 2) == 'f');
27 var sizeIndex = (isArrayVariant ? name.length - 3 : name.length - 2);
28 var size = parseInt(name.substring(sizeIndex, sizeIndex + 1));
29 // Initialize argument list with null uniform location
30 var args = [ null ];
31 if (isArrayVariant) {
32 // Call variant which takes values as array
33 if (isMatrix) {
34 size = size * size;
35 args.push(false);
37 var array = (isFloat ? new Float32Array(size) : new Int32Array(size));
38 for (var i = 0; i < size; i++) {
39 array[i] = i;
41 args.push(array);
42 } else {
43 // Call variant which takes values as parameters
44 for (var i = 0; i < size; i++) {
45 args.push(i);
48 var func = gl[name];
49 return func.apply(gl, args);
52 var funcs = [ "uniform1f", "uniform1fv", "uniform1i", "uniform1iv",
53 "uniform2f", "uniform2fv", "uniform2i", "uniform2iv",
54 "uniform3f", "uniform3fv", "uniform3i", "uniform3iv",
55 "uniform4f", "uniform4fv", "uniform4i", "uniform4iv",
56 "uniformMatrix2fv", "uniformMatrix3fv", "uniformMatrix4fv" ];
57 for (var i = 0; i < funcs.length; i++) {
58 callString = "callUniformFunction('" + funcs[i] + "')";
59 shouldBeUndefined(callString);
60 shouldBe("gl.getError()", "gl.NO_ERROR");
62 </script>
64 </body>
65 </html>