Search in sources :

Example 6 with FieldConfigFeatureTypeConstraint

use of com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint in project sldeditor by robward-scisys.

the class FieldConfigFeatureTypeConstraintTest method testUndoAction.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint#undoAction(com.sldeditor.common.undo.UndoInterface)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint#redoAction(com.sldeditor.common.undo.UndoInterface)}.
 */
@Test
public void testUndoAction() {
    FieldConfigFeatureTypeConstraint field = new FieldConfigFeatureTypeConstraint(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
    field.undoAction(null);
    field.redoAction(null);
    field.createUI();
    StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
    FeatureTypeConstraint expectedValue1 = styleFactory.createFeatureTypeConstraint("Feature", Filter.INCLUDE, new Extent[0]);
    List<FeatureTypeConstraint> testValue = new ArrayList<FeatureTypeConstraint>();
    testValue.add(expectedValue1);
    field.populateField(testValue);
    assertEquals(expectedValue1, field.getFeatureTypeConstraint().get(0));
    FeatureTypeConstraint expectedValue2 = styleFactory.createFeatureTypeConstraint("Feature2", Filter.INCLUDE, new Extent[0]);
    List<FeatureTypeConstraint> testValue2 = new ArrayList<FeatureTypeConstraint>();
    testValue2.add(expectedValue1);
    testValue2.add(expectedValue2);
    field.populateField(testValue2);
    UndoManager.getInstance().undo();
    assertEquals(1, field.getFeatureTypeConstraint().size());
    assertEquals(expectedValue1, field.getFeatureTypeConstraint().get(0));
    UndoManager.getInstance().redo();
    assertEquals(2, field.getFeatureTypeConstraint().size());
    assertEquals(expectedValue2, field.getFeatureTypeConstraint().get(1));
    // Increase the code coverage
    field.undoAction(null);
    field.undoAction(new UndoEvent(null, FieldIdEnum.NAME, "", "new"));
    field.redoAction(null);
    field.redoAction(new UndoEvent(null, FieldIdEnum.NAME, "", "new"));
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) UndoEvent(com.sldeditor.common.undo.UndoEvent) FeatureTypeConstraint(org.geotools.styling.FeatureTypeConstraint) FieldConfigFeatureTypeConstraint(com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint) StyleFactoryImpl(org.geotools.styling.StyleFactoryImpl) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) ArrayList(java.util.ArrayList) FieldConfigFeatureTypeConstraint(com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint) Test(org.junit.Test)

Example 7 with FieldConfigFeatureTypeConstraint

use of com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint in project sldeditor by robward-scisys.

the class FieldConfigFeatureTypeConstraintTest method testSetEnabled.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint#internal_setEnabled(boolean)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint#isEnabled()}.
 */
@Test
public void testSetEnabled() {
    FieldConfigFeatureTypeConstraint field = new FieldConfigFeatureTypeConstraint(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
    // Field will not have been created
    boolean expectedValue = true;
    field.internal_setEnabled(expectedValue);
    assertFalse(field.isEnabled());
    // Create text field
    field.createUI();
    field.createUI();
    assertEquals(expectedValue, field.isEnabled());
    expectedValue = false;
    field.internal_setEnabled(expectedValue);
    assertEquals(expectedValue, field.isEnabled());
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigFeatureTypeConstraint(com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint) Test(org.junit.Test)

Example 8 with FieldConfigFeatureTypeConstraint

use of com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint in project sldeditor by robward-scisys.

the class FieldConfigFeatureTypeConstraintTest method testSetVisible.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint#setVisible(boolean)}.
 */
@Test
public void testSetVisible() {
    FieldConfigFeatureTypeConstraint field = new FieldConfigFeatureTypeConstraint(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
    boolean expectedValue = true;
    field.setVisible(expectedValue);
    field.createUI();
    field.setVisible(expectedValue);
    expectedValue = false;
    field.setVisible(expectedValue);
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigFeatureTypeConstraint(com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint) Test(org.junit.Test)

Example 9 with FieldConfigFeatureTypeConstraint

use of com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint in project sldeditor by robward-scisys.

the class FieldConfigFeatureTypeConstraintTest method testFeatureTypeConstraintUpdated.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint#featureTypeConstraintUpdated()}.
 */
@Test
public void testFeatureTypeConstraintUpdated() {
    FieldConfigFeatureTypeConstraint field = new FieldConfigFeatureTypeConstraint(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
    field.featureTypeConstraintUpdated();
// No testing
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigFeatureTypeConstraint(com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint) Test(org.junit.Test)

Example 10 with FieldConfigFeatureTypeConstraint

use of com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint in project sldeditor by robward-scisys.

the class FieldConfigFeatureTypeConstraintTest method testExtentUpdated.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint#extentUpdated()}.
 */
@Test
public void testExtentUpdated() {
    FieldConfigFeatureTypeConstraint field = new FieldConfigFeatureTypeConstraint(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
    field.extentUpdated();
    field.createUI();
    field.extentUpdated();
// No testing
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigFeatureTypeConstraint(com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint) Test(org.junit.Test)

Aggregations

FieldConfigFeatureTypeConstraint (com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint)10 FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)9 Geometry (com.vividsolutions.jts.geom.Geometry)9 Test (org.junit.Test)9 ArrayList (java.util.ArrayList)2 FeatureTypeConstraint (org.geotools.styling.FeatureTypeConstraint)2 StyleFactoryImpl (org.geotools.styling.StyleFactoryImpl)2 UndoEvent (com.sldeditor.common.undo.UndoEvent)1 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)1 XMLFieldConfigBoolean (com.sldeditor.common.xml.ui.XMLFieldConfigBoolean)1 XMLFieldConfigColour (com.sldeditor.common.xml.ui.XMLFieldConfigColour)1 XMLFieldConfigColourMap (com.sldeditor.common.xml.ui.XMLFieldConfigColourMap)1 XMLFieldConfigDSProperties (com.sldeditor.common.xml.ui.XMLFieldConfigDSProperties)1 XMLFieldConfigDouble (com.sldeditor.common.xml.ui.XMLFieldConfigDouble)1 XMLFieldConfigEnum (com.sldeditor.common.xml.ui.XMLFieldConfigEnum)1 FieldList (com.sldeditor.common.xml.ui.XMLFieldConfigEnumValue.FieldList)1 XMLFieldConfigEnumValueList (com.sldeditor.common.xml.ui.XMLFieldConfigEnumValueList)1 XMLFieldConfigFeatureTypeConstraint (com.sldeditor.common.xml.ui.XMLFieldConfigFeatureTypeConstraint)1 XMLFieldConfigFont (com.sldeditor.common.xml.ui.XMLFieldConfigFont)1 XMLFieldConfigFontPreview (com.sldeditor.common.xml.ui.XMLFieldConfigFontPreview)1