forked from iTwin/itwinjs-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSystem.test.ts
65 lines (62 loc) · 3.13 KB
/
System.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*---------------------------------------------------------------------------------------------
* Copyright (c) 2019 Bentley Systems, Incorporated. All rights reserved.
* Licensed under the MIT License. See LICENSE.md in the project root for license terms.
*--------------------------------------------------------------------------------------------*/
import { expect } from "chai";
import { Capabilities, RenderType, DepthType } from "@bentley/imodeljs-frontend/lib/webgl";
// import { WebGLTestContext } from "./WebGLTestContext";
describe("System WebGL Capabilities", () => {
it("capabilities should all default to 0 or false", () => {
// Test default capabilities. Change if WebGL2 support added (not all will default to 0 or false).
const cap: Capabilities = new Capabilities();
expect(cap.maxRenderType).to.equal(RenderType.TextureUnsignedByte);
expect(cap.maxDepthType).to.equal(DepthType.RenderBufferUnsignedShort16);
expect(cap.maxTextureSize).to.equal(0);
expect(cap.maxColorAttachments).to.equal(0);
expect(cap.maxDrawBuffers).to.equal(0);
expect(cap.maxFragTextureUnits).to.equal(0);
expect(cap.maxVertTextureUnits).to.equal(0);
expect(cap.maxVertAttribs).to.equal(0);
expect(cap.maxVertUniformVectors).to.equal(0);
expect(cap.maxVaryingVectors).to.equal(0);
expect(cap.maxFragUniformVectors).to.equal(0);
expect(cap.supportsNonPowerOf2Textures).to.be.false;
expect(cap.supportsDrawBuffers).to.be.false;
expect(cap.supports32BitElementIndex).to.be.false;
expect(cap.supportsTextureFloat).to.be.false;
expect(cap.supportsTextureHalfFloat).to.be.false;
expect(cap.supportsShaderTextureLOD).to.be.false;
});
// ###TODO: Disabled for now. Need a way to make a fresh GL obj with new WebGLTestContext API.
/*
it("capabilities should be able to be initialized", () => {
const context = new WebGLTestContext();
const gl: WebGLRenderingContext | undefined = context.context;
if (undefined === gl) {
// do not enable below assert until we know GL can succeed on PRG
// assert.isOk(false, "Could not initialize GL");
return;
}
// Test initializing of capabilities
const cap: Capabilities = new Capabilities();
const isInitialized: boolean = cap.init(gl);
expect(isInitialized).to.be.true;
});
it("capabilities should be able to be read", () => {
const context = new WebGLTestContext();
const gl: WebGLRenderingContext | undefined = context.context;
if (undefined === gl) {
// do not enable below assert until we know GL can succeed on PRG
// assert.isOk(false, "Could not initialize GL");
return;
}
// Test initializing of capabilities
const cap: Capabilities = new Capabilities();
expect(cap.init(gl)).to.be.true;
expect(cap.maxTextureSize).to.not.equal(0);
expect(cap.supportsDrawBuffers).to.be.true; // drawBuffers currently needed (remove when no longer a requirement)
expect(cap.queryExtensionObject<WEBGL_draw_buffers>("WEBGL_draw_buffers")).to.not.be.undefined;
expect(cap.queryExtensionObject<OES_texture_float>("Fake extension")).to.be.undefined; // test fake extension
});
*/
});