Changeset 8930 in josm


Ignore:
Timestamp:
2015-10-23T00:06:17+02:00 (6 years ago)
Author:
Don-vip
Message:

see #10730 - see #11992 - add regression unit test

Location:
trunk/test
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java

    r7937 r8930  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.actions;
     3
     4import static org.junit.Assert.assertEquals;
    35
    46import java.io.FileInputStream;
     
    1113import org.openstreetmap.josm.Main;
    1214import org.openstreetmap.josm.TestUtils;
     15import org.openstreetmap.josm.actions.search.SearchAction;
    1316import org.openstreetmap.josm.data.osm.DataSet;
    1417import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    4346        }
    4447    }
     48
     49    /**
     50     * Non-regression test for bug #11992.
     51     * @throws IOException if any I/O error occurs
     52     * @throws IllegalDataException if OSM parsing fails
     53     */
     54    @Test
     55    public void testTicket11992() throws IOException, IllegalDataException {
     56        try (InputStream is = new FileInputStream(TestUtils.getRegressionDataFile(11992, "shapes.osm"))) {
     57            DataSet ds = OsmReader.parseDataSet(is, null);
     58            assertEquals(10, ds.getWays().size());
     59            Main.map.mapView.addLayer(new OsmDataLayer(ds, null, null));
     60            for (String ref : new String[]{"A", "B", "C", "D", "E"}) {
     61                System.out.print("Joining ways " + ref);
     62                SearchAction.search("type:way ref="+ref, SearchAction.SearchMode.replace);
     63                assertEquals(2, ds.getSelectedWays().size());
     64                Main.main.menu.joinAreas.join(ds.getSelectedWays());
     65                assertEquals(1, ds.getSelectedWays().size());
     66                System.out.println(" ==> OK");
     67            }
     68        }
     69    }
    4570}
Note: See TracChangeset for help on using the changeset viewer.