use of com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel in project sldeditor by robward-scisys.
the class InLineFeatureModelTest method testIsCellEditable.
/**
* Test method for {@link com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel#isCellEditable(int, int)}.
* Test method for {@link com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel#InLineFeatureModel(com.sldeditor.ui.detail.config.inlinefeature.InlineFeatureUpdateInterface)}.
*/
@Test
public void testIsCellEditable() {
InLineFeatureModel model = new InLineFeatureModel(null);
assertTrue(model.isCellEditable(0, 0));
assertTrue(model.isCellEditable(0, 1));
assertTrue(model.isCellEditable(0, -1));
assertEquals(-1, model.getGeometryFieldIndex());
}
use of com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel in project sldeditor by robward-scisys.
the class InLineFeatureModelTest method testUpdateGeometry.
/**
* Test method for {@link com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel#updateGeometry(int, com.vividsolutions.jts.geom.Geometry)}.
*/
@Test
public void testUpdateGeometry() {
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);
assertFalse(listener.hasInlineFeatureUpdatedCalled());
model.updateGeometry(0, null);
assertTrue(listener.hasInlineFeatureUpdatedCalled());
}
use of com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel in project sldeditor by robward-scisys.
the class InLineFeatureModelTest method testUpdateCRS.
/**
* Test method for {@link com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel#updateCRS(com.sldeditor.ui.widgets.ValueComboBoxData)}.
*/
@Test
public void testUpdateCRS() {
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);
model.updateCRS(null);
assertNull(userLayer.getInlineFeatureType().getGeometryDescriptor().getCoordinateReferenceSystem());
ValueComboBoxData expectedCRS = new ValueComboBoxData("EPSG:2000", "Test CRS", VendorOptionManager.getInstance().getDefaultVendorOptionVersion());
assertFalse(listener.hasInlineFeatureUpdatedCalled());
model.updateCRS(expectedCRS);
assertTrue(listener.hasInlineFeatureUpdatedCalled());
String newCRSCode = userLayer.getInlineFeatureType().getGeometryDescriptor().getCoordinateReferenceSystem().getCoordinateSystem().getName().getCode();
assertNotNull(newCRSCode);
}
use of com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel in project sldeditor by robward-scisys.
the class InLineFeatureModelTest method testRemoveColumn.
/**
* Test method for {@link com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel#removeColumn(java.lang.String)}.
* Test method for {@link com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel#getColumnNames()}.
*/
@Test
public void testRemoveColumn() {
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);
// Geometry column not returned, so column name count 1 less than column count
assertEquals(2, model.getColumnCount());
assertEquals(1, model.getColumnNames().size());
model.addNewColumn();
assertTrue(listener.hasInlineFeatureUpdatedCalled());
assertEquals(2, model.getColumnNames().size());
model.removeColumn("unknown column");
assertFalse(listener.hasInlineFeatureUpdatedCalled());
assertEquals(2, model.getColumnNames().size());
// Remove the last column that was just added
model.removeColumn(model.getColumnNames().get(model.getColumnNames().size() - 1));
assertTrue(listener.hasInlineFeatureUpdatedCalled());
assertEquals(1, model.getColumnNames().size());
}
use of com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel in project sldeditor by robward-scisys.
the class InLineFeatureModelTest method testGetColumnCount.
/**
* Test method for {@link com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel#getColumnCount()}.
* Test method for {@link com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel#getColumnName(int)}.
* Test method for {@link com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel#addNewColumn()}.
* Test method for {@link com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel#getGeometryFieldIndex()}.
*/
@Test
public void testGetColumnCount() {
DummyInlineFeatureUpdated listener = new DummyInlineFeatureUpdated();
InLineFeatureModel model = new InLineFeatureModel(listener);
assertEquals(0, model.getColumnCount());
// Currently no feature collection
model.addNewColumn();
assertEquals(0, model.getColumnCount());
DummyInlineSLDFile testData1 = new DummyInlineSLDFile();
UserLayer userLayer = (UserLayer) testData1.getSLD().layers().get(0);
model.populate(userLayer);
assertEquals(2, model.getColumnCount());
assertFalse(listener.hasInlineFeatureUpdatedCalled());
model.addNewColumn();
assertEquals(3, model.getColumnCount());
assertTrue(listener.hasInlineFeatureUpdatedCalled());
assertEquals(0, model.getGeometryFieldIndex());
assertNotNull(model.getColumnName(0));
assertNull(model.getColumnName(-1));
assertNull(model.getColumnName(5));
}
Aggregations