Added getters to dre fixture

This commit is contained in:
Marcus Rockwell 2024-10-10 12:14:21 -04:00
parent 79e68136ba
commit d7f9b8a516
2 changed files with 70 additions and 6 deletions

View File

@ -182,31 +182,37 @@ public class DreApplication extends TrickApplication {
@Action @Action
public void selectDRBinary() { public void selectDRBinary() {
format = "DRBinary"; format = "DRBinary";
DRBinary_item.setSelected(true);
} }
@Action @Action
public void selectDRAscii() { public void selectDRAscii() {
format = "DRAscii"; format = "DRAscii";
DRAscii_item.setSelected(true);
} }
@Action @Action
public void selectDRHDF5() { public void selectDRHDF5() {
format = "DRHDF5"; format = "DRHDF5";
DRHDF5_item.setSelected(true);
} }
@Action @Action
public void selectDRAlways() { public void selectDRAlways() {
frequency = "DR_Always"; frequency = "DR_Always";
DRAlways_item.setSelected(true);
} }
@Action @Action
public void selectDRChanges() { public void selectDRChanges() {
frequency = "DR_Changes"; frequency = "DR_Changes";
DRChanges_item.setSelected(true);
} }
@Action @Action
public void selectDRStepChanges() { public void selectDRStepChanges() {
frequency = "DR_Step_Changes"; frequency = "DR_Step_Changes";
DRStepChanges_item.setSelected(true);
} }
@Action @Action
@ -222,16 +228,19 @@ public class DreApplication extends TrickApplication {
@Action @Action
public void selectDRBuffer() { public void selectDRBuffer() {
buffering = "DR_Buffer"; buffering = "DR_Buffer";
DRBuffer_item.setSelected(true);
} }
@Action @Action
public void selectDRNoBuffer() { public void selectDRNoBuffer() {
buffering = "DR_No_Buffer"; buffering = "DR_No_Buffer";
DRNoBuffer_item.setSelected(true);
} }
@Action @Action
public void selectDRRingBuffer() { public void selectDRRingBuffer() {
buffering = "DR_Ring_Buffer"; buffering = "DR_Ring_Buffer";
DRRingBuffer_item.setSelected(true);
} }
@Action @Action
@ -400,6 +409,7 @@ public class DreApplication extends TrickApplication {
*/ */
private JMenu createOptionsMenu() { private JMenu createOptionsMenu() {
JMenu optionsMenu = new JMenu(); JMenu optionsMenu = new JMenu();
JRadioButtonMenuItem[] rbuttons;
String[] formats = {"selectDRBinary", "selectDRAscii", "selectDRHDF5"}, String[] formats = {"selectDRBinary", "selectDRAscii", "selectDRHDF5"},
frequencies = {"selectDRAlways", "selectDRChanges", "selectDRStepChanges"}, frequencies = {"selectDRAlways", "selectDRChanges", "selectDRStepChanges"},
buffers = {"selectDRBuffer", "selectDRNoBuffer", "selectDRRingBuffer"}; buffers = {"selectDRBuffer", "selectDRNoBuffer", "selectDRRingBuffer"};
@ -407,12 +417,20 @@ public class DreApplication extends TrickApplication {
optionsMenu.setName("optionsMenu"); optionsMenu.setName("optionsMenu");
optionsMenu.add(new JLabel("Format ")); optionsMenu.add(new JLabel("Format "));
addRadioButtonMenuItems(optionsMenu, formats); rbuttons = addRadioButtonMenuItems(optionsMenu, formats);
DRBinary_item = rbuttons[0];
DRAscii_item = rbuttons[1];
DRHDF5_item = rbuttons[2];
optionsMenu.addSeparator(); optionsMenu.addSeparator();
optionsMenu.add(new JLabel("Freq")); optionsMenu.add(new JLabel("Freq"));
addRadioButtonMenuItems(optionsMenu, frequencies); rbuttons = addRadioButtonMenuItems(optionsMenu, frequencies);
DRAlways_item = rbuttons[0];
DRChanges_item = rbuttons[1];
DRStepChanges_item = rbuttons[2];
optionsMenu.addSeparator(); optionsMenu.addSeparator();
@ -423,7 +441,11 @@ public class DreApplication extends TrickApplication {
optionsMenu.addSeparator(); optionsMenu.addSeparator();
optionsMenu.add(new JXLabel("Buffering")); optionsMenu.add(new JXLabel("Buffering"));
addRadioButtonMenuItems(optionsMenu, buffers); rbuttons = addRadioButtonMenuItems(optionsMenu, buffers);
DRBuffer_item = rbuttons[0];
DRNoBuffer_item = rbuttons[1];
DRRingBuffer_item = rbuttons[2];
selectDRBinary(); // by default, DR_Binary selectDRBinary(); // by default, DR_Binary

View File

@ -139,7 +139,7 @@ public class DreFixture extends FrameFixture {
.enterText(cycle); .enterText(cycle);
} }
public JOptionPaneFixture getErrorPopup() { public JOptionPaneFixture getErrorPopupFixture() {
JOptionPaneFixture opt = optionPane(timeout(1500)); JOptionPaneFixture opt = optionPane(timeout(1500));
if(opt.target().getMessageType() == JOptionPane.ERROR_MESSAGE) if(opt.target().getMessageType() == JOptionPane.ERROR_MESSAGE)
return opt; return opt;
@ -147,11 +147,53 @@ public class DreFixture extends FrameFixture {
} }
private void selectOption(String term) { public int getSelectedOptions() {
String menuItemName = "selectDR" + term + "MenuItem"; int opts = 0b11111111111;
if (getOptionState("Binary"))
opts &= BINARY;
else if(getOptionState("Ascii"))
opts &= ASCII;
else if (getOptionState("HDF5"))
opts &= HDF5;
if (getOptionState("Always"))
opts &= ALWAYS;
else if(getOptionState("Changes"))
opts &= CHANGES;
else if (getOptionState("StepChanges"))
opts &= STEP;
if (getOptionState("Buffer"))
opts &= BUFFER;
else if(getOptionState("NoBuffer"))
opts &= NO_BUFFER;
else if (getOptionState("RingBuffer"))
opts &= RING_BUFFER;
if(isSinglePrec())
opts &= SINGLE_PREC_ON;
else
opts &= SINGLE_PREC_OFF;
return opts;
}
private boolean getOptionState(String ID) {
String menuItemName = "selectDR" + ID + "MenuItem";
return menuItem(menuItemName).target().isSelected();
}
private void selectOption(String ID) {
String menuItemName = "selectDR" + ID + "MenuItem";
menuItem(menuItemName).click(); menuItem(menuItemName).click();
} }
private boolean isSinglePrec() {
String singlePrecName = "toggleSinglePrecisionCheckBoxMenuItem";
return menuItem(singlePrecName).target().isSelected();
}
private void setSinglePrec(boolean state) { private void setSinglePrec(boolean state) {
String singlePrecName = "toggleSinglePrecisionCheckBoxMenuItem"; String singlePrecName = "toggleSinglePrecisionCheckBoxMenuItem";
JMenuItemFixture singlePrecCB = menuItem(singlePrecName); JMenuItemFixture singlePrecCB = menuItem(singlePrecName);