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