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

Side by Side Diff: conformance/more/functions/texSubImage2DHTMLBadArgs.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 tex = gl.createTexture();
13 gl.bindTexture(gl.TEXTURE_2D, tex);
14 return [gl, tex];
15 }
16
17 Tests.testTexImage2D = function(gl) {
18 var b = document.createElement('b');
19 var div = document.createElement('div');
20 var c = document.getElementById('c');
21 assertOk("make texture",
22 function() {gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGN ED_BYTE, c); });
23 assertGLError(gl, gl.INVALID_VALUE, "y + height > texture height",
24 function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 1, gl.RGBA, gl.UNSIGNE D_BYTE, c); });
25 assertGLError(gl, gl.INVALID_VALUE, "x + width > texture width",
26 function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 1, 0, gl.RGBA, gl.UNSIGNE D_BYTE, c); });
27 assertGLError(gl, gl.INVALID_VALUE, "negative x",
28 function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, -1, 0, gl.RGBA, gl.UNSIGN ED_BYTE, c); });
29 assertGLError(gl, gl.INVALID_VALUE, "negative y",
30 function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, -1, gl.RGBA, gl.UNSIGN ED_BYTE, c); });
31 assertGLError(gl, gl.INVALID_VALUE, "negative level",
32 function() {gl.texSubImage2D(gl.TEXTURE_2D, -1, 0, 0, gl.RGBA, gl.UNSIGN ED_BYTE, c); });
33 assertThrowNoGLError(gl, "bad element b",
34 function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGBA, gl.UNSIGNED _BYTE, b); });
35 assertThrowNoGLError(gl, "bad element div",
36 function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGBA, gl.UNSIGNED _BYTE, div); });
37 assertThrowNoGLError(gl, "no element",
38 function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGBA, gl.UNSIGNED _BYTE, 0); });
39 assertThrowNoGLError(gl, "string as data",
40 function() {gl.texSubImage2D(gl.TEXTURE_2D, 0,0, 0, gl.RGBA, gl.UNSIGNED _BYTE, "foo"); });
41 assertGLError(gl, gl.INVALID_ENUM, "bad target",
42 function() {gl.texSubImage2D(gl.FLOAT, 0, 0,0, gl.RGBA, gl.UNSIGNED_BYTE , c); });
43 assertOk("good args",
44 function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGN ED_BYTE, c); });
45 assertGLError(gl, gl.INVALID_OPERATION, "format not same as original",
46 function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGB, gl.UNSIGNED_ BYTE, c); });
47 assertGLError(gl, gl.INVALID_OPERATION, "type not same as original",
48 function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGBA, gl.UNSIGNED _SHORT_4_4_4_4, c); });
49 assertOk("make texture RGB",
50 function() {gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED _BYTE, c); });
51 assertOk("format same as original RGB",
52 function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGB, gl.UNSIGNED_ BYTE, c); });
53 assertGLError(gl, gl.INVALID_OPERATION, "format not same as original RGB",
54 function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGBA, gl.UNSIGNED _BYTE, c); });
55 assertGLError(gl, gl.INVALID_OPERATION, "type not same as original RGB",
56 function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGB, gl.UNSIGNED_ SHORT_5_6_5, c); });
57 assertOk("make texture RGBA 4_4_4_4",
58 function() {gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGN ED_SHORT_4_4_4_4, c); });
59 assertOk("format same as original RGBA 4_4_4_4",
60 function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGBA, gl.UNSIGNED _SHORT_4_4_4_4, c); });
61 assertGLError(gl, gl.INVALID_OPERATION, "format not same as original RGBA 4_ 4_4_4",
62 function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGB, gl.UNSIGNED_ BYTE, c); });
63 assertGLError(gl, gl.INVALID_OPERATION, "type not same as original RGBA 4_4_ 4_4",
64 function() {gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGBA, gl.UNSIGNED _BYTE, c); });
65 }
66
67 Tests.endUnit = function(gl, tex) {
68 gl.bindTexture(gl.TEXTURE_2D, null);
69 gl.deleteTexture(tex);
70 }
71
72 </script>
73 <style>canvas{ position:absolute; }</style>
74 </head><body>
75 <canvas id="gl" width="16" height="16"></canvas>
76 <canvas id="c" width="16" height="16"></canvas>
77 </body></html>
OLDNEW
« no previous file with comments | « conformance/more/functions/texSubImage2DHTML.html ('k') | conformance/more/functions/uniformMatrix.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698