Files
JIMRI/java/test/jmri/jmrix/lenz/swing/lv102/LV102InternalFrameTest.java
2026-06-17 14:00:51 +02:00

74 lines
2.2 KiB
Java

package jmri.jmrix.lenz.swing.lv102;
import java.awt.GraphicsEnvironment;
import jmri.util.JUnitUtil;
import org.junit.Assert;
import org.junit.jupiter.api.*;
import org.junit.Assume;
/**
* LV102InternalFrameTest.java
*
* Test for the jmri.jmrix.lenz.swing.lv102.LV102InternalFrame class
*
* @author Paul Bender
*/
public class LV102InternalFrameTest {
@Test
public void testCtor() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
LV102InternalFrame f = new LV102InternalFrame();
Assert.assertNotNull(f);
}
@Test
public void testResetButton() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
// skip this test on macos due to a problem with the Jemmy library
// and internal frames.
Assume.assumeFalse(jmri.util.SystemType.isMacOSX());
// we are building an LV102Frame here, which automatically contains
// an LV102 Internal Frame
LV102Frame f = new LV102Frame(Bundle.getMessage("MenuItemLV102ConfigurationManager"));
f.setVisible(true);
LV102FrameScaffold operator = new LV102FrameScaffold();
operator.pushResetButton();
Assert.assertEquals("Default Voltage","",operator.getSelectedVoltage());
f.setVisible(false);
f.dispose();
}
@Test
public void testDefaultButton() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
// skip this test on macos due to a problem with the Jemmy library
// and internal frames.
Assume.assumeFalse(jmri.util.SystemType.isMacOSX());
// we are building an LV102Frame here, which automatically contains
// an LV102 Internal Frame
LV102Frame f = new LV102Frame(Bundle.getMessage("MenuItemLV102ConfigurationManager"));
f.setVisible(true);
LV102FrameScaffold operator = new LV102FrameScaffold();
operator.pushDefaultButton();
Assert.assertEquals("Default Voltage","16V (factory default)",operator.getSelectedVoltage());
f.setVisible(false);
f.dispose();
}
@BeforeEach
public void setUp() {
JUnitUtil.setUp();
JUnitUtil.resetProfileManager();
}
@AfterEach
public void tearDown() {
JUnitUtil.tearDown();
}
}