- Timestamp:
- 07/02/13 16:20:07 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/test/java/com/framsticks/gui/BrowserTest.java
r88 r90 1 1 package com.framsticks.gui; 2 2 3 import javax.swing.JFrame; 3 import static org.fest.assertions.Assertions.assertThat; 4 import static org.fest.swing.edt.GuiActionRunner.execute; 5 4 6 5 7 import org.apache.log4j.Logger; 6 import org.fest.swing.edt.FailOnThreadViolationRepaintManager;7 import org.fest.swing.edt.GuiActionRunner;8 import org.fest.swing.edt.GuiQuery;9 8 import org.fest.swing.edt.GuiTask; 10 import org.fest.swing.fixture.FrameFixture; 11 import org.fest.swing.fixture.JTreeFixture; 12 // import static org.fest.swing.edt.GuiActionRunner.*; 13 import org.testng.annotations.*; 9 import org.testng.annotations.Test; 14 10 11 import com.framsticks.model.ModelPackage; 15 12 import com.framsticks.remote.RemoteInstance; 16 import com.framsticks.test.TestConfiguration;17 import com.framsticks.util.dispatching.Dispatching;18 import com.framsticks.util.dispatching.JoinableMonitor;19 // import com.framsticks.util.dispatching.Dispatching;20 13 21 import static org.fest.assertions.Assertions.*; 22 import static org.fest.swing.core.BasicRobot.robotWithNewAwtHierarchy; 23 import static org.fest.swing.edt.GuiActionRunner.*; 24 import org.fest.swing.core.Robot; 14 public class BrowserTest extends BrowserBaseTest { 25 15 26 public class BrowserTest extends TestConfiguration {27 16 private static final Logger log = Logger.getLogger(BrowserTest.class); 28 17 29 JoinableMonitor monitor; 30 Browser browser; 31 Robot robot; 32 FrameFixture frame; 18 RemoteInstance localhost; 33 19 34 @BeforeClass 35 public void setUp() { 36 FailOnThreadViolationRepaintManager.install(); 37 assertThat(executeInEDT()).isTrue(); 20 @Override 21 protected void configureBrowser() { 22 browser = new Browser(); 38 23 39 robot = robotWithNewAwtHierarchy(); 40 41 browser = new Browser(); 42 monitor = new JoinableMonitor(browser); 43 44 RemoteInstance localhost = new RemoteInstance(); 24 localhost = new RemoteInstance(); 45 25 localhost.setName("localhost"); 46 26 localhost.setAddress("localhost:9009"); 27 localhost.usePackage(new ModelPackage()); 47 28 48 29 browser.addInstance(localhost); 49 30 50 monitor.use();51 // robot.waitForIdle();52 frame = new FrameFixture(robot,53 GuiActionRunner.execute(new GuiQuery<JFrame>() {54 @Override55 protected JFrame executeInEDT() throws Throwable {56 return browser.getMainFrame().getSwing();57 }58 }));59 60 log.info("frame fixture done");61 // frame.show();62 // log.info("frame fixture shown");63 31 } 64 32 65 public void clickAndExpandPath(JTreeFixture tree, String path) { 66 tree.clickPath(path).expandPath(path); 67 robot.waitForIdle(); 68 } 69 70 @Test 33 @Test(timeOut = 10000) 71 34 public void testShow() { 72 35 log.info("testing"); 73 JTreeFixture tree = frame.tree("tree");74 36 tree.clickRow(0).expandRow(0); 75 37 robot.waitForIdle(); … … 81 43 @Override 82 44 protected void executeInEDT() throws Throwable { 83 assertThat(frame.panel("o Simulator").component().isVisible()) 84 .isTrue(); 45 assertThat(frame.panel("Simulator").component().isVisible()).isTrue(); 85 46 } 86 47 }); 87 48 88 clickAndExpandPath(tree, "localhost/simulator/genepools"); 89 clickAndExpandPath(tree, "localhost/simulator/genepools/groups"); 90 clickAndExpandPath(tree, "localhost/simulator/genepools/groups/Genotypes"); 49 clickAndExpandPath("localhost/simulator/genepools"); 50 clickAndExpandPath("localhost/simulator/genepools/groups"); 51 clickAndExpandPath("localhost/simulator/genepools/groups/Genotypes"); 52 } 91 53 92 54 93 55 94 95 96 97 // tree.clickPath("localhost/simulator/genepools/groups/Genotypes/genotypes");98 // robot.waitForIdle();99 // sleep(2);100 // tree.expandPath("localhost/simulator/genepools/groups/Genotypes/genotypes");101 102 // tree.expandRow(tree.component().getLeadSelectionRow() + 1);103 // robot.waitForIdle();104 105 // sleep(2);106 }107 108 109 @AfterClass110 public void tearDown() {111 log.info("before close");112 113 monitor.drop();114 115 Dispatching.joinAbsolutely(browser);116 // frame.cleanUp();117 // log.info("before close");118 // browser.interrupt();119 120 // try {121 // // frame.close();122 // } catch (Throwable t) {123 // log.error("caught ", t);124 // }125 // log.info("after close");126 // // frame.close();127 // // frame.cleanUp();128 129 130 131 // Dispatching.join(browser);132 }133 134 56 }
Note: See TracChangeset
for help on using the changeset viewer.