@gjsify/webgl 0.3.16 → 0.3.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/conformance/attribs.spec.js +3 -315
- package/lib/esm/conformance/buffers.spec.js +1 -220
- package/lib/esm/conformance/context.spec.js +3 -302
- package/lib/esm/conformance/programs.spec.js +3 -477
- package/lib/esm/conformance/rendering-basic.spec.js +3 -141
- package/lib/esm/conformance/rendering.spec.js +7 -514
- package/lib/esm/conformance/setup.js +1 -47
- package/lib/esm/conformance/state.spec.js +1 -365
- package/lib/esm/conformance/textures.spec.js +3 -337
- package/lib/esm/conformance/uniforms.spec.js +1 -484
- package/lib/esm/conformance-test.js +1 -25
- package/lib/esm/extensions/ext-blend-minmax.js +1 -18
- package/lib/esm/extensions/ext-color-buffer-float.js +1 -12
- package/lib/esm/extensions/ext-color-buffer-half-float.js +1 -12
- package/lib/esm/extensions/ext-texture-filter-anisotropic.js +1 -18
- package/lib/esm/extensions/oes-element-index-unit.js +1 -13
- package/lib/esm/extensions/oes-standard-derivatives.js +1 -17
- package/lib/esm/extensions/oes-texture-float-linear.js +1 -13
- package/lib/esm/extensions/oes-texture-float.js +1 -13
- package/lib/esm/extensions/oes-texture-half-float.js +1 -19
- package/lib/esm/extensions/stackgl-destroy-context.js +1 -12
- package/lib/esm/extensions/stackgl-resize-drawing-buffer.js +1 -12
- package/lib/esm/html-canvas-element.js +1 -65
- package/lib/esm/index.js +1 -33
- package/lib/esm/linkable.js +1 -50
- package/lib/esm/test-utils.js +4 -186
- package/lib/esm/test.js +1 -11
- package/lib/esm/types/index.js +1 -5
- package/lib/esm/utils.js +1 -201
- package/lib/esm/webgl-active-info.js +1 -11
- package/lib/esm/webgl-bridge.js +1 -167
- package/lib/esm/webgl-buffer.js +1 -19
- package/lib/esm/webgl-context-attributes.js +1 -24
- package/lib/esm/webgl-context-base.js +8 -3069
- package/lib/esm/webgl-drawing-buffer-wrapper.js +1 -11
- package/lib/esm/webgl-framebuffer.js +1 -110
- package/lib/esm/webgl-program.js +1 -27
- package/lib/esm/webgl-query.js +1 -17
- package/lib/esm/webgl-renderbuffer.js +1 -25
- package/lib/esm/webgl-rendering-context.js +1 -175
- package/lib/esm/webgl-sampler.js +1 -17
- package/lib/esm/webgl-shader-precision-format.js +1 -11
- package/lib/esm/webgl-shader.js +1 -25
- package/lib/esm/webgl-sync.js +1 -17
- package/lib/esm/webgl-texture-unit.js +1 -13
- package/lib/esm/webgl-texture.js +1 -23
- package/lib/esm/webgl-transform-feedback.js +1 -17
- package/lib/esm/webgl-uniform-location.js +1 -15
- package/lib/esm/webgl-vertex-array-object.js +1 -23
- package/lib/esm/webgl-vertex-attribute.js +1 -151
- package/lib/esm/webgl1.spec.js +10 -1044
- package/lib/esm/webgl2-rendering-context.js +1 -1218
- package/lib/esm/webgl2.spec.js +45 -1288
- package/lib/types/webgl-bridge.d.ts +9 -9
- package/package.json +9 -9
|
@@ -1,302 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
//#region src/ts/conformance/context.spec.ts
|
|
6
|
-
const WEBGL_METHODS = [
|
|
7
|
-
"getContextAttributes",
|
|
8
|
-
"activeTexture",
|
|
9
|
-
"attachShader",
|
|
10
|
-
"bindAttribLocation",
|
|
11
|
-
"bindBuffer",
|
|
12
|
-
"bindFramebuffer",
|
|
13
|
-
"bindRenderbuffer",
|
|
14
|
-
"bindTexture",
|
|
15
|
-
"blendColor",
|
|
16
|
-
"blendEquation",
|
|
17
|
-
"blendEquationSeparate",
|
|
18
|
-
"blendFunc",
|
|
19
|
-
"blendFuncSeparate",
|
|
20
|
-
"bufferData",
|
|
21
|
-
"bufferSubData",
|
|
22
|
-
"checkFramebufferStatus",
|
|
23
|
-
"clear",
|
|
24
|
-
"clearColor",
|
|
25
|
-
"clearDepth",
|
|
26
|
-
"clearStencil",
|
|
27
|
-
"colorMask",
|
|
28
|
-
"compileShader",
|
|
29
|
-
"compressedTexImage2D",
|
|
30
|
-
"compressedTexSubImage2D",
|
|
31
|
-
"copyTexImage2D",
|
|
32
|
-
"copyTexSubImage2D",
|
|
33
|
-
"createBuffer",
|
|
34
|
-
"createFramebuffer",
|
|
35
|
-
"createProgram",
|
|
36
|
-
"createRenderbuffer",
|
|
37
|
-
"createShader",
|
|
38
|
-
"createTexture",
|
|
39
|
-
"cullFace",
|
|
40
|
-
"deleteBuffer",
|
|
41
|
-
"deleteFramebuffer",
|
|
42
|
-
"deleteProgram",
|
|
43
|
-
"deleteRenderbuffer",
|
|
44
|
-
"deleteShader",
|
|
45
|
-
"deleteTexture",
|
|
46
|
-
"depthFunc",
|
|
47
|
-
"depthMask",
|
|
48
|
-
"depthRange",
|
|
49
|
-
"detachShader",
|
|
50
|
-
"disable",
|
|
51
|
-
"disableVertexAttribArray",
|
|
52
|
-
"drawArrays",
|
|
53
|
-
"drawElements",
|
|
54
|
-
"enable",
|
|
55
|
-
"enableVertexAttribArray",
|
|
56
|
-
"finish",
|
|
57
|
-
"flush",
|
|
58
|
-
"framebufferRenderbuffer",
|
|
59
|
-
"framebufferTexture2D",
|
|
60
|
-
"frontFace",
|
|
61
|
-
"generateMipmap",
|
|
62
|
-
"getActiveAttrib",
|
|
63
|
-
"getActiveUniform",
|
|
64
|
-
"getAttachedShaders",
|
|
65
|
-
"getAttribLocation",
|
|
66
|
-
"getParameter",
|
|
67
|
-
"getBufferParameter",
|
|
68
|
-
"getError",
|
|
69
|
-
"getExtension",
|
|
70
|
-
"getFramebufferAttachmentParameter",
|
|
71
|
-
"getProgramParameter",
|
|
72
|
-
"getProgramInfoLog",
|
|
73
|
-
"getRenderbufferParameter",
|
|
74
|
-
"getShaderParameter",
|
|
75
|
-
"getShaderInfoLog",
|
|
76
|
-
"getShaderPrecisionFormat",
|
|
77
|
-
"getShaderSource",
|
|
78
|
-
"getSupportedExtensions",
|
|
79
|
-
"getTexParameter",
|
|
80
|
-
"getUniform",
|
|
81
|
-
"getUniformLocation",
|
|
82
|
-
"getVertexAttrib",
|
|
83
|
-
"getVertexAttribOffset",
|
|
84
|
-
"hint",
|
|
85
|
-
"isBuffer",
|
|
86
|
-
"isContextLost",
|
|
87
|
-
"isEnabled",
|
|
88
|
-
"isFramebuffer",
|
|
89
|
-
"isProgram",
|
|
90
|
-
"isRenderbuffer",
|
|
91
|
-
"isShader",
|
|
92
|
-
"isTexture",
|
|
93
|
-
"lineWidth",
|
|
94
|
-
"linkProgram",
|
|
95
|
-
"pixelStorei",
|
|
96
|
-
"polygonOffset",
|
|
97
|
-
"readPixels",
|
|
98
|
-
"renderbufferStorage",
|
|
99
|
-
"sampleCoverage",
|
|
100
|
-
"scissor",
|
|
101
|
-
"shaderSource",
|
|
102
|
-
"stencilFunc",
|
|
103
|
-
"stencilFuncSeparate",
|
|
104
|
-
"stencilMask",
|
|
105
|
-
"stencilMaskSeparate",
|
|
106
|
-
"stencilOp",
|
|
107
|
-
"stencilOpSeparate",
|
|
108
|
-
"texImage2D",
|
|
109
|
-
"texParameterf",
|
|
110
|
-
"texParameteri",
|
|
111
|
-
"texSubImage2D",
|
|
112
|
-
"uniform1f",
|
|
113
|
-
"uniform1fv",
|
|
114
|
-
"uniform1i",
|
|
115
|
-
"uniform1iv",
|
|
116
|
-
"uniform2f",
|
|
117
|
-
"uniform2fv",
|
|
118
|
-
"uniform2i",
|
|
119
|
-
"uniform2iv",
|
|
120
|
-
"uniform3f",
|
|
121
|
-
"uniform3fv",
|
|
122
|
-
"uniform3i",
|
|
123
|
-
"uniform3iv",
|
|
124
|
-
"uniform4f",
|
|
125
|
-
"uniform4fv",
|
|
126
|
-
"uniform4i",
|
|
127
|
-
"uniform4iv",
|
|
128
|
-
"uniformMatrix2fv",
|
|
129
|
-
"uniformMatrix3fv",
|
|
130
|
-
"uniformMatrix4fv",
|
|
131
|
-
"useProgram",
|
|
132
|
-
"validateProgram",
|
|
133
|
-
"vertexAttrib1f",
|
|
134
|
-
"vertexAttrib1fv",
|
|
135
|
-
"vertexAttrib2f",
|
|
136
|
-
"vertexAttrib2fv",
|
|
137
|
-
"vertexAttrib3f",
|
|
138
|
-
"vertexAttrib3fv",
|
|
139
|
-
"vertexAttrib4f",
|
|
140
|
-
"vertexAttrib4fv",
|
|
141
|
-
"vertexAttribPointer",
|
|
142
|
-
"viewport"
|
|
143
|
-
];
|
|
144
|
-
const WEBGL_CONSTANTS = [
|
|
145
|
-
["DEPTH_BUFFER_BIT", 256],
|
|
146
|
-
["STENCIL_BUFFER_BIT", 1024],
|
|
147
|
-
["COLOR_BUFFER_BIT", 16384],
|
|
148
|
-
["POINTS", 0],
|
|
149
|
-
["LINES", 1],
|
|
150
|
-
["LINE_LOOP", 2],
|
|
151
|
-
["LINE_STRIP", 3],
|
|
152
|
-
["TRIANGLES", 4],
|
|
153
|
-
["TRIANGLE_STRIP", 5],
|
|
154
|
-
["TRIANGLE_FAN", 6],
|
|
155
|
-
["ZERO", 0],
|
|
156
|
-
["ONE", 1],
|
|
157
|
-
["SRC_COLOR", 768],
|
|
158
|
-
["SRC_ALPHA", 770],
|
|
159
|
-
["FUNC_ADD", 32774],
|
|
160
|
-
["ARRAY_BUFFER", 34962],
|
|
161
|
-
["ELEMENT_ARRAY_BUFFER", 34963],
|
|
162
|
-
["STREAM_DRAW", 35040],
|
|
163
|
-
["STATIC_DRAW", 35044],
|
|
164
|
-
["DYNAMIC_DRAW", 35048],
|
|
165
|
-
["FRAGMENT_SHADER", 35632],
|
|
166
|
-
["VERTEX_SHADER", 35633],
|
|
167
|
-
["COMPILE_STATUS", 35713],
|
|
168
|
-
["LINK_STATUS", 35714],
|
|
169
|
-
["VALIDATE_STATUS", 35715],
|
|
170
|
-
["FLOAT", 5126],
|
|
171
|
-
["FLOAT_VEC2", 35664],
|
|
172
|
-
["FLOAT_VEC3", 35665],
|
|
173
|
-
["FLOAT_VEC4", 35666],
|
|
174
|
-
["FLOAT_MAT2", 35674],
|
|
175
|
-
["FLOAT_MAT3", 35675],
|
|
176
|
-
["FLOAT_MAT4", 35676],
|
|
177
|
-
["INT", 5124],
|
|
178
|
-
["TEXTURE_2D", 3553],
|
|
179
|
-
["TEXTURE_CUBE_MAP", 34067],
|
|
180
|
-
["RGBA", 6408],
|
|
181
|
-
["RGB", 6407],
|
|
182
|
-
["UNSIGNED_BYTE", 5121],
|
|
183
|
-
["UNSIGNED_SHORT", 5123],
|
|
184
|
-
["UNSIGNED_INT", 5125],
|
|
185
|
-
["FRAMEBUFFER", 36160],
|
|
186
|
-
["RENDERBUFFER", 36161],
|
|
187
|
-
["DEPTH_COMPONENT16", 33189],
|
|
188
|
-
["DEPTH_ATTACHMENT", 36096],
|
|
189
|
-
["COLOR_ATTACHMENT0", 36064],
|
|
190
|
-
["FRAMEBUFFER_COMPLETE", 36053],
|
|
191
|
-
["NO_ERROR", 0],
|
|
192
|
-
["INVALID_ENUM", 1280],
|
|
193
|
-
["INVALID_VALUE", 1281],
|
|
194
|
-
["INVALID_OPERATION", 1282],
|
|
195
|
-
["OUT_OF_MEMORY", 1285]
|
|
196
|
-
];
|
|
197
|
-
var context_spec_default = async () => {
|
|
198
|
-
await on("Display", async () => {
|
|
199
|
-
const setup = createGLSetup();
|
|
200
|
-
if (!setup) {
|
|
201
|
-
console.warn("WebGL context not available — skipping conformance/context tests");
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
const { gl, glArea, win } = setup;
|
|
205
|
-
glArea.make_current();
|
|
206
|
-
await describe("conformance/context/methods: all WebGL methods present", async () => {
|
|
207
|
-
beforeEach(async () => {
|
|
208
|
-
glArea.make_current();
|
|
209
|
-
});
|
|
210
|
-
await it("all standard WebGL methods are functions on the context", async () => {
|
|
211
|
-
const missing = [];
|
|
212
|
-
for (const method of WEBGL_METHODS) {
|
|
213
|
-
if (typeof gl[method] !== "function") {
|
|
214
|
-
missing.push(method);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
if (missing.length > 0) {
|
|
218
|
-
throw new Error(`Missing WebGL methods: ${missing.join(", ")}`);
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
await describe("conformance/context/constants-and-properties: constant values", async () => {
|
|
223
|
-
beforeEach(async () => {
|
|
224
|
-
glArea.make_current();
|
|
225
|
-
});
|
|
226
|
-
await it("all sampled WebGL constants have the correct numeric value", async () => {
|
|
227
|
-
const wrong = [];
|
|
228
|
-
for (const [name, expected] of WEBGL_CONSTANTS) {
|
|
229
|
-
const actual = gl[name];
|
|
230
|
-
if (actual !== expected) {
|
|
231
|
-
wrong.push(`${name}: expected ${expected}, got ${actual}`);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
if (wrong.length > 0) {
|
|
235
|
-
throw new Error(`Wrong constant values:\n${wrong.join("\n")}`);
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
await it("WebGLRenderingContext class constant values match instance constants", async () => {
|
|
239
|
-
const wrong = [];
|
|
240
|
-
for (const [name, expected] of WEBGL_CONSTANTS) {
|
|
241
|
-
const classVal = WebGLRenderingContext[name];
|
|
242
|
-
if (classVal !== undefined && classVal !== expected) {
|
|
243
|
-
wrong.push(`${name}: expected ${expected}, got ${classVal}`);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
if (wrong.length > 0) {
|
|
247
|
-
throw new Error(`Wrong class constant values:\n${wrong.join("\n")}`);
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
});
|
|
251
|
-
await describe("conformance/context/context-type-test", async () => {
|
|
252
|
-
beforeEach(async () => {
|
|
253
|
-
glArea.make_current();
|
|
254
|
-
});
|
|
255
|
-
await it("WebGLRenderingContext should exist in globalThis", async () => {
|
|
256
|
-
expect(typeof globalThis.WebGLRenderingContext !== "undefined").toBeTruthy();
|
|
257
|
-
});
|
|
258
|
-
await it("gl should be an instance of WebGLRenderingContext", async () => {
|
|
259
|
-
expect(gl instanceof WebGLRenderingContext).toBeTruthy();
|
|
260
|
-
});
|
|
261
|
-
await it("getContextAttributes returns an object", async () => {
|
|
262
|
-
const attrs = gl.getContextAttributes();
|
|
263
|
-
expect(attrs).not.toBeNull();
|
|
264
|
-
expect(typeof attrs).toBe("object");
|
|
265
|
-
});
|
|
266
|
-
await it("isContextLost returns false initially", async () => {
|
|
267
|
-
expect(gl.isContextLost()).toBe(false);
|
|
268
|
-
});
|
|
269
|
-
await it("canvas property points to the HTMLCanvasElement", async () => {
|
|
270
|
-
expect(gl.canvas).not.toBeNull();
|
|
271
|
-
expect(typeof gl.canvas.getContext).toBe("function");
|
|
272
|
-
});
|
|
273
|
-
await it("drawingBufferWidth and drawingBufferHeight are positive integers", async () => {
|
|
274
|
-
expect(gl.drawingBufferWidth).toBeGreaterThan(0);
|
|
275
|
-
expect(gl.drawingBufferHeight).toBeGreaterThan(0);
|
|
276
|
-
expect(Number.isInteger(gl.drawingBufferWidth)).toBeTruthy();
|
|
277
|
-
expect(Number.isInteger(gl.drawingBufferHeight)).toBeTruthy();
|
|
278
|
-
});
|
|
279
|
-
await it("getSupportedExtensions returns an array of strings", async () => {
|
|
280
|
-
const exts = gl.getSupportedExtensions();
|
|
281
|
-
expect(Array.isArray(exts)).toBeTruthy();
|
|
282
|
-
for (const ext of exts) {
|
|
283
|
-
expect(typeof ext).toBe("string");
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
await it("getParameter(VENDOR) and getParameter(RENDERER) return strings", async () => {
|
|
287
|
-
const vendor = gl.getParameter(gl.VENDOR);
|
|
288
|
-
const renderer = gl.getParameter(gl.RENDERER);
|
|
289
|
-
const version = gl.getParameter(gl.VERSION);
|
|
290
|
-
const shadingLang = gl.getParameter(gl.SHADING_LANGUAGE_VERSION);
|
|
291
|
-
expect(typeof vendor).toBe("string");
|
|
292
|
-
expect(typeof renderer).toBe("string");
|
|
293
|
-
expect(typeof version).toBe("string");
|
|
294
|
-
expect(typeof shadingLang).toBe("string");
|
|
295
|
-
});
|
|
296
|
-
});
|
|
297
|
-
win.destroy();
|
|
298
|
-
});
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
//#endregion
|
|
302
|
-
export { context_spec_default as default };
|
|
1
|
+
import{createGLSetup as e}from"./setup.js";import{beforeEach as t,describe as n,expect as r,it as i,on as a}from"@gjsify/unit";import{WebGLRenderingContext as o}from"@gjsify/webgl";const s=`getContextAttributes.activeTexture.attachShader.bindAttribLocation.bindBuffer.bindFramebuffer.bindRenderbuffer.bindTexture.blendColor.blendEquation.blendEquationSeparate.blendFunc.blendFuncSeparate.bufferData.bufferSubData.checkFramebufferStatus.clear.clearColor.clearDepth.clearStencil.colorMask.compileShader.compressedTexImage2D.compressedTexSubImage2D.copyTexImage2D.copyTexSubImage2D.createBuffer.createFramebuffer.createProgram.createRenderbuffer.createShader.createTexture.cullFace.deleteBuffer.deleteFramebuffer.deleteProgram.deleteRenderbuffer.deleteShader.deleteTexture.depthFunc.depthMask.depthRange.detachShader.disable.disableVertexAttribArray.drawArrays.drawElements.enable.enableVertexAttribArray.finish.flush.framebufferRenderbuffer.framebufferTexture2D.frontFace.generateMipmap.getActiveAttrib.getActiveUniform.getAttachedShaders.getAttribLocation.getParameter.getBufferParameter.getError.getExtension.getFramebufferAttachmentParameter.getProgramParameter.getProgramInfoLog.getRenderbufferParameter.getShaderParameter.getShaderInfoLog.getShaderPrecisionFormat.getShaderSource.getSupportedExtensions.getTexParameter.getUniform.getUniformLocation.getVertexAttrib.getVertexAttribOffset.hint.isBuffer.isContextLost.isEnabled.isFramebuffer.isProgram.isRenderbuffer.isShader.isTexture.lineWidth.linkProgram.pixelStorei.polygonOffset.readPixels.renderbufferStorage.sampleCoverage.scissor.shaderSource.stencilFunc.stencilFuncSeparate.stencilMask.stencilMaskSeparate.stencilOp.stencilOpSeparate.texImage2D.texParameterf.texParameteri.texSubImage2D.uniform1f.uniform1fv.uniform1i.uniform1iv.uniform2f.uniform2fv.uniform2i.uniform2iv.uniform3f.uniform3fv.uniform3i.uniform3iv.uniform4f.uniform4fv.uniform4i.uniform4iv.uniformMatrix2fv.uniformMatrix3fv.uniformMatrix4fv.useProgram.validateProgram.vertexAttrib1f.vertexAttrib1fv.vertexAttrib2f.vertexAttrib2fv.vertexAttrib3f.vertexAttrib3fv.vertexAttrib4f.vertexAttrib4fv.vertexAttribPointer.viewport`.split(`.`),c=[[`DEPTH_BUFFER_BIT`,256],[`STENCIL_BUFFER_BIT`,1024],[`COLOR_BUFFER_BIT`,16384],[`POINTS`,0],[`LINES`,1],[`LINE_LOOP`,2],[`LINE_STRIP`,3],[`TRIANGLES`,4],[`TRIANGLE_STRIP`,5],[`TRIANGLE_FAN`,6],[`ZERO`,0],[`ONE`,1],[`SRC_COLOR`,768],[`SRC_ALPHA`,770],[`FUNC_ADD`,32774],[`ARRAY_BUFFER`,34962],[`ELEMENT_ARRAY_BUFFER`,34963],[`STREAM_DRAW`,35040],[`STATIC_DRAW`,35044],[`DYNAMIC_DRAW`,35048],[`FRAGMENT_SHADER`,35632],[`VERTEX_SHADER`,35633],[`COMPILE_STATUS`,35713],[`LINK_STATUS`,35714],[`VALIDATE_STATUS`,35715],[`FLOAT`,5126],[`FLOAT_VEC2`,35664],[`FLOAT_VEC3`,35665],[`FLOAT_VEC4`,35666],[`FLOAT_MAT2`,35674],[`FLOAT_MAT3`,35675],[`FLOAT_MAT4`,35676],[`INT`,5124],[`TEXTURE_2D`,3553],[`TEXTURE_CUBE_MAP`,34067],[`RGBA`,6408],[`RGB`,6407],[`UNSIGNED_BYTE`,5121],[`UNSIGNED_SHORT`,5123],[`UNSIGNED_INT`,5125],[`FRAMEBUFFER`,36160],[`RENDERBUFFER`,36161],[`DEPTH_COMPONENT16`,33189],[`DEPTH_ATTACHMENT`,36096],[`COLOR_ATTACHMENT0`,36064],[`FRAMEBUFFER_COMPLETE`,36053],[`NO_ERROR`,0],[`INVALID_ENUM`,1280],[`INVALID_VALUE`,1281],[`INVALID_OPERATION`,1282],[`OUT_OF_MEMORY`,1285]];var l=async()=>{await a(`Display`,async()=>{let a=e();if(!a){console.warn(`WebGL context not available — skipping conformance/context tests`);return}let{gl:l,glArea:u,win:d}=a;u.make_current(),await n(`conformance/context/methods: all WebGL methods present`,async()=>{t(async()=>{u.make_current()}),await i(`all standard WebGL methods are functions on the context`,async()=>{let e=[];for(let t of s)typeof l[t]!=`function`&&e.push(t);if(e.length>0)throw Error(`Missing WebGL methods: ${e.join(`, `)}`)})}),await n(`conformance/context/constants-and-properties: constant values`,async()=>{t(async()=>{u.make_current()}),await i(`all sampled WebGL constants have the correct numeric value`,async()=>{let e=[];for(let[t,n]of c){let r=l[t];r!==n&&e.push(`${t}: expected ${n}, got ${r}`)}if(e.length>0)throw Error(`Wrong constant values:\n${e.join(`
|
|
2
|
+
`)}`)}),await i(`WebGLRenderingContext class constant values match instance constants`,async()=>{let e=[];for(let[t,n]of c){let r=o[t];r!==void 0&&r!==n&&e.push(`${t}: expected ${n}, got ${r}`)}if(e.length>0)throw Error(`Wrong class constant values:\n${e.join(`
|
|
3
|
+
`)}`)})}),await n(`conformance/context/context-type-test`,async()=>{t(async()=>{u.make_current()}),await i(`WebGLRenderingContext should exist in globalThis`,async()=>{r(globalThis.WebGLRenderingContext!==void 0).toBeTruthy()}),await i(`gl should be an instance of WebGLRenderingContext`,async()=>{r(l instanceof o).toBeTruthy()}),await i(`getContextAttributes returns an object`,async()=>{let e=l.getContextAttributes();r(e).not.toBeNull(),r(typeof e).toBe(`object`)}),await i(`isContextLost returns false initially`,async()=>{r(l.isContextLost()).toBe(!1)}),await i(`canvas property points to the HTMLCanvasElement`,async()=>{r(l.canvas).not.toBeNull(),r(typeof l.canvas.getContext).toBe(`function`)}),await i(`drawingBufferWidth and drawingBufferHeight are positive integers`,async()=>{r(l.drawingBufferWidth).toBeGreaterThan(0),r(l.drawingBufferHeight).toBeGreaterThan(0),r(Number.isInteger(l.drawingBufferWidth)).toBeTruthy(),r(Number.isInteger(l.drawingBufferHeight)).toBeTruthy()}),await i(`getSupportedExtensions returns an array of strings`,async()=>{let e=l.getSupportedExtensions();r(Array.isArray(e)).toBeTruthy();for(let t of e)r(typeof t).toBe(`string`)}),await i(`getParameter(VENDOR) and getParameter(RENDERER) return strings`,async()=>{let e=l.getParameter(l.VENDOR),t=l.getParameter(l.RENDERER),n=l.getParameter(l.VERSION),i=l.getParameter(l.SHADING_LANGUAGE_VERSION);r(typeof e).toBe(`string`),r(typeof t).toBe(`string`),r(typeof n).toBe(`string`),r(typeof i).toBe(`string`)})}),d.destroy()})};export{l as default};
|