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

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

mapmode: add basic unit tests

  • Property svn:eol-style set to native
File size: 1.3 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.BeforeClass;
8import org.junit.Test;
9import org.openstreetmap.josm.JOSMFixture;
10import org.openstreetmap.josm.Main;
11import org.openstreetmap.josm.data.osm.DataSet;
12import org.openstreetmap.josm.gui.layer.OsmDataLayer;
13
14/**
15 * Unit tests for class {@link ExtrudeAction}.
16 */
17public class ExtrudeActionTest {
18
19 /**
20 * Setup test.
21 */
22 @BeforeClass
23 public static void setUp() {
24 JOSMFixture.createUnitTestFixture().init(true);
25 }
26
27 /**
28 * Unit test of {@link ExtrudeAction#enterMode} and {@link ExtrudeAction#exitMode}.
29 */
30 @Test
31 public void testMode() {
32 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
33 try {
34 Main.main.addLayer(layer);
35 ExtrudeAction mapMode = new ExtrudeAction(Main.map);
36 MapMode oldMapMode = Main.map.mapMode;
37 assertTrue(Main.map.selectMapMode(mapMode));
38 assertEquals(mapMode, Main.map.mapMode);
39 assertTrue(Main.map.selectMapMode(oldMapMode));
40 } finally {
41 Main.main.removeLayer(layer);
42 }
43 }
44}
Note: See TracBrowser for help on using the repository browser.