browser/devtools/tilt/test/browser_tilt_gl06.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     3 "use strict";
     5 let isWebGLAvailable;
     7 function onWebGLFail() {
     8   isWebGLAvailable = false;
     9 }
    11 function onWebGLSuccess() {
    12   isWebGLAvailable = true;
    13 }
    15 function test() {
    16   if (!isWebGLSupported()) {
    17     info("Skipping tilt_gl06 because WebGL isn't supported on this hardware.");
    18     return;
    19   }
    21   let canvas = createCanvas();
    23   let renderer = new TiltGL.Renderer(canvas, onWebGLFail, onWebGLSuccess);
    24   let gl = renderer.context;
    26   if (!isWebGLAvailable) {
    27     return;
    28   }
    31   let vb = new renderer.VertexBuffer([1, 2, 3, 4, 5, 6], 3);
    33   ok(vb instanceof TiltGL.VertexBuffer,
    34     "The vertex buffer object wasn't instantiated correctly.");
    35   ok(vb._ref,
    36     "The vertex buffer gl element wasn't created at initialization.");
    37   ok(vb.components,
    38     "The vertex buffer components weren't created at initialization.");
    39   is(vb.itemSize, 3,
    40     "The vertex buffer item size isn't set correctly.");
    41   is(vb.numItems, 2,
    42     "The vertex buffer number of items weren't calculated correctly.");
    45   let ib = new renderer.IndexBuffer([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
    47   ok(ib instanceof TiltGL.IndexBuffer,
    48     "The index buffer object wasn't instantiated correctly.");
    49   ok(ib._ref,
    50     "The index buffer gl element wasn't created at initialization.");
    51   ok(ib.components,
    52     "The index buffer components weren't created at initialization.");
    53   is(ib.itemSize, 1,
    54     "The index buffer item size isn't set correctly.");
    55   is(ib.numItems, 10,
    56     "The index buffer number of items weren't calculated correctly.");
    57 }

mercurial