TestCmdSetColor.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. module( "CmdSetColor" );
  2. test("Test CmdSetColor (Undo and Redo)", function() {
  3. var editor = new Editor();
  4. var pointLight = aPointlight( "The light Light" );
  5. editor.execute( new CmdAddObject( pointLight ) );
  6. var green = 12581843; // bffbd3
  7. var blue = 14152447; // d7f2ff
  8. var yellow = 16775383; // fff8d7
  9. var colors = [ green, blue, yellow ];
  10. colors.map( function( color ) {
  11. var cmd = new CmdSetColor( pointLight, 'color', color );
  12. cmd.updatable = false;
  13. editor.execute( cmd );
  14. });
  15. ok( pointLight.color.getHex() == colors[ colors.length - 1 ],
  16. "OK, color has been set successfully (expected: '" + colors[ colors.length - 1 ] + "', actual: '" + pointLight.color.getHex() + "')" );
  17. editor.undo();
  18. ok( pointLight.color.getHex() == colors[ colors.length - 2 ],
  19. "OK, color has been set successfully after undo (expected: '" + colors[ colors.length - 2 ] + "', actual: '" + pointLight.color.getHex() + "')" );
  20. editor.redo();
  21. ok( pointLight.color.getHex() == colors[ colors.length - 1 ],
  22. "OK, color has been set successfully after redo (expected: '" + colors[ colors.length - 1 ] + "', actual: '" + pointLight.color.getHex() + "')" );
  23. });