Ignore:
Timestamp:
2019-04-07T07:14:21+02:00 (6 years ago)
Author:
gerdp
Message:

fix #17568: newline missing in exported *.poly file when only a single ring is written
Further changes

  • use PrinterWriter
  • add Unit test for export of simple polygon
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified applications/editors/josm/plugins/poly/test/unit/poly/PolyExporterTest.java ΒΆ

    r34860 r34966  
    3232     */
    3333    @Test
     34    public void testSimpleExport() throws Exception {
     35        DataSet dsIn1 = new PolyImporter().parseDataSet(TestUtils.getTestDataRoot() + "/simple.poly");
     36        assertNotNull(dsIn1);
     37        assertEquals(4, dsIn1.getNodes().size());
     38        assertEquals(1, dsIn1.getWays().size());
     39        assertEquals(0, dsIn1.getRelations().size());
     40
     41        Path out = Files.createTempFile("simple-out", "poly");
     42        new PolyExporter().exportData(out.toFile(), new OsmDataLayer(dsIn1, null, null));
     43        DataSet dsIn2 = new PolyImporter().parseDataSet(out.toString());
     44        assertNotNull(dsIn2);
     45        assertEquals(4, dsIn2.getNodes().size());
     46        assertEquals(1, dsIn2.getWays().size());
     47        assertEquals(0, dsIn2.getRelations().size());
     48       
     49        Files.delete(out);
     50    }
     51
     52    /**
     53     * Import file, export it, import the exported file and compare content
     54     * @throws Exception if an error occurs
     55     */
     56    @Test
    3457    public void testExport() throws Exception {
    3558        DataSet dsIn1 = new PolyImporter().parseDataSet(TestUtils.getTestDataRoot() + "/holes.poly");
Note: See TracChangeset for help on using the changeset viewer.