Search in sources :

Example 6 with FieldConfigFilename

use of com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename in project sldeditor by robward-scisys.

the class FieldConfigFilenameTest method testGetBasePanel.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename#getBasePanel()}.
 */
@Test
public void testGetBasePanel() {
    boolean valueOnly = true;
    FieldConfigFilename field = new FieldConfigFilename(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    assertNull(field.getBasePanel());
}
Also used : FieldConfigFilename(com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) Test(org.junit.Test)

Example 7 with FieldConfigFilename

use of com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename in project sldeditor by robward-scisys.

the class FieldConfigFilenameTest method testGetVendorOption.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename#getVendorOption()}.
 */
@Test
public void testGetVendorOption() {
    boolean valueOnly = true;
    FieldConfigFilename field = new FieldConfigFilename(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    assertEquals(VendorOptionManager.getInstance().getDefaultVendorOptionVersion(), field.getVendorOption());
}
Also used : FieldConfigFilename(com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) Test(org.junit.Test)

Example 8 with FieldConfigFilename

use of com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename in project sldeditor by robward-scisys.

the class FieldConfigFilenameTest method testGenerateExpression.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename#generateExpression()}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename#populateExpression(java.lang.Object, org.opengis.filter.expression.Expression)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename#populateField(java.lang.String)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename#setTestValue(com.sldeditor.ui.detail.config.FieldId, java.lang.String)}.
 */
@Test
public void testGenerateExpression() {
    boolean valueOnly = true;
    FieldConfigFilename field = new FieldConfigFilename(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);
    assertEquals(expectedValue, field.getStringValue());
    File f = null;
    try {
        f = File.createTempFile(getClass().getSimpleName(), ".tmp");
    } catch (IOException e) {
        e.printStackTrace();
    }
    try {
        if ((f != null) && (f.toURI() != null)) {
            if (f.toURI().toURL() != null) {
                expectedValue = f.toURI().toURL().toString();
            }
        }
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    field.setTestValue(null, expectedValue);
    field.populateExpression(expectedValue);
    assertTrue(expectedValue.compareTo(field.getStringValue()) == 0);
    f.delete();
}
Also used : MalformedURLException(java.net.MalformedURLException) FieldConfigFilename(com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) IOException(java.io.IOException) File(java.io.File) Test(org.junit.Test)

Example 9 with FieldConfigFilename

use of com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename in project sldeditor by robward-scisys.

the class FieldConfigFilenameTest method testAccept.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename#accept(org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testAccept() {
    boolean valueOnly = true;
    FieldConfigFilename field = new FieldConfigFilename(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    assertFalse(field.accept(null));
    StyleBuilder styleBuilder = new StyleBuilder();
    ExternalGraphicImpl externalGraphic = (ExternalGraphicImpl) styleBuilder.createExternalGraphic("test.tmp", "png");
    assertTrue(field.accept(externalGraphic));
    Mark marker = styleBuilder.createMark("triangle");
    assertFalse(field.accept(marker));
}
Also used : FieldConfigFilename(com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename) ExternalGraphicImpl(org.geotools.styling.ExternalGraphicImpl) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) StyleBuilder(org.geotools.styling.StyleBuilder) Mark(org.geotools.styling.Mark) Test(org.junit.Test)

Example 10 with FieldConfigFilename

use of com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename in project sldeditor by robward-scisys.

the class FieldConfigFilenameTest method testGetSymbolClass.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename#getSymbolClass()}.
 */
@Test
public void testGetSymbolClass() {
    boolean valueOnly = true;
    FieldConfigFilename field = new FieldConfigFilename(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    assertEquals(ExternalGraphicImpl.class, field.getSymbolClass());
}
Also used : FieldConfigFilename(com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) Test(org.junit.Test)

Aggregations

FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)16 FieldConfigFilename (com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename)16 Test (org.junit.Test)16 StyleBuilder (org.geotools.styling.StyleBuilder)3 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)2 PointFillDetails (com.sldeditor.ui.detail.PointFillDetails)2 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)2 File (java.io.File)2 IOException (java.io.IOException)2 MalformedURLException (java.net.MalformedURLException)2 ExternalGraphicImpl (org.geotools.styling.ExternalGraphicImpl)2 Mark (org.geotools.styling.Mark)2 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)1 FieldConfigColour (com.sldeditor.ui.detail.config.FieldConfigColour)1 FieldConfigSlider (com.sldeditor.ui.detail.config.FieldConfigSlider)1 FieldConfigSymbolType (com.sldeditor.ui.detail.config.FieldConfigSymbolType)1 Fill (org.geotools.styling.Fill)1 GraphicFill (org.opengis.style.GraphicFill)1 GraphicalSymbol (org.opengis.style.GraphicalSymbol)1