content/canvas/test/webgl-conformance/conformance/buffers/buffer-bind-test.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/canvas/test/webgl-conformance/conformance/buffers/buffer-bind-test.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,63 @@
     1.4 +<!--
     1.5 +Copyright (c) 2011 The Chromium Authors. All rights reserved.
     1.6 +Use of this source code is governed by a BSD-style license that can be
     1.7 +found in the LICENSE file.
     1.8 + -->
     1.9 +<!DOCTYPE html>
    1.10 +<html>
    1.11 +  <head>
    1.12 +<meta charset="utf-8">
    1.13 +    <title>WebGL BindBuffer conformance test.</title>
    1.14 +    <link rel="stylesheet" href="../../resources/js-test-style.css"/>
    1.15 +    <script src="../../resources/js-test-pre.js"></script>
    1.16 +    <script src="../resources/webgl-test.js"> </script>
    1.17 +</head>
    1.18 +<body>
    1.19 +<canvas id="example" width="40" height="40" style="width: 40px; height: 40px;"></canvas>
    1.20 +<div id="description"></div>
    1.21 +<div id="console"></div>
    1.22 +<script>
    1.23 +description("Checks a buffer can only be bound to 1 target.");
    1.24 +
    1.25 +debug("");
    1.26 +debug("Canvas.getContext");
    1.27 +
    1.28 +var gl = create3DContext(document.getElementById("canvas"));
    1.29 +if (!gl) {
    1.30 +  testFailed("context does not exist");
    1.31 +} else {
    1.32 +  testPassed("context exists");
    1.33 +
    1.34 +  debug("");
    1.35 +
    1.36 +  var buf = gl.createBuffer();
    1.37 +  gl.bindBuffer(gl.ARRAY_BUFFER, buf);
    1.38 +  glErrorShouldBe(gl, gl.NO_ERROR,
    1.39 +            "should be able to bind buffer.");
    1.40 +  gl.bindBuffer(gl.ARRAY_BUFFER, null);
    1.41 +  glErrorShouldBe(gl, gl.NO_ERROR,
    1.42 +            "should be able to unbind buffer.");
    1.43 +  gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buf);
    1.44 +  glErrorShouldBe(gl, gl.INVALID_OPERATION,
    1.45 +            "should get INVALID_OPERATION if attempting to bind buffer to different target");
    1.46 +
    1.47 +  var buf = gl.createBuffer();
    1.48 +  gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buf);
    1.49 +  glErrorShouldBe(gl, gl.NO_ERROR,
    1.50 +            "should be able to bind buffer.");
    1.51 +  gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
    1.52 +  glErrorShouldBe(gl, gl.NO_ERROR,
    1.53 +            "should be able to unbind buffer.");
    1.54 +  gl.bindBuffer(gl.ARRAY_BUFFER, buf);
    1.55 +  glErrorShouldBe(gl, gl.INVALID_OPERATION,
    1.56 +            "should get INVALID_OPERATION if attempting to bind buffer to different target");
    1.57 +}
    1.58 +
    1.59 +debug("");
    1.60 +successfullyParsed = true;
    1.61 +</script>
    1.62 +<script>finishTest();</script>
    1.63 +
    1.64 +</body>
    1.65 +</html>
    1.66 +

mercurial