mirror of
https://github.com/visgl/luma.gl.git
synced 2026-02-01 14:33:49 +00:00
39 lines
949 B
JavaScript
39 lines
949 B
JavaScript
import test from 'tape-catch';
|
|
import {createGLContext, Texture2D} from '../../dist/headless';
|
|
|
|
const fixture = {
|
|
gl: createGLContext()
|
|
};
|
|
|
|
test('WebGL#Texture2D construct/delete', t => {
|
|
const {gl} = fixture;
|
|
|
|
t.throws(
|
|
() => new Texture2D(),
|
|
/.*WebGLRenderingContext.*/,
|
|
'Texture2D throws on missing gl context');
|
|
|
|
const texture = new Texture2D(gl);
|
|
t.ok(texture instanceof Texture2D, 'Texture2D construction successful');
|
|
|
|
texture.delete();
|
|
t.ok(texture instanceof Texture2D, 'Texture2D delete successful');
|
|
|
|
texture.delete();
|
|
t.ok(texture instanceof Texture2D, 'Texture2D repeated delete successful');
|
|
|
|
t.end();
|
|
});
|
|
|
|
test('WebGL#Texture2D buffer update', t => {
|
|
const {gl} = fixture;
|
|
|
|
let texture = new Texture2D(gl);
|
|
t.ok(texture instanceof Texture2D, 'Texture2D construction successful');
|
|
|
|
texture = texture.delete();
|
|
t.ok(texture instanceof Texture2D, 'Texture2D delete successful');
|
|
|
|
t.end();
|
|
});
|