browser/devtools/tilt/test/browser_tilt_gl07.js

Wed, 31 Dec 2014 07:53:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:53:36 +0100
branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
permissions
-rw-r--r--

Correct small whitespace inconsistency, lost while renaming variables.

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_gl07 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 p = new renderer.Program({
michael@0 32 vs: TiltGL.ColorShader.vs,
michael@0 33 fs: TiltGL.ColorShader.fs,
michael@0 34 attributes: ["vertexPosition"],
michael@0 35 uniforms: ["mvMatrix", "projMatrix", "fill"]
michael@0 36 });
michael@0 37
michael@0 38 ok(p instanceof TiltGL.Program,
michael@0 39 "The program object wasn't instantiated correctly.");
michael@0 40
michael@0 41 ok(p._ref,
michael@0 42 "The program WebGL object wasn't created properly.");
michael@0 43 isnot(p._id, -1,
michael@0 44 "The program id wasn't set properly.");
michael@0 45 ok(p._attributes,
michael@0 46 "The program attributes cache wasn't created properly.");
michael@0 47 ok(p._uniforms,
michael@0 48 "The program uniforms cache wasn't created properly.");
michael@0 49
michael@0 50 is(typeof p._attributes.vertexPosition, "number",
michael@0 51 "The vertexPosition attribute wasn't cached as it should.");
michael@0 52 is(typeof p._uniforms.mvMatrix, "object",
michael@0 53 "The mvMatrix uniform wasn't cached as it should.");
michael@0 54 is(typeof p._uniforms.projMatrix, "object",
michael@0 55 "The projMatrix uniform wasn't cached as it should.");
michael@0 56 is(typeof p._uniforms.fill, "object",
michael@0 57 "The fill uniform wasn't cached as it should.");
michael@0 58 }

mercurial