DirectionalLightShadow.tests.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* global QUnit */
  2. import { ObjectLoader } from '../../../../src/loaders/ObjectLoader';
  3. import { DirectionalLight } from '../../../../src/lights/DirectionalLight';
  4. import { DirectionalLightShadow } from '../../../../src/lights/DirectionalLightShadow';
  5. export default QUnit.module( 'Lights', () => {
  6. QUnit.module( 'DirectionalLightShadow', () => {
  7. // INHERITANCE
  8. QUnit.todo( "Extending", ( assert ) => {
  9. assert.ok( false, "everything's gonna be alright" );
  10. } );
  11. // INSTANCING
  12. QUnit.todo( "Instancing", ( assert ) => {
  13. assert.ok( false, "everything's gonna be alright" );
  14. } );
  15. // OTHERS
  16. QUnit.test( "clone/copy", ( assert ) => {
  17. var a = new DirectionalLightShadow();
  18. var b = new DirectionalLightShadow();
  19. var c;
  20. assert.notDeepEqual( a, b, "Newly instanced shadows are not equal" );
  21. c = a.clone();
  22. assert.smartEqual( a, c, "Shadows are identical after clone()" );
  23. c.mapSize.set( 1024, 1024 );
  24. assert.notDeepEqual( a, c, "Shadows are different again after change" );
  25. b.copy( a );
  26. assert.smartEqual( a, b, "Shadows are identical after copy()" );
  27. b.mapSize.set( 512, 512 );
  28. assert.notDeepEqual( a, b, "Shadows are different again after change" );
  29. } );
  30. QUnit.test( "toJSON", ( assert ) => {
  31. var light = new DirectionalLight();
  32. var shadow = new DirectionalLightShadow();
  33. shadow.bias = 10;
  34. shadow.radius = 5;
  35. shadow.mapSize.set( 1024, 1024 );
  36. light.shadow = shadow;
  37. var json = light.toJSON();
  38. var newLight = new ObjectLoader().parse( json );
  39. assert.smartEqual( newLight.shadow, light.shadow, "Reloaded shadow is identical to the original one" );
  40. } );
  41. } );
  42. } );
粤ICP备19079148号