BoxGeometry.tests.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* global QUnit */
  2. import { BoxGeometry } from '../../../../src/geometries/BoxGeometry.js';
  3. import { BufferGeometry } from '../../../../src/core/BufferGeometry.js';
  4. import { runStdGeometryTests } from '../../utils/qunit-utils.js';
  5. export default QUnit.module( 'Geometries', () => {
  6. QUnit.module( 'BoxGeometry', ( hooks ) => {
  7. let geometries = undefined;
  8. hooks.beforeEach( function () {
  9. const parameters = {
  10. width: 10,
  11. height: 20,
  12. depth: 30,
  13. widthSegments: 2,
  14. heightSegments: 3,
  15. depthSegments: 4
  16. };
  17. geometries = [
  18. new BoxGeometry(),
  19. new BoxGeometry( parameters.width, parameters.height, parameters.depth ),
  20. new BoxGeometry( parameters.width, parameters.height, parameters.depth, parameters.widthSegments, parameters.heightSegments, parameters.depthSegments ),
  21. ];
  22. } );
  23. // INHERITANCE
  24. QUnit.test( 'Extending', ( assert ) => {
  25. const object = new BoxGeometry();
  26. assert.strictEqual(
  27. object instanceof BufferGeometry, true,
  28. 'BoxGeometry extends from BufferGeometry'
  29. );
  30. } );
  31. // INSTANCING
  32. QUnit.test( 'Instancing', ( assert ) => {
  33. const object = new BoxGeometry();
  34. assert.ok( object, 'Can instantiate a BoxGeometry.' );
  35. } );
  36. // PROPERTIES
  37. QUnit.test( 'type', ( assert ) => {
  38. const object = new BoxGeometry();
  39. assert.ok(
  40. object.type === 'BoxGeometry',
  41. 'BoxGeometry.type should be BoxGeometry'
  42. );
  43. } );
  44. QUnit.todo( 'parameters', ( assert ) => {
  45. assert.ok( false, 'everything\'s gonna be alright' );
  46. } );
  47. // STATIC
  48. QUnit.todo( 'fromJSON', ( assert ) => {
  49. assert.ok( false, 'everything\'s gonna be alright' );
  50. } );
  51. // OTHERS
  52. QUnit.test( 'Standard geometry tests', ( assert ) => {
  53. runStdGeometryTests( assert, geometries );
  54. } );
  55. } );
  56. } );
粤ICP备19079148号