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