Wed, 31 Dec 2014 06:55:46 +0100
Added tag TORBROWSER_REPLICA for changeset 6474c204b198
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_gl08 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 t = new renderer.Texture({ |
michael@0 | 32 | source: canvas, |
michael@0 | 33 | format: "RGB" |
michael@0 | 34 | }); |
michael@0 | 35 | |
michael@0 | 36 | ok(t instanceof TiltGL.Texture, |
michael@0 | 37 | "The texture object wasn't instantiated correctly."); |
michael@0 | 38 | |
michael@0 | 39 | ok(t._ref, |
michael@0 | 40 | "The texture WebGL object wasn't created properly."); |
michael@0 | 41 | isnot(t._id, -1, |
michael@0 | 42 | "The texture id wasn't set properly."); |
michael@0 | 43 | isnot(t.width, -1, |
michael@0 | 44 | "The texture width wasn't set properly."); |
michael@0 | 45 | isnot(t.height, -1, |
michael@0 | 46 | "The texture height wasn't set properly."); |
michael@0 | 47 | ok(t.loaded, |
michael@0 | 48 | "The texture loaded flag wasn't set to true as it should."); |
michael@0 | 49 | } |