Changeset 43 in tmcsimulator for trunk/test


Ignore:
Timestamp:
06/23/2016 11:34:59 AM (10 years ago)
Author:
jdalbey
Message:

ExitAction?.java Remove confirmation prompt from exiting Sim Mgr. Enhance Sim Mgr smoke test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/tmcsim/simulationmanager/SimulationManagerSmokeTest.java

    r34 r43  
    11package tmcsim.simulationmanager; 
    22 
     3import java.awt.Component; 
    34import java.io.File; 
     5import javax.swing.JButton; 
    46import static junit.framework.Assert.assertEquals; 
     7import static junit.framework.Assert.assertFalse; 
     8import static junit.framework.Assert.assertTrue; 
    59import static junit.framework.Assert.fail; 
    6 import org.uispec4j.*; 
     10import org.uispec4j.Panel; 
     11import org.uispec4j.TextBox; 
     12import org.uispec4j.Trigger; 
     13import org.uispec4j.UISpecTestCase; 
     14import org.uispec4j.Window; 
    715import org.uispec4j.interception.WindowInterceptor; 
    816import tmcsim.cadsimulator.CADSimulator; 
     
    3543 
    3644        Window cadwindow = null; 
    37         System.setProperty("CONFIG_DIR", "config/testConfig"); 
    38         if (System.getProperty("CONFIG_DIR") != null) 
     45        System.setProperty("CAD_SIM_PROPERTIES", "config/cad_simulator_smoketest_config.properties"); 
     46        if (System.getProperty("CAD_SIM_PROPERTIES") != null) 
    3947        { 
    4048            cadwindow = WindowInterceptor.run(new Trigger() 
     
    4452                    try 
    4553                    { 
    46                         engine = new CADSimulator(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + "cad_simulator_config.properties"); 
    47  
     54                        engine = new CADSimulator(System.getProperty("CAD_SIM_PROPERTIES")); 
    4855                    } catch (Exception e) 
    4956                    { 
     
    5259                } 
    5360            }); 
    54         } else 
     61        } 
     62        else 
    5563        { 
    56             fail("CONFIG_DIR system property not defined."); 
     64            fail("CAD_SIM_PROPERTIES system property not defined."); 
    5765        } 
    5866 
    5967        // Check CAD Simulator appears with no script and nothing connected 
    60         assertEquals("CAD Simulator", cadwindow.getTitle()); 
     68        assertTrue("Window title incorrect", cadwindow.getTitle().startsWith("CAD Simulator")); 
    6169        Panel mainPanel = cadwindow.getPanel("contentPane"); 
    6270        TextBox txtStatus = mainPanel.getTextBox("simulationStatus"); 
     
    6775 
    6876        Window simMgrWindow = null; 
    69         System.setProperty("CONFIG_DIR", "config/testConfig"); 
    70         if (System.getProperty("CONFIG_DIR") != null) 
     77        System.setProperty("SIM_MGR_PROPERTIES", "config/sim_manager_smoketest_config.properties"); 
     78        if (System.getProperty("SIM_MGR_PROPERTIES") != null) 
    7179        { 
    7280            simMgrWindow = WindowInterceptor.run(new Trigger() 
     
    7684                    try 
    7785                    { 
    78                         //simMgrApp = new SimulationManager(System.getProperty("SIM_MGR_PROPERTIES")); 
    79                         simMgrApp = new SimulationManager(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + "sim_manager_config.properties"); 
     86                        simMgrApp = new SimulationManager(System.getProperty("SIM_MGR_PROPERTIES")); 
    8087                    } catch (Exception ex) 
    8188                    { 
     
    8491                } 
    8592            }); 
    86         } else 
     93        } 
     94        else 
    8795        { 
    88             fail("CONFIG_DIR system property not defined."); 
     96            fail("SIM_MGR_PROPERTIES system property not defined."); 
    8997        } 
    9098 
     
    117125        assertEquals("Running", txtSimStatus.getText()); 
    118126 
     127        //List all available buttons 
     128        Component[] buttons = win.getSwingComponents(JButton.class); 
     129        for (Component comp : buttons) 
     130        { 
     131            System.out.println(comp); 
     132        } 
     133        win.getButton("Load Script"); 
     134        win.getButton("Pause"); 
     135        win.getButton("Disconnect from Paramics"); 
     136        win.getButton("Reset"); 
     137        win.getButton("Load Network"); 
    119138        // Quit 
    120139        engine = null; 
    121         simMgrApp = null; 
     140        win.getMenuBar().getMenu("File").getSubMenu("Exit").click(); 
     141        //simMgrApp = null; 
    122142    } 
    123143} 
Note: See TracChangeset for help on using the changeset viewer.