use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testGetSessionPreferenceState.
@Test
public void testGetSessionPreferenceState() {
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"));
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testHasProperties.
@Test
public void testHasProperties() {
UserPreferencesManager m = new JmriUserPreferencesManager();
m.setSaveAllowed(false);
Assert.assertFalse(m.hasProperties(strClass));
m.setProperty(strClass, "test1", log);
m.setProperty(strClass, "test2", null);
Assert.assertTrue(m.hasProperties(strClass));
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testGetClassDescription_String.
@Test
public void testGetClassDescription_String() {
UserPreferencesManager m = new TestJmriUserPreferencesManager();
m.setSaveAllowed(false);
Assert.assertNotNull(m.getClassDescription(strClass));
Assert.assertTrue(m.getClassDescription(strClass).isEmpty());
m.setPreferenceState(strClass, "test1", true);
Assert.assertNull(m.getClassDescription(strClass));
m.setPreferenceState(AppConfigBase.class.getName(), "test1", true);
String d = ResourceBundle.getBundle("apps.AppsConfigBundle").getString("Application");
Assert.assertEquals(d, m.getClassDescription(AppConfigBase.class.getName()));
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testSetSimplePreferenceState.
@Test
public void testSetSimplePreferenceState() {
UserPreferencesManager m = new JmriUserPreferencesManager();
m.setSaveAllowed(false);
Assert.assertFalse(m.getSimplePreferenceState("one"));
m.setSimplePreferenceState("one", true);
Assert.assertTrue(m.getSimplePreferenceState("one"));
Assert.assertFalse(m.getSimplePreferenceState("two"));
m.setSimplePreferenceState("one", false);
Assert.assertFalse(m.getSimplePreferenceState("one"));
Assert.assertFalse(m.getSimplePreferenceState("two"));
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testSetMessageItemDetails.
@Test
public void testSetMessageItemDetails() {
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"));
}
Aggregations