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

Side by Side Diff: conformance/more/conformance/argGenerators-L_S.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 // L
64
65 lineWidth : {
66 generate : function() { return [randomLineWidth()]; },
67 teardown : function() { GL.lineWidth(1); }
68 },
69 linkProgram : {}, // FIXME
70
71 // P
72 pixelStorei : {
73 generate : function() {
74 return [pixelStoreiPname.random(), pixelStoreiParam.random()];
75 },
76 checkArgValidity : function(pname, param) {
77 return pixelStoreiPname.has(pname) && pixelStoreiParam.has(param);
78 },
79 teardown : function() {
80 GL.pixelStorei(GL.PACK_ALIGNMENT, 4);
81 GL.pixelStorei(GL.UNPACK_ALIGNMENT, 4);
82 }
83 },
84 polygonOffset : {
85 generate : function() { return [randomFloat(), randomFloat()]; },
86 teardown : function() { GL.polygonOffset(0,0); }
87 },
88
89 // R
90
91 readPixels : {}, // FIXME
92 renderbufferStorage : {}, // FIXME
93
94 // S-1
95
96 sampleCoverage : {
97 generate : function() { return [randomFloatFromRange(0,1), randomBool()] },
98 teardown : function() { GL.sampleCoverage(1, false); }
99 },
100 scissor : {
101 generate : function() {
102 return [randomInt(3000)-1500, randomInt(3000)-1500, randomIntFromRange(0,3 000), randomIntFromRange(0,3000)];
103 },
104 checkArgValidity : function(x,y,w,h) {
105 return castToInt(w) >= 0 && castToInt(h) >= 0;
106 },
107 teardown : function() {
108 GL.scissor(0,0,GL.canvas.width, GL.canvas.height);
109 }
110 },
111 shaderSource : {}, // FIXME
112 stencilFunc : {
113 generate : function(){
114 return [stencilFuncFunc.random(), randomInt(MaxStencilValue), randomInt(0x ffffffff)];
115 },
116 checkArgValidity : function(func, ref, mask) {
117 return stencilFuncFunc.has(func) && castToInt(ref) >= 0 && castToInt(ref) < MaxStencilValue;
118 },
119 teardown : function() {
120 GL.stencilFunc(GL.ALWAYS, 0, 0xffffffff);
121 }
122 },
123 stencilFuncSeparate : {
124 generate : function(){
125 return [cullFace.random(), stencilFuncFunc.random(), randomInt(MaxStencilV alue), randomInt(0xffffffff)];
126 },
127 checkArgValidity : function(face, func, ref, mask) {
128 return cullFace.has(face) && stencilFuncFunc.has(func) && castToInt(ref) > = 0 && castToInt(ref) < MaxStencilValue;
129 },
130 teardown : function() {
131 GL.stencilFunc(GL.ALWAYS, 0, 0xffffffff);
132 }
133 },
134 stencilMask : {
135 generate : function() { return [randomInt(0xffffffff)]; },
136 teardown : function() { GL.stencilMask(0xffffffff); }
137 }
138
139 };
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