BoxHelper.tests.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /* global QUnit */
  2. import { BoxHelper } from '../../../../src/helpers/BoxHelper.js';
  3. import { LineSegments } from '../../../../src/objects/LineSegments.js';
  4. import { runStdGeometryTests } from '../../utils/qunit-utils.js';
  5. import { BoxGeometry } from '../../../../src/geometries/BoxGeometry.js';
  6. import { SphereGeometry } from '../../../../src/geometries/SphereGeometry.js';
  7. import { Mesh } from '../../../../src/objects/Mesh.js';
  8. export default QUnit.module( 'Helpers', () => {
  9. QUnit.module( 'BoxHelper', ( hooks ) => {
  10. let geometries = undefined;
  11. hooks.beforeEach( function () {
  12. // Test with a normal cube and a box helper
  13. const boxGeometry = new BoxGeometry();
  14. const box = new Mesh( boxGeometry );
  15. const boxHelper = new BoxHelper( box );
  16. // The same should happen with a comparable sphere
  17. const sphereGeometry = new SphereGeometry();
  18. const sphere = new Mesh( sphereGeometry );
  19. const sphereBoxHelper = new BoxHelper( sphere );
  20. // Note that unlike what I'd like to, these doesn't check the equivalency
  21. // of the two generated geometries
  22. geometries = [ boxHelper.geometry, sphereBoxHelper.geometry ];
  23. } );
  24. // INHERITANCE
  25. QUnit.test( 'Extending', ( assert ) => {
  26. const object = new BoxHelper();
  27. assert.strictEqual(
  28. object instanceof LineSegments, true,
  29. 'BoxHelper extends from LineSegments'
  30. );
  31. } );
  32. // INSTANCING
  33. QUnit.test( 'Instancing', ( assert ) => {
  34. const object = new BoxHelper();
  35. assert.ok( object, 'Can instantiate a BoxHelper.' );
  36. } );
  37. // PROPERTIES
  38. QUnit.test( 'type', ( assert ) => {
  39. const object = new BoxHelper();
  40. assert.ok(
  41. object.type === 'BoxHelper',
  42. 'BoxHelper.type should be BoxHelper'
  43. );
  44. } );
  45. QUnit.todo( 'object', ( assert ) => {
  46. assert.ok( false, 'everything\'s gonna be alright' );
  47. } );
  48. QUnit.todo( 'matrixAutoUpdate', ( assert ) => {
  49. assert.ok( false, 'everything\'s gonna be alright' );
  50. } );
  51. // PUBLIC
  52. QUnit.todo( 'update', ( assert ) => {
  53. assert.ok( false, 'everything\'s gonna be alright' );
  54. } );
  55. QUnit.todo( 'setFromObject', ( assert ) => {
  56. assert.ok( false, 'everything\'s gonna be alright' );
  57. } );
  58. QUnit.todo( 'copy', ( assert ) => {
  59. assert.ok( false, 'everything\'s gonna be alright' );
  60. } );
  61. QUnit.test( 'dispose', ( assert ) => {
  62. assert.expect( 0 );
  63. const object = new BoxHelper();
  64. object.dispose();
  65. } );
  66. // OTHERS
  67. QUnit.test( 'Standard geometry tests', ( assert ) => {
  68. runStdGeometryTests( assert, geometries );
  69. } );
  70. } );
  71. } );
粤ICP备19079148号