@gjsify/webgl 0.3.12 → 0.3.14
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 +312 -293
- package/lib/esm/conformance/buffers.spec.js +217 -200
- package/lib/esm/conformance/context.spec.js +295 -295
- package/lib/esm/conformance/programs.spec.js +458 -445
- package/lib/esm/conformance/rendering-basic.spec.js +134 -128
- package/lib/esm/conformance/rendering.spec.js +502 -400
- package/lib/esm/conformance/setup.js +42 -31
- package/lib/esm/conformance/state.spec.js +360 -343
- package/lib/esm/conformance/textures.spec.js +330 -338
- package/lib/esm/conformance/uniforms.spec.js +465 -309
- package/lib/esm/conformance-test.js +24 -22
- package/lib/esm/extensions/ext-blend-minmax.js +16 -16
- package/lib/esm/extensions/ext-color-buffer-float.js +10 -11
- package/lib/esm/extensions/ext-color-buffer-half-float.js +10 -11
- package/lib/esm/extensions/ext-texture-filter-anisotropic.js +16 -16
- package/lib/esm/extensions/oes-element-index-unit.js +11 -12
- package/lib/esm/extensions/oes-standard-derivatives.js +15 -15
- package/lib/esm/extensions/oes-texture-float-linear.js +11 -12
- package/lib/esm/extensions/oes-texture-float.js +11 -12
- package/lib/esm/extensions/oes-texture-half-float.js +17 -17
- package/lib/esm/extensions/stackgl-destroy-context.js +10 -10
- package/lib/esm/extensions/stackgl-resize-drawing-buffer.js +10 -10
- package/lib/esm/html-canvas-element.js +64 -64
- package/lib/esm/index.js +29 -26
- package/lib/esm/linkable.js +49 -49
- package/lib/esm/test-utils.js +158 -107
- package/lib/esm/test.js +8 -4
- package/lib/esm/types/index.js +5 -5
- package/lib/esm/utils.js +164 -187
- package/lib/esm/webgl-active-info.js +10 -9
- package/lib/esm/webgl-bridge.js +162 -147
- package/lib/esm/webgl-buffer.js +17 -15
- package/lib/esm/webgl-context-attributes.js +23 -22
- package/lib/esm/webgl-context-base.js +3039 -3351
- package/lib/esm/webgl-drawing-buffer-wrapper.js +10 -9
- package/lib/esm/webgl-framebuffer.js +108 -106
- package/lib/esm/webgl-program.js +25 -23
- package/lib/esm/webgl-query.js +15 -13
- package/lib/esm/webgl-renderbuffer.js +23 -21
- package/lib/esm/webgl-rendering-context.js +173 -187
- package/lib/esm/webgl-sampler.js +15 -13
- package/lib/esm/webgl-shader-precision-format.js +10 -9
- package/lib/esm/webgl-shader.js +23 -21
- package/lib/esm/webgl-sync.js +15 -13
- package/lib/esm/webgl-texture-unit.js +12 -11
- package/lib/esm/webgl-texture.js +21 -19
- package/lib/esm/webgl-transform-feedback.js +15 -13
- package/lib/esm/webgl-uniform-location.js +14 -13
- package/lib/esm/webgl-vertex-array-object.js +20 -18
- package/lib/esm/webgl-vertex-attribute.js +149 -145
- package/lib/esm/webgl1.spec.js +1039 -650
- package/lib/esm/webgl2-rendering-context.js +1210 -1273
- package/lib/esm/webgl2.spec.js +1284 -1252
- package/package.json +9 -9
- package/lib/esm/@types/glsl-tokenizer/index.d.js +0 -0
|
@@ -1,302 +1,302 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach, on } from "@gjsify/unit";
|
|
2
|
-
import { WebGLRenderingContext as OurWebGLRenderingContext } from "@gjsify/webgl";
|
|
3
1
|
import { createGLSetup } from "./setup.js";
|
|
2
|
+
import { beforeEach, describe, expect, it, on } from "@gjsify/unit";
|
|
3
|
+
import { WebGLRenderingContext } from "@gjsify/webgl";
|
|
4
|
+
|
|
5
|
+
//#region src/ts/conformance/context.spec.ts
|
|
4
6
|
const WEBGL_METHODS = [
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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"
|
|
141
143
|
];
|
|
142
144
|
const WEBGL_CONSTANTS = [
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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]
|
|
194
196
|
];
|
|
195
197
|
var context_spec_default = async () => {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
win.destroy();
|
|
298
|
-
});
|
|
299
|
-
};
|
|
300
|
-
export {
|
|
301
|
-
context_spec_default as default
|
|
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
|
+
});
|
|
302
299
|
};
|
|
300
|
+
|
|
301
|
+
//#endregion
|
|
302
|
+
export { context_spec_default as default };
|