-
Notifications
You must be signed in to change notification settings - Fork 663
Expand file tree
/
Copy path778-webgl-kernel-experimental.js
More file actions
29 lines (25 loc) · 1.02 KB
/
778-webgl-kernel-experimental.js
File metadata and controls
29 lines (25 loc) · 1.02 KB
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
const { assert, test, module: describe } = require('qunit');
const { GPU } = require('../../src');
const old = {};
describe('issue #778 - WebGL kernel feature checks may throw an error', {
before: () => {
old.document = global.document;
old.OffscreenCanvas = global.OffscreenCanvas;
global.document = undefined;
// Mocking OffscreenCanvas
global.OffscreenCanvas = class OffscreenCanvas {
constructor() {}
getContext(context) {
if (context === "webgl") return;
if (context === 'experimental-webgl') throw new TypeError("Failed to execute 'getContext' on 'OffscreenCanvas': The provided value 'experimental-webgl' is not a valid enum value of type OffscreenRenderingContextType.")
}
}
},
after: () => {
global.document = old.document;
global.OffscreenCanvas = old.OffscreenCanvas;
}
});
test('Check that WebGL is not supported', () => {
assert.notOk(GPU.isWebGLSupported);
});