Set up DRE AssertJ Fixture

This commit is contained in:
Marcus Rockwell 2024-10-06 19:31:31 -05:00
parent d5dcc315ac
commit dc9559e131
5 changed files with 32254 additions and 25 deletions

@ -8,19 +8,27 @@ import org.jdesktop.application.Application;
import trick.common.ApplicationTest;
import trick.common.TestUtils;
import static org.assertj.core.api.Assumptions.assumeThat;
public class MockDreApplication extends DreApplication {
public static void main(String[] args) {
File sie;
sieResourcePath = TestUtils.getTrickHome() + "/test/SIM_test_dr/S_sie.resource";
sieResourcePath = TEST_DR_SIE;
sie = new File(sieResourcePath);
if (!sie.exists()) {
boolean success = TestUtils.compileTestSim("SIM_test_dr");
}
assumeThat(sie.exists()).withFailMessage("Test Sie Resource File Not Found!\n")
.isTrue();
Application.launch(MockDreApplication.class, args);
}
/* Relative path from trick home to test_dr_sie.src, an S_sie.resource file copied from SIM_test_dr */
private final static String TEST_DR_SIE = TestUtils.getTrickHome() +
"/trick_source/java/src/test/resources/test_dr_sie.src";
/* Relative path from trick home to cannon_sie.src, an S_sie.resource file copied from SIM_cannon_numeric */
private final static String CANNON_SIE = TestUtils.getTrickHome() +
"/trick_source/java/src/test/resources/cannon_sie.src";
}

@ -1,4 +1,4 @@
package trick.simcontrol.fixtures;
package trick.dre.fixtures;
import java.awt.Font;
import java.awt.GraphicsEnvironment;
@ -12,18 +12,27 @@ import org.assertj.swing.fixture.JLabelFixture;
import org.assertj.swing.fixture.JListFixture;
import org.assertj.swing.fixture.JPanelFixture;
import trick.dre.fixtures.DreFixtureExtension;
import org.jdesktop.swingx.JXTitledPanel;
import trick.dre.DreApplication;
import trick.common.ui.components.FontChooser;
public class DreFixture extends FrameFixture {
private JPanelFixture varTreePanel,
varSelectedPanel,
varSearchPanel;
public DreFixture(Robot robot, DreApplication target) {
super(robot, target.getMainFrame());
}
public static DreFixtureExtension getExtension() {
return new DreFixtureExtension();
varTreePanel = panel(
new GenericTypeMatcher<JXTitledPanel>(JXTitledPanel.class) {
@Override
protected boolean isMatching(JXTitledPanel pane) {
return pane.getTitle().equals("Variables");
}
}
);
}
}

@ -1,16 +0,0 @@
package trick.dre.fixtures;
import java.awt.Container;
import org.assertj.swing.core.Robot;
import org.assertj.swing.fixture.ComponentFixtureExtension;
import trick.simcontrol.fixtures.DreFixture;
public class DreFixtureExtension extends ComponentFixtureExtension {
@Override
public DreFixture createFixture(Robot robot, Container root) {
DreApplication dreFrame = robot.finder().findByType(root, DreApplication.class, true);
return new DreFixture(robot, dreFrame);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff