mirror of
https://github.com/nasa/trick.git
synced 2025-02-10 12:41:21 +00:00
Completed DRE Fixture
This commit is contained in:
parent
65d637f7ef
commit
6ece3a2d9a
@ -41,7 +41,7 @@ public class DreApplicationTest extends ApplicationTest {
|
|||||||
protected void onSetUp() {
|
protected void onSetUp() {
|
||||||
application(MockDreApplication.class).start();
|
application(MockDreApplication.class).start();
|
||||||
|
|
||||||
sleep(500);
|
sleep(1000);
|
||||||
|
|
||||||
dre_fix = new DreFixture(robot(), MockDreApplication.getInstance());
|
dre_fix = new DreFixture(robot(), MockDreApplication.getInstance());
|
||||||
}
|
}
|
||||||
@ -51,6 +51,8 @@ public class DreApplicationTest extends ApplicationTest {
|
|||||||
boolean bool = true;
|
boolean bool = true;
|
||||||
dre_fix.selectVar("drx/name");
|
dre_fix.selectVar("drx/name");
|
||||||
dre_fix.setOptions(HDF5 | STEP | RING_BUFFER);
|
dre_fix.setOptions(HDF5 | STEP | RING_BUFFER);
|
||||||
|
dre_fix.setGroupName("TestingTesting123");
|
||||||
|
dre_fix.saveMenuItem("TestingMenuBar");
|
||||||
sleep(5000);
|
sleep(5000);
|
||||||
assertThat(bool).isTrue();
|
assertThat(bool).isTrue();
|
||||||
}
|
}
|
||||||
|
@ -13,14 +13,14 @@ import trick.common.TestUtils;
|
|||||||
import static org.assertj.core.api.Assumptions.assumeThat;
|
import static org.assertj.core.api.Assumptions.assumeThat;
|
||||||
|
|
||||||
public class MockDreApplication extends DreApplication {
|
public class MockDreApplication extends DreApplication {
|
||||||
private static MockDreApplication the_dre;
|
private static MockDreApplication the_dre = null;
|
||||||
|
|
||||||
public MockDreApplication() {
|
public MockDreApplication() {
|
||||||
super();
|
super();
|
||||||
the_dre = this;
|
the_dre = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MockDreApplication getInstance() { return the_dre; }
|
public static final MockDreApplication getInstance() { return the_dre; }
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
File sie;
|
File sie;
|
||||||
|
@ -3,27 +3,50 @@ package trick.dre.fixtures;
|
|||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.GraphicsEnvironment;
|
import java.awt.GraphicsEnvironment;
|
||||||
|
|
||||||
|
import javax.swing.JCheckBoxMenuItem;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
import org.assertj.swing.core.GenericTypeMatcher;
|
import org.assertj.swing.core.GenericTypeMatcher;
|
||||||
import org.assertj.swing.core.Robot;
|
import org.assertj.swing.core.Robot;
|
||||||
import org.assertj.swing.fixture.ComponentContainerFixture;
|
import org.assertj.swing.fixture.ComponentContainerFixture;
|
||||||
import org.assertj.swing.fixture.DialogFixture;
|
import org.assertj.swing.fixture.DialogFixture;
|
||||||
import org.assertj.swing.fixture.FrameFixture;
|
import org.assertj.swing.fixture.FrameFixture;
|
||||||
import org.assertj.swing.fixture.JCheckBoxFixture;
|
import org.assertj.swing.fixture.JCheckBoxFixture;
|
||||||
|
import org.assertj.swing.fixture.JComboBoxFixture;
|
||||||
|
import org.assertj.swing.fixture.JFileChooserFixture;
|
||||||
import org.assertj.swing.fixture.JLabelFixture;
|
import org.assertj.swing.fixture.JLabelFixture;
|
||||||
import org.assertj.swing.fixture.JListFixture;
|
import org.assertj.swing.fixture.JListFixture;
|
||||||
|
import org.assertj.swing.fixture.JMenuItemFixture;
|
||||||
|
import org.assertj.swing.fixture.JOptionPaneFixture;
|
||||||
import org.assertj.swing.fixture.JPanelFixture;
|
import org.assertj.swing.fixture.JPanelFixture;
|
||||||
|
import org.assertj.swing.fixture.JScrollPaneFixture;
|
||||||
|
import org.assertj.swing.fixture.JTextComponentFixture;
|
||||||
import org.assertj.swing.fixture.JTreeFixture;
|
import org.assertj.swing.fixture.JTreeFixture;
|
||||||
|
|
||||||
import org.jdesktop.swingx.JXTitledPanel;
|
import org.jdesktop.swingx.JXTitledPanel;
|
||||||
|
|
||||||
import trick.dre.DreApplication;
|
import trick.dre.DreApplication;
|
||||||
import trick.common.ui.components.FontChooser;
|
import trick.common.ui.components.FontChooser;
|
||||||
|
import trick.sie.utils.SearchPanel;
|
||||||
|
|
||||||
|
import static org.assertj.swing.timing.Timeout.timeout;
|
||||||
|
|
||||||
public class DreFixture extends FrameFixture {
|
public class DreFixture extends FrameFixture {
|
||||||
private JPanelFixture varTreePanel,
|
private JPanelFixture varTreePanel,
|
||||||
varSelectedPanel,
|
varSelectedPanel,
|
||||||
varSearchPanel;
|
varSearchPanel;
|
||||||
|
|
||||||
|
private JTextComponentFixture nameField,
|
||||||
|
cycleField,
|
||||||
|
fileSizeField,
|
||||||
|
searchBar;
|
||||||
|
|
||||||
|
private JCheckBoxFixture sizeLimitCheckBox,
|
||||||
|
caseSCheckBox,
|
||||||
|
regexCheckBox;
|
||||||
|
|
||||||
|
private JScrollPaneFixture searchResults;
|
||||||
|
private JComboBoxFixture sizeUnitComboBox;
|
||||||
private JTreeFixture varTree;
|
private JTreeFixture varTree;
|
||||||
|
|
||||||
public DreFixture(Robot robot, DreApplication target) {
|
public DreFixture(Robot robot, DreApplication target) {
|
||||||
@ -31,8 +54,27 @@ public class DreFixture extends FrameFixture {
|
|||||||
|
|
||||||
varTreePanel = panel(new JXTitledPanelMatcher("Variables"));
|
varTreePanel = panel(new JXTitledPanelMatcher("Variables"));
|
||||||
varSelectedPanel = panel(new JXTitledPanelMatcher("Selected Variables"));
|
varSelectedPanel = panel(new JXTitledPanelMatcher("Selected Variables"));
|
||||||
|
varSearchPanel = panel(
|
||||||
|
new GenericTypeMatcher<SearchPanel>(SearchPanel.class) {
|
||||||
|
@Override
|
||||||
|
protected boolean isMatching(SearchPanel panel) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
nameField = textBox("groupNameField");
|
||||||
|
cycleField = textBox("cycleField");
|
||||||
|
fileSizeField = textBox("fileSizeField");
|
||||||
|
|
||||||
|
sizeLimitCheckBox = checkBox("sizeLimitToggle");
|
||||||
|
sizeUnitComboBox = comboBox("unitsComboBox");
|
||||||
|
|
||||||
varTree = varTreePanel.tree();
|
varTree = varTreePanel.tree();
|
||||||
|
|
||||||
|
searchBar = varSearchPanel.textBox();
|
||||||
|
searchResults = varSearchPanel.scrollPane();
|
||||||
|
caseSCheckBox = varSearchPanel.checkBox("caseSensitiveCheckBox");
|
||||||
|
regexCheckBox = varSearchPanel.checkBox("regularExpressionCheckBox");
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------
|
//---------------------------
|
||||||
@ -44,41 +86,79 @@ public class DreFixture extends FrameFixture {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setOptions(int opts) {
|
public void setOptions(int opts) {
|
||||||
switch (opts & 0b1110000000) {
|
switch (opts & 0b11100000000) {
|
||||||
case BINARY: selectFormat(0); break;
|
case BINARY: selectOption("Binary"); break;
|
||||||
case ASCII: selectFormat(1); break;
|
case ASCII: selectOption("Ascii"); break;
|
||||||
case HDF5: selectFormat(2); break;
|
case HDF5: selectOption("HDF5"); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (opts & 0b0001110000) {
|
switch (opts & 0b00011100000) {
|
||||||
case ALWAYS: selectFrequency(0); break;
|
case ALWAYS: selectOption("Always"); break;
|
||||||
case CHANGES: selectFrequency(1); break;
|
case CHANGES: selectOption("Changes"); break;
|
||||||
case STEP: selectFrequency(2); break;
|
case STEP: selectOption("StepChanges"); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (opts & 0b0000001110) {
|
switch (opts & 0b00000011100) {
|
||||||
case BUFFER: selectBuffer(0); break;
|
case BUFFER: selectOption("Buffer"); break;
|
||||||
case NO_BUFFER: selectBuffer(1); break;
|
case NO_BUFFER: selectOption("NoBuffer"); break;
|
||||||
case RING_BUFFER: selectBuffer(2); break;
|
case RING_BUFFER: selectOption("RingBuffer"); break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (opts & 0b00000000011) {
|
||||||
|
case SINGLE_PREC_ON: setSinglePrec(true); break;
|
||||||
|
case SINGLE_PREC_OFF: setSinglePrec(false); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectFormat(int index) {
|
public void saveMenuItem(String path) {
|
||||||
String menuItemName = "DR" + FORMATS[index];
|
menuItem("saveDRMenuItem").click();
|
||||||
|
|
||||||
|
JFileChooserFixture fc = fileChooser(timeout(1500));
|
||||||
|
JTextComponentFixture fileEntryTextBox = fc.fileNameTextBox();
|
||||||
|
|
||||||
|
fileEntryTextBox.deleteText()
|
||||||
|
.enterText(path);
|
||||||
|
fc.approve();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void openMenuItem(String path) {
|
||||||
|
menuItem("openDRMenuItem").click();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupName(String name) {
|
||||||
|
nameField.deleteText()
|
||||||
|
.enterText(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCycle(String cycle) {
|
||||||
|
cycleField.deleteText()
|
||||||
|
.enterText(cycle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JOptionPaneFixture getErrorPopup() {
|
||||||
|
JOptionPaneFixture opt = optionPane(timeout(1500));
|
||||||
|
if(opt.target().getMessageType() == JOptionPane.ERROR_MESSAGE)
|
||||||
|
return opt;
|
||||||
|
else return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void selectOption(String term) {
|
||||||
|
String menuItemName = "selectDR" + term + "MenuItem";
|
||||||
menuItem(menuItemName).click();
|
menuItem(menuItemName).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectFrequency(int index) {
|
private void setSinglePrec(boolean state) {
|
||||||
String menuItemName = "DR_" + FREQUENCIES[index];
|
String singlePrecName = "toggleSinglePrecisionCheckBoxMenuItem";
|
||||||
menuItem(menuItemName).click();
|
JMenuItemFixture singlePrecCB = menuItem(singlePrecName);
|
||||||
}
|
JCheckBoxMenuItem singlePrecTarget = (JCheckBoxMenuItem) singlePrecCB.target();
|
||||||
|
if(state ^ singlePrecTarget.getState()){
|
||||||
private void selectBuffer(int index) {
|
singlePrecCB.click();
|
||||||
String menuItemName = "DR_" + BUFFERS[index];
|
}
|
||||||
menuItem(menuItemName).click();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------
|
//---------------------------
|
||||||
@ -105,18 +185,15 @@ public class DreFixture extends FrameFixture {
|
|||||||
//----------------------------
|
//----------------------------
|
||||||
// 0x000 000 000 0
|
// 0x000 000 000 0
|
||||||
|
|
||||||
public final static int BINARY = 0b1000000000,
|
public final static int BINARY = 0b10000000000,
|
||||||
ASCII = 0b0100000000,
|
ASCII = 0b01000000000,
|
||||||
HDF5 = 0b0010000000,
|
HDF5 = 0b00100000000,
|
||||||
ALWAYS = 0b0001000000,
|
ALWAYS = 0b00010000000,
|
||||||
CHANGES = 0b0000100000,
|
CHANGES = 0b00001000000,
|
||||||
STEP = 0b0000010000,
|
STEP = 0b00000100000,
|
||||||
BUFFER = 0b0000001000,
|
BUFFER = 0b00000010000,
|
||||||
NO_BUFFER = 0b0000000100,
|
NO_BUFFER = 0b00000001000,
|
||||||
RING_BUFFER = 0b0000000010,
|
RING_BUFFER = 0b00000000100,
|
||||||
SINGLE_PREC = 0b0000000001;
|
SINGLE_PREC_ON = 0b00000000010,
|
||||||
|
SINGLE_PREC_OFF = 0b00000000001;
|
||||||
private final String[] FORMATS = {"Binary", "Ascii", "HJDF5"},
|
|
||||||
BUFFERS = {"Buffer", "No_Buffer", "Ring_Buffer", "Thread_Buffer"},
|
|
||||||
FREQUENCIES = {"Always", "Changes", "Step_Changes"};
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user