Light.tests.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /* global QUnit */
  2. import { Light } from '../../../../src/lights/Light.js';
  3. import { Object3D } from '../../../../src/core/Object3D.js';
  4. import { runStdLightTests } from '../../utils/qunit-utils.js';
  5. export default QUnit.module( 'Lights', () => {
  6. QUnit.module( 'Light', ( hooks ) => {
  7. let lights = undefined;
  8. hooks.beforeEach( function () {
  9. const parameters = {
  10. color: 0xaaaaaa,
  11. intensity: 0.5
  12. };
  13. lights = [
  14. new Light(),
  15. new Light( parameters.color ),
  16. new Light( parameters.color, parameters.intensity )
  17. ];
  18. } );
  19. // INHERITANCE
  20. QUnit.test( 'Extending', ( assert ) => {
  21. const object = new Light();
  22. assert.strictEqual(
  23. object instanceof Object3D, true,
  24. 'Light extends from Object3D'
  25. );
  26. } );
  27. // INSTANCING
  28. QUnit.test( 'Instancing', ( assert ) => {
  29. const object = new Light();
  30. assert.ok( object, 'Can instantiate a Light.' );
  31. } );
  32. // PROPERTIES
  33. QUnit.test( 'type', ( assert ) => {
  34. const object = new Light();
  35. assert.ok(
  36. object.type === 'Light',
  37. 'Light.type should be Light'
  38. );
  39. } );
  40. QUnit.todo( 'color', ( assert ) => {
  41. assert.ok( false, 'everything\'s gonna be alright' );
  42. } );
  43. QUnit.todo( 'intensity', ( assert ) => {
  44. assert.ok( false, 'everything\'s gonna be alright' );
  45. } );
  46. // PUBLIC
  47. QUnit.test( 'isLight', ( assert ) => {
  48. const object = new Light();
  49. assert.ok(
  50. object.isLight,
  51. 'Light.isLight should be true'
  52. );
  53. } );
  54. QUnit.test( 'dispose', ( assert ) => {
  55. assert.expect( 0 );
  56. // empty, test exists
  57. const object = new Light();
  58. object.dispose();
  59. } );
  60. QUnit.todo( 'copy', ( assert ) => {
  61. assert.ok( false, 'everything\'s gonna be alright' );
  62. } );
  63. QUnit.todo( 'toJSON', ( assert ) => {
  64. assert.ok( false, 'everything\'s gonna be alright' );
  65. } );
  66. // OTHERS
  67. QUnit.test( 'Standard light tests', ( assert ) => {
  68. runStdLightTests( assert, lights );
  69. } );
  70. } );
  71. } );
粤ICP备19079148号