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