Search in sources :

Example 11 with Turnout

use of jmri.Turnout in project JMRI by JMRI.

the class SE8cSignalHeadTest method testCtor1.

@Test
public void testCtor1() {
    Turnout it11 = InstanceManager.turnoutManagerInstance().provideTurnout("11");
    Turnout it12 = InstanceManager.turnoutManagerInstance().provideTurnout("12");
    Assert.assertEquals("to low before", Turnout.UNKNOWN, it11.getCommandedState());
    Assert.assertEquals("to high before", Turnout.UNKNOWN, it12.getCommandedState());
    SE8cSignalHead s = new SE8cSignalHead(new NamedBeanHandle<Turnout>("11", it11), new NamedBeanHandle<Turnout>("12", it12));
    Assert.assertEquals("system name", "IH:SE8C:\"11\";\"12\"", s.getSystemName());
    Assert.assertEquals("to low", Turnout.UNKNOWN, it11.getCommandedState());
    // dark
    Assert.assertEquals("to high", Turnout.CLOSED, it12.getCommandedState());
}
Also used : Turnout(jmri.Turnout) Test(org.junit.Test)

Example 12 with Turnout

use of jmri.Turnout in project JMRI by JMRI.

the class SE8cSignalHeadTest method testStateFollowingCtor2.

@Test
public void testStateFollowingCtor2() {
    Turnout it11 = InstanceManager.turnoutManagerInstance().provideTurnout("11");
    Turnout it12 = InstanceManager.turnoutManagerInstance().provideTurnout("12");
    SE8cSignalHead s1 = new SE8cSignalHead(new NamedBeanHandle<Turnout>("11", it11), new NamedBeanHandle<Turnout>("12", it12), "user name");
    // s2 should follow s1
    SE8cSignalHead s2 = new SE8cSignalHead(new NamedBeanHandle<Turnout>("11", it11), new NamedBeanHandle<Turnout>("12", it12), "user name");
    s1.setAppearance(SignalHead.DARK);
    Assert.assertEquals("s2 after DARK", SignalHead.DARK, s2.getAppearance());
    s1.setAppearance(SignalHead.RED);
    Assert.assertEquals("s2 after RED", SignalHead.RED, s2.getAppearance());
    s1.setAppearance(SignalHead.GREEN);
    Assert.assertEquals("s2 after GREEN", SignalHead.GREEN, s2.getAppearance());
    s1.setAppearance(SignalHead.YELLOW);
    Assert.assertEquals("s2 after YELLOW", SignalHead.YELLOW, s2.getAppearance());
    s1.setAppearance(SignalHead.DARK);
    Assert.assertEquals("s2 after DARK", SignalHead.DARK, s2.getAppearance());
}
Also used : Turnout(jmri.Turnout) Test(org.junit.Test)

Example 13 with Turnout

use of jmri.Turnout in project JMRI by JMRI.

the class SE8cSignalHeadTest method testDarkState.

@Test
public void testDarkState() {
    Turnout it11 = InstanceManager.turnoutManagerInstance().provideTurnout("11");
    Turnout it12 = InstanceManager.turnoutManagerInstance().provideTurnout("12");
    SE8cSignalHead s = new SE8cSignalHead(new NamedBeanHandle<Turnout>("11", it11), new NamedBeanHandle<Turnout>("12", it12), "user name");
    s.setAppearance(SignalHead.DARK);
    Assert.assertEquals("to low after", Turnout.UNKNOWN, it11.getCommandedState());
    Assert.assertEquals("to high after", Turnout.CLOSED, it12.getCommandedState());
}
Also used : Turnout(jmri.Turnout) Test(org.junit.Test)

Example 14 with Turnout

use of jmri.Turnout in project JMRI by JMRI.

the class SE8cSignalHeadTest method testGreenState.

@Test
public void testGreenState() {
    Turnout it11 = InstanceManager.turnoutManagerInstance().provideTurnout("11");
    Turnout it12 = InstanceManager.turnoutManagerInstance().provideTurnout("12");
    SE8cSignalHead s = new SE8cSignalHead(new NamedBeanHandle<Turnout>("11", it11), new NamedBeanHandle<Turnout>("12", it12), "user name");
    s.setAppearance(SignalHead.GREEN);
    Assert.assertEquals("to low after", Turnout.CLOSED, it11.getCommandedState());
    Assert.assertEquals("to high after", Turnout.CLOSED, it12.getCommandedState());
}
Also used : Turnout(jmri.Turnout) Test(org.junit.Test)

Example 15 with Turnout

use of jmri.Turnout in project JMRI by JMRI.

the class SE8cSignalHeadTest method testStateFollowingCtor3.

@Test
public void testStateFollowingCtor3() {
    Turnout it11 = InstanceManager.turnoutManagerInstance().provideTurnout("11");
    Turnout it12 = InstanceManager.turnoutManagerInstance().provideTurnout("12");
    SE8cSignalHead s1 = new SE8cSignalHead(new NamedBeanHandle<Turnout>("11", it11), new NamedBeanHandle<Turnout>("12", it12), "user name");
    // s2 should follow s1
    SE8cSignalHead s2 = new SE8cSignalHead(11, "user name");
    s1.setAppearance(SignalHead.DARK);
    Assert.assertEquals("s2 after DARK", SignalHead.DARK, s2.getAppearance());
    s1.setAppearance(SignalHead.RED);
    Assert.assertEquals("s2 after RED", SignalHead.RED, s2.getAppearance());
    s1.setAppearance(SignalHead.GREEN);
    Assert.assertEquals("s2 after GREEN", SignalHead.GREEN, s2.getAppearance());
    s1.setAppearance(SignalHead.YELLOW);
    Assert.assertEquals("s2 after YELLOW", SignalHead.YELLOW, s2.getAppearance());
    s1.setAppearance(SignalHead.DARK);
    Assert.assertEquals("s2 after DARK", SignalHead.DARK, s2.getAppearance());
}
Also used : Turnout(jmri.Turnout) Test(org.junit.Test)

Aggregations

Turnout (jmri.Turnout)221 Test (org.junit.Test)63 Sensor (jmri.Sensor)26 SignalHead (jmri.SignalHead)20 Element (org.jdom2.Element)20 TurnoutManager (jmri.TurnoutManager)17 JmriException (jmri.JmriException)11 Light (jmri.Light)10 SignalMast (jmri.SignalMast)10 ActionEvent (java.awt.event.ActionEvent)9 NamedBeanHandle (jmri.NamedBeanHandle)9 JsonException (jmri.server.json.JsonException)9 ActionListener (java.awt.event.ActionListener)8 Block (jmri.Block)7 JsonNode (com.fasterxml.jackson.databind.JsonNode)6 NamedBean (jmri.NamedBean)6 Route (jmri.Route)6 AbstractTurnout (jmri.implementation.AbstractTurnout)6 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)5