use of jmri.jmrix.rps.Reading in project JMRI by JMRI.
the class SerialAdapterTest method testStringParsing3.
@Test
public void testStringParsing3() throws java.io.IOException {
// String input = "DATA,TIME,4105,3751,1423,2835";
String input = "4105,3751,1423,2835";
new Engine() {
{
_instance = this;
setDefaultAlignment();
}
@Override
protected void setInitialAlignment() {
setDefaultAlignment();
}
};
SerialAdapter s = new SerialAdapter();
Reading r = s.makeReading(input);
Assert.assertEquals("n sample OK", 4, r.getNValues());
Assert.assertTrue("val 1", 0.001 > Math.abs(r.getValue(1) - 4105.));
Assert.assertTrue("val 2", 0.001 > Math.abs(r.getValue(2) - 3751.));
Assert.assertTrue("val 3", 0.001 > Math.abs(r.getValue(3) - 1423.));
Assert.assertTrue("val 4", 0.001 > Math.abs(r.getValue(4) - 2835.));
}
use of jmri.jmrix.rps.Reading in project JMRI by JMRI.
the class RpsTrackingFrameTest method testShow.
@Test
public void testShow() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
new Engine() {
void reset() {
_instance = null;
}
}.reset();
Engine.instance().setMaxReceiverNumber(2);
Engine.instance().setReceiver(1, new Receiver(new Point3d(12., 12., 0.)));
Engine.instance().setReceiver(2, new Receiver(new Point3d(12., 12., 0.)));
RpsTrackingFrame f = new RpsTrackingFrame("Test RPS Tracking");
f.initComponents();
f.setVisible(true);
// use local access
RpsTrackingPanel p = f.panel;
Reading loco = new Reading("21", null);
Measurement m = new Measurement(loco, 0.0, 0.0, 0.0, 0.133, 5, "source");
p.notify(m);
loco = new Reading("21", null);
m = new Measurement(loco, 5., 5., 0.0, 0.133, 5, "source");
p.notify(m);
loco = new Reading("21", null);
m = new Measurement(loco, 0., 5., 0.0, 0.133, 5, "source");
p.notify(m);
loco = new Reading("21", null);
m = new Measurement(loco, 5., 0., 0.0, 0.133, 5, "source");
p.notify(m);
Assert.assertNotNull("found frame", f);
f.dispose();
}
Aggregations