content/canvas/test/webgl-mochitest/test_fb_param_crash.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/canvas/test/webgl-mochitest/test_fb_param_crash.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,48 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<title>WebGL test: bug 958723</title>
     1.6 +<script src="/tests/SimpleTest/SimpleTest.js"></script>
     1.7 +<link rel="stylesheet" href="/tests/SimpleTest/test.css">
     1.8 +<script src="driver-info.js"></script>
     1.9 +<script src="webgl-util.js"></script>
    1.10 +<body>
    1.11 +<canvas id="c"></canvas>
    1.12 +<script>
    1.13 +
    1.14 +// Give ourselves a scope to return early from:
    1.15 +(function() {
    1.16 +  var gl = WebGLUtil.getWebGL('c');
    1.17 +  if (!gl) {
    1.18 +    todo(false, 'WebGL is unavailable.');
    1.19 +    return;
    1.20 +  }
    1.21 +
    1.22 +  // Catch actual WebGLUtil errors, not GL errors.
    1.23 +  function errorFunc(str) {
    1.24 +    ok(false, 'Error: ' + str);
    1.25 +  }
    1.26 +  WebGLUtil.setErrorFunc(errorFunc);
    1.27 +
    1.28 +  function checkGLError(func, info, reference) {
    1.29 +    var error = gl.getError();
    1.30 +    var prefix = info ? ('[' + info + '] ') : '';
    1.31 +    var text = 'gl.getError should be 0x' + reference.toString(16) +
    1.32 +               ', was 0x' + error.toString(16) + '.';
    1.33 +    func(error == reference, prefix + text);
    1.34 +  }
    1.35 +
    1.36 +  // Begin test:
    1.37 +  if (!gl.getExtension('WEBGL_draw_buffers')) {
    1.38 +    todo(false, 'Not having this extension is fine.');
    1.39 +    return;
    1.40 +  }
    1.41 +  checkGLError(ok, 'before bad param query', 0);
    1.42 +
    1.43 +  var result = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER,
    1.44 +                                                    gl.COLOR_ATTACHMENT0,
    1.45 +                                                    gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
    1.46 +
    1.47 +  checkGLError(ok, 'after bad param query', gl.INVALID_OPERATION);
    1.48 +})();
    1.49 +
    1.50 +</script>
    1.51 +

mercurial