PointLight.tests.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* global QUnit */
  2. import { runStdLightTests } from '../../utils/qunit-utils';
  3. import { PointLight } from '../../../../src/lights/PointLight';
  4. export default QUnit.module( 'Lights', () => {
  5. QUnit.module( 'PointLight', ( hooks ) => {
  6. var lights = undefined;
  7. hooks.beforeEach( function () {
  8. const parameters = {
  9. color: 0xaaaaaa,
  10. intensity: 0.5,
  11. distance: 100,
  12. decay: 2
  13. };
  14. lights = [
  15. new PointLight(),
  16. new PointLight( parameters.color ),
  17. new PointLight( parameters.color, parameters.intensity ),
  18. new PointLight( parameters.color, parameters.intensity, parameters.distance ),
  19. new PointLight( parameters.color, parameters.intensity, parameters.distance, parameters.decay )
  20. ];
  21. } );
  22. // INHERITANCE
  23. QUnit.todo( "Extending", ( assert ) => {
  24. assert.ok( false, "everything's gonna be alright" );
  25. } );
  26. // INSTANCING
  27. QUnit.todo( "Instancing", ( assert ) => {
  28. assert.ok( false, "everything's gonna be alright" );
  29. } );
  30. // PROPERTIES
  31. QUnit.test( "power", ( assert ) => {
  32. var a = new PointLight( 0xaaaaaa );
  33. a.intensity = 100;
  34. assert.numEqual( a.power, 100 * Math.PI * 4, "Correct power for an intensity of 100" );
  35. a.intensity = 40;
  36. assert.numEqual( a.power, 40 * Math.PI * 4, "Correct power for an intensity of 40" );
  37. a.power = 100;
  38. assert.numEqual( a.intensity, 100 / ( 4 * Math.PI ), "Correct intensity for a power of 100" );
  39. } );
  40. // PUBLIC STUFF
  41. QUnit.todo( "isPointLight", ( assert ) => {
  42. assert.ok( false, "everything's gonna be alright" );
  43. } );
  44. QUnit.todo( "copy", ( assert ) => {
  45. assert.ok( false, "everything's gonna be alright" );
  46. } );
  47. // OTHERS
  48. QUnit.test( 'Standard light tests', ( assert ) => {
  49. runStdLightTests( assert, lights );
  50. } );
  51. } );
  52. } );
粤ICP备19079148号