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

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

Issue 8342021: Add webgl conformance tests r15841. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 9 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
+ LF
OLDNEW
(Empty)
1 // ArgGenerators contains argument generators for WebGL functions.
2 // The argument generators are used for running random tests against the WebGL
3 // functions.
4 //
5 // ArgGenerators is an object consisting of functionName : argGen -properties.
6 //
7 // functionName is a WebGL context function name and the argGen is an argument
8 // generator object that encapsulates the requirements to run
9 // randomly generated tests on the WebGL function.
10 //
11 // An argGen object has the following methods:
12 // - setup -- set up state for testing the GL function, returns values
13 // that need cleanup in teardown. Run once before entering a
14 // test loop.
15 // - teardown -- do cleanup on setup's return values after testing is complete
16 // - generate -- generate a valid set of random arguments for the GL function
17 // - returnValueCleanup -- do cleanup on value returned by the tested GL funct ion
18 // - cleanup -- do cleanup on generated arguments from generate
19 // - checkArgValidity -- check if passed args are valid. Has a call signature
20 // that matches generate's return value. Returns true
21 // if args are valid, false if not.
22 //
23 // Example test loop that demonstrates how the function args and return
24 // values flow together:
25 //
26 // var setupArgs = argGen.setup();
27 // for (var i=0; i<numberOfTests; i++) {
28 // var generatedArgs = argGen.generate.apply(argGen, setupArgs);
29 // var validArgs = argGen.checkArgValidity.apply(argGen, generatedArgs);
30 // var rv = call the GL function with generatedArgs;
31 // argGen.returnValueCleanup(rv);
32 // argGen.cleanup.apply(argGen, generatedArgs);
33 // }
34 // argGen.teardown.apply(argGen, setupArgs);
35 //
36 ArgGenerators = {
37
38 // GL functions in alphabetical order
39
40 // C
41
42 checkFramebufferStatus : {
43 generate : function() {
44 return [Math.random() > 0.5 ? null : GL.createFramebuffer()];
45 },
46 checkArgValidity : function(fbo) {
47 if (fbo != null)
48 GL.bindFramebuffer(GL.FRAMEBUFFER, fbo);
49 return fbo == null || GL.isFramebuffer(fbo);
50 },
51 cleanup : function(fbo){
52 GL.bindFramebuffer(GL.FRAMEBUFFER, null);
53 if (fbo != null)
54 try{ GL.deleteFramebuffer(fbo); } catch(e) {}
55 }
56 },
57 clear : {
58 generate : function() { return [clearMask.random()]; },
59 checkArgValidity : function(mask) { return clearMask.has(mask); }
60 },
61 clearColor : {
62 generate : function() { return randomColor(); },
63 teardown : function() { GL.clearColor(0,0,0,0); }
64 },
65 clearDepth : {
66 generate : function() { return [Math.random()]; },
67 teardown : function() { GL.clearDepth(1); }
68 },
69 clearStencil : {
70 generate : function() { return [randomStencil()]; },
71 teardown : function() { GL.clearStencil(0); }
72 },
73 colorMask : {
74 generate : function() {
75 return [randomBool(), randomBool(), randomBool(), randomBool()];
76 },
77 teardown : function() { GL.colorMask(true, true, true, true); }
78 },
79 compileShader : {}, // FIXME
80 copyTexImage2D : {}, // FIXME
81 copyTexSubImage2D : {}, // FIXME
82 createBuffer : {
83 generate : function() { return []; },
84 returnValueCleanup : function(o) { GL.deleteBuffer(o); }
85 },
86 createFramebuffer : {
87 generate : function() { return []; },
88 returnValueCleanup : function(o) { GL.deleteFramebuffer(o); }
89 },
90 createProgram : {
91 generate : function() { return []; },
92 returnValueCleanup : function(o) { GL.deleteProgram(o); }
93 },
94 createRenderbuffer : {
95 generate : function() { return []; },
96 returnValueCleanup : function(o) { GL.deleteRenderbuffer(o); }
97 },
98 createShader : {
99 generate : function() { return [shaderType.random()]; },
100 checkArgValidity : function(t) { return shaderType.has(t); },
101 returnValueCleanup : function(o) { GL.deleteShader(o); }
102 },
103 createTexture : {
104 generate : function() { return []; },
105 returnValueCleanup : function(o) { GL.deleteTexture(o); }
106 },
107 cullFace : {
108 generate : function() { return [cullFace.random()]; },
109 checkArgValidity : function(f) { return cullFace.has(f); },
110 teardown : function() { GL.cullFace(GL.BACK); }
111 }
112
113 };
OLDNEW
« no previous file with comments | « conformance/more/conformance/argGenerators-B4.js ('k') | conformance/more/conformance/argGenerators-D_G.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698