Search in sources :

Example 36 with ProgDebugger

use of jmri.progdebugger.ProgDebugger in project JMRI by JMRI.

the class AddressedHighCvProgrammerFacadeTest method testCvLimit.

public void testCvLimit() {
    ProgDebugger dp = new ProgDebugger();
    dp.setTestReadLimit(256);
    dp.setTestWriteLimit(256);
    Programmer p = new AddressedHighCvProgrammerFacade(dp, "256", "253", "254", "255", "100");
    Assert.assertTrue("CV limit read OK", p.getCanRead("1024"));
    Assert.assertTrue("CV limit write OK", p.getCanWrite("1024"));
    Assert.assertTrue("CV limit read fail", !p.getCanRead("1025"));
    Assert.assertTrue("CV limit write fail", !p.getCanWrite("1025"));
}
Also used : Programmer(jmri.Programmer) ProgDebugger(jmri.progdebugger.ProgDebugger)

Example 37 with ProgDebugger

use of jmri.progdebugger.ProgDebugger in project JMRI by JMRI.

the class AddressedHighCvProgrammerFacadeTest method testWriteReadIndexed.

public void testWriteReadIndexed() throws jmri.ProgrammerException, InterruptedException {
    ProgDebugger dp = new ProgDebugger();
    dp.setTestReadLimit(256);
    dp.setTestWriteLimit(256);
    Programmer p = new AddressedHighCvProgrammerFacade(dp, "256", "253", "254", "255", "100");
    ProgListener l = new ProgListener() {

        @Override
        public void programmingOpReply(int value, int status) {
            log.debug("callback value=" + value + " status=" + status);
            replied = true;
            readValue = value;
        }
    };
    p.writeCV("258", 12, l);
    waitReply();
    Assert.assertTrue("target not written", !dp.hasBeenWritten(258));
    Assert.assertEquals("index H written", 2, dp.getCvVal(253));
    Assert.assertEquals("index L written", 58, dp.getCvVal(254));
    Assert.assertEquals("value written", 12, dp.getCvVal(255));
    p.readCV("258", l);
    waitReply();
    Assert.assertEquals("read back", 12, readValue);
}
Also used : Programmer(jmri.Programmer) ProgDebugger(jmri.progdebugger.ProgDebugger) ProgListener(jmri.ProgListener)

Example 38 with ProgDebugger

use of jmri.progdebugger.ProgDebugger in project JMRI by JMRI.

the class OffsetHighCvProgrammerFacadeTest method testWriteReadIndexed.

public void testWriteReadIndexed() throws jmri.ProgrammerException, InterruptedException {
    ProgDebugger dp = new ProgDebugger();
    dp.setTestReadLimit(256);
    dp.setTestWriteLimit(256);
    Programmer p = new OffsetHighCvProgrammerFacade(dp, "256", "7", "10", "100");
    ProgListener l = new ProgListener() {

        @Override
        public void programmingOpReply(int value, int status) {
            log.debug("callback value=" + value + " status=" + status);
            replied = true;
            readValue = value;
        }
    };
    p.writeCV("258", 12, l);
    waitReply();
    Assert.assertTrue("target not written", !dp.hasBeenWritten(258));
    Assert.assertEquals("index written", 20, dp.getCvVal(7));
    Assert.assertEquals("value written", 12, dp.getCvVal(58));
    p.readCV("258", l);
    waitReply();
    Assert.assertEquals("read back", 12, readValue);
}
Also used : Programmer(jmri.Programmer) ProgDebugger(jmri.progdebugger.ProgDebugger) ProgListener(jmri.ProgListener)

Example 39 with ProgDebugger

use of jmri.progdebugger.ProgDebugger in project JMRI by JMRI.

the class ResettingOffsetHighCvProgrammerFacadeTest method testCvLimit.

public void testCvLimit() {
    ProgDebugger dp = new ProgDebugger();
    dp.setTestReadLimit(256);
    dp.setTestWriteLimit(256);
    Programmer p = new ResettingOffsetHighCvProgrammerFacade(dp, "256", "7", "10", "100", "200");
    Assert.assertTrue("CV limit read OK", p.getCanRead("1024"));
    Assert.assertTrue("CV limit write OK", p.getCanWrite("1024"));
    Assert.assertTrue("CV limit read fail", !p.getCanRead("1025"));
    Assert.assertTrue("CV limit write fail", !p.getCanWrite("1025"));
}
Also used : Programmer(jmri.Programmer) ProgDebugger(jmri.progdebugger.ProgDebugger)

Example 40 with ProgDebugger

use of jmri.progdebugger.ProgDebugger in project JMRI by JMRI.

the class FnMapPanelTest method testLargeNumbers.

public void testLargeNumbers() {
    ProgDebugger p = new ProgDebugger();
    VariableTableModel tableModel = new VariableTableModel(new JLabel(""), new String[] { "Name", "Value" }, new CvTableModel(new JLabel(""), p), new IndexedCvTableModel(new JLabel(""), p));
    List<Integer> varsUsed = null;
    Element model = new Element("model");
    model.setAttribute("numFns", "28");
    new FnMapPanel(tableModel, varsUsed, model);
}
Also used : ProgDebugger(jmri.progdebugger.ProgDebugger) Element(org.jdom2.Element) JLabel(javax.swing.JLabel)

Aggregations

ProgDebugger (jmri.progdebugger.ProgDebugger)40 Programmer (jmri.Programmer)33 ProgListener (jmri.ProgListener)27 JLabel (javax.swing.JLabel)4 Element (org.jdom2.Element)4 DocType (org.jdom2.DocType)2 Document (org.jdom2.Document)2 DefaultProgrammerManager (jmri.managers.DefaultProgrammerManager)1 Before (org.junit.Before)1