Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1038)

Side by Side Diff: conformance/more/conformance/argGenerators-G_I.js

Issue 41503006: Add ToT WebGL conformance tests : part 8 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
OLDNEW
(Empty)
1 /*
2 ** Copyright (c) 2012 The Khronos Group Inc.
3 **
4 ** Permission is hereby granted, free of charge, to any person obtaining a
5 ** copy of this software and/or associated documentation files (the
6 ** "Materials"), to deal in the Materials without restriction, including
7 ** without limitation the rights to use, copy, modify, merge, publish,
8 ** distribute, sublicense, and/or sell copies of the Materials, and to
9 ** permit persons to whom the Materials are furnished to do so, subject to
10 ** the following conditions:
11 **
12 ** The above copyright notice and this permission notice shall be included
13 ** in all copies or substantial portions of the Materials.
14 **
15 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
22 */
23
24 // ArgGenerators contains argument generators for WebGL functions.
25 // The argument generators are used for running random tests against the WebGL
26 // functions.
27 //
28 // ArgGenerators is an object consisting of functionName : argGen -properties.
29 //
30 // functionName is a WebGL context function name and the argGen is an argument
31 // generator object that encapsulates the requirements to run
32 // randomly generated tests on the WebGL function.
33 //
34 // An argGen object has the following methods:
35 // - setup -- set up state for testing the GL function, returns values
36 // that need cleanup in teardown. Run once before entering a
37 // test loop.
38 // - teardown -- do cleanup on setup's return values after testing is complete
39 // - generate -- generate a valid set of random arguments for the GL function
40 // - returnValueCleanup -- do cleanup on value returned by the tested GL funct ion
41 // - cleanup -- do cleanup on generated arguments from generate
42 // - checkArgValidity -- check if passed args are valid. Has a call signature
43 // that matches generate's return value. Returns true
44 // if args are valid, false if not.
45 //
46 // Example test loop that demonstrates how the function args and return
47 // values flow together:
48 //
49 // var setupArgs = argGen.setup();
50 // for (var i=0; i<numberOfTests; i++) {
51 // var generatedArgs = argGen.generate.apply(argGen, setupArgs);
52 // var validArgs = argGen.checkArgValidity.apply(argGen, generatedArgs);
53 // var rv = call the GL function with generatedArgs;
54 // argGen.returnValueCleanup(rv);
55 // argGen.cleanup.apply(argGen, generatedArgs);
56 // }
57 // argGen.teardown.apply(argGen, setupArgs);
58 //
59 ArgGenerators = {
60
61 // GL functions in alphabetical order
62
63 // G-2
64
65 getAttribLocation : {
66 generate : function() {
67 var program = GL.createProgram();
68 var name = randomName();
69 GL.bindAttribLocation(program, randomVertexAttribute(), name);
70 return [program, name];
71 },
72 checkArgValidity : function(program, name) {
73 return GL.isProgram(program) && isValidName(name);
74 },
75 cleanup : function(program, name) {
76 try { GL.deleteProgram(program); } catch(e) {}
77 }
78 },/*
79 getParameter : {
80 generate : function() { return [getParameterPname.random()]; },
81 checkArgValidity : function(p) { return getParameterPname.has(p); }
82 },
83 getBufferParameter : {}, // FIXME
84 getError : {
85 generate : function() { return []; }
86 },
87 getFramebufferAttachmentParameter : {}, // FIXME
88 getProgramParameter : {}, // FIXME
89 getProgramInfoLog : {}, // FIXME
90 getRenderbufferParameter : {}, // FIXME
91 getShaderParameter : {}, // FIXME
92 getShaderInfoLog : {}, // FIXME
93 getShaderSource : {}, // FIXME
94 getTexParameter : {}, // FIXME
95 getUniform : {}, // FIXME
96 getUniformLocation : {}, // FIXME
97 getVertexAttrib : {}, // FIXME
98 getVertexAttribOffset : {}, // FIXME
99
100 // H
101
102 hint : {
103 generate : function() { return [GL.GENERATE_MIPMAP_HINT, mipmapHint.random() ]; },
104 checkValidArgs : function(h, m) {
105 return h == GL.GENERATE_MIPMAP_HINT && mipmapHint.has(m);
106 },
107 teardown : function(){ GL.hint(GL.GENERATE_MIPMAP_HINT, GL.DONT_CARE); }
108 },
109
110 // I
111
112 isBuffer : {
113 generate : function() { return [GL.createBuffer()]; },
114 cleanup : function(o) { try { GL.deleteBuffer(o); } catch(e) {} }
115 },
116 isEnabled : {
117 generate : function() { return [enableCap.random()]; },
118 checkArgValidity : function(c) { return enableCap.has(c); }
119 },
120 isFramebuffer : {
121 generate : function() { return [GL.createFramebuffer()]; },
122 cleanup : function(o) { try { GL.deleteFramebuffer(o); } catch(e) {} }
123 },
124 isProgram : {
125 generate : function() { return [GL.createProgram()]; },
126 cleanup : function(o) { try { GL.deleteProgram(o); } catch(e) {} }
127 },
128 isRenderbuffer : {
129 generate : function() { return [GL.createRenderbuffer()]; },
130 cleanup : function(o) { try { GL.deleteRenderbuffer(o); } catch(e) {} }
131 },
132 isShader : {
133 generate : function() { return [GL.createShader(shaderType.random())]; },
134 cleanup : function(o) { try { GL.deleteShader(o); } catch(e) {} }
135 },
136 isTexture : {
137 generate : function() { return [GL.createTexture()]; },
138 cleanup : function(o) { try { GL.deleteTexture(o); } catch(e) {} }
139 }*/
140
141 };
OLDNEW
« no previous file with comments | « conformance/more/conformance/argGenerators-D_G.js ('k') | conformance/more/conformance/argGenerators-L_S.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698