TestCmdRemoveObject.js 701 B

123456789101112131415161718192021222324252627
  1. module( "CmdRemoveObject" );
  2. test( "Test CmdRemoveObject (Undo and Redo)", function() {
  3. var editor = new Editor();
  4. var theName = "Come back!" ;
  5. var mesh = aBox( theName );
  6. editor.execute( new CmdAddObject( mesh ) );
  7. editor.select( mesh );
  8. // var object = editor.selected;
  9. var parent = mesh.parent;
  10. editor.execute( new CmdRemoveObject( mesh ) );
  11. editor.select( parent );
  12. ok( editor.scene.children.length == 0, "OK, object removal was successful" );
  13. editor.undo();
  14. ok( editor.scene.children[0].name == theName, "OK, removal was undone successfully, object exists again" );
  15. editor.redo();
  16. ok( editor.scene.children.length == 0, "OK, object was removed again (redo removal)" );
  17. });