use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.
the class FieldConfigColourMapTest method testUndoAction.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#undoAction(com.sldeditor.common.undo.UndoInterface)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#redoAction(com.sldeditor.common.undo.UndoInterface)}.
*/
@Test
public void testUndoAction() {
FieldConfigColourMap field = new FieldConfigColourMap(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
field.undoAction(null);
field.redoAction(null);
field.createUI();
ColorMap expectedValue1 = new ColorMapImpl();
field.populateField(expectedValue1);
assertEquals(expectedValue1, field.getColourMap());
FilterFactory ff = CommonFactoryFinder.getFilterFactory();
ColorMap expectedValue2 = new ColorMapImpl();
ColorMapEntryImpl entry = new ColorMapEntryImpl();
entry.setColor(ff.literal("#001122"));
expectedValue2.addColorMapEntry(entry);
field.populateField(expectedValue2);
UndoManager.getInstance().undo();
assertEquals(expectedValue1.getColorMapEntries().length, field.getColourMap().getColorMapEntries().length);
UndoManager.getInstance().redo();
assertEquals(expectedValue2.getColorMapEntries().length, field.getColourMap().getColorMapEntries().length);
// Increase the code coverage
field.undoAction(null);
field.undoAction(new UndoEvent(null, FieldIdEnum.NAME, "", "new"));
field.redoAction(null);
field.redoAction(new UndoEvent(null, FieldIdEnum.NAME, "", "new"));
}
use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.
the class FieldConfigColourMapTest method testColourMapUpdated.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#colourMapUpdated()}.
*/
@Test
public void testColourMapUpdated() {
FieldConfigColourMap field = new FieldConfigColourMap(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
field.createUI();
field.colourMapUpdated();
}
use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.
the class FieldConfigMarkerTest method testAttributeSelection.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker#attributeSelection(java.lang.String)}.
*/
@Test
public void testAttributeSelection() {
boolean valueOnly = true;
FieldConfigMarker field = new FieldConfigMarker(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
field.attributeSelection("field");
// Does nothing
}
use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.
the class FieldConfigMarkerTest method testGetColourExpression.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker#getColourExpression()}.
*/
@Test
public void testGetColourExpression() {
boolean valueOnly = true;
FieldConfigMarker field = new FieldConfigMarker(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
assertNull(field.getColourExpression());
}
use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.
the class FieldConfigMarkerTest method testPopulateFieldOverrideMap.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker#populateFieldOverrideMap(java.lang.Class, com.sldeditor.ui.detail.FieldEnableState)}.
*/
@Test
public void testPopulateFieldOverrideMap() {
// Test it with non null values
FieldIdEnum colourFieldId = FieldIdEnum.FILL_COLOUR;
Class<?> panelId = PointFillDetails.class;
FieldConfigColour colourField = new FieldConfigColour(new FieldConfigCommonData(panelId, colourFieldId, "", false));
colourField.createUI();
String expectedColourValue = "#012345";
colourField.setTestValue(null, expectedColourValue);
double expectedOpacityValue = 0.72;
FieldConfigSlider opacityField = new FieldConfigSlider(new FieldConfigCommonData(panelId, colourFieldId, "", false));
opacityField.createUI();
opacityField.populateField(expectedOpacityValue);
FieldConfigBase symbolSelectionField = new FieldConfigSymbolType(new FieldConfigCommonData(panelId, colourFieldId, "", false));
symbolSelectionField.createUI();
GraphicPanelFieldManager fieldConfigManager = new GraphicPanelFieldManager(panelId);
fieldConfigManager.add(colourFieldId, colourField);
FieldIdEnum opacityFieldId = FieldIdEnum.OVERALL_OPACITY;
fieldConfigManager.add(opacityFieldId, opacityField);
FieldIdEnum symbolSelectionFieldId = FieldIdEnum.SYMBOL_TYPE;
fieldConfigManager.add(symbolSelectionFieldId, symbolSelectionField);
ColourFieldConfig strokeConfig = new ColourFieldConfig(GroupIdEnum.STROKE, FieldIdEnum.STROKE_STROKE_COLOUR, FieldIdEnum.OVERALL_OPACITY, FieldIdEnum.STROKE_FILL_WIDTH);
boolean valueOnly = true;
ColourFieldConfig fillConfig = new ColourFieldConfig(GroupIdEnum.FILL, FieldIdEnum.FILL_COLOUR, FieldIdEnum.OVERALL_OPACITY, FieldIdEnum.STROKE_WIDTH);
FieldConfigMarker field = new FieldConfigMarker(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), fillConfig, strokeConfig, null);
field.populateFieldOverrideMap(String.class, null);
field.populateFieldOverrideMap(PointSymbolizerDetails.class, null);
}
Aggregations