InstancedBufferAttribute.tests.js 1.4 KB

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