Search in sources :

Example 1 with ProgModeSelector

use of jmri.jmrit.progsupport.ProgModeSelector in project JMRI by JMRI.

the class CombinedLocoSelListPaneTest method testSelectedDecoderType.

public void testSelectedDecoderType() {
    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);
    combinedlocosellistpane.mDecoderList.setSelectedIndex(4);
    Assert.assertEquals("after update", true, combinedlocosellistpane.isDecoderSelected());
    String stringRet = combinedlocosellistpane.selectedDecoderType();
    Assert.assertEquals("selected item", "NMRA standard register definitions (NMRA standard register definitions)", stringRet);
}
Also used : Programmer(jmri.Programmer) ProgModeSelector(jmri.jmrit.progsupport.ProgModeSelector) JLabel(javax.swing.JLabel)

Example 2 with ProgModeSelector

use of jmri.jmrit.progsupport.ProgModeSelector 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)

Aggregations

JLabel (javax.swing.JLabel)2 Programmer (jmri.Programmer)2 ProgModeSelector (jmri.jmrit.progsupport.ProgModeSelector)2