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

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

see #15182 - deprecate Main.map and Main.isDisplayingMapView(). Replacements: gui.MainApplication.getMap() / gui.MainApplication.isDisplayingMapView()

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