Search in sources :

Example 46 with UserPreferencesManager

use of jmri.UserPreferencesManager in project JMRI by JMRI.

the class JmriUserPreferencesManagerTest method testGetChoiceOptions.

@Test
public void testGetChoiceOptions() {
    UserPreferencesManager m = new JmriUserPreferencesManager();
    m.setSaveAllowed(false);
    HashMap<Integer, String> options = new HashMap<>();
    options.put(1, "test1");
    Assert.assertTrue(m.getChoiceOptions(strClass, "item1").isEmpty());
    m.setMessageItemDetails(strClass, "item1", "description1", options, 0);
    Assert.assertEquals(options, m.getChoiceOptions(strClass, "item1"));
}
Also used : HashMap(java.util.HashMap) UserPreferencesManager(jmri.UserPreferencesManager) Test(org.junit.Test)

Example 47 with UserPreferencesManager

use of jmri.UserPreferencesManager in project JMRI by JMRI.

the class JmriUserPreferencesManagerTest method testSetSessionPreferenceState.

@Test
public void testSetSessionPreferenceState() {
    UserPreferencesManager m = new JmriUserPreferencesManager();
    m.setSaveAllowed(false);
    Assert.assertFalse(m.getSessionPreferenceState("test1"));
    Assert.assertFalse(m.getSessionPreferenceState("test2"));
    m.setSessionPreferenceState("test1", true);
    Assert.assertTrue(m.getSessionPreferenceState("test1"));
    Assert.assertFalse(m.getSessionPreferenceState("test2"));
    m.setSessionPreferenceState("test1", false);
    Assert.assertFalse(m.getSessionPreferenceState("test1"));
    Assert.assertFalse(m.getSessionPreferenceState("test2"));
    m.setSessionPreferenceState("test2", true);
    Assert.assertFalse(m.getSessionPreferenceState("test1"));
    Assert.assertTrue(m.getSessionPreferenceState("test2"));
}
Also used : UserPreferencesManager(jmri.UserPreferencesManager) Test(org.junit.Test)

Aggregations

UserPreferencesManager (jmri.UserPreferencesManager)47 Test (org.junit.Test)43 HashMap (java.util.HashMap)10 Dimension (java.awt.Dimension)7 Point (java.awt.Point)5 AppConfigBase (apps.AppConfigBase)2 File (java.io.File)2 JLabel (javax.swing.JLabel)2 RosterGroupSelector (jmri.jmrit.roster.rostergroup.RosterGroupSelector)2 NullProfile (jmri.profile.NullProfile)2 BoxLayout (javax.swing.BoxLayout)1 JCheckBox (javax.swing.JCheckBox)1 JPanel (javax.swing.JPanel)1 ShutDownManager (jmri.ShutDownManager)1