Skip to content

Commit

Permalink
Add RenderProgram unit test file, see: #2
Browse files Browse the repository at this point in the history
  • Loading branch information
marlitas committed Oct 2, 2023
1 parent 4c9974d commit 656026e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions js/alpenglow-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import './clip/PolygonClippingTests.js';
import './parallel/ParallelTests.js';
import './webgpu/SnippetTests.js';
import './webgpu/ExampleTests.js';
import './render-program/RenderProgramTests.js';

// Since our tests are loaded asynchronously, we must direct QUnit to begin the tests
qunitStart();
4 changes: 4 additions & 0 deletions js/render-program/RenderProgram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ export default abstract class RenderProgram {
}
}

// REVIEW: Documentation here would be helpful. I see that this is getting overridden, but when are we getting
// a RenderProgram and when are we getting null? What does the difference of that return value tell us?
// Is this what is actually doing the simplification based on the type of RenderProgram we are?
// Is null essentially saying that this RenderProgram cannot be simplified?
protected getSimplified( children: RenderProgram[] ): RenderProgram | null {
return null;
}
Expand Down
19 changes: 19 additions & 0 deletions js/render-program/RenderProgramTests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2023, University of Colorado Boulder

/**
* Testing for RenderProgram vs a simplified RenderProgram
*
* @author Marla Schulz (PhET Interactive Simulations)
*
*/

import { RenderColor } from '../imports.js';
import Vector4 from '../../../dot/js/Vector4.js';

QUnit.module( 'RenderProgram' );

QUnit.test( 'color', assert => {
const renderColorProgram = new RenderColor( new Vector4( 245, 40, 145, 0.8 ) );

assert.equal( renderColorProgram.getName(), 'RenderColor' );
} );

0 comments on commit 656026e

Please sign in to comment.