use of com.sldeditor.ui.detail.config.FieldConfigTimePeriod in project sldeditor by robward-scisys.
the class FieldConfigTimePeriodTest method testSetEnabled.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigTimePeriod#internal_setEnabled(boolean)}.
* Test method for {@link com.sldeditor.ui.detail.config.FieldConfigTimePeriod#isEnabled()}.
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigTimePeriod#createUI(javax.swing.Box)}.
*/
@Test
public void testSetEnabled() {
// Value only, no attribute/expression dropdown
boolean valueOnly = true;
FieldConfigTimePeriod field = new FieldConfigTimePeriod(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, null, valueOnly));
// Text field will not have been created
boolean expectedValue = true;
field.internal_setEnabled(expectedValue);
assertFalse(field.isEnabled());
// Create text field
field.createUI();
assertEquals(expectedValue, field.isEnabled());
expectedValue = false;
field.internal_setEnabled(expectedValue);
assertEquals(expectedValue, field.isEnabled());
// Has attribute/expression dropdown
valueOnly = false;
FieldConfigTimePeriod field2 = new FieldConfigTimePeriod(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, null, valueOnly));
// Text field will not have been created
expectedValue = true;
field2.internal_setEnabled(expectedValue);
assertFalse(field2.isEnabled());
// Create text field
field2.createUI();
assertEquals(expectedValue, field2.isEnabled());
expectedValue = false;
field2.internal_setEnabled(expectedValue);
// Actual value is coming from the attribute panel, not the text field
assertEquals(!expectedValue, field2.isEnabled());
}
use of com.sldeditor.ui.detail.config.FieldConfigTimePeriod in project sldeditor by robward-scisys.
the class FieldConfigTimePeriodTest method testRevertToDefaultValue.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigTimePeriod#revertToDefaultValue()}. Test
* method for {@link com.sldeditor.ui.detail.config.FieldConfigTimePeriod#getStringValue()}.
*/
@Test
public void testRevertToDefaultValue() {
boolean valueOnly = true;
FieldConfigTimePeriod field = new FieldConfigTimePeriod(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, null, valueOnly));
field.revertToDefaultValue();
assertNotNull(field.getStringValue());
field.createUI();
field.revertToDefaultValue();
String expectedDefaultValue = "default value";
assertTrue(expectedDefaultValue.compareTo(field.getStringValue()) != 0);
}
Aggregations