143 lines
4.1 KiB
Java
143 lines
4.1 KiB
Java
package jmri.jmrit.beantable;
|
|
|
|
import jmri.Audio;
|
|
import jmri.util.JUnitUtil;
|
|
import jmri.util.ThreadingUtil;
|
|
import jmri.util.junit.annotations.*;
|
|
|
|
import org.junit.jupiter.api.*;
|
|
|
|
import org.netbeans.jemmy.operators.JButtonOperator;
|
|
import org.netbeans.jemmy.operators.JFrameOperator;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
|
|
/**
|
|
*
|
|
* @author Paul Bender Copyright (C) 2017
|
|
*/
|
|
public class AudioTableActionTest extends AbstractTableActionBase<Audio> {
|
|
|
|
@Test
|
|
public void testCTor() {
|
|
assertNotNull( a, "exists");
|
|
}
|
|
|
|
@Override
|
|
public String getTableFrameName(){
|
|
return Bundle.getMessage("TitleAudioTable");
|
|
}
|
|
|
|
@Test
|
|
@Override
|
|
@Disabled("Audio table will only be init if an audio manager is available")
|
|
@ToDo("Complete Test Initialization, then remove overriden test so parent class can execute")
|
|
public void testGetTableDataModel(){
|
|
}
|
|
|
|
/**
|
|
* Check the return value of getPanel. The tested class provides a panel.
|
|
*/
|
|
@Override
|
|
@Test
|
|
public void testGetPanel(){
|
|
assertNotNull( a.getPanel(), "AudioTableAction getPanel returns null");
|
|
}
|
|
|
|
@Override
|
|
@Test
|
|
public void testGetClassDescription(){
|
|
assertEquals( "Audio Table",a.getClassDescription(), "Turnout Table Action class description");
|
|
}
|
|
|
|
/**
|
|
* Check the return value of includeAddButton. The table generated by
|
|
* this action includes an Add Button.
|
|
*/
|
|
@Override
|
|
@Test
|
|
public void testIncludeAddButton(){
|
|
assertTrue( a.includeAddButton(), "Default include add button");
|
|
}
|
|
|
|
@Test
|
|
@Disabled("Audio table does not have Add... button")
|
|
@Override
|
|
public void testAddButton() {
|
|
}
|
|
|
|
@Override
|
|
public String getAddFrameName(){
|
|
return "";
|
|
}
|
|
|
|
@Test
|
|
@Override
|
|
@Disabled("Audio table does not have Add... button")
|
|
public void testAddThroughDialog() {
|
|
}
|
|
|
|
@Test
|
|
@Override
|
|
@Disabled("Audio table does not have Add... button, so test needs re-written")
|
|
@ToDo("Re-write parent class test to use the right name, or add without dialog")
|
|
public void testEditButton() {
|
|
}
|
|
|
|
@Test
|
|
@Override
|
|
@DisabledIfHeadless
|
|
public void testExecute() {
|
|
super.testExecute();
|
|
jmri.AudioManager audioManager = jmri.InstanceManager.getNullableDefault(jmri.AudioManager.class);
|
|
if ( audioManager != null ) {
|
|
audioManager.cleanup();
|
|
}
|
|
}
|
|
|
|
@Test
|
|
@DisabledIfHeadless
|
|
public void testLaunchAddBufferAddSourceButtons() {
|
|
ThreadingUtil.runOnGUI( () -> a.actionPerformed(null));
|
|
JFrameOperator jfo = new JFrameOperator(getTableFrameName());
|
|
assertNotNull( jfo, "failed to find frame");
|
|
|
|
JButtonOperator jbo = new JButtonOperator( jfo, Bundle.getMessage("ButtonAddAudioBuffer"));
|
|
jbo.doClick();
|
|
JFrameOperator jfoBuffer = new JFrameOperator(Bundle.getMessage("TitleAddAudioBuffer"));
|
|
assertNotNull( jfoBuffer, "failed to find Buffer frame");
|
|
JUnitUtil.dispose(jfoBuffer.getWindow());
|
|
|
|
jbo = new JButtonOperator( jfo, Bundle.getMessage("ButtonAddAudioSource"));
|
|
jbo.doClick();
|
|
JFrameOperator jfoSource = new JFrameOperator(Bundle.getMessage("TitleAddAudioSource"));
|
|
assertNotNull( jfoSource, "failed to find Source frame");
|
|
JUnitUtil.dispose(jfoSource.getWindow());
|
|
|
|
JUnitUtil.dispose(jfo.getWindow());
|
|
}
|
|
|
|
@BeforeEach
|
|
@Override
|
|
public void setUp() {
|
|
JUnitUtil.setUp();
|
|
JUnitUtil.resetProfileManager();
|
|
JUnitUtil.initDefaultUserMessagePreferences();
|
|
helpTarget = "package.jmri.jmrit.beantable.AudioTable";
|
|
a = new AudioTableAction();
|
|
}
|
|
|
|
@AfterEach
|
|
@Override
|
|
public void tearDown() {
|
|
JUnitUtil.clearShutDownManager(); // should be converted to check of scheduled ShutDownActions
|
|
JUnitUtil.tearDown();
|
|
a = null;
|
|
}
|
|
|
|
// private static final Logger log = LoggerFactory.getLogger(AudioTableActionTest.class);
|
|
|
|
}
|