browser/devtools/tilt/test/browser_tilt_gl06.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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

mercurial