Search in sources :

Example 6 with WKTGeometry

use of com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry in project sldeditor by robward-scisys.

the class WKTGeometryTest method testAddNewSegment.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry#addNewSegment()}. Test
 * method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry#addNewSegment(int)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry#isEmpty()}. Test
 * method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry#getSegmentList(int)}.
 */
@Test
public void testAddNewSegment() {
    WKTGeometry g = new WKTGeometry();
    WKTType wktType = new WKTType("name", false, 5, "", false, true);
    g.setGeometryType(wktType);
    g.addNewSegment();
    assertFalse(g.isEmpty());
    assertEquals(1, g.getNoOfSegments());
    assertEquals(-1, g.addNewSegment(-3));
    assertFalse(g.isEmpty());
    assertEquals(1, g.getNoOfSegments());
    assertEquals(0, g.addNewSegment(3));
    assertFalse(g.isEmpty());
    assertEquals(2, g.getNoOfSegments());
}
Also used : WKTGeometry(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry) WKTType(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTType) Test(org.junit.Test)

Example 7 with WKTGeometry

use of com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry in project sldeditor by robward-scisys.

the class WKTGeometryTest method testGetGeometryType.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry#getGeometryType()}.
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry#setGeometryType(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTType)}.
 */
@Test
public void testGetGeometryType() {
    WKTGeometry g = new WKTGeometry();
    WKTType wktType = new WKTType("name", false, 5, "", false, true);
    g.setGeometryType(wktType);
    assertEquals(wktType, g.getGeometryType());
}
Also used : WKTGeometry(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry) WKTType(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTType) Test(org.junit.Test)

Example 8 with WKTGeometry

use of com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry in project sldeditor by robward-scisys.

the class WKTGeometryTest method testAddNewShape.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry#addNewShape()}. Test
 * method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry#removeShape(int)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry#removeSegment(int, int)}.
 */
@Test
public void testAddNewShape() {
    WKTGeometry g = new WKTGeometry();
    String expectedListItem = "listitem";
    WKTType wktType = new WKTType("name", false, 5, expectedListItem, false, true);
    g.setGeometryType(wktType);
    g.addNewShape();
    int expectedIndex = 0;
    String actualValue = g.getMultiShapeName(expectedIndex);
    assertTrue(actualValue.compareTo(String.format("%s %d", expectedListItem, expectedIndex + 1)) == 0);
    g.addNewShape();
    g.removeShape(-1);
    g.removeShape(2);
    g.removeShape(0);
    assertTrue(g.getNoOfSegments() == 1);
    assertEquals(2, g.addNewShape());
    assertEquals(1, g.addNewSegment(1));
    assertEquals(2, g.addNewSegment(1));
    g.removeSegment(0, -1);
    assertEquals(3, g.addNewSegment(1));
    g.removeSegment(0, 5);
    assertEquals(4, g.addNewSegment(1));
    g.removeSegment(1, 2);
    int actualSize = g.getSegmentList(1).size();
    assertEquals(4, actualSize);
    actualValue = g.getSegmentName(0);
    assertTrue(actualValue.compareTo(String.format("%s %d", expectedListItem, expectedIndex + 1)) == 0);
    wktType = new WKTType("name", false, 5, expectedListItem, true, true);
    g.setGeometryType(wktType);
    actualValue = g.getSegmentName(0);
    assertTrue(actualValue.compareTo(String.format("%s %d", Localisation.getString(WKTDialog.class, "WKTDialog.partShape"), expectedIndex + 1)) == 0);
    assertNull(g.getSegmentList(-4));
    assertNull(g.getSegmentList(43));
}
Also used : WKTGeometry(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry) WKTType(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTType) Test(org.junit.Test)

Aggregations

WKTGeometry (com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry)8 Test (org.junit.Test)8 WKTType (com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTType)5