source: josm/trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ParallelWayActionTest.java@ 14138

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

see #15229 - deprecate Main.platform and related methods - new class PlatformManager

  • Property svn:eol-style set to native
File size: 2.0 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.actions.mapmode;
3
4import static org.junit.Assert.assertEquals;
5import static org.junit.Assert.assertTrue;
6
7import org.junit.Rule;
8import org.junit.Test;
9import org.openstreetmap.josm.TestUtils;
10import org.openstreetmap.josm.actions.mapmode.ParallelWayAction.Mode;
11import org.openstreetmap.josm.actions.mapmode.ParallelWayAction.Modifier;
12import org.openstreetmap.josm.data.osm.DataSet;
13import org.openstreetmap.josm.gui.MainApplication;
14import org.openstreetmap.josm.gui.MapFrame;
15import org.openstreetmap.josm.gui.layer.OsmDataLayer;
16import org.openstreetmap.josm.testutils.JOSMTestRules;
17
18import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
19
20/**
21 * Unit tests for class {@link ParallelWayAction}.
22 */
23public 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().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}
Note: See TracBrowser for help on using the repository browser.