Search in sources :

Example 6 with InLineFeatureModel

use of com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel 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());
}
Also used : InLineFeatureModel(com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel) DummyInlineSLDFile(com.sldeditor.test.unit.datasource.impl.DummyInlineSLDFile) UserLayer(org.geotools.styling.UserLayer) Test(org.junit.Test)

Example 7 with InLineFeatureModel

use of com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel 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());
}
Also used : InLineFeatureModel(com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel) DummyInlineSLDFile(com.sldeditor.test.unit.datasource.impl.DummyInlineSLDFile) UserLayer(org.geotools.styling.UserLayer) Test(org.junit.Test)

Example 8 with InLineFeatureModel

use of com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel 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);
}
Also used : InLineFeatureModel(com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel) DummyInlineSLDFile(com.sldeditor.test.unit.datasource.impl.DummyInlineSLDFile) UserLayer(org.geotools.styling.UserLayer) Test(org.junit.Test)

Example 9 with InLineFeatureModel

use of com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel 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());
}
Also used : InLineFeatureModel(com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel) DummyInlineSLDFile(com.sldeditor.test.unit.datasource.impl.DummyInlineSLDFile) UserLayer(org.geotools.styling.UserLayer) Test(org.junit.Test)

Aggregations

InLineFeatureModel (com.sldeditor.ui.detail.config.inlinefeature.InLineFeatureModel)9 Test (org.junit.Test)9 DummyInlineSLDFile (com.sldeditor.test.unit.datasource.impl.DummyInlineSLDFile)8 UserLayer (org.geotools.styling.UserLayer)8 ValueComboBoxData (com.sldeditor.ui.widgets.ValueComboBoxData)1