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

Side by Side Diff: conformance/more/functions/bufferSubDataBadArgs.html

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 <!DOCTYPE html>
2 <html><head>
3 <meta charset="utf-8">
4 <link rel="stylesheet" type="text/css" href="../unit.css" />
5 <script type="application/x-javascript" src="../unit.js"></script>
6 <script type="application/x-javascript" src="../util.js"></script>
7 <script type="application/x-javascript">
8
9 Tests.startUnit = function () {
10 var canvas = document.getElementById('gl');
11 var gl = wrapGLContext(canvas.getContext(GL_CONTEXT_ID));
12 var buf = gl.createBuffer();
13 var ebuf = gl.createBuffer();
14 gl.bindBuffer(gl.ARRAY_BUFFER, buf);
15 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, ebuf);
16 return [gl, buf, ebuf];
17 }
18
19 Tests.testBufferData = function(gl) {
20 var data = [0,0,0,0, 1,0,0,0, 0,1,0,0];
21 gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(data), gl.STREAM_DRAW);
22 gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(data), gl.STREAM_DRAW );
23 assertOk("zero length data",
24 function(){gl.bufferSubData(gl.ARRAY_BUFFER, 0, new Float32Array(0));});
25 assertFail("number for data",
26 function(){gl.bufferSubData(gl.ARRAY_BUFFER, 0, 12);});
27 assertFail("bad target",
28 function(){gl.bufferSubData(gl.TEXTURE_2D, 0, new Float32Array([1,2,3])) ;});
29 assertFail("array for data",
30 function(){gl.bufferSubData(gl.ARRAY_BUFFER, 0, [1,2,3]);});
31 assertOk("floats in element buffer",
32 function(){gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, 0, new Float32Array ([1,2,3]));});
33 assertFail("negative offset",
34 function(){gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, -1, new Uint16Array ([1,2,3]));});
35 assertFail("offset out of range",
36 function(){gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, 24, new Uint16Array ([1,2,3]));});
37 assertFail("offset out of range",
38 function(){gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, 2400000, new Uint16 Array([1,2,3]));});
39 assertFail("offset out of range",
40 function(){gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, 19, new Uint16Array ([1,2,3]));});
41 assertFail("data too large",
42 function(){gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, 0, new Uint16Array( data.concat([1])));});
43 assertOk("offset + data too large",
44 function(){gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, 18, new Uint16Array ([1,2,3]));});
45 assertOk("good args",
46 function(){gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, 0, new Uint16Array( [1,2,3]));});
47 throwError(gl, 'bufferData0');
48 gl.bindBuffer(gl.ARRAY_BUFFER, null);
49 assertFail("setting buffer 0",
50 function(){gl.bufferSubData(gl.ARRAY_BUFFER, 0, new Float32Array([1,2,3])) ;});
51 throwError(gl, 'bufferData1');
52 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
53 assertFail("setting buffer 0",
54 function(){gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, 0, new Uint16Array( [1,2,3]));});
55 throwError(gl, 'bufferData2');
56 }
57
58 Tests.endUnit = function(gl, buf, ebuf) {
59 gl.deleteBuffer(buf);
60 gl.deleteBuffer(ebuf);
61 }
62
63 </script>
64 <style>canvas{ position:absolute; }</style>
65 </head><body>
66 <canvas id="gl" width="16" height="16"></canvas>
67 </body></html>
OLDNEW
« no previous file with comments | « conformance/more/functions/bufferSubData.html ('k') | conformance/more/functions/copyTexImage2D.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698