use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testGetMultipleChoiceOption.
@Test
public void testGetMultipleChoiceOption() {
UserPreferencesManager m = new JmriUserPreferencesManager();
m.setSaveAllowed(false);
HashMap<Integer, String> options = new HashMap<>();
options.put(1, "test1");
Assert.assertEquals(0, m.getMultipleChoiceOption(strClass, "item1"));
m.setMessageItemDetails(strClass, "item1", "description1", options, 0);
Assert.assertEquals(0, m.getMultipleChoiceOption(strClass, "item1"));
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testGetSimplePreferenceState.
@Test
public void testGetSimplePreferenceState() {
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 testGetWindowLocation.
@Test
public void testGetWindowLocation() {
UserPreferencesManager m = new JmriUserPreferencesManager();
m.setSaveAllowed(false);
Point windowLocation = new Point(69, 96);
m.setWindowLocation(strClass, windowLocation);
Point savedWindowLocation = m.getWindowLocation(strClass);
Assert.assertEquals(windowLocation, savedWindowLocation);
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testGetPreferenceState.
@Test
public void testGetPreferenceState() {
UserPreferencesManager m = new TestJmriUserPreferencesManager();
m.setSaveAllowed(false);
Assert.assertFalse(m.getPreferenceState(strClass, "test1"));
m.setPreferenceState(strClass, "test1", true);
Assert.assertTrue(m.getPreferenceState(strClass, "test1"));
Assert.assertFalse(m.getPreferenceState(strClass, "test2"));
m.setPreferenceState(strClass, "test1", false);
Assert.assertFalse(m.getPreferenceState(strClass, "test1"));
Assert.assertFalse(m.getPreferenceState(strClass, "test2"));
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testSetPreferenceItemDetails.
@Test
public void testSetPreferenceItemDetails() {
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"));
}
Aggregations