Search in sources :

Example 1 with LocoStatsPanel

use of jmri.jmrix.loconet.locostats.swing.LocoStatsPanel in project JMRI by JMRI.

the class LocoStatsFrameTest method testLocoBufferFormat.

@Test
public void testLocoBufferFormat() throws Exception {
    Assume.assumeFalse(GraphicsEnvironment.isHeadless());
    LocoStatsPanel p = getFrame("LocoBuffer Stats Window", 150);
    p.requestUpdate();
    // initialize with a null traffic controller
    p.stats = new jmri.jmrix.loconet.locostats.LocoStatsFunc(null);
    p.stats.message(new LocoNetMessage(new int[] { LnConstants.OPC_PEER_XFER, 0x10, 0x50, 0x50, 0x01, 0x0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }));
    JFrame f = jmri.util.JmriJFrame.getFrame("LocoBuffer Stats Window");
    Assert.assertTrue("found frame", f != null);
    f.dispose();
}
Also used : JmriJFrame(jmri.util.JmriJFrame) JFrame(javax.swing.JFrame) LocoStatsPanel(jmri.jmrix.loconet.locostats.swing.LocoStatsPanel) LocoNetMessage(jmri.jmrix.loconet.LocoNetMessage) Test(org.junit.Test)

Example 2 with LocoStatsPanel

use of jmri.jmrix.loconet.locostats.swing.LocoStatsPanel in project JMRI by JMRI.

the class LocoStatsFrameTest method testMS100Format.

@Test
public void testMS100Format() throws Exception {
    Assume.assumeFalse(GraphicsEnvironment.isHeadless());
    LocoStatsPanel p = getFrame("MS100 Stats Window", 450);
    p.requestUpdate();
    Assert.assertNotNull("p isn't supposed to be null", p);
    // initialize with a null traffic controller
    p.stats = new jmri.jmrix.loconet.locostats.LocoStatsFunc(null);
    p.stats.message(new LocoNetMessage(new int[] { LnConstants.OPC_PEER_XFER, 0x10, 0x22, 0x22, 0x01, 0x00, 1, 2, 0x20, 4, 0x00, 5, 6, 0, 0, 0 }));
    JFrame f = jmri.util.JmriJFrame.getFrame("MS100 Stats Window");
    Assert.assertTrue("found frame", f != null);
    f.dispose();
}
Also used : JmriJFrame(jmri.util.JmriJFrame) JFrame(javax.swing.JFrame) LocoStatsPanel(jmri.jmrix.loconet.locostats.swing.LocoStatsPanel) LocoNetMessage(jmri.jmrix.loconet.LocoNetMessage) Test(org.junit.Test)

Example 3 with LocoStatsPanel

use of jmri.jmrix.loconet.locostats.swing.LocoStatsPanel in project JMRI by JMRI.

the class LocoStatsPanelTest method testCTor.

@Test
public void testCTor() {
    LocoStatsPanel t = new LocoStatsPanel();
    Assert.assertNotNull("exists", t);
}
Also used : LocoStatsPanel(jmri.jmrix.loconet.locostats.swing.LocoStatsPanel) Test(org.junit.Test)

Example 4 with LocoStatsPanel

use of jmri.jmrix.loconet.locostats.swing.LocoStatsPanel in project JMRI by JMRI.

the class LocoStatsFrameTest method getFrame.

LocoStatsPanel getFrame(String title, int offset) throws Exception {
    JmriJFrame f = new JmriJFrame();
    LocoStatsPanel p = new LocoStatsPanel() {

        @Override
        public void requestUpdate() {
            // replace actual transmit
            updateRequestPending = true;
        }
    };
    p.initComponents();
    f.getContentPane().add(p);
    f.setTitle(title);
    f.setLocation(0, offset);
    f.pack();
    f.setVisible(true);
    return p;
}
Also used : JmriJFrame(jmri.util.JmriJFrame) LocoStatsPanel(jmri.jmrix.loconet.locostats.swing.LocoStatsPanel)

Example 5 with LocoStatsPanel

use of jmri.jmrix.loconet.locostats.swing.LocoStatsPanel in project JMRI by JMRI.

the class LocoStatsFrameTest method testPR2Format.

@Test
public void testPR2Format() throws Exception {
    Assume.assumeFalse(GraphicsEnvironment.isHeadless());
    LocoStatsPanel p = getFrame("PR2 Stats Window", 300);
    p.requestUpdate();
    // initialize with a null traffic controller
    p.stats = new jmri.jmrix.loconet.locostats.LocoStatsFunc(null);
    p.stats.message(new LocoNetMessage(new int[] { LnConstants.OPC_PEER_XFER, 0x10, 0x22, 0x22, 0x01, 0x00, 1, 2, 0, 4, 0x00, 5, 6, 0, 0, 0 }));
    JFrame f = jmri.util.JmriJFrame.getFrame("PR2 Stats Window");
    Assert.assertTrue("found frame", f != null);
    f.dispose();
}
Also used : JmriJFrame(jmri.util.JmriJFrame) JFrame(javax.swing.JFrame) LocoStatsPanel(jmri.jmrix.loconet.locostats.swing.LocoStatsPanel) LocoNetMessage(jmri.jmrix.loconet.LocoNetMessage) Test(org.junit.Test)

Aggregations

LocoStatsPanel (jmri.jmrix.loconet.locostats.swing.LocoStatsPanel)5 JmriJFrame (jmri.util.JmriJFrame)4 Test (org.junit.Test)4 JFrame (javax.swing.JFrame)3 LocoNetMessage (jmri.jmrix.loconet.LocoNetMessage)3