| 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.ExtrudeAction.Mode;
|
|---|
| 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 ExtrudeAction}.
|
|---|
| 22 | */
|
|---|
| 23 | public class ExtrudeActionTest {
|
|---|
| 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 ExtrudeAction#enterMode} and {@link ExtrudeAction#exitMode}.
|
|---|
| 34 | */
|
|---|
| 35 | @Test
|
|---|
| 36 | public void testMode() {
|
|---|
| 37 | OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
|
|---|
| 38 | try {
|
|---|
| 39 | Main.getLayerManager().addLayer(layer);
|
|---|
| 40 | ExtrudeAction mapMode = new ExtrudeAction();
|
|---|
| 41 | MapFrame map = MainApplication.getMap();
|
|---|
| 42 | MapMode oldMapMode = map.mapMode;
|
|---|
| 43 | assertTrue(map.selectMapMode(mapMode));
|
|---|
| 44 | assertEquals(mapMode, map.mapMode);
|
|---|
| 45 | assertTrue(map.selectMapMode(oldMapMode));
|
|---|
| 46 | } finally {
|
|---|
| 47 | Main.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 | }
|
|---|