MCPcopy Index your code
hub / github.com/gpujs/gpu.js / imageArgumentTest

Function imageArgumentTest

test/features/image.js:5–22  ·  view source on GitHub ↗
(mode, done)

Source from the content-addressed store, hash-verified

3
4describe('image');
5function imageArgumentTest(mode, done) {
6 const gpu = new GPU({ mode });
7 const image = document.createElement('img');
8 image.src = 'jellyfish-1.jpeg';
9 image.onload = function() {
10 const imageKernel = gpu.createKernel(function(image) {
11 const pixel = image[this.thread.y][this.thread.x];
12 this.color(pixel[0], pixel[1], pixel[2], pixel[3]);
13 }, {
14 graphical: true,
15 output : [image.width, image.height]
16 });
17 imageKernel(image);
18 assert.equal(true, true, 'does not throw');
19 gpu.destroy();
20 done();
21 };
22}
23
24(typeof Image !== 'undefined' ? test : skip)('image argument auto', t => {
25 imageArgumentTest(null, t.async());

Callers 1

image.jsFile · 0.85

Calls 3

createKernelMethod · 0.95
destroyMethod · 0.95
colorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…