Search in sources :

Example 36 with Programmer

use of jmri.Programmer in project JMRI by JMRI.

the class CombinedLocoSelListPaneTest method testIsDecoderSelected.

public void testIsDecoderSelected() {
    ProgModeSelector sel = new ProgModeSelector() {

        Programmer programmer = new jmri.progdebugger.ProgDebugger();

        @Override
        public Programmer getProgrammer() {
            return programmer;
        }

        @Override
        public boolean isSelected() {
            return true;
        }

        @Override
        public void dispose() {
        }
    };
    JLabel val1 = new JLabel();
    // ensure a valid DecoderIndexFile
    jmri.jmrit.decoderdefn.DecoderIndexFile.resetInstance();
    CombinedLocoSelListPane combinedlocosellistpane = new CombinedLocoSelListPane(val1, sel);
    Assert.assertEquals("initial state", false, combinedlocosellistpane.isDecoderSelected());
    combinedlocosellistpane.mDecoderList.setSelectedIndex(1);
    Assert.assertEquals("after update", true, combinedlocosellistpane.isDecoderSelected());
}
Also used : Programmer(jmri.Programmer) ProgModeSelector(jmri.jmrit.progsupport.ProgModeSelector) JLabel(javax.swing.JLabel)

Example 37 with Programmer

use of jmri.Programmer in project JMRI by JMRI.

the class PackageTest method testConfigProgrammer.

// check configuring the programmer
public void testConfigProgrammer() {
    // initialize the system
    Programmer p = new ProgDebugger();
    InstanceManager.setProgrammerManager(new DefaultProgrammerManager(p));
    assertTrue(InstanceManager.getDefault(jmri.ProgrammerManager.class).getGlobalProgrammer() == p);
}
Also used : Programmer(jmri.Programmer) ProgDebugger(jmri.progdebugger.ProgDebugger) DefaultProgrammerManager(jmri.managers.DefaultProgrammerManager) DefaultProgrammerManager(jmri.managers.DefaultProgrammerManager)

Example 38 with Programmer

use of jmri.Programmer in project JMRI by JMRI.

the class DebugProgrammerManagerTest method testServiceModeUnique.

/**
     * Any service mode request gets the same object
     */
public void testServiceModeUnique() {
    InstanceManager.setProgrammerManager(new DebugProgrammerManager());
    Programmer p = InstanceManager.getDefault(jmri.ProgrammerManager.class).getGlobalProgrammer();
    Assert.assertTrue("same service mode programmer", InstanceManager.getDefault(jmri.ProgrammerManager.class).getGlobalProgrammer() == p);
}
Also used : Programmer(jmri.Programmer)

Example 39 with Programmer

use of jmri.Programmer in project JMRI by JMRI.

the class DebugProgrammerTest method testCvLimit.

public void testCvLimit() {
    Programmer p = new jmri.progdebugger.ProgDebugger();
    Assert.assertTrue("CV limit read", p.getCanRead("256"));
    Assert.assertTrue("CV limit write", p.getCanWrite("256"));
    Assert.assertTrue("CV limit read", !p.getCanRead("257"));
    Assert.assertTrue("CV limit write", !p.getCanWrite("257"));
}
Also used : Programmer(jmri.Programmer)

Example 40 with Programmer

use of jmri.Programmer in project JMRI by JMRI.

the class DebugProgrammerTest method testWriteRead.

public void testWriteRead() throws jmri.ProgrammerException, InterruptedException {
    Programmer p = new ProgDebugger();
    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(4, 12, l);
    waitReply();
    log.debug("readValue is " + readValue);
    p.readCV(4, l);
    waitReply();
    log.debug("readValue is " + readValue);
    Assert.assertEquals("read back", 12, readValue);
}
Also used : Programmer(jmri.Programmer) ProgListener(jmri.ProgListener)

Aggregations

Programmer (jmri.Programmer)63 ProgDebugger (jmri.progdebugger.ProgDebugger)33 ProgListener (jmri.ProgListener)27 JFrame (javax.swing.JFrame)4 JPanel (javax.swing.JPanel)3 ProgrammerException (jmri.ProgrammerException)3 IdentifyLoco (jmri.jmrit.roster.IdentifyLoco)3 PaneOpsProgFrame (jmri.jmrit.symbolicprog.tabbedframe.PaneOpsProgFrame)3 BoxLayout (javax.swing.BoxLayout)2 JLabel (javax.swing.JLabel)2 JMenuBar (javax.swing.JMenuBar)2 AddressedProgrammerManager (jmri.AddressedProgrammerManager)2 GlobalProgrammerManager (jmri.GlobalProgrammerManager)2 DecoderFile (jmri.jmrit.decoderdefn.DecoderFile)2 IdentifyDecoder (jmri.jmrit.decoderdefn.IdentifyDecoder)2 ProgModeSelector (jmri.jmrit.progsupport.ProgModeSelector)2 RosterEntry (jmri.jmrit.roster.RosterEntry)2 CvTableModel (jmri.jmrit.symbolicprog.CvTableModel)2 IndexedCvTableModel (jmri.jmrit.symbolicprog.IndexedCvTableModel)2 KnownLocoSelPane (jmri.jmrit.symbolicprog.KnownLocoSelPane)2