luma.gl/test/webgl/vertex-array-object.spec.js
2017-03-15 11:24:00 -07:00

35 lines
887 B
JavaScript

import test from 'tape-catch';
import {createGLContext} from '../../headless';
import {VertexArrayObject} from '../../dist/webgl';
const fixture = {
gl: createGLContext()
};
test('WebGL#VertexArrayObject construct/delete', t => {
const {gl} = fixture;
if (!VertexArrayObject.isSupported(gl)) {
t.comment('- VertexArrayObject not supported, skipping tests');
t.end();
return;
}
t.throws(
() => new VertexArrayObject(),
/.*WebGLRenderingContext.*/,
'VertexArrayObject throws on missing gl context');
const vao = new VertexArrayObject(gl);
t.ok(vao instanceof VertexArrayObject, 'VertexArrayObject construction successful');
vao.delete();
t.ok(vao instanceof VertexArrayObject, 'VertexArrayObject delete successful');
vao.delete();
t.ok(vao instanceof VertexArrayObject, 'VertexArrayObject repeated delete successful');
t.end();
});