browser/devtools/tilt/test/browser_tilt_gl05.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/tilt/test/browser_tilt_gl05.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,40 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +"use strict";
     1.7 +
     1.8 +let isWebGLAvailable;
     1.9 +
    1.10 +function onWebGLFail() {
    1.11 +  isWebGLAvailable = false;
    1.12 +}
    1.13 +
    1.14 +function onWebGLSuccess() {
    1.15 +  isWebGLAvailable = true;
    1.16 +}
    1.17 +
    1.18 +function test() {
    1.19 +  if (!isWebGLSupported()) {
    1.20 +    info("Skipping tilt_gl05 because WebGL isn't supported on this hardware.");
    1.21 +    return;
    1.22 +  }
    1.23 +
    1.24 +  let canvas = createCanvas();
    1.25 +
    1.26 +  let renderer = new TiltGL.Renderer(canvas, onWebGLFail, onWebGLSuccess);
    1.27 +  let gl = renderer.context;
    1.28 +
    1.29 +  if (!isWebGLAvailable) {
    1.30 +    return;
    1.31 +  }
    1.32 +
    1.33 +
    1.34 +  let mesh = {
    1.35 +    vertices: new renderer.VertexBuffer([1, 2, 3], 3),
    1.36 +    indices: new renderer.IndexBuffer([1]),
    1.37 +  };
    1.38 +
    1.39 +  ok(mesh.vertices instanceof TiltGL.VertexBuffer,
    1.40 +    "The mesh vertices weren't saved at initialization.");
    1.41 +  ok(mesh.indices instanceof TiltGL.IndexBuffer,
    1.42 +    "The mesh indices weren't saved at initialization.");
    1.43 +}

mercurial