use of com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature in project sldeditor by robward-scisys.
the class FieldConfigInlineFeatureTest method testGenerateExpression.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature#generateExpression()}.
* Test method for
* {@link com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature#populateExpression(java.lang.Object)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature#populateField(java.lang.String)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature#setTestValue(com.sldeditor.ui.detail.config.FieldId, java.lang.String)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature#getStringValue()}.
*/
@Test
public void testGenerateExpression() {
FieldConfigInlineFeature field = new FieldConfigInlineFeature(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, null, true));
String testValue = null;
field.populate(null);
field.setTestValue(FieldIdEnum.UNKNOWN, testValue);
field.populateField(testValue);
field.createUI();
UserLayer userLayer1 = DefaultSymbols.createNewUserLayer();
field.populateField(userLayer1);
String actualValue = field.getStringValue();
assertTrue(actualValue.compareTo("") == 0);
DummyInlineSLDFile testData1 = new DummyInlineSLDFile();
UserLayer userLayer2 = (UserLayer) testData1.getSLD().layers().get(0);
Controller.getInstance().setPopulating(true);
field.populateField(userLayer2);
String expectedValue2 = InlineFeatureUtils.getInlineFeaturesText(userLayer2);
actualValue = field.getStringValue();
assertTrue(actualValue.compareTo(expectedValue2) == 0);
field.setTestValue(FieldIdEnum.UNKNOWN, expectedValue2);
actualValue = field.getStringValue();
// The fids are different
assertTrue(expectedValue2.compareTo(actualValue) != 0);
field.populateExpression((String) null);
field.populateExpression((Integer) null);
String expectedValue3 = "test inline value3";
field.populateExpression(expectedValue3);
Controller.getInstance().setPopulating(false);
}
use of com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature in project sldeditor by robward-scisys.
the class FieldConfigInlineFeatureTest method testRevertToDefaultValue.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature#revertToDefaultValue()}.
* Test method for
* {@link com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature#setDefaultValue(java.lang.String)}.
*/
@Test
public void testRevertToDefaultValue() {
FieldConfigInlineFeature field = new FieldConfigInlineFeature(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, null, true));
field.revertToDefaultValue();
assertNull(field.getStringValue());
field.createUI();
field.revertToDefaultValue();
assertNotNull(field.getStringValue());
assertTrue(field.getStringValue().isEmpty());
String expectedValue = "test inline data";
field.setDefaultValue(expectedValue);
field.revertToDefaultValue();
assertNotNull(field.getStringValue());
}
use of com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature in project sldeditor by robward-scisys.
the class FieldConfigInlineFeatureTest method testAttributeSelection.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature#attributeSelection(java.lang.String)}.
*/
@Test
public void testAttributeSelection() {
FieldConfigInlineFeature field = new FieldConfigInlineFeature(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, null, true));
field.attributeSelection(null);
// Does nothing
}
Aggregations