1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.actions.mapmode;
|
---|
3 |
|
---|
4 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
---|
5 | import static org.junit.jupiter.api.Assertions.assertTrue;
|
---|
6 |
|
---|
7 | import org.junit.jupiter.api.Test;
|
---|
8 | import org.openstreetmap.josm.TestUtils;
|
---|
9 | import org.openstreetmap.josm.actions.mapmode.ExtrudeAction.Mode;
|
---|
10 | import org.openstreetmap.josm.data.osm.DataSet;
|
---|
11 | import org.openstreetmap.josm.gui.MainApplication;
|
---|
12 | import org.openstreetmap.josm.gui.MapFrame;
|
---|
13 | import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
---|
14 | import org.openstreetmap.josm.testutils.annotations.Main;
|
---|
15 | import org.openstreetmap.josm.testutils.annotations.Projection;
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * Unit tests for class {@link ExtrudeAction}.
|
---|
19 | */
|
---|
20 | @Main
|
---|
21 | @Projection
|
---|
22 | class ExtrudeActionTest {
|
---|
23 | /**
|
---|
24 | * Unit test of {@link ExtrudeAction#enterMode} and {@link ExtrudeAction#exitMode}.
|
---|
25 | */
|
---|
26 | @Test
|
---|
27 | void testMode() {
|
---|
28 | OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
|
---|
29 | try {
|
---|
30 | MainApplication.getLayerManager().addLayer(layer);
|
---|
31 | ExtrudeAction mapMode = new ExtrudeAction();
|
---|
32 | MapFrame map = MainApplication.getMap();
|
---|
33 | MapMode oldMapMode = map.mapMode;
|
---|
34 | assertTrue(map.selectMapMode(mapMode));
|
---|
35 | assertEquals(mapMode, map.mapMode);
|
---|
36 | assertTrue(map.selectMapMode(oldMapMode));
|
---|
37 | } finally {
|
---|
38 | MainApplication.getLayerManager().removeLayer(layer);
|
---|
39 | }
|
---|
40 | }
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * Unit test of {@link Mode} enum.
|
---|
44 | */
|
---|
45 | @Test
|
---|
46 | void testEnumMode() {
|
---|
47 | TestUtils.superficialEnumCodeCoverage(Mode.class);
|
---|
48 | }
|
---|
49 | }
|
---|