TestCmdSetUuid.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * @author lxxxvi / https://github.com/lxxxvi
  3. * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch)
  4. */
  5. module( "CmdSetUuid" );
  6. test( "Test CmdSetUuid (Undo and Redo)", function() {
  7. var editor = new Editor();
  8. var object = aBox( 'UUID test box' );
  9. editor.execute( new CmdAddObject( object ) );
  10. var uuids = [ THREE.Math.generateUUID(), THREE.Math.generateUUID(), THREE.Math.generateUUID() ];
  11. uuids.map( function( uuid ) {
  12. var cmd = new CmdSetUuid( object, uuid );
  13. cmd.updatable = false;
  14. editor.execute( cmd );
  15. } );
  16. ok( object.uuid == uuids[ uuids.length - 1 ],
  17. "OK, UUID on actual object matches last UUID in the test data array " );
  18. editor.undo();
  19. ok( object.uuid == uuids[ uuids.length - 2 ],
  20. "OK, UUID on actual object matches second to the last UUID in the test data array (after undo)" );
  21. editor.redo();
  22. ok( object.uuid == uuids[ uuids.length - 1 ],
  23. "OK, UUID on actual object matches last UUID in the test data array again (after redo) " );
  24. } );