content/canvas/test/webgl-conformance/conformance/misc/null-object-behaviour.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!--
     2 Copyright (C) 2011 Apple Computer, Inc.  All rights reserved.
     4 Redistribution and use in source and binary forms, with or without
     5 modification, are permitted provided that the following conditions
     6 are met:
     7 1. Redistributions of source code must retain the above copyright
     8    notice, this list of conditions and the following disclaimer.
     9 2. Redistributions in binary form must reproduce the above copyright
    10    notice, this list of conditions and the following disclaimer in the
    11    documentation and/or other materials provided with the distribution.
    13 THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
    14 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    15 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    16 PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
    17 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    18 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    19 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    20 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
    21 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    24 -->
    25 <!DOCTYPE html>
    26 <html>
    27 <head>
    28 <meta charset="utf-8">
    29 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
    30 <script src="../../resources/js-test-pre.js"></script>
    31 <script src="../resources/webgl-test.js"></script>
    32 <script src="../resources/webgl-test-utils.js"></script>
    33 </head>
    34 <body>
    35 <div id="description"></div>
    36 <div id="console"></div>
    38 <script>
    39 var wtu = WebGLTestUtils;
    40 description("Tests calling WebGL APIs without providing the necessary objects");
    42 var context = wtu.create3DContext();
    43 var program = wtu.loadStandardProgram(context);
    44 var shader = wtu.loadStandardVertexShader(context);
    45 var shouldGenerateGLError = wtu.shouldGenerateGLError;
    47 assertMsg(program != null, "Program Compiled");
    48 assertMsg(shader != null, "Shader Compiled");
    49 shouldGenerateGLError(context, context.INVALID_VALUE, "context.compileShader(undefined)");
    50 shouldGenerateGLError(context, context.INVALID_VALUE, "context.linkProgram(undefined)");
    51 shouldGenerateGLError(context, context.INVALID_VALUE, "context.attachShader(undefined, undefined)");
    52 shouldGenerateGLError(context, context.INVALID_VALUE, "context.attachShader(program, undefined)");
    53 shouldGenerateGLError(context, context.INVALID_VALUE, "context.attachShader(undefined, shader)");
    54 shouldGenerateGLError(context, context.INVALID_VALUE, "context.detachShader(program, undefined)");
    55 shouldGenerateGLError(context, context.INVALID_VALUE, "context.detachShader(undefined, shader)");
    56 shouldGenerateGLError(context, context.INVALID_VALUE, "context.shaderSource(undefined, undefined)");
    57 shouldGenerateGLError(context, context.INVALID_VALUE, "context.shaderSource(undefined, 'foo')");
    58 shouldGenerateGLError(context, context.INVALID_VALUE, "context.bindAttribLocation(undefined, 0, 'foo')");
    59 shouldThrow("context.bindBuffer(context.ARRAY_BUFFER, 0)");
    60 shouldThrow("context.bindFramebuffer(context.FRAMEBUFFER, 0)");
    61 shouldThrow("context.bindRenderbuffer(context.RENDERBUFFER, 0)");
    62 shouldThrow("context.bindTexture(context.TEXTURE_2D, 0)");
    63 shouldGenerateGLError(context, context.NO_ERROR, "context.bindBuffer(context.ARRAY_BUFFER, null)");
    64 shouldGenerateGLError(context, context.NO_ERROR, "context.bindFramebuffer(context.FRAMEBUFFER, null)");
    65 shouldGenerateGLError(context, context.NO_ERROR, "context.bindRenderbuffer(context.RENDERBUFFER, null)");
    66 shouldGenerateGLError(context, context.NO_ERROR, "context.bindTexture(context.TEXTURE_2D, null)");
    67 shouldGenerateGLError(context, context.NO_ERROR, "context.bindBuffer(context.ARRAY_BUFFER, undefined)");
    68 shouldGenerateGLError(context, context.NO_ERROR, "context.bindFramebuffer(context.FRAMEBUFFER, undefined)");
    69 shouldGenerateGLError(context, context.NO_ERROR, "context.bindRenderbuffer(context.RENDERBUFFER, undefined)");
    70 shouldGenerateGLError(context, context.NO_ERROR, "context.bindTexture(context.TEXTURE_2D, undefined)");
    71 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, null)");
    72 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, null, 0)");
    73 shouldGenerateGLError(context, context.INVALID_VALUE, "context.getProgramParameter(undefined, 0)");
    74 shouldGenerateGLError(context, context.INVALID_VALUE, "context.getProgramInfoLog(undefined, 0)");
    75 shouldGenerateGLError(context, context.INVALID_VALUE, "context.getShaderParameter(undefined, 0)");
    76 shouldGenerateGLError(context, context.INVALID_VALUE, "context.getShaderInfoLog(undefined, 0)");
    77 shouldGenerateGLError(context, context.INVALID_VALUE, "context.getShaderSource(undefined)");
    78 shouldGenerateGLError(context, context.INVALID_VALUE, "context.getUniform(undefined, null)");
    79 shouldGenerateGLError(context, context.INVALID_VALUE, "context.getUniformLocation(undefined, 'foo')");
    81 debug("");
    82 debug("check with bindings");
    83 context.bindBuffer(context.ARRAY_BUFFER, context.createBuffer());
    84 context.bindTexture(context.TEXTURE_2D, context.createTexture());
    85 shouldGenerateGLError(context, context.NO_ERROR, "context.bufferData(context.ARRAY_BUFFER, 1, context.STATIC_DRAW)");
    86 shouldGenerateGLError(context, context.NO_ERROR, "context.getBufferParameter(context.ARRAY_BUFFER, context.BUFFER_SIZE)");
    87 shouldGenerateGLError(context, context.NO_ERROR, "context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 1, 1, 0, context.RGBA, context.UNSIGNED_BYTE, new Uint8Array([0,0,0,0]))");
    88 shouldGenerateGLError(context, context.NO_ERROR, "context.texParameteri(context.TEXTURE_2D, context.TEXTURE_MIN_FILTER, context.NEAREST)");
    89 shouldGenerateGLError(context, context.NO_ERROR, "context.getTexParameter(context.TEXTURE_2D, context.TEXTURE_MIN_FILTER)");
    91 debug("");
    92 debug("check without bindings");
    93 context.bindBuffer(context.ARRAY_BUFFER, null);
    94 context.bindTexture(context.TEXTURE_2D, null);
    95 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.bufferData(context.ARRAY_BUFFER, 1, context.STATIC_DRAW)");
    96 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.getBufferParameter(context.ARRAY_BUFFER, context.BUFFER_SIZE)");
    97 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 1, 1, 0, context.RGBA, context.UNSIGNED_BYTE, new Uint8Array([0,0,0,0]))");
    98 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.texParameteri(context.TEXTURE_2D, context.TEXTURE_MIN_FILTER, context.NEAREST)");
    99 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.getTexParameter(context.TEXTURE_2D, context.TEXTURE_MIN_FILTER)");
   102 successfullyParsed = true;
   103 </script>
   105 <script>finishTest();</script>
   106 </body>
   107 </html>

mercurial