Skip to content

Commit

Permalink
Add test case and fix for glGetDebugInfo regression under Node. (#111)
Browse files Browse the repository at this point in the history
* Add test case and fix for glGetDebugInfo regression under Node.

* Add "experimental.js" to exported "files"  in package.json.

* Add comments to some top-level test index.js files
  • Loading branch information
ibgreen committed Nov 30, 2016
1 parent 736ed05 commit 4617ca0
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 25 deletions.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -29,7 +29,8 @@
"shaderlib",
"src",
"headless.js",
"node-io.js"
"node-io.js",
"experimental.js"
],
"dependencies": {
"autobind-decorator": "^1.3.3",
Expand Down
4 changes: 2 additions & 2 deletions src/webgl/context.js
Expand Up @@ -205,9 +205,9 @@ export function glGetDebugInfo(gl) {
// specs by returning null for unsupported extension. Instead,
// it returns an object without GL_UNMASKED_VENDOR_WEBGL and GL_UNMASKED_RENDERER_WEBGL.
return {
vendor: info.GL_UNMASKED_VENDOR_WEBGL ?
vendor: (info && info.GL_UNMASKED_VENDOR_WEBGL) ?
gl.getParameter(GL_UNMASKED_VENDOR_WEBGL) : 'unknown',
renderer: info.GL_UNMASKED_RENDERER_WEBGL ?
renderer: (info && info.GL_UNMASKED_RENDERER_WEBGL) ?
gl.getParameter(GL_UNMASKED_RENDERER_WEBGL) : 'unknown'
};
}
Expand Down
5 changes: 4 additions & 1 deletion test/headless-nowebgl.js
@@ -1,6 +1,9 @@
// Note that we do two test runs on luma.gl, with and without headless-gl
// This file imports tests that should run *without* headless-gl included

require('babel-core/register');
require('babel-polyfill');

// Quick test that webgl independent code works
require('./webgl/core-spec');
require('./webgl/context-no-headless.spec');
require('./webgl-independent');
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions test/webgl/context.spec.js
@@ -0,0 +1,18 @@
const {createGLContext, glGetDebugInfo} = require('../../src/headless');
const {isWebGLContext} = require('../../src/webgl/webgl-checks');

const test = require('tape-catch');

test('WebGL#headless context creation', t => {
const gl = createGLContext();
t.ok(isWebGLContext(gl), 'Context creation ok');
t.end();
});

test('WebGL#glGetDebugInfo', t => {
const gl = createGLContext();
const info = glGetDebugInfo(gl);
t.ok(typeof info.vendor === 'string', 'info.vendor ok');
t.ok(typeof info.renderer === 'string', 'info.renderer ok');
t.end();
});
File renamed without changes.
File renamed without changes.
25 changes: 14 additions & 11 deletions test/webgl/index.js
@@ -1,24 +1,27 @@
// Note that we do two test runs on luma.gl, with and without headless-gl
// This file imports tests that should run *with* headless-gl included

// helpers & utils
import './helpers/query-manager.spec';

// webgl
import './webgl-spec';
import './core-spec.js';
import './vertex-attributes-spec';
import './buffer-spec';
import './program-spec';
import './texture-spec';
import './framebuffer-spec';
import './renderbuffer-spec';
import './draw-spec';
import './uniforms-spec';
import './context.spec.js';
import './vertex-attributes.spec';
import './buffer.spec';
import './program.spec';
import './texture.spec';
import './framebuffer.spec';
import './renderbuffer.spec';
import './draw.spec';
import './uniforms.spec';

// Extensions
import './timer-query.spec';

// import './fbo-spec';

// webgl2
import './vertex-array-object-spec';
import './vertex-array-object.spec';

// misc
import './io-spec';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 0 additions & 10 deletions test/webgl/webgl-spec.js

This file was deleted.

0 comments on commit 4617ca0

Please sign in to comment.