use of jmri.Turnout in project JMRI by JMRI.
the class MatrixSignalMastTest method testCtor1.
@Test
// it11 etc. are indirectly used as NamedBeans IT11 etc.
@SuppressWarnings("unused")
public void testCtor1() {
// provide 3 turnouts:
Turnout it11 = InstanceManager.turnoutManagerInstance().provideTurnout("11");
Turnout it12 = InstanceManager.turnoutManagerInstance().provideTurnout("12");
Turnout it13 = InstanceManager.turnoutManagerInstance().provideTurnout("13");
MatrixSignalMast m = new MatrixSignalMast("IF$xsm:basic:one-low($0001)-3t", "user");
m.setBitNum(3);
m.setOutput("output1", "IT11");
m.setOutput("output2", "IT12");
m.setOutput("output3", "IT13");
Assert.assertEquals("system name", "IF$xsm:basic:one-low($0001)-3t", m.getSystemName());
Assert.assertEquals("user name", "user", m.getUserName());
//System.out.println(it11.getFullyFormattedDisplayName()); //debug
Assert.assertEquals("output2", "IT12", m.outputsToBeans.get("output2").getName());
}
use of jmri.Turnout in project JMRI by JMRI.
the class TripleOutputSignalHeadTest method testCTor.
@Test
public void testCTor() {
Turnout it = (InstanceManager.getDefault(TurnoutManager.class)).provideTurnout("IT1");
NamedBeanHandle<Turnout> green = new NamedBeanHandle<>("green handle", it);
Turnout it2 = (InstanceManager.getDefault(TurnoutManager.class)).provideTurnout("IT3");
NamedBeanHandle<Turnout> red = new NamedBeanHandle<>("red handle", it2);
Turnout it3 = (InstanceManager.getDefault(TurnoutManager.class)).provideTurnout("IT2");
NamedBeanHandle<Turnout> yellow = new NamedBeanHandle<>("yellow handle", it3);
TripleOutputSignalHead t = new TripleOutputSignalHead("Test Head", green, red, yellow);
Assert.assertNotNull("exists", t);
}
use of jmri.Turnout in project JMRI by JMRI.
the class TripleTurnoutSignalHeadTest method testCTor.
@Test
public void testCTor() {
Turnout it = (InstanceManager.getDefault(TurnoutManager.class)).provideTurnout("IT1");
NamedBeanHandle<Turnout> green = new NamedBeanHandle<>("green handle", it);
Turnout it2 = (InstanceManager.getDefault(TurnoutManager.class)).provideTurnout("IT3");
NamedBeanHandle<Turnout> red = new NamedBeanHandle<>("red handle", it2);
Turnout it3 = (InstanceManager.getDefault(TurnoutManager.class)).provideTurnout("IT2");
NamedBeanHandle<Turnout> yellow = new NamedBeanHandle<>("yellow handle", it3);
TripleTurnoutSignalHead t = new TripleTurnoutSignalHead("Test Head", green, red, yellow);
Assert.assertNotNull("exists", t);
}
use of jmri.Turnout in project JMRI by JMRI.
the class SingleTurnoutSignalHeadTest method testDarkValidTypes1.
public void testDarkValidTypes1() {
Turnout t = InstanceManager.turnoutManagerInstance().provideTurnout("IT1");
SingleTurnoutSignalHead h = new SingleTurnoutSignalHead("IH1", new jmri.NamedBeanHandle<Turnout>("IT1", t), SignalHead.DARK, SignalHead.RED);
int[] states = h.getValidStates();
Assert.assertEquals(3, states.length);
Assert.assertEquals(SignalHead.DARK, states[0]);
Assert.assertEquals(SignalHead.RED, states[1]);
Assert.assertEquals(SignalHead.FLASHRED, states[2]);
String[] names = h.getValidStateNames();
Assert.assertEquals(3, names.length);
Assert.assertEquals("Dark", names[0]);
Assert.assertEquals("Red", names[1]);
Assert.assertEquals("Flashing Red", names[2]);
h.setAppearance(SignalHead.DARK);
Assert.assertEquals(SignalHead.DARK, h.getAppearance());
Assert.assertEquals("Dark", h.getAppearanceName());
h.setAppearance(SignalHead.FLASHRED);
Assert.assertEquals(SignalHead.FLASHRED, h.getAppearance());
Assert.assertEquals("Flashing Red", h.getAppearanceName());
// stops flash timer
h.setAppearance(SignalHead.RED);
Assert.assertEquals(SignalHead.RED, h.getAppearance());
Assert.assertEquals("Red", h.getAppearanceName());
}
use of jmri.Turnout in project JMRI by JMRI.
the class SingleTurnoutSignalHeadTest method testNoDarkValidTypes.
public void testNoDarkValidTypes() {
Turnout t = InstanceManager.turnoutManagerInstance().provideTurnout("IT1");
SingleTurnoutSignalHead h = new SingleTurnoutSignalHead("IH1", new jmri.NamedBeanHandle<Turnout>("IT1", t), SignalHead.GREEN, SignalHead.RED);
int[] states = h.getValidStates();
Assert.assertEquals(2, states.length);
Assert.assertEquals(SignalHead.GREEN, states[0]);
Assert.assertEquals(SignalHead.RED, states[1]);
String[] names = h.getValidStateNames();
Assert.assertEquals(2, names.length);
Assert.assertEquals("Green", names[0]);
Assert.assertEquals("Red", names[1]);
h.setAppearance(SignalHead.GREEN);
Assert.assertEquals(SignalHead.GREEN, h.getAppearance());
Assert.assertEquals("Green", h.getAppearanceName());
h.setAppearance(SignalHead.RED);
Assert.assertEquals(SignalHead.RED, h.getAppearance());
Assert.assertEquals("Red", h.getAppearanceName());
}
Aggregations