source: josm/trunk/test/unit/org/openstreetmap/josm/actions/DeleteLayerActionTest.java

Last change on this file was 18837, checked in by taylor.smock, 17 months ago

Fix #23057: An invisible layer should not become active when removing a layer

  • Property svn:eol-style set to native
File size: 1.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.actions;
3
4import static org.junit.jupiter.api.Assertions.assertNotNull;
5import static org.junit.jupiter.api.Assertions.assertNull;
6
7import org.junit.jupiter.api.Test;
8import org.openstreetmap.josm.data.osm.DataSet;
9import org.openstreetmap.josm.gui.MainApplication;
10import org.openstreetmap.josm.gui.layer.OsmDataLayer;
11import org.openstreetmap.josm.testutils.annotations.Main;
12import org.openstreetmap.josm.testutils.annotations.Projection;
13
14/**
15 * Unit tests for class {@link DeleteLayerAction}.
16 */
17@Main
18@Projection
19final class DeleteLayerActionTest {
20 /**
21 * Unit test of {@link DeleteLayerAction#actionPerformed}
22 */
23 @Test
24 void testActionPerformed() {
25 DeleteLayerAction action = new DeleteLayerAction();
26 // No layer
27 action.actionPerformed(null);
28 // OsmDataLayer
29 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
30 MainApplication.getLayerManager().addLayer(layer);
31 assertNotNull(MainApplication.getLayerManager().getActiveLayer());
32 action.actionPerformed(null);
33 assertNull(MainApplication.getLayerManager().getActiveLayer());
34 }
35}
Note: See TracBrowser for help on using the repository browser.