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.Rule;
|
---|
8 | import org.junit.Test;
|
---|
9 | import org.openstreetmap.josm.Main;
|
---|
10 | import org.openstreetmap.josm.TestUtils;
|
---|
11 | import org.openstreetmap.josm.actions.mapmode.ParallelWayAction.Mode;
|
---|
12 | import org.openstreetmap.josm.actions.mapmode.ParallelWayAction.Modifier;
|
---|
13 | import org.openstreetmap.josm.data.osm.DataSet;
|
---|
14 | import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
---|
15 | import org.openstreetmap.josm.testutils.JOSMTestRules;
|
---|
16 |
|
---|
17 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * Unit tests for class {@link ParallelWayAction}.
|
---|
21 | */
|
---|
22 | public class ParallelWayActionTest {
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * Setup test.
|
---|
26 | */
|
---|
27 | @Rule
|
---|
28 | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
---|
29 | public JOSMTestRules test = new JOSMTestRules().platform().platform().mainMenu().projection();
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * Unit test of {@link ParallelWayAction#enterMode} and {@link ParallelWayAction#exitMode}.
|
---|
33 | */
|
---|
34 | @Test
|
---|
35 | public void testMode() {
|
---|
36 | OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
|
---|
37 | try {
|
---|
38 | Main.getLayerManager().addLayer(layer);
|
---|
39 | ParallelWayAction mapMode = new ParallelWayAction(Main.map);
|
---|
40 | MapMode oldMapMode = Main.map.mapMode;
|
---|
41 | assertTrue(Main.map.selectMapMode(mapMode));
|
---|
42 | assertEquals(mapMode, Main.map.mapMode);
|
---|
43 | assertTrue(Main.map.selectMapMode(oldMapMode));
|
---|
44 | } finally {
|
---|
45 | Main.getLayerManager().removeLayer(layer);
|
---|
46 | }
|
---|
47 | }
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * Unit test of {@link Mode} enum.
|
---|
51 | */
|
---|
52 | @Test
|
---|
53 | public void testEnumMode() {
|
---|
54 | TestUtils.superficialEnumCodeCoverage(Mode.class);
|
---|
55 | }
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * Unit test of {@link Modifier} enum.
|
---|
59 | */
|
---|
60 | @Test
|
---|
61 | public void testEnumModifier() {
|
---|
62 | TestUtils.superficialEnumCodeCoverage(Modifier.class);
|
---|
63 | }
|
---|
64 | }
|
---|