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

Side by Side Diff: conformance/more/conformance/argGenerators-L_S.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 // L
41
42 lineWidth : {
43 generate : function() { return [randomLineWidth()]; },
44 teardown : function() { GL.lineWidth(1); }
45 },
46 linkProgram : {}, // FIXME
47
48 // P
49 pixelStorei : {
50 generate : function() {
51 return [pixelStoreiPname.random(), pixelStoreiParam.random()];
52 },
53 checkArgValidity : function(pname, param) {
54 return pixelStoreiPname.has(pname) && pixelStoreiParam.has(param);
55 },
56 teardown : function() {
57 GL.pixelStorei(GL.PACK_ALIGNMENT, 4);
58 GL.pixelStorei(GL.UNPACK_ALIGNMENT, 4);
59 }
60 },
61 polygonOffset : {
62 generate : function() { return [randomFloat(), randomFloat()]; },
63 teardown : function() { GL.polygonOffset(0,0); }
64 },
65
66 // R
67
68 readPixels : {}, // FIXME
69 renderbufferStorage : {}, // FIXME
70
71 // S-1
72
73 sampleCoverage : {
74 generate : function() { return [randomFloatFromRange(0,1), randomBool()] },
75 teardown : function() { GL.sampleCoverage(1, false); }
76 },
77 scissor : {
78 generate : function() {
79 return [randomInt(3000)-1500, randomInt(3000)-1500, randomIntFromRange(0,3 000), randomIntFromRange(0,3000)];
80 },
81 checkArgValidity : function(x,y,w,h) {
82 return castToInt(w) >= 0 && castToInt(h) >= 0;
83 },
84 teardown : function() {
85 GL.scissor(0,0,GL.canvas.width, GL.canvas.height);
86 }
87 },
88 shaderSource : {}, // FIXME
89 stencilFunc : {
90 generate : function(){
91 return [stencilFuncFunc.random(), randomInt(MaxStencilValue), randomInt(0x ffffffff)];
92 },
93 checkArgValidity : function(func, ref, mask) {
94 return stencilFuncFunc.has(func) && castToInt(ref) >= 0 && castToInt(ref) < MaxStencilValue;
95 },
96 teardown : function() {
97 GL.stencilFunc(GL.ALWAYS, 0, 0xffffffff);
98 }
99 },
100 stencilFuncSeparate : {
101 generate : function(){
102 return [cullFace.random(), stencilFuncFunc.random(), randomInt(MaxStencilV alue), randomInt(0xffffffff)];
103 },
104 checkArgValidity : function(face, func, ref, mask) {
105 return cullFace.has(face) && stencilFuncFunc.has(func) && castToInt(ref) > = 0 && castToInt(ref) < MaxStencilValue;
106 },
107 teardown : function() {
108 GL.stencilFunc(GL.ALWAYS, 0, 0xffffffff);
109 }
110 },
111 stencilMask : {
112 generate : function() { return [randomInt(0xffffffff)]; },
113 teardown : function() { GL.stencilMask(0xffffffff); }
114 }
115
116 };
OLDNEW
« no previous file with comments | « conformance/more/conformance/argGenerators-G_I.js ('k') | conformance/more/conformance/argGenerators-S_V.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698