use of com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF in project sldeditor by robward-scisys.
the class FieldConfigTTFTest method testCreateCopy.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF#createCopy(com.sldeditor.ui.detail.config.FieldConfigBase)}.
*/
@Test
public void testCreateCopy() {
boolean valueOnly = true;
class TestFieldConfigTTF extends FieldConfigTTF {
public TestFieldConfigTTF(FieldConfigCommonData commonData) {
super(commonData, null, null, null);
}
public FieldConfigPopulate callCreateCopy(FieldConfigBase fieldConfigBase) {
return createCopy(fieldConfigBase);
}
}
TestFieldConfigTTF field = new TestFieldConfigTTF(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly));
FieldConfigTTF copy = (FieldConfigTTF) field.callCreateCopy(null);
assertNull(copy);
copy = (FieldConfigTTF) 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.symboltype.ttf.FieldConfigTTF in project sldeditor by robward-scisys.
the class FieldConfigTTFTest method testGetValue.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF#getValue(com.sldeditor.ui.detail.GraphicPanelFieldManager, org.opengis.filter.expression.Expression, boolean, boolean)}.
*/
@Test
public void testGetValue() {
GraphicPanelFieldManager fieldConfigManager = null;
Class<?> panelId = PointFillDetails.class;
fieldConfigManager = new GraphicPanelFieldManager(panelId);
FieldIdEnum colourFieldId = FieldIdEnum.FILL_COLOUR;
FieldConfigColour colourField = new FieldConfigColour(new FieldConfigCommonData(panelId, colourFieldId, "", false));
colourField.createUI();
String expectedColourValue = "#012345";
colourField.setTestValue(null, expectedColourValue);
fieldConfigManager.add(colourFieldId, colourField);
ColourFieldConfig fillConfig = new ColourFieldConfig(GroupIdEnum.FILL, FieldIdEnum.FILL_COLOUR, FieldIdEnum.OVERALL_OPACITY, FieldIdEnum.STROKE_WIDTH);
ColourFieldConfig strokeConfig = new ColourFieldConfig(GroupIdEnum.STROKE, FieldIdEnum.STROKE_STROKE_COLOUR, FieldIdEnum.OVERALL_OPACITY, FieldIdEnum.STROKE_FILL_WIDTH);
boolean valueOnly = true;
FieldConfigTTF field = new FieldConfigTTF(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), fillConfig, strokeConfig, null);
List<GraphicalSymbol> actualValue = field.getValue(null, null, false, false);
assertTrue(actualValue.isEmpty());
field.createUI();
actualValue = field.getValue(null, null, false, false);
assertTrue(actualValue.isEmpty());
actualValue = field.getValue(fieldConfigManager, null, false, false);
assertTrue(actualValue.size() == 1);
}
use of com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF in project sldeditor by robward-scisys.
the class FieldConfigTTFTest method testGetFill.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF#getFill(org.opengis.style.GraphicFill, com.sldeditor.ui.detail.GraphicPanelFieldManager)}.
*/
@Test
public void testGetFill() {
boolean valueOnly = true;
FieldConfigTTF field = new FieldConfigTTF(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
assertNull(field.getFill(null, null));
}
use of com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF in project sldeditor by robward-scisys.
the class FieldConfigTTFTest method testGetVendorOption.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF#getVendorOption()}.
*/
@Test
public void testGetVendorOption() {
boolean valueOnly = true;
FieldConfigTTF field = new FieldConfigTTF(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
assertEquals(VendorOptionManager.getInstance().getDefaultVendorOptionVersion(), field.getVendorOption());
}
use of com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF in project sldeditor by robward-scisys.
the class FieldConfigTTFTest method testGenerateExpression.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF#generateExpression()}.
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF#populateExpression(java.lang.Object, org.opengis.filter.expression.Expression)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF#populateField(java.lang.String)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF#setTestValue(com.sldeditor.ui.detail.config.FieldId, java.lang.String)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF#getStringValue()}.
*/
@Test
public void testGenerateExpression() {
boolean valueOnly = true;
FieldConfigTTF field = new FieldConfigTTF(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);
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();
}
Aggregations