use of com.sldeditor.ui.detail.NamedLayerDetails in project sldeditor by robward-scisys.
the class NamedLayerDetailsTest method testNamedLayerDetails.
/**
* Test method for {@link com.sldeditor.ui.detail.NamedLayerDetails#NamedLayerDetails(com.sldeditor.filter.v2.function.FunctionNameInterface)}.
* Test method for {@link com.sldeditor.ui.detail.NamedLayerDetails#populate(com.sldeditor.common.data.SelectedSymbol)}.
* Test method for {@link com.sldeditor.ui.detail.NamedLayerDetails#dataChanged(com.sldeditor.ui.detail.config.FieldId)}.
* Test method for {@link com.sldeditor.ui.detail.NamedLayerDetails#getFieldDataManager()}.
* Test method for {@link com.sldeditor.ui.detail.NamedLayerDetails#isDataPresent()}.
* Test method for {@link com.sldeditor.ui.detail.NamedLayerDetails#preLoadSymbol()}.
*/
@Test
public void testNamedLayerDetails() {
NamedLayerDetails panel = new NamedLayerDetails();
panel.populate(null);
// Set up test data
StyledLayerDescriptor sld = DefaultSymbols.createNewSLD();
SelectedSymbol.getInstance().createNewSLD(sld);
NamedLayer namedLayer = DefaultSymbols.createNewNamedLayer();
String expectedNameValue = "named layer test value";
namedLayer.setName(expectedNameValue);
namedLayer.addStyle(DefaultSymbols.createNewStyle());
sld.layers().add(namedLayer);
SelectedSymbol.getInstance().addNewStyledLayer(namedLayer);
SelectedSymbol.getInstance().setStyledLayer(namedLayer);
panel.populate(SelectedSymbol.getInstance());
panel.dataChanged(null);
GraphicPanelFieldManager fieldDataManager = panel.getFieldDataManager();
assertNotNull(fieldDataManager);
FieldConfigString nameField = (FieldConfigString) fieldDataManager.get(FieldIdEnum.NAME);
assertTrue(expectedNameValue.compareTo(nameField.getStringValue()) == 0);
assertTrue(panel.isDataPresent());
// Reset to default value
panel.preLoadSymbol();
assertTrue("".compareTo(nameField.getStringValue()) == 0);
}
Aggregations