1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.actions;
|
---|
3 |
|
---|
4 | import java.io.FileInputStream;
|
---|
5 | import java.io.IOException;
|
---|
6 | import java.io.InputStream;
|
---|
7 |
|
---|
8 | import org.junit.BeforeClass;
|
---|
9 | import org.junit.Test;
|
---|
10 | import org.openstreetmap.josm.JOSMFixture;
|
---|
11 | import org.openstreetmap.josm.Main;
|
---|
12 | import org.openstreetmap.josm.TestUtils;
|
---|
13 | import org.openstreetmap.josm.data.osm.DataSet;
|
---|
14 | import org.openstreetmap.josm.gui.MainApplication;
|
---|
15 | import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
---|
16 | import org.openstreetmap.josm.gui.preferences.ToolbarPreferences;
|
---|
17 | import org.openstreetmap.josm.io.IllegalDataException;
|
---|
18 | import org.openstreetmap.josm.io.OsmReader;
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Unit tests of {@link JoinAreasAction} class.
|
---|
22 | */
|
---|
23 | public class JoinAreasActionTest {
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * Setup test.
|
---|
27 | */
|
---|
28 | @BeforeClass
|
---|
29 | public static void setUp() {
|
---|
30 | JOSMFixture.createUnitTestFixture().init();
|
---|
31 | Main.toolbar = new ToolbarPreferences();
|
---|
32 | new MainApplication();
|
---|
33 | Main.main.createMapFrame(null, null);
|
---|
34 | }
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * Non-regression test for bug #10511.
|
---|
38 | * @throws IOException if any I/O error occurs
|
---|
39 | * @throws IllegalDataException if OSM parsing fails
|
---|
40 | */
|
---|
41 | @Test
|
---|
42 | public void testTicket10511() throws IOException, IllegalDataException {
|
---|
43 | try (InputStream is = new FileInputStream(TestUtils.getRegressionDataFile(10511, "10511_mini.osm"))) {
|
---|
44 | DataSet ds = OsmReader.parseDataSet(is, null);
|
---|
45 | Main.map.mapView.addLayer(new OsmDataLayer(ds, null, null));
|
---|
46 | new JoinAreasAction().join(ds.getWays());
|
---|
47 | }
|
---|
48 | }
|
---|
49 | }
|
---|