1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.actions.mapmode;
|
---|
3 |
|
---|
4 | import static org.junit.Assert.assertEquals;
|
---|
5 | import static org.junit.Assert.assertTrue;
|
---|
6 |
|
---|
7 | import org.junit.BeforeClass;
|
---|
8 | import org.junit.Test;
|
---|
9 | import org.openstreetmap.josm.JOSMFixture;
|
---|
10 | import org.openstreetmap.josm.Main;
|
---|
11 | import org.openstreetmap.josm.data.osm.DataSet;
|
---|
12 | import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Unit tests for class {@link ImproveWayAccuracyAction}.
|
---|
16 | */
|
---|
17 | public class ImproveWayAccuracyActionTest {
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * Setup test.
|
---|
21 | */
|
---|
22 | @BeforeClass
|
---|
23 | public static void setUp() {
|
---|
24 | JOSMFixture.createUnitTestFixture().init(true);
|
---|
25 | }
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * Unit test of {@link ImproveWayAccuracyAction#enterMode} and {@link ImproveWayAccuracyAction#exitMode}.
|
---|
29 | */
|
---|
30 | @Test
|
---|
31 | public void testMode() {
|
---|
32 | OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
|
---|
33 | try {
|
---|
34 | Main.getLayerManager().addLayer(layer);
|
---|
35 | ImproveWayAccuracyAction mapMode = new ImproveWayAccuracyAction(Main.map);
|
---|
36 | MapMode oldMapMode = Main.map.mapMode;
|
---|
37 | assertTrue(Main.map.selectMapMode(mapMode));
|
---|
38 | assertEquals(mapMode, Main.map.mapMode);
|
---|
39 | assertTrue(Main.map.selectMapMode(oldMapMode));
|
---|
40 | } finally {
|
---|
41 | Main.getLayerManager().removeLayer(layer);
|
---|
42 | }
|
---|
43 | }
|
---|
44 | }
|
---|