use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testGetProperty.
@Test
public void testGetProperty() {
UserPreferencesManager m = new JmriUserPreferencesManager();
m.setSaveAllowed(false);
Assert.assertNull(m.getProperty(strClass, "test1"));
m.setProperty(strClass, "test1", log);
Assert.assertEquals(log, m.getProperty(strClass, "test1"));
m.setProperty(strClass, "test1", null);
Assert.assertNull(m.getProperty(strClass, "test1"));
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testSetSaveWindowLocation.
@Test
public void testSetSaveWindowLocation() {
UserPreferencesManager m = new JmriUserPreferencesManager();
m.setSaveAllowed(false);
Assert.assertFalse(m.getSaveWindowLocation(strClass));
m.setSaveWindowLocation(strClass, true);
Assert.assertTrue(m.getSaveWindowLocation(strClass));
m.setSaveWindowLocation(strClass, false);
Assert.assertFalse(m.getSaveWindowLocation(strClass));
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testGetPreferenceItemDescription.
@Test
public void testGetPreferenceItemDescription() {
UserPreferencesManager m = new TestJmriUserPreferencesManager();
m.setSaveAllowed(false);
Assert.assertNull(m.getPreferenceItemDescription(strClass, "test1"));
m.setPreferenceItemDetails(strClass, "test1", "description1");
Assert.assertEquals("description1", m.getPreferenceItemDescription(strClass, "test1"));
m.setPreferenceItemDetails(strClass, "test1", null);
Assert.assertNull(m.getPreferenceItemDescription(strClass, "test1"));
}
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"));
}
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"));
}
Aggregations