use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testGetMultipleChoiceSize.
@Test
public void testGetMultipleChoiceSize() {
UserPreferencesManager m = new JmriUserPreferencesManager();
m.setSaveAllowed(false);
HashMap<Integer, String> options = new HashMap<>();
options.put(1, "test1");
Assert.assertEquals(0, m.getMultipleChoiceSize(strClass));
m.setMessageItemDetails(strClass, "item1", "description1", options, 0);
Assert.assertEquals(1, m.getMultipleChoiceSize(strClass));
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testSetWindowLocation.
@Test
public void testSetWindowLocation() {
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 testGetSimplePreferenceStateList.
@Test
public void testGetSimplePreferenceStateList() {
UserPreferencesManager m = new JmriUserPreferencesManager();
m.setSaveAllowed(false);
// defaults to empty
Assert.assertEquals(0, m.getSimplePreferenceStateList().size());
m.setSimplePreferenceState("test1", true);
// setting a preference to true adds it
Assert.assertEquals(1, m.getSimplePreferenceStateList().size());
m.setSimplePreferenceState("test1", false);
// setting a preference to false removes it
Assert.assertEquals(0, m.getSimplePreferenceStateList().size());
m.setSimplePreferenceState("test1", true);
m.setSimplePreferenceState("test2", true);
// setting a preference to true adds it
Assert.assertEquals(2, m.getSimplePreferenceStateList().size());
m.setSimplePreferenceState("test2", true);
// setting a preference to true twice adds it once
Assert.assertEquals(2, m.getSimplePreferenceStateList().size());
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testDisallowSave.
@Test
public void testDisallowSave() {
UserPreferencesManager m = new JmriUserPreferencesManager();
Assert.assertTrue(m.isSaveAllowed());
m.disallowSave();
Assert.assertFalse(m.isSaveAllowed());
m.setSaveAllowed(true);
Assert.assertTrue(m.isSaveAllowed());
}
use of jmri.UserPreferencesManager in project JMRI by JMRI.
the class JmriUserPreferencesManagerTest method testGetSaveWindowLocation.
@Test
public void testGetSaveWindowLocation() {
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));
}
Aggregations