use of com.sldeditor.ui.detail.config.FieldConfigBoolean in project sldeditor by robward-scisys.
the class FieldConfigBooleanTest method testAttributeSelection.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigBoolean#attributeSelection(java.lang.String)}.
*/
@Test
public void testAttributeSelection() {
boolean valueOnly = true;
FieldConfigBoolean field = new FieldConfigBoolean(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", valueOnly));
field.attributeSelection(null);
// Does nothing
}
use of com.sldeditor.ui.detail.config.FieldConfigBoolean in project sldeditor by robward-scisys.
the class FieldConfigBooleanTest method testSetEnabled.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigBoolean#internal_setEnabled(boolean)}. Test
* method for {@link com.sldeditor.ui.detail.config.FieldConfigBoolean#isEnabled()}.
*/
@Test
public void testSetEnabled() {
// Value only, no attribute/expression dropdown
boolean valueOnly = true;
FieldConfigBoolean field = new FieldConfigBoolean(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", 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;
FieldConfigBoolean field2 = new FieldConfigBoolean(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", 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.FieldConfigBoolean in project sldeditor by robward-scisys.
the class FieldConfigBooleanTest method testSetVisible.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigBoolean#setVisible(boolean)}.
*/
@Test
public void testSetVisible() {
boolean valueOnly = true;
FieldConfigBoolean field = new FieldConfigBoolean(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", valueOnly));
boolean expectedValue = true;
field.setVisible(expectedValue);
field.createUI();
field.setVisible(expectedValue);
expectedValue = false;
field.setVisible(expectedValue);
}
use of com.sldeditor.ui.detail.config.FieldConfigBoolean in project sldeditor by robward-scisys.
the class FieldConfigBooleanTest method testRevertToDefaultValue.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigBoolean#revertToDefaultValue()}. Test method
* for {@link com.sldeditor.ui.detail.config.FieldConfigBoolean#setDefaultValue(boolean)}.
*/
@Test
public void testRevertToDefaultValue() {
boolean valueOnly = true;
FieldConfigBoolean field = new FieldConfigBoolean(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", valueOnly));
field.revertToDefaultValue();
assertFalse(field.getBooleanValue());
field.createUI();
field.revertToDefaultValue();
assertFalse(field.getBooleanValue());
boolean expectedDefaultValue = true;
field.setDefaultValue(expectedDefaultValue);
field.revertToDefaultValue();
assertEquals(expectedDefaultValue, field.getBooleanValue());
}
use of com.sldeditor.ui.detail.config.FieldConfigBoolean in project sldeditor by robward-scisys.
the class FieldConfigBooleanTest method testCreateCopy.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigBoolean#createCopy(com.sldeditor.ui.detail.config.FieldConfigBase)}.
*/
@Test
public void testCreateCopy() {
boolean valueOnly = true;
class TestFieldConfigBoolean extends FieldConfigBoolean {
public TestFieldConfigBoolean(FieldConfigCommonData commonData) {
super(commonData);
}
public FieldConfigPopulate callCreateCopy(FieldConfigBase fieldConfigBase) {
return createCopy(fieldConfigBase);
}
}
TestFieldConfigBoolean field = new TestFieldConfigBoolean(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", valueOnly));
FieldConfigBoolean copy = (FieldConfigBoolean) field.callCreateCopy(null);
assertNull(copy);
copy = (FieldConfigBoolean) field.callCreateCopy(field);
assertEquals(field.getFieldId(), copy.getFieldId());
assertTrue(field.getLabel().compareTo(copy.getLabel()) == 0);
assertEquals(field.isValueOnly(), copy.isValueOnly());
}
Aggregations