source: josm/trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java@ 7534

Last change on this file since 7534 was 7534, checked in by Don-vip, 10 years ago

see #10511 - add unit test

File size: 1.6 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.actions;
3
4import java.io.FileInputStream;
5import java.io.IOException;
6import java.io.InputStream;
7
8import org.junit.BeforeClass;
9import org.junit.Test;
10import org.openstreetmap.josm.JOSMFixture;
11import org.openstreetmap.josm.Main;
12import org.openstreetmap.josm.TestUtils;
13import org.openstreetmap.josm.data.osm.DataSet;
14import org.openstreetmap.josm.gui.MainApplication;
15import org.openstreetmap.josm.gui.layer.OsmDataLayer;
16import org.openstreetmap.josm.gui.preferences.ToolbarPreferences;
17import org.openstreetmap.josm.io.IllegalDataException;
18import org.openstreetmap.josm.io.OsmReader;
19
20/**
21 * Unit tests of {@link JoinAreasAction} class.
22 */
23public 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}
Note: See TracBrowser for help on using the repository browser.