use of org.geotools.styling.UserLayer 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 org.geotools.styling.UserLayer in project sldeditor by robward-scisys.
the class InLineFeatureModelTest method testSetValueAtObjectIntInt.
/**
* Test method for {@link com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel#setValueAt(java.lang.Object, int, int)}.
*/
@Test
public void testSetValueAtObjectIntInt() {
DummyInlineFeatureUpdated listener = new DummyInlineFeatureUpdated();
InLineFeatureModel model = new InLineFeatureModel(listener);
DummyInlineSLDFile testData1 = new DummyInlineSLDFile();
UserLayer userLayer = (UserLayer) testData1.getSLD().layers().get(0);
model.populate(userLayer);
assertEquals(1, model.getRowCount());
assertFalse(listener.hasInlineFeatureUpdatedCalled());
assertFalse(listener.hasInlineFeatureUpdatedCalled());
model.setValueAt(null, -1, 0);
model.setValueAt(null, 5, 0);
model.setValueAt(null, 0, -1);
model.setValueAt(null, 0, 5);
assertFalse(listener.hasInlineFeatureUpdatedCalled());
String expectedValue = "test value";
model.setValueAt(expectedValue, 0, 1);
String actualValue = (String) model.getValueAt(0, 1);
assertTrue(actualValue.compareTo(expectedValue) == 0);
assertTrue(listener.hasInlineFeatureUpdatedCalled());
}
use of org.geotools.styling.UserLayer in project sldeditor by robward-scisys.
the class InLineFeatureModelTest method testGetFeatureCollection.
/**
* Test method for {@link com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel#getFeatureCollection()}.
* Test method for {@link com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel#getInlineFeatures()}.
*/
@Test
public void testGetFeatureCollection() {
DummyInlineFeatureUpdated listener = new DummyInlineFeatureUpdated();
InLineFeatureModel model = new InLineFeatureModel(listener);
assertNull(model.getFeatureCollection());
DummyInlineSLDFile testData1 = new DummyInlineSLDFile();
UserLayer userLayer = (UserLayer) testData1.getSLD().layers().get(0);
model.populate(userLayer);
assertNotNull(model.getFeatureCollection());
assertNotNull(model.getInlineFeatures());
}
use of org.geotools.styling.UserLayer in project sldeditor by robward-scisys.
the class InLineFeatureModelTest method testGetValueAt.
/**
* Test method for {@link com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel#getValueAt(int, int)}.
* Test method for {@link com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel#populate(org.geotools.styling.UserLayer)}.
*/
@Test
public void testGetValueAt() {
DummyInlineFeatureUpdated listener = new DummyInlineFeatureUpdated();
InLineFeatureModel model = new InLineFeatureModel(listener);
DummyInlineSLDFile testData1 = new DummyInlineSLDFile();
UserLayer userLayer = (UserLayer) testData1.getSLD().layers().get(0);
model.populate(userLayer);
assertEquals(1, model.getRowCount());
assertFalse(listener.hasInlineFeatureUpdatedCalled());
assertNull(model.getValueAt(-1, 0));
assertNull(model.getValueAt(5, 0));
assertNull(model.getValueAt(0, -1));
assertNull(model.getValueAt(0, 5));
String actualValue = (String) model.getValueAt(0, 1);
assertTrue(actualValue.compareTo("Pacific NW") == 0);
}
use of org.geotools.styling.UserLayer in project sldeditor by robward-scisys.
the class InLineFeatureModelTest method testGetRowCount.
/**
* Test method for {@link com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel#getRowCount()}.
*/
@Test
public void testGetRowCount() {
InLineFeatureModel model = new InLineFeatureModel(null);
assertEquals(0, model.getRowCount());
DummyInlineSLDFile testData1 = new DummyInlineSLDFile();
UserLayer userLayer = (UserLayer) testData1.getSLD().layers().get(0);
model.populate(userLayer);
assertEquals(2, model.getColumnCount());
}
Aggregations