1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.layer;
|
---|
3 |
|
---|
4 | import static org.junit.Assert.assertNotNull;
|
---|
5 | import static org.junit.Assert.assertNull;
|
---|
6 |
|
---|
7 | import org.junit.Rule;
|
---|
8 | import org.junit.Test;
|
---|
9 | import org.openstreetmap.josm.Main;
|
---|
10 | import org.openstreetmap.josm.data.gpx.GpxData;
|
---|
11 | import org.openstreetmap.josm.data.osm.DataSet;
|
---|
12 | import org.openstreetmap.josm.gui.MainApplication;
|
---|
13 | import org.openstreetmap.josm.gui.MapFrame;
|
---|
14 | import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
|
---|
15 | import org.openstreetmap.josm.testutils.JOSMTestRules;
|
---|
16 |
|
---|
17 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * Unit tests of {@link MarkerLayer} class.
|
---|
21 | */
|
---|
22 | public 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 | }
|
---|