browser/devtools/tilt/test/browser_tilt_gl08.js

changeset 1
ca08bd8f51b2
equal deleted inserted replaced
-1:000000000000 0:727eb1758b3f
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3 "use strict";
4
5 let isWebGLAvailable;
6
7 function onWebGLFail() {
8 isWebGLAvailable = false;
9 }
10
11 function onWebGLSuccess() {
12 isWebGLAvailable = true;
13 }
14
15 function test() {
16 if (!isWebGLSupported()) {
17 info("Skipping tilt_gl08 because WebGL isn't supported on this hardware.");
18 return;
19 }
20
21 let canvas = createCanvas();
22
23 let renderer = new TiltGL.Renderer(canvas, onWebGLFail, onWebGLSuccess);
24 let gl = renderer.context;
25
26 if (!isWebGLAvailable) {
27 return;
28 }
29
30
31 let t = new renderer.Texture({
32 source: canvas,
33 format: "RGB"
34 });
35
36 ok(t instanceof TiltGL.Texture,
37 "The texture object wasn't instantiated correctly.");
38
39 ok(t._ref,
40 "The texture WebGL object wasn't created properly.");
41 isnot(t._id, -1,
42 "The texture id wasn't set properly.");
43 isnot(t.width, -1,
44 "The texture width wasn't set properly.");
45 isnot(t.height, -1,
46 "The texture height wasn't set properly.");
47 ok(t.loaded,
48 "The texture loaded flag wasn't set to true as it should.");
49 }

mercurial