This repository has been archived by the owner on May 16, 2023. It is now read-only.
forked from gpujs/gpu.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from jbghoul/webgl-kernel-experimental
Webgl kernel experimental
- Loading branch information
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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); | ||
}); |