use of com.sldeditor.ui.detail.config.FieldConfigGeometryField in project sldeditor by robward-scisys.
the class FieldConfigGeometryFieldTest method testCreateCopy.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigGeometryField#createCopy(com.sldeditor.ui.detail.config.FieldConfigBase)}.
*/
@Test
public void testCreateCopy() {
class TestFieldConfigGeometryField extends FieldConfigGeometryField {
public TestFieldConfigGeometryField(FieldConfigCommonData commonData) {
super(commonData);
}
public FieldConfigPopulate callCreateCopy(FieldConfigBase fieldConfigBase) {
return createCopy(fieldConfigBase);
}
}
TestFieldConfigGeometryField field = new TestFieldConfigGeometryField(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", true));
FieldConfigGeometryField copy = (FieldConfigGeometryField) field.callCreateCopy(null);
assertNull(copy);
copy = (FieldConfigGeometryField) field.callCreateCopy(field);
assertEquals(field.getFieldId(), copy.getFieldId());
assertTrue(field.getLabel().compareTo(copy.getLabel()) == 0);
assertEquals(field.isValueOnly(), copy.isValueOnly());
}
use of com.sldeditor.ui.detail.config.FieldConfigGeometryField in project sldeditor by robward-scisys.
the class FieldConfigGeometryFieldTest method testRevertToDefaultValue.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigGeometryField#revertToDefaultValue()}. Test
* method for
* {@link com.sldeditor.ui.detail.config.FieldConfigGeometryField#setDefaultValue(java.lang.String)}.
*/
@Test
public void testRevertToDefaultValue() {
FieldConfigGeometryField field = new FieldConfigGeometryField(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", true));
TestDataSource testDataSource = new TestDataSource();
String expectedDefaultValue = testDataSource.getDefaultGeometryField();
field.setDefaultValue(expectedDefaultValue);
field.revertToDefaultValue();
field.createUI();
field.revertToDefaultValue();
assertNull(field.getStringValue());
field.createUI();
@SuppressWarnings("unused") DataSourceInterface dataSource = DataSourceFactory.createDataSource(testDataSource);
field.createUI();
field.dataSourceLoaded(GeometryTypeEnum.POLYGON, false);
field.revertToDefaultValue();
assertTrue(expectedDefaultValue.compareTo(field.getStringValue()) == 0);
}
Aggregations