Changeset 10817 in josm for trunk/test/unit/org


Ignore:
Timestamp:
2016-08-15T21:30:34+02:00 (8 years ago)
Author:
simon04
Message:

see #7307 - Enhance GeoJSON export

  • Save ways as LineString or Polygon depending on the area style.
  • Save multipolygons as MultiPolygon.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/io/GeoJSONWriterTest.java

    r10171 r10817  
    33
    44import static org.junit.Assert.assertEquals;
     5import static org.junit.Assert.assertTrue;
    56
    67import org.junit.BeforeClass;
    78import org.junit.Test;
    89import org.openstreetmap.josm.JOSMFixture;
     10import org.openstreetmap.josm.TestUtils;
    911import org.openstreetmap.josm.data.coor.LatLon;
    1012import org.openstreetmap.josm.data.osm.DataSet;
     
    1214import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1315import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
     16
     17import java.io.FileInputStream;
    1418
    1519/**
     
    6670                "}").replace("'", "\""), writer.write().trim());
    6771    }
     72
     73    /**
     74     * Unit test for multipolygon
     75     */
     76    @Test
     77    public void testMultipolygon() throws Exception {
     78        try (FileInputStream in = new FileInputStream(TestUtils.getTestDataRoot() + "multipolygon.osm")) {
     79            DataSet ds = OsmReader.parseDataSet(in, null);
     80            final OsmDataLayer layer = new OsmDataLayer(ds, "foo", null);
     81            final GeoJSONWriter writer = new GeoJSONWriter(layer, ProjectionPreference.wgs84.getProjection());
     82            assertTrue(writer.write().contains("MultiPolygon"));
     83        }
     84    }
    6885}
Note: See TracChangeset for help on using the changeset viewer.