DirectionalLightShadow.tests.js 1.7 KB

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