InstancedBufferAttribute.tests.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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, false, 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, true, 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.normalized === true, "normalized was copied" );
  27. assert.ok( copiedInstance.meshPerAttribute === 123, "meshPerAttribute was copied" );
  28. for ( var i = 0; i < array.length; i ++ ) {
  29. assert.ok( copiedInstance.array[ i ] === array[ i ], "array was copied" );
  30. }
  31. } );
  32. } );
  33. } );