source: josm/trunk/test/unit/org/openstreetmap/josm/gui/layer/MarkerLayerTest.java@ 12632

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

see #15182 - fix unit tests

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.layer;
3
4import static org.junit.Assert.assertNotNull;
5import static org.junit.Assert.assertNull;
6
7import org.junit.Rule;
8import org.junit.Test;
9import org.openstreetmap.josm.Main;
10import org.openstreetmap.josm.data.gpx.GpxData;
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.markerlayer.MarkerLayer;
15import org.openstreetmap.josm.testutils.JOSMTestRules;
16
17import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
18
19/**
20 * Unit tests of {@link MarkerLayer} class.
21 */
22public class MarkerLayerTest {
23
24 /**
25 * For creating layers
26 */
27 @Rule
28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
29 public JOSMTestRules test = new JOSMTestRules().main().projection();
30
31 /**
32 * Unit test of {@code Main.map.mapView.playHeadMarker}.
33 */
34 @Test
35 public void testPlayHeadMarker() {
36 try {
37 Main.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
38 MapFrame map = MainApplication.getMap();
39 MarkerLayer layer = new MarkerLayer(new GpxData(), null, null, null);
40 assertNull(map.mapView.playHeadMarker);
41 Main.getLayerManager().addLayer(layer);
42 assertNotNull(map.mapView.playHeadMarker);
43 Main.getLayerManager().removeLayer(layer);
44 } finally {
45 if (MainApplication.isDisplayingMapView()) {
46 MainApplication.getMap().mapView.playHeadMarker = null;
47 }
48 }
49 }
50}
Note: See TracBrowser for help on using the repository browser.