Skip to content

Commit bec8391

Browse files
committed
Move scope test into p5.Shader.js and align with existing strands test style
1 parent 0455a6c commit bec8391

2 files changed

Lines changed: 15 additions & 25 deletions

File tree

test/unit/webgl/p5.Shader.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,21 @@ suite('p5.Shader', function() {
459459
}).not.toThrowError();
460460
});
461461

462+
test('buildMaterialShader forwards scope to modify', () => {
463+
myp5.createCanvas(5, 5, myp5.WEBGL);
464+
expect(() => {
465+
const myShader = myp5.buildMaterialShader(() => {
466+
myp5.getPixelInputs(inputs => {
467+
inputs.color = [1, 0, 0, 1];
468+
return inputs;
469+
});
470+
}, { myp5 });
471+
myp5.noStroke();
472+
myp5.shader(myShader);
473+
myp5.plane(myp5.width, myp5.height);
474+
}).not.toThrowError();
475+
});
476+
462477
test('returns numbers for builtin globals outside hooks and a strandNode when called inside hooks', () => {
463478
myp5.createCanvas(5, 5, myp5.WEBGL);
464479
myp5.baseMaterialShader().modify(() => {

test/unit/webgl/p5.Shader.scope.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)