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

Side by Side Diff: conformance/more/conformance/argGenerators-B4.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, 1 month 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 // B-4
64
65 bufferSubData : {
66 setup : function() {
67 var buf = GL.createBuffer();
68 var ebuf = GL.createBuffer();
69 GL.bindBuffer(GL.ARRAY_BUFFER, buf);
70 GL.bufferData(GL.ARRAY_BUFFER, 256, GL.STATIC_DRAW);
71 GL.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, ebuf);
72 GL.bufferData(GL.ELEMENT_ARRAY_BUFFER, 256, GL.STATIC_DRAW);
73 return [buf, ebuf];
74 },
75 generate : function(buf, ebuf) {
76 var d = randomBufferSubData(256);
77 return [bufferTarget.random(), d.offset, d.data];
78 },
79 checkArgValidity : function(target, offset, data) {
80 return bufferTarget.has(target) && offset >= 0 && data.byteLength >= 0 && offset + data.byteLength <= 256;
81 },
82 teardown : function(buf, ebuf) {
83 GL.deleteBuffer(buf);
84 GL.deleteBuffer(ebuf);
85 },
86 }
87
88 };
OLDNEW
« no previous file with comments | « conformance/more/conformance/argGenerators-B3.js ('k') | conformance/more/conformance/argGenerators-C.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698