source: josm/trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ExtrudeActionTest.java@ 12636

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

see #15182 - deprecate Main.getLayerManager(). Replacement: gui.MainApplication.getLayerManager()

  • Property svn:eol-style set to native
File size: 1.8 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.ExtrudeAction.Mode;
11import org.openstreetmap.josm.data.osm.DataSet;
12import org.openstreetmap.josm.gui.MainApplication;
13import org.openstreetmap.josm.gui.MapFrame;
14import org.openstreetmap.josm.gui.layer.OsmDataLayer;
15import org.openstreetmap.josm.testutils.JOSMTestRules;
16
17import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
18
19/**
20 * Unit tests for class {@link ExtrudeAction}.
21 */
22public class ExtrudeActionTest {
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().main().projection();
30
31 /**
32 * Unit test of {@link ExtrudeAction#enterMode} and {@link ExtrudeAction#exitMode}.
33 */
34 @Test
35 public void testMode() {
36 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
37 try {
38 MainApplication.getLayerManager().addLayer(layer);
39 ExtrudeAction mapMode = new ExtrudeAction();
40 MapFrame map = MainApplication.getMap();
41 MapMode oldMapMode = map.mapMode;
42 assertTrue(map.selectMapMode(mapMode));
43 assertEquals(mapMode, map.mapMode);
44 assertTrue(map.selectMapMode(oldMapMode));
45 } finally {
46 MainApplication.getLayerManager().removeLayer(layer);
47 }
48 }
49
50 /**
51 * Unit test of {@link Mode} enum.
52 */
53 @Test
54 public void testEnumMode() {
55 TestUtils.superficialEnumCodeCoverage(Mode.class);
56 }
57}
Note: See TracBrowser for help on using the repository browser.