InstancedBufferAttribute.tests.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * @author simonThiele / https://github.com/simonThiele
  3. */
  4. /* global QUnit */
  5. import { InstancedBufferAttribute } from '../../../../src/core/InstancedBufferAttribute';
  6. export default QUnit.module( 'Core', () => {
  7. QUnit.module( 'InstancedBufferAttribute', () => {
  8. // INHERITANCE
  9. QUnit.todo( "Extending", ( assert ) => {
  10. assert.ok( false, "everything's gonna be alright" );
  11. } );
  12. // INSTANCING
  13. QUnit.test( "Instancing", ( assert ) => {
  14. var instance = new InstancedBufferAttribute( new Float32Array( 10 ), 2 );
  15. assert.ok( instance.meshPerAttribute === 1, "ok" );
  16. var instance = new InstancedBufferAttribute( new Float32Array( 10 ), 2, 123 );
  17. assert.ok( instance.meshPerAttribute === 123, "ok" );
  18. } );
  19. // PUBLIC STUFF
  20. QUnit.test( "copy", ( assert ) => {
  21. var array = new Float32Array( [ 1, 2, 3, 7, 8, 9 ] );
  22. var instance = new InstancedBufferAttribute( array, 2, 123 );
  23. var copiedInstance = instance.copy( instance );
  24. assert.ok( copiedInstance instanceof InstancedBufferAttribute, "the clone has the correct type" );
  25. assert.ok( copiedInstance.itemSize === 2, "itemSize was copied" );
  26. assert.ok( copiedInstance.meshPerAttribute === 123, "meshPerAttribute was copied" );
  27. for ( var i = 0; i < array.length; i ++ ) {
  28. assert.ok( copiedInstance.array[ i ] === array[ i ], "array was copied" );
  29. }
  30. } );
  31. } );
  32. } );
粤ICP备19079148号