Changeset 664 in tmcsimulator for trunk/test/tmcsim/simulationmanager/SimulationManagerSmokeTest.java
- Timestamp:
- 09/14/2022 03:31:54 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/tmcsim/simulationmanager/SimulationManagerSmokeTest.java
r658 r664 3 3 import java.awt.Component; 4 4 import java.io.File; 5 import java.util.Arrays; 5 6 import javax.swing.JButton; 6 7 import static junit.framework.Assert.assertEquals; … … 39 40 * Call constructors for both classes 40 41 */ 41 public void testBothGUIs() throws ScriptException, SimulationException 42 public void testBothGUIs() throws ScriptException, SimulationException, InterruptedException 42 43 { 43 44 System.out.println("Smoke Test Sim Mgr & CADSimulator"); 44 45 45 46 Window cadwindow = null; 46 System.setProperty("CAD_SIM_PROPERTIES", "config/cad_s imulator_smoketest_config.properties");47 System.setProperty("CAD_SIM_PROPERTIES", "config/cad_server.properties"); 47 48 if (System.getProperty("CAD_SIM_PROPERTIES") != null) 48 49 { … … 77 78 78 79 Window simMgrWindow = null; 79 System.setProperty("SIM_MGR_PROPERTIES", "config/sim_manager _smoketest_config.properties");80 System.setProperty("SIM_MGR_PROPERTIES", "config/sim_manager.properties"); 80 81 if (System.getProperty("SIM_MGR_PROPERTIES") != null) 81 82 { … … 118 119 // Click "Start" 119 120 win.getButton("Start").click(); 120 try 121 { 122 Thread.sleep(200); 123 } catch (Exception ex) 124 { 125 ex.printStackTrace(); 126 } 121 Thread.sleep(200); 127 122 assertEquals("Running", txtSimStatus.getText()); 128 123 129 //List all available buttons 130 Component[] buttons = win.getSwingComponents(JButton.class); 131 for (Component comp : buttons) 132 { 133 System.out.println(comp); 134 } 124 java.util.ArrayList<String> expectedButtons = new java.util.ArrayList<String>(Arrays.asList("Load Script","Start","Pause","Reset","Connect to Paramics", 125 "Load Network","Reschedule","Trigger","Delete","Add New Incident","Divert Traffic")); 126 // Check for appearance of buttons in the GUI 135 127 win.getButton("Load Script"); 136 win.getButton("Pause");137 win.getButton("Disconnect from Paramics");138 128 win.getButton("Reset"); 139 win.getButton("Load Network"); 129 win.getButton("Add New Incident"); 130 win.getButton("Reschedule"); 131 win.getButton("Trigger"); 132 win.getButton("Delete"); 133 //Find all available buttons - obsolete, replaced by stmts above 134 // Component[] buttons = win.getSwingComponents(JButton.class); 135 // java.util.List<Component> actualButtons = Arrays.asList(buttons); 136 // for (Component actualBtn: actualButtons) 137 // { 138 // if (actualBtn instanceof JButton) 139 // { 140 // String btnName = ((JButton) actualBtn).getText(); 141 // if (btnName.length()>0) 142 // { 143 // if (expectedButtons.contains(btnName)) 144 // { 145 // expectedButtons.remove(btnName); 146 // } 147 // else 148 // { 149 // fail("GUI has an unexpected button: "+btnName); 150 // } 151 // } 152 // } 153 // } 154 // if (expectedButtons.size() > 0) 155 // { 156 // fail("GUI is missing a button: "+expectedButtons); 157 // } 158 159 // Pause the simulation 160 win.getButton("Pause").click(); 161 Thread.sleep(200); 162 win.getButton("Resume"); // resume should appear when paused 140 163 // Quit 141 164 engine = null;
Note: See TracChangeset
for help on using the changeset viewer.
