Thread: [Ejtools-cvs] libraries/adwt/src/test/test/adwt/action FR_fr_ActionTest.java,NONE,1.1 US_en_ActionTe
Brought to you by:
letiemble
From: <let...@us...> - 2003-12-14 10:50:01
|
Update of /cvsroot/ejtools/libraries/adwt/src/test/test/adwt/action In directory sc8-pr-cvs1:/tmp/cvs-serv19233/adwt/src/test/test/adwt/action Modified Files: ActionTest.java Added Files: FR_fr_ActionTest.java US_en_ActionTest.java Log Message: Add more javadocs. Add package.html files. --- NEW FILE: FR_fr_ActionTest.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package test.adwt.action; import java.util.Locale; /** * @author Laurent Etiemble * @version $Revision: 1.1 $ */ public class FR_fr_ActionTest extends ActionTest { /** Constructor for the ActionTest object */ public FR_fr_ActionTest() { super(); } /** * Constructor for the ActionTest object * * @param name Description of the Parameter */ public FR_fr_ActionTest(String name) { super(name); } /** A unit test for JUnit */ public void testInstantiation() { Locale locale = new Locale("fr", "FR"); this.doTestInstantiation(locale); } } --- NEW FILE: US_en_ActionTest.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package test.adwt.action; import java.util.Locale; /** * @author Laurent Etiemble * @version $Revision: 1.1 $ */ public class US_en_ActionTest extends ActionTest { /** Constructor for the ActionTest object */ public US_en_ActionTest() { super(); } /** * Constructor for the ActionTest object * * @param name Description of the Parameter */ public US_en_ActionTest(String name) { super(name); } /** A unit test for JUnit */ public void testInstantiation() { Locale locale = new Locale("", ""); this.doTestInstantiation(locale); } } Index: ActionTest.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/test/test/adwt/action/ActionTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ActionTest.java 27 Nov 2003 00:51:45 -0000 1.3 --- ActionTest.java 13 Dec 2003 21:29:35 -0000 1.4 *************** *** 7,10 **** --- 7,16 ---- package test.adwt.action; + import java.awt.event.ActionEvent; + import java.util.Locale; + + import javax.swing.JMenuItem; + import javax.swing.JRadioButtonMenuItem; + import org.ejtools.adwt.action.Command; import org.ejtools.adwt.action.CommandAction; *************** *** 30,33 **** --- 36,41 ---- import org.ejtools.adwt.action.help.HelpOnLineAction; import org.ejtools.adwt.action.help.TOTDAction; + import org.ejtools.adwt.action.tools.ExportAction; + import org.ejtools.adwt.action.tools.ImportAction; import org.ejtools.adwt.action.view.ShowConsoleAction; import org.ejtools.adwt.action.window.CascadeAction; *************** *** 36,39 **** --- 44,48 ---- import org.ejtools.adwt.action.window.InternalFrameAction; import org.ejtools.adwt.action.window.TileAction; + import org.ejtools.adwt.service.MenuBarService; import junit.framework.TestCase; *************** *** 45,49 **** public class ActionTest extends TestCase { ! /**Constructor for the ActionTest object */ public ActionTest() { --- 54,62 ---- public class ActionTest extends TestCase { ! /** Description of the Field */ ! protected int value = 0; ! ! ! /** Constructor for the ActionTest object */ public ActionTest() { *************** *** 53,57 **** /** ! *Constructor for the ActionTest object * * @param name Description of the Parameter --- 66,70 ---- /** ! * Constructor for the ActionTest object * * @param name Description of the Parameter *************** *** 64,70 **** /** A unit test for JUnit */ ! public void testInstantiation() { CommandAction action = null; Command command = new Command() --- 77,124 ---- /** A unit test for JUnit */ ! public void testCommandAction() { CommandAction action = null; + CommandAction childAction = null; + + Command command = + new Command() + { + public void execute() + { + value = 99; + } + }; + + action = new NewAction(command); + childAction = new NewAction(command); + + assertEquals("Must contains no child", action.size(), 0); + action.add(childAction); + assertEquals("Must contains one child", action.size(), 1); + action.remove(childAction); + assertEquals("Must contains no child", action.size(), 0); + + assertEquals("Values must be equal", value, 0); + action.actionPerformed(new ActionEvent(this, 0, "TEST")); + assertEquals("Values must be equal", value, 99); + + assertEquals("ToolBar presence must be the same", action.getToolBar(), true); + assertEquals("Menu must be the same", action.getMenu(), "action.file"); + assertEquals("Menu layout must be the same", action.getMenuLayout(), MenuBarService.NO_LAYOUT); + assertEquals("Item classes must be the same", action.getMenuItem().getClass(), JMenuItem.class); + } + + + /** + * Description of the Method + * + * @param locale Description of the Parameter + */ + protected void doTestInstantiation(Locale locale) + { + Locale.setDefault(locale); + + CommandAction action = null; Command command = new Command() *************** *** 79,144 **** action = new RefreshAction(command); assertNotNull("Action must be not null", action); // Package org.ejtools.adwt.action.edit action = new CopyAction(command); assertNotNull("Action must be not null", action); action = new CutAction(command); assertNotNull("Action must be not null", action); action = new DeleteAction(command); assertNotNull("Action must be not null", action); action = new DeselectAllAction(command); assertNotNull("Action must be not null", action); action = new PasteAction(command); assertNotNull("Action must be not null", action); action = new SelectAllAction(command); assertNotNull("Action must be not null", action); // Package org.ejtools.adwt.action.file action = new ExitAction(command); assertNotNull("Action must be not null", action); action = new FileHistoryAction(command); assertNotNull("Action must be not null", action); action = new FileHistoryActionTop(command); assertNotNull("Action must be not null", action); action = new NewAction(command); assertNotNull("Action must be not null", action); action = new OpenAction(command); assertNotNull("Action must be not null", action); action = new PrintAction(command); assertNotNull("Action must be not null", action); action = new SaveAction(command); assertNotNull("Action must be not null", action); action = new SaveAsAction(command); assertNotNull("Action must be not null", action); ! action = new OpenWorkspaceAction(command); assertNotNull("Action must be not null", action); action = new SaveWorkspaceAction(command); assertNotNull("Action must be not null", action); ! action = new SaveAsWorkspaceAction(command); ! assertNotNull("Action must be not null", action); // Package org.ejtools.adwt.action.help action = new AboutAction(command); assertNotNull("Action must be not null", action); action = new HelpOnLineAction(command); assertNotNull("Action must be not null", action); action = new TOTDAction(command); assertNotNull("Action must be not null", action); // Package org.ejtools.adwt.action.view action = new ShowConsoleAction(command); assertNotNull("Action must be not null", action); // Package org.ejtools.adwt.action.help action = new CascadeAction(command); assertNotNull("Action must be not null", action); action = new CloseAction(command); assertNotNull("Action must be not null", action); action = new CloseAllAction(command); assertNotNull("Action must be not null", action); action = new InternalFrameAction(command); assertNotNull("Action must be not null", action); action = new TileAction(command); assertNotNull("Action must be not null", action); } } --- 133,235 ---- action = new RefreshAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); // Package org.ejtools.adwt.action.edit action = new CopyAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); action = new CutAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); action = new DeleteAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); action = new DeselectAllAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); action = new PasteAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); action = new SelectAllAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); // Package org.ejtools.adwt.action.file action = new ExitAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); action = new FileHistoryAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); action = new FileHistoryActionTop(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); action = new NewAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); action = new OpenAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); + action = new OpenWorkspaceAction(command); + assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); action = new PrintAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); action = new SaveAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); action = new SaveAsAction(command); assertNotNull("Action must be not null", action); ! assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); ! action = new SaveAsWorkspaceAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); action = new SaveWorkspaceAction(command); assertNotNull("Action must be not null", action); ! assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); // Package org.ejtools.adwt.action.help action = new AboutAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); action = new HelpOnLineAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); action = new TOTDAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); + + // Package org.ejtools.adwt.action.tools + action = new ExportAction(command); + assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); + action = new ImportAction(command); + assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); // Package org.ejtools.adwt.action.view action = new ShowConsoleAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); // Package org.ejtools.adwt.action.help action = new CascadeAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); action = new CloseAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); action = new CloseAllAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); action = new InternalFrameAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); + assertEquals("Action must have a JRadioButtonMenuItem item", action.getMenuItem().getClass(), JRadioButtonMenuItem.class); + assertEquals("Action must have a JRadioButtonMenuItem item", action.getMenuItem().getClass(), JRadioButtonMenuItem.class); action = new TileAction(command); assertNotNull("Action must be not null", action); + assertEquals("Locale must be the same", action.getResourceBundle().getLocale(), locale); } } |