Ignore:
Timestamp:
2019-11-02T15:11:34+01:00 (7 years ago)
Author:
Don-vip
Message:

fix #16796 - Rework of GPX track colors / layer preferences (patch by Bjoeni)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/GpxLayerTest.java

    r15425 r15496  
    44import static org.junit.Assert.assertEquals;
    55import static org.junit.Assert.assertFalse;
     6import static org.junit.Assert.assertNull;
    67import static org.junit.Assert.assertTrue;
    78
     
    1920import org.openstreetmap.josm.TestUtils;
    2021import org.openstreetmap.josm.data.gpx.GpxData;
    21 import org.openstreetmap.josm.data.gpx.ImmutableGpxTrack;
     22import org.openstreetmap.josm.data.gpx.GpxTrack;
     23import org.openstreetmap.josm.data.gpx.IGpxTrackSegment;
    2224import org.openstreetmap.josm.data.gpx.WayPoint;
    2325import org.openstreetmap.josm.data.osm.DataSet;
     
    7476    public void testGpxLayer() throws Exception {
    7577        GpxLayer layer = new GpxLayer(new GpxData(), "foo", false);
     78        GpxTrack trk = new GpxTrack(new ArrayList<IGpxTrackSegment>(), new HashMap<>());
     79        trk.getExtensions().add("gpxd", "color", "#FF0000");
     80        layer.data.addTrack(trk);
     81
    7682        assertEquals("foo", layer.getName());
    7783        assertFalse(layer.isLocalFile());
    78         assertEquals(Color.MAGENTA, layer.getColorProperty().get());
    79         assertEquals("<html>0 tracks (0 segments), 0 routes, 0 waypoints<br>Length: < 0.01 m<br></html>", layer.getToolTipText());
     84        assertEquals(layer.getColor(), Color.RED);
     85        assertEquals("<html>1 track (0 segments), 0 routes, 0 waypoints<br>Length: < 0.01 m<br></html>", layer.getToolTipText());
    8086
    8187        GpxLayer layer2 = new GpxLayer(new GpxData(), "bar", true);
    8288        assertEquals("bar", layer2.getName());
    8389        assertTrue(layer2.isLocalFile());
    84         assertEquals(Color.MAGENTA, layer2.getColorProperty().get());
     90        assertNull(layer2.getColor());
    8591        assertEquals("<html>0 tracks (0 segments), 0 routes, 0 waypoints<br>Length: < 0.01 m<br></html>", layer2.getToolTipText());
    8692
     
    188194    public void testGetTimespanForTrack() throws Exception {
    189195        assertEquals("", GpxLayer.getTimespanForTrack(
    190                 new ImmutableGpxTrack(new ArrayList<Collection<WayPoint>>(), new HashMap<String, Object>())));
     196                new GpxTrack(new ArrayList<Collection<WayPoint>>(), new HashMap<String, Object>())));
    191197
    192198        assertEquals("1/3/16 11:59 AM - 12:00 PM (0:00)", GpxLayer.getTimespanForTrack(getMinimalGpxData().tracks.iterator().next()));
Note: See TracChangeset for help on using the changeset viewer.