Search in sources :

Example 16 with FieldConfigWKT

use of com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.FieldConfigWKT in project sldeditor by robward-scisys.

the class FieldConfigWKTTest method testGenerateExpression.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.FieldConfigWKT#generateExpression()}.
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.FieldConfigWKT#populateExpression(java.lang.Object, org.opengis.filter.expression.Expression)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.FieldConfigWKT#setTestValue(com.sldeditor.ui.detail.config.FieldId, java.lang.String)}.
 */
@Test
public void testGenerateExpression() {
    boolean valueOnly = true;
    FieldConfigWKT field = new FieldConfigWKT(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    field.populateExpression((Double) null);
    field.populateField((String) null);
    assertNull(field.getStringValue());
    // Create ui
    field.createUI();
    field.populateExpression((Double) null);
    String expectedValue = "string value";
    field.populateExpression(expectedValue);
    assertTrue(expectedValue.compareTo(field.getStringValue()) == 0);
    expectedValue = "wkt://POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))";
    field.setTestValue(null, expectedValue);
    field.populateExpression(expectedValue);
    assertTrue(expectedValue.compareTo(field.getStringValue()) == 0);
}
Also used : FieldConfigWKT(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.FieldConfigWKT) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) Test(org.junit.Test)

Aggregations

FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)16 FieldConfigWKT (com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.FieldConfigWKT)16 Test (org.junit.Test)16 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)3 Mark (org.geotools.styling.Mark)3 StyleBuilder (org.geotools.styling.StyleBuilder)3 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)2 ColourFieldConfig (com.sldeditor.ui.detail.ColourFieldConfig)2 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)2 PointFillDetails (com.sldeditor.ui.detail.PointFillDetails)2 FieldConfigColour (com.sldeditor.ui.detail.config.FieldConfigColour)2 FieldConfigSlider (com.sldeditor.ui.detail.config.FieldConfigSlider)2 FieldConfigSymbolType (com.sldeditor.ui.detail.config.FieldConfigSymbolType)2 ExternalGraphicImpl (org.geotools.styling.ExternalGraphicImpl)2 File (java.io.File)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 Expression (org.opengis.filter.expression.Expression)1 GraphicalSymbol (org.opengis.style.GraphicalSymbol)1