use of com.sldeditor.ui.detail.config.FieldConfigBoundingBox in project sldeditor by robward-scisys.
the class FieldConfigBoundingBoxTest method testRevertToDefaultValue.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigBoundingBox#revertToDefaultValue()}. Test
* method for {@link com.sldeditor.ui.detail.config.FieldConfigBoundingBox#getStringValue()}.
*/
@Test
public void testRevertToDefaultValue() {
boolean valueOnly = true;
FieldConfigBoundingBox field = new FieldConfigBoundingBox(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", valueOnly));
field.revertToDefaultValue();
assertNotNull(field.getStringValue());
field.createUI();
field.revertToDefaultValue();
String expectedDefaultValue = "default value";
assertTrue(expectedDefaultValue.compareTo(field.getStringValue()) != 0);
}
use of com.sldeditor.ui.detail.config.FieldConfigBoundingBox in project sldeditor by robward-scisys.
the class FieldConfigBoundingBoxTest method testGenerateExpression.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigBoundingBox#generateExpression()}. Test
* method for
* {@link com.sldeditor.ui.detail.config.FieldConfigBoundingBox#populateExpression(java.lang.Object, org.opengis.filter.expression.Expression)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigBoundingBox#populateField(org.geotools.geometry.jts.ReferencedEnvelope)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigBoundingBox#setTestValue(com.sldeditor.ui.detail.config.FieldId, boolean)}.
*/
@Test
public void testGenerateExpression() {
boolean valueOnly = true;
class TestFieldConfigBoundingBox extends FieldConfigBoundingBox {
public TestFieldConfigBoundingBox(FieldConfigCommonData commonData) {
super(commonData);
}
public Expression callGenerateExpression() {
return generateExpression();
}
}
TestFieldConfigBoundingBox field = new TestFieldConfigBoundingBox(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", valueOnly));
Expression actualExpression = field.callGenerateExpression();
assertNotNull(actualExpression);
// Try string values - erroneous
field.createUI();
field.populateExpression("");
CoordinateReferenceSystem crs = CoordManager.getInstance().getWGS84();
ReferencedEnvelope envelope1 = new ReferencedEnvelope(0.0, 1.0, 51.0, 51.1, crs);
field.populateExpression(envelope1);
actualExpression = field.callGenerateExpression();
assertTrue(envelope1.toString().compareTo(actualExpression.toString()) == 0);
ReferencedEnvelope envelope2 = new ReferencedEnvelope(-10.0, -4.0, 31.0, 45.11, crs);
field.setTestValue(null, envelope2);
actualExpression = field.callGenerateExpression();
assertTrue(envelope2.toString().compareTo(actualExpression.toString()) == 0);
}
Aggregations