diff -r 000000000000 -r 6474c204b198 browser/devtools/tilt/test/browser_tilt_gl08.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/devtools/tilt/test/browser_tilt_gl08.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,49 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + +let isWebGLAvailable; + +function onWebGLFail() { + isWebGLAvailable = false; +} + +function onWebGLSuccess() { + isWebGLAvailable = true; +} + +function test() { + if (!isWebGLSupported()) { + info("Skipping tilt_gl08 because WebGL isn't supported on this hardware."); + return; + } + + let canvas = createCanvas(); + + let renderer = new TiltGL.Renderer(canvas, onWebGLFail, onWebGLSuccess); + let gl = renderer.context; + + if (!isWebGLAvailable) { + return; + } + + + let t = new renderer.Texture({ + source: canvas, + format: "RGB" + }); + + ok(t instanceof TiltGL.Texture, + "The texture object wasn't instantiated correctly."); + + ok(t._ref, + "The texture WebGL object wasn't created properly."); + isnot(t._id, -1, + "The texture id wasn't set properly."); + isnot(t.width, -1, + "The texture width wasn't set properly."); + isnot(t.height, -1, + "The texture height wasn't set properly."); + ok(t.loaded, + "The texture loaded flag wasn't set to true as it should."); +}