PointLight.tests.js 1.9 KB

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