Search in sources :

Example 1 with DisplacementImpl

use of org.geotools.styling.DisplacementImpl in project sldeditor by robward-scisys.

the class DetailsUtilitiesTest method testIsSameDisplacementDisplacement.

/**
 * Test method for {@link com.sldeditor.ui.detail.DetailsUtilities#isSame(org.geotools.styling.Displacement, org.geotools.styling.Displacement)}.
 */
@Test
public void testIsSameDisplacementDisplacement() {
    assertFalse(DetailsUtilities.isSame((Displacement) null, (Displacement) null));
    FilterFactory ff = CommonFactoryFinder.getFilterFactory();
    // Try values that are the same
    Displacement displacement1 = new DisplacementImpl();
    displacement1.setDisplacementX(ff.literal(42));
    displacement1.setDisplacementY(ff.literal(-2));
    Displacement displacement2 = new DisplacementImpl();
    displacement2.setDisplacementX(ff.literal("42"));
    displacement2.setDisplacementY(ff.literal(-2));
    assertTrue(DetailsUtilities.isSame(displacement1, displacement2));
    // Try values that are not the same
    Displacement displacement3 = new DisplacementImpl();
    displacement3.setDisplacementX(ff.literal(1));
    displacement3.setDisplacementY(ff.literal(-2));
    assertFalse(DetailsUtilities.isSame(displacement1, displacement3));
    assertFalse(DetailsUtilities.isSame(displacement2, displacement3));
    Displacement displacement4 = new DisplacementImpl();
    displacement4.setDisplacementX(ff.literal((Long) 1L));
    displacement4.setDisplacementY(ff.literal(-2));
    assertFalse(DetailsUtilities.isSame(displacement1, displacement4));
    assertFalse(DetailsUtilities.isSame(displacement2, displacement4));
}
Also used : DisplacementImpl(org.geotools.styling.DisplacementImpl) Displacement(org.geotools.styling.Displacement) FilterFactory(org.opengis.filter.FilterFactory) Test(org.junit.Test)

Aggregations

Displacement (org.geotools.styling.Displacement)1 DisplacementImpl (org.geotools.styling.DisplacementImpl)1 Test (org.junit.Test)1 FilterFactory (org.opengis.filter.FilterFactory)1