use of com.sldeditor.ui.detail.config.font.FieldConfigFont in project sldeditor by robward-scisys.
the class FieldConfigFontTest method testSetVisible.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.font.FieldConfigFont#setVisible(boolean)}.
*/
@Test
public void testSetVisible() {
boolean valueOnly = true;
FieldConfigFont field = new FieldConfigFont(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly));
boolean expectedValue = true;
field.setVisible(expectedValue);
field.createUI();
expectedValue = false;
field.setVisible(expectedValue);
}
use of com.sldeditor.ui.detail.config.font.FieldConfigFont in project sldeditor by robward-scisys.
the class FieldConfigFontTest method testUndoAction.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.font.FieldConfigFont#undoAction(com.sldeditor.common.undo.UndoInterface)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.font.FieldConfigFont#redoAction(com.sldeditor.common.undo.UndoInterface)}.
*/
@Test
public void testUndoAction() {
boolean valueOnly = true;
FieldConfigFont field = new FieldConfigFont(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly));
String expectedDefaultValue1 = fontFamilies[0];
field.createUI();
field.populateField(expectedDefaultValue1);
String actualValue1 = field.getStringValue();
assertTrue(expectedDefaultValue1.compareTo(actualValue1) == 0);
String expectedDefaultValue2 = fontFamilies[0];
field.populateField(expectedDefaultValue2);
String actualValue2 = field.getStringValue();
assertTrue(expectedDefaultValue2.compareTo(actualValue2) == 0);
UndoManager.getInstance().undo();
String actualValue = field.getStringValue();
assertTrue(expectedDefaultValue1.compareTo(actualValue) == 0);
UndoManager.getInstance().redo();
actualValue = field.getStringValue();
assertTrue(expectedDefaultValue2.compareTo(actualValue) == 0);
// Increase the code coverage
field.undoAction(null);
field.undoAction(new UndoEvent(null, FieldIdEnum.NAME, Double.valueOf(1.0), Double.valueOf(2.0)));
field.redoAction(null);
field.redoAction(new UndoEvent(null, FieldIdEnum.NAME, Double.valueOf(1.0), Double.valueOf(2.0)));
}
use of com.sldeditor.ui.detail.config.font.FieldConfigFont in project sldeditor by robward-scisys.
the class FieldConfigFontTest method testAttributeSelection.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.font.FieldConfigFont#attributeSelection(java.lang.String)}.
*/
@Test
public void testAttributeSelection() {
boolean valueOnly = true;
FieldConfigFont field = new FieldConfigFont(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly));
field.attributeSelection("field");
// Does nothing
}
use of com.sldeditor.ui.detail.config.font.FieldConfigFont in project sldeditor by robward-scisys.
the class FieldConfigFontTest method testGenerateExpression.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.font.FieldConfigFont#generateExpression()}. Test method
* for
* {@link com.sldeditor.ui.detail.config.font.FieldConfigFont#populateField(org.geotools.styling.Font)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.font.FieldConfigFont#setTestValue(com.sldeditor.ui.detail.config.FieldId, java.lang.String)}.
* Test method for {@link com.sldeditor.ui.detail.config.font.FieldConfigFont#getFont()}. Test
* method for
* {@link com.sldeditor.ui.detail.config.font.FieldConfigFont#populateExpression(java.lang.Object, org.opengis.filter.expression.Expression)}.
* Test method for {@link com.sldeditor.ui.detail.config.font.FieldConfigFont#getStringValue()}.
*/
@Test
public void testGenerateExpression() {
boolean valueOnly = true;
FieldConfigFont field = new FieldConfigFont(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly));
field.setTestValue(FieldIdEnum.UNKNOWN, (String) null);
field.populateField((String) null);
field.populateField((Font) null);
field.populateExpression((Font) null);
String expectedValue = fontFamilies[0];
field.createUI();
field.populateField(expectedValue);
String actualValue = field.getStringValue();
assertTrue(expectedValue.compareTo(actualValue) == 0);
field.setTestValue(FieldIdEnum.UNKNOWN, expectedValue);
actualValue = field.getStringValue();
assertTrue(expectedValue.compareTo(actualValue) == 0);
StyleBuilder styleBuilder = new StyleBuilder();
Font f1 = styleBuilder.createFont(expectedValue, false, true, 24.0);
field.populateField(f1);
actualValue = field.getStringValue();
assertTrue(expectedValue.compareTo(actualValue) == 0);
}
Aggregations