|
1 <!DOCTYPE HTML> |
|
2 <title>WebGL test: bug 958723</title> |
|
3 <script src="/tests/SimpleTest/SimpleTest.js"></script> |
|
4 <link rel="stylesheet" href="/tests/SimpleTest/test.css"> |
|
5 <script src="driver-info.js"></script> |
|
6 <script src="webgl-util.js"></script> |
|
7 <body> |
|
8 <canvas id="c"></canvas> |
|
9 <script> |
|
10 |
|
11 // Give ourselves a scope to return early from: |
|
12 (function() { |
|
13 var gl = WebGLUtil.getWebGL('c'); |
|
14 if (!gl) { |
|
15 todo(false, 'WebGL is unavailable.'); |
|
16 return; |
|
17 } |
|
18 |
|
19 // Catch actual WebGLUtil errors, not GL errors. |
|
20 function errorFunc(str) { |
|
21 ok(false, 'Error: ' + str); |
|
22 } |
|
23 WebGLUtil.setErrorFunc(errorFunc); |
|
24 |
|
25 function checkGLError(func, info, reference) { |
|
26 var error = gl.getError(); |
|
27 var prefix = info ? ('[' + info + '] ') : ''; |
|
28 var text = 'gl.getError should be 0x' + reference.toString(16) + |
|
29 ', was 0x' + error.toString(16) + '.'; |
|
30 func(error == reference, prefix + text); |
|
31 } |
|
32 |
|
33 // Begin test: |
|
34 if (!gl.getExtension('WEBGL_draw_buffers')) { |
|
35 todo(false, 'Not having this extension is fine.'); |
|
36 return; |
|
37 } |
|
38 checkGLError(ok, 'before bad param query', 0); |
|
39 |
|
40 var result = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, |
|
41 gl.COLOR_ATTACHMENT0, |
|
42 gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME); |
|
43 |
|
44 checkGLError(ok, 'after bad param query', gl.INVALID_OPERATION); |
|
45 })(); |
|
46 |
|
47 </script> |
|
48 |