use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.
the class FieldConfigWKTTest method testGetFieldList.
/**
* Test method for
* {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.FieldConfigWKT#getFieldList(com.sldeditor.ui.detail.GraphicPanelFieldManager)}.
*/
@Test
public void testGetFieldList() {
boolean valueOnly = true;
FieldConfigWKT field = new FieldConfigWKT(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
assertEquals(1, field.getFieldList(null).size());
}
use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.
the class FieldConfigWKTTest method testRevertToDefaultValue.
/**
* Test method for
* {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.FieldConfigWKT#revertToDefaultValue()}.
*/
@Test
public void testRevertToDefaultValue() {
boolean valueOnly = true;
FieldConfigWKT field = new FieldConfigWKT(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
field.revertToDefaultValue();
field.createUI();
field.revertToDefaultValue();
}
use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.
the class ExtractGeometryFieldTest method testGetGeometryField.
/**
* Test method for {@link com.sldeditor.ui.detail.ExtractGeometryField#getGeometryField(com.sldeditor.ui.detail.config.FieldConfigPopulation)}.
*/
@Test
public void testGetGeometryField() {
assertNull(ExtractGeometryField.getGeometryField(null));
FieldIdEnum fieldId = FieldIdEnum.GEOMETRY;
GraphicPanelFieldManager fieldConfigManager = new GraphicPanelFieldManager(Geometry.class);
FieldConfigGeometry geometryField = new FieldConfigGeometry(new FieldConfigCommonData(Geometry.class, fieldId, "label", true), "button");
geometryField.createUI();
fieldConfigManager.add(fieldId, geometryField);
FieldConfigPopulation obj = new FieldConfigPopulation(fieldConfigManager);
// Try valid geometry field name
geometryField.populateField("ValidTestField");
Expression actualExpression = ExtractGeometryField.getGeometryField(obj);
assertNotNull(actualExpression);
// Try invalid geometry field name
geometryField.populateField("");
actualExpression = ExtractGeometryField.getGeometryField(obj);
assertNull(actualExpression);
// Try invalid geometry field name
geometryField.populateField(" ");
actualExpression = ExtractGeometryField.getGeometryField(obj);
assertNull(actualExpression);
// Try when there is no geometry field
obj = new FieldConfigPopulation(fieldConfigManager);
actualExpression = ExtractGeometryField.getGeometryField(obj);
assertNull(actualExpression);
}
use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.
the class FieldConfigBaseTest method testFireDataChanged.
/**
* Test method for {@link com.sldeditor.ui.detail.config.FieldConfigBase#fireDataChanged()}.
*/
@Test
public void testFireDataChanged() {
boolean valueOnly = true;
FieldIdEnum expectedFieldId = FieldIdEnum.NAME;
String expectedLabel = "test label";
TestFieldConfigBase field = new TestFieldConfigBase(new FieldConfigCommonData(String.class, expectedFieldId, expectedLabel, valueOnly));
TestUpdateSymbolInterface listener = new TestUpdateSymbolInterface();
field.addDataChangedListener(listener);
assertFalse(listener.hasBeenCalled());
Controller.getInstance().setPopulating(true);
field.testFireDataChanged();
assertFalse(listener.hasBeenCalled());
Controller.getInstance().setPopulating(false);
field.testFireDataChanged();
assertTrue(listener.hasBeenCalled());
// Leave the is populating flag as false otherwise a load of tests will fail
}
use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.
the class FieldConfigBaseTest method testExpressionUpdated.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigBase#expressionUpdated(org.opengis.filter.expression.Expression)}.
*/
@Test
public void testExpressionUpdated() {
FieldIdEnum expectedFieldId = FieldIdEnum.NAME;
String expectedLabel = "test label";
TestFieldConfigBase field = new TestFieldConfigBase(new FieldConfigCommonData(String.class, expectedFieldId, expectedLabel, false));
TestUpdateSymbolInterface listener = new TestUpdateSymbolInterface();
field.addDataChangedListener(listener);
String expressionName = "test expression";
assertFalse(listener.hasBeenCalled());
FilterFactory ff = CommonFactoryFinder.getFilterFactory();
Expression testExpression = ff.literal(expressionName);
field.expressionUpdated(testExpression);
assertTrue(listener.hasBeenCalled());
assertEquals(ExpressionTypeEnum.E_EXPRESSION, field.getExpressionType());
Expression expression = field.getExpression();
assertTrue(expressionName.compareTo(expression.toString()) == 0);
}
Aggregations