mirror of
https://github.com/gpujs/gpu.js.git
synced 2026-01-18 16:04:10 +00:00
fix: typescript to include video and KernelValues fix: Duplicate image in unit test fix: Bump and build
61 lines
1.6 KiB
JavaScript
61 lines
1.6 KiB
JavaScript
const { assert, skip, test, module: describe, only } = require('qunit');
|
|
const { webGLKernelValueMaps } = require('../../../../../src');
|
|
|
|
describe('internal: WebGLKernelValueDynamicUnsignedArray');
|
|
|
|
test('.updateValue() checks too large', () => {
|
|
const mockKernel = {
|
|
constructor: {
|
|
features: { maxTextureSize: 2 },
|
|
},
|
|
validate: true,
|
|
};
|
|
const v = new webGLKernelValueMaps.unsigned.dynamic.Array([1,2], {
|
|
kernel: mockKernel,
|
|
name: 'test',
|
|
type: 'Array',
|
|
origin: 'user',
|
|
tactic: 'speed',
|
|
onRequestContextHandle: () => 1,
|
|
onRequestTexture: () => null,
|
|
onRequestIndex: () => 1
|
|
});
|
|
|
|
assert.throws(() => {
|
|
v.updateValue(new Array([1,2,3,4,5,6,7,8]));
|
|
}, new Error('Argument width of 4 larger than maximum size of 2 for your GPU'));
|
|
});
|
|
|
|
test('.updateValue() checks ok', () => {
|
|
const mockKernel = {
|
|
constructor: {
|
|
features: { maxTextureSize: 4 },
|
|
},
|
|
validate: true,
|
|
setUniform3iv: () => {},
|
|
setUniform2iv: () => {},
|
|
setUniform1i: () => {},
|
|
};
|
|
const mockContext = {
|
|
activeTexture: () => {},
|
|
bindTexture: () => {},
|
|
texParameteri: () => {},
|
|
pixelStorei: () => {},
|
|
texImage2D: () => {},
|
|
};
|
|
const v = new webGLKernelValueMaps.unsigned.dynamic.Array([1,2], {
|
|
kernel: mockKernel,
|
|
name: 'test',
|
|
type: 'Array',
|
|
origin: 'user',
|
|
tactic: 'speed',
|
|
context: mockContext,
|
|
onRequestContextHandle: () => 1,
|
|
onRequestTexture: () => null,
|
|
onRequestIndex: () => 1
|
|
});
|
|
v.updateValue(new Array([2,1]));
|
|
|
|
assert.equal(v.constructor.name, 'WebGLKernelValueDynamicUnsignedArray');
|
|
});
|