Changeset 15496 in josm for trunk/test/unit


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

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

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
3 added
3 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxDataTest.java

    r14338 r15496  
    3636import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    3737import nl.jqno.equalsverifier.EqualsVerifier;
     38import nl.jqno.equalsverifier.Warning;
    3839
    3940/**
     
    6465    @Test
    6566    public void testMergeFrom() {
    66         ImmutableGpxTrack track = singleWaypointGpxTrack();
     67        GpxTrack track = singleWaypointGpxTrack();
    6768        GpxRoute route = singleWaypointRoute();
    6869        WayPoint newWP = new WayPoint(LatLon.NORTH_POLE);
     
    103104        final GpxData expected = getGpx(exp);
    104105        own.mergeFrom(other, cut, connect);
    105         assertEquals(expected, own);
     106        own.put(GpxConstants.META_BOUNDS, null);
     107        expected.put(GpxConstants.META_BOUNDS, null); //they are only updated by GpxWriter
     108        assertEquals(exp + " didn't match!", expected, own);
    106109    }
    107110
     
    117120        assertEquals(0, data.getTracks().size());
    118121
    119         ImmutableGpxTrack track1 = emptyGpxTrack();
    120         ImmutableGpxTrack track2 = singleWaypointGpxTrack();
     122        GpxTrack track1 = emptyGpxTrack();
     123        GpxTrack track2 = singleWaypointGpxTrack();
    121124        data.addTrack(track1);
    122125        assertEquals(1, data.getTracks().size());
     
    137140    @Test(expected = IllegalArgumentException.class)
    138141    public void testAddTrackFails() {
    139         ImmutableGpxTrack track1 = emptyGpxTrack();
     142        GpxTrack track1 = emptyGpxTrack();
    140143        data.addTrack(track1);
    141144        data.addTrack(track1);
     
    147150    @Test(expected = IllegalArgumentException.class)
    148151    public void testRemoveTrackFails() {
    149         ImmutableGpxTrack track1 = emptyGpxTrack();
     152        GpxTrack track1 = emptyGpxTrack();
    150153        data.addTrack(track1);
    151154        data.removeTrack(track1);
     
    246249    public void testHasTrackPoints() {
    247250        assertFalse(data.hasTrackPoints());
    248         ImmutableGpxTrack track1 = emptyGpxTrack();
     251        GpxTrack track1 = emptyGpxTrack();
    249252        data.addTrack(track1);
    250253        assertFalse(data.hasTrackPoints());
    251         ImmutableGpxTrack track2 = singleWaypointGpxTrack();
     254        GpxTrack track2 = singleWaypointGpxTrack();
    252255        data.addTrack(track2);
    253256        assertTrue(data.hasTrackPoints());
     
    260263    public void testGetTrackPoints() {
    261264        assertEquals(0, data.getTrackPoints().count());
    262         ImmutableGpxTrack track1 = singleWaypointGpxTrack();
     265        GpxTrack track1 = singleWaypointGpxTrack();
    263266        data.addTrack(track1);
    264267        assertEquals(1, data.getTrackPoints().count());
    265         ImmutableGpxTrack track2 = singleWaypointGpxTrack();
     268        GpxTrack track2 = singleWaypointGpxTrack();
    266269        data.addTrack(track2);
    267270        assertEquals(2, data.getTrackPoints().count());
     
    281284    @Test
    282285    public void testIsEmpty() {
    283         ImmutableGpxTrack track1 = singleWaypointGpxTrack();
     286        GpxTrack track1 = singleWaypointGpxTrack();
    284287        WayPoint waypoint = new WayPoint(LatLon.ZERO);
    285288        GpxRoute route = singleWaypointRoute();
     
    308311    @Test
    309312    public void testLength() {
    310         ImmutableGpxTrack track1 = waypointGpxTrack(
     313        GpxTrack track1 = waypointGpxTrack(
    311314                new WayPoint(new LatLon(0, 0)),
    312315                new WayPoint(new LatLon(1, 1)),
    313316                new WayPoint(new LatLon(0, 2)));
    314         ImmutableGpxTrack track2 = waypointGpxTrack(
     317        GpxTrack track2 = waypointGpxTrack(
    315318                new WayPoint(new LatLon(0, 0)),
    316319                new WayPoint(new LatLon(-1, 1)));
     
    336339        p2.setTime(new Date(100020));
    337340        p4.setTime(new Date(500020));
    338         data.addTrack(new ImmutableGpxTrack(Arrays.asList(Arrays.asList(p1, p2)), Collections.emptyMap()));
    339         data.addTrack(new ImmutableGpxTrack(Arrays.asList(Arrays.asList(p3, p4, p5)), Collections.emptyMap()));
     341        data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p1, p2)), Collections.emptyMap()));
     342        data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p3, p4, p5)), Collections.emptyMap()));
    340343
    341344        Date[] times = data.getMinMaxTimeForAllTracks();
     
    355358                .map(WayPoint::new)
    356359                .collect(Collectors.toList());
    357         data.addTrack(new ImmutableGpxTrack(Arrays.asList(points), Collections.emptyMap()));
     360        data.addTrack(new GpxTrack(Arrays.asList(points), Collections.emptyMap()));
    358361
    359362        WayPoint closeToMiddle = data.nearestPointOnTrack(new EastNorth(10, 0), 10);
     
    449452    }
    450453
    451     private static ImmutableGpxTrack emptyGpxTrack() {
    452         return new ImmutableGpxTrack(Collections.<Collection<WayPoint>>emptyList(), Collections.emptyMap());
    453     }
    454 
    455     private static ImmutableGpxTrack singleWaypointGpxTrack() {
    456         return new ImmutableGpxTrack(Collections.singleton(Collections.singleton(new WayPoint(LatLon.ZERO))), Collections.emptyMap());
    457     }
    458 
    459     private static ImmutableGpxTrack waypointGpxTrack(WayPoint... wps) {
    460         return new ImmutableGpxTrack(Collections.singleton(Arrays.asList(wps)), Collections.emptyMap());
     454    private static GpxTrack emptyGpxTrack() {
     455        return new GpxTrack(Collections.<Collection<WayPoint>>emptyList(), Collections.emptyMap());
     456    }
     457
     458    private static GpxTrack singleWaypointGpxTrack() {
     459        return new GpxTrack(Collections.singleton(Collections.singleton(new WayPoint(LatLon.ZERO))), Collections.emptyMap());
     460    }
     461
     462    private static GpxTrack waypointGpxTrack(WayPoint... wps) {
     463        return new GpxTrack(Collections.singleton(Arrays.asList(wps)), Collections.emptyMap());
    461464    }
    462465
     
    473476    public void testEqualsContract() {
    474477        TestUtils.assumeWorkingEqualsVerifier();
     478        GpxExtensionCollection col = new GpxExtensionCollection();
     479        col.add("josm", "from-server", "true");
    475480        EqualsVerifier.forClass(GpxData.class).usingGetClass()
    476             .withIgnoredFields("attr", "creator", "fromServer", "storageFile", "listeners", "tracks", "routes", "waypoints", "proxy", "segSpans")
     481            .suppress(Warning.NONFINAL_FIELDS)
     482            .withIgnoredFields("creator", "fromServer", "storageFile", "initializing", "updating", "suppressedInvalidate", "listeners", "tracks", "routes", "waypoints", "proxy", "segSpans", "modified")
    477483            .withPrefabValues(WayPoint.class, new WayPoint(LatLon.NORTH_POLE), new WayPoint(LatLon.SOUTH_POLE))
    478484            .withPrefabValues(ListenerList.class, ListenerList.create(), ListenerList.create())
     485            .withPrefabValues(GpxExtensionCollection.class, new GpxExtensionCollection(), col)
    479486            .verify();
    480487    }
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxRouteTest.java

    r13079 r15496  
    3030    public void testEqualsContract() {
    3131        TestUtils.assumeWorkingEqualsVerifier();
     32        GpxExtensionCollection col = new GpxExtensionCollection();
     33        col.add("josm", "from-server", "true");
    3234        EqualsVerifier.forClass(GpxRoute.class).usingGetClass()
    3335            .suppress(Warning.NONFINAL_FIELDS)
    3436            .withPrefabValues(WayPoint.class, new WayPoint(LatLon.NORTH_POLE), new WayPoint(LatLon.SOUTH_POLE))
     37            .withPrefabValues(GpxExtensionCollection.class, new GpxExtensionCollection(), col)
    3538            .verify();
    3639    }
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/WayPointTest.java

    r13342 r15496  
    2929    public void testEqualsContract() {
    3030        TestUtils.assumeWorkingEqualsVerifier();
     31        GpxExtensionCollection col = new GpxExtensionCollection();
     32        col.add("josm", "from-server", "true");
    3133        EqualsVerifier.forClass(WayPoint.class).usingGetClass()
    3234            .suppress(Warning.NONFINAL_FIELDS)
    3335            .withIgnoredFields("customColoring", "dir", "drawLine", "east", "north", "eastNorthCacheKey")
     36            .withPrefabValues(GpxExtensionCollection.class, new GpxExtensionCollection(), col)
    3437            .verify();
    3538    }
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/WithAttributesTest.java

    r13079 r15496  
    2929    public void testEqualsContract() {
    3030        TestUtils.assumeWorkingEqualsVerifier();
     31        GpxExtensionCollection col = new GpxExtensionCollection();
     32        col.add("josm", "from-server", "true");
    3133        EqualsVerifier.forClass(WithAttributes.class).usingGetClass()
    3234            .suppress(Warning.NONFINAL_FIELDS)
     35            .withPrefabValues(GpxExtensionCollection.class, new GpxExtensionCollection(), col)
    3336            .verify();
    3437    }
  • 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()));
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/LayerTest.java

    r14120 r15496  
    88import static org.junit.Assert.assertTrue;
    99
    10 import java.awt.Color;
    1110import java.io.File;
    1211
     
    1413import org.junit.Rule;
    1514import org.junit.Test;
    16 import org.openstreetmap.josm.data.preferences.AbstractProperty;
    17 import org.openstreetmap.josm.data.preferences.NamedColorProperty;
    1815import org.openstreetmap.josm.data.projection.ProjectionRegistry;
    1916import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    4138    public void setUp() {
    4239        testLayer = new LayerManagerTest.TestLayer();
    43     }
    44 
    45     /**
    46      * Test {@link Layer#getColorProperty()}
    47      */
    48     @Test
    49     public void testGetColorProperty() {
    50         assertEquals(null, testLayer.getColorProperty());
    51 
    52         AbstractProperty<Color> color = new LayerManagerTest.TestLayer() {
    53             @Override
    54             protected NamedColorProperty getBaseColorProperty() {
    55                 return new NamedColorProperty("x", Color.BLACK);
    56             }
    57         }.getColorProperty();
    58 
    59         assertEquals(Color.BLACK, color.get());
    60         assertEquals(Color.BLACK, color.getDefaultValue());
    61         assertEquals("clr.layer.Test Layer.x", color.getKey());
    6240    }
    6341
     
    9876        assertEquals("Test Layer2", testLayer.getName());
    9977
    100         testLayer = new LayerManagerTest.TestLayer() {
    101             @Override
    102             public AbstractProperty<Color> getColorProperty() {
    103                 return new NamedColorProperty("test", Color.RED);
    104             }
    105         };
     78        testLayer = new LayerManagerTest.TestLayer();
    10679
    10780        testLayer.setName("Test Layer2");
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/OsmDataLayerTest.java

    r15419 r15496  
    2424import org.openstreetmap.josm.data.gpx.GpxData;
    2525import org.openstreetmap.josm.data.gpx.GpxTrack;
    26 import org.openstreetmap.josm.data.gpx.GpxTrackSegment;
     26import org.openstreetmap.josm.data.gpx.IGpxTrackSegment;
    2727import org.openstreetmap.josm.data.gpx.WayPoint;
    2828import org.openstreetmap.josm.data.osm.DataSet;
     
    241241        assertEquals(1, gpx.getTrackCount());
    242242        GpxTrack track = gpx.getTracks().iterator().next();
    243         Collection<GpxTrackSegment> segments = track.getSegments();
     243        Collection<IGpxTrackSegment> segments = track.getSegments();
    244244        assertEquals(1, segments.size());
    245245        Collection<WayPoint> trackpoints = segments.iterator().next().getWayPoints();
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityActionTest.java

    r14349 r15496  
    3939            @Override
    4040            protected String getString(final ExtendedDialog instance) {
    41                 return ((JLabel) ((JPanel) this.getContent(instance)).getComponent(2)).getText();
     41                return ((JLabel) ((JPanel) instance.getContentPane().getComponent(0)).getComponent(2)).getText();
    4242            }
    4343        };
    4444        edMocker.getMockResultMap().put(
    45             "<html>Select all tracks that you want to be displayed. You can drag select a range of " +
    46             "tracks or use CTRL+Click to select specific ones. The map is updated live in the " +
    47             "background. Open the URLs by double clicking them.</html>",
    48             "Show all"
    49         );
     45                "<html>Select all tracks that you want to be displayed. " +
     46                        "You can drag select a range of tracks or use CTRL+Click to select specific ones. " +
     47                        "The map is updated live in the background. Open the URLs by double clicking them, edit name and description by double clicking the cell.</html>",
     48                        "Show all"
     49                );
    5050
    5151        new ChooseTrackVisibilityAction(GpxLayerTest.getMinimalGpxLayer()).actionPerformed(null);
     
    5353        assertEquals(1, edMocker.getInvocationLog().size());
    5454        Object[] invocationLogEntry = edMocker.getInvocationLog().get(0);
    55         assertEquals(1, (int) invocationLogEntry[0]);
     55        assertEquals(2, (int) invocationLogEntry[0]);
    5656        assertEquals("Set track visibility for Bananas", invocationLogEntry[2]);
    5757    }
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerActionTest.java

    r15432 r15496  
    6767    public void testFromTrack() throws Exception {
    6868        Config.getPref().put("gpx.convert-tags", "no");
    69         testFromTrack("tracks");
     69        testFromTrack("tracks.gpx", "tracks.osm");
    7070
    7171        Config.getPref().put("gpx.convert-tags", "yes");
    72         testFromTrack("tracks-ele-time");
     72        testFromTrack("tracks.gpx", "tracks-ele-time.osm");
    7373
    7474        Config.getPref().put("gpx.convert-tags", "list");
    7575        Config.getPref().putList("gpx.convert-tags.list.yes", Arrays.asList("ele"));
    7676        Config.getPref().putList("gpx.convert-tags.list.no", Arrays.asList("time"));
    77         testFromTrack("tracks-ele");
    78 
     77        testFromTrack("tracks.gpx", "tracks-ele.osm");
    7978
    8079        Config.getPref().putList("gpx.convert-tags.list.yes", Arrays.asList("time"));
    8180        Config.getPref().putList("gpx.convert-tags.list.no", Arrays.asList("ele"));
    82         testFromTrack("tracks-time");
     81        testFromTrack("tracks.gpx", "tracks-time.osm");
     82
     83        //Extension tests:
     84        Config.getPref().put("gpx.convert-tags", "yes");
     85        testFromTrack("tracks-extensions.gpx", "tracks-extensions.osm");
     86
     87        Config.getPref().put("gpx.convert-tags", "list");
     88        Config.getPref().putList("gpx.convert-tags.list.yes", Arrays.asList("time", "ele"));
     89        Config.getPref().putList("gpx.convert-tags.list.no", Arrays.asList(
     90                "gpxx:DisplayColor",
     91                "gpxd:color",
     92                "gpx:extension:test:tag",
     93                "gpx:extension:test:segment:tag"));
     94        testFromTrack("tracks-extensions.gpx", "tracks-ele-time.osm");
     95
    8396    }
    8497
     
    107120    }
    108121
    109     private void testFromTrack(String expected) throws IOException, SAXException, IllegalDataException {
    110         final GpxData data = GpxReaderTest.parseGpxData(TestUtils.getTestDataRoot() + "tracks/tracks.gpx");
     122    private void testFromTrack(String originalGpx, String expectedOsm) throws IOException, SAXException, IllegalDataException {
     123        final GpxData data = GpxReaderTest.parseGpxData(TestUtils.getTestDataRoot() + "tracks/" + originalGpx);
    111124        final DataSet osmExpected = OsmReader.parseDataSet(Files.newInputStream(
    112                 Paths.get(TestUtils.getTestDataRoot(), "tracks/" + expected + ".osm")), null);
     125                Paths.get(TestUtils.getTestDataRoot(), "tracks/" + expectedOsm)), null);
    113126        final GpxLayer layer = new GpxLayer(data);
    114127        final DataSet osm = new ConvertFromGpxLayerAction(layer).convert();
    115         //compare sorted coordinates/tags and total amount of primitives, because IDs and order will vary after reload
     128        //compare sorted nodes/ways, tags and total amount of primitives, because IDs and order will vary after reload
    116129
    117130        List<GenericNode> nodes = osm.getNodes().stream()
     
    125138                .collect(Collectors.toList());
    126139
    127         assertEquals(nodesExpected, nodes);
    128         assertEquals(osmExpected.allPrimitives().size(), osm.allPrimitives().size());
     140        assertEquals("Conversion " + originalGpx + " -> " + expectedOsm + " didn't match!", nodesExpected, nodes);
     141
     142        List<String> ways = osm.getWays().stream()
     143                .map(w -> Integer.toString(w.getNodes().size()) + ":" + w.getKeys().entrySet().stream().sorted((e1, e2) -> e1.getKey().compareTo(e2.getKey())).collect(Collectors.toList()).toString())
     144                .sorted()
     145                .collect(Collectors.toList());
     146
     147        List<String> waysExpected = osmExpected.getWays().stream()
     148                .map(w -> Integer.toString(w.getNodes().size()) + ":" + w.getKeys().entrySet().stream().sorted((e1, e2) -> e1.getKey().compareTo(e2.getKey())).collect(Collectors.toList()).toString())
     149                .sorted()
     150                .collect(Collectors.toList());
     151
     152        assertEquals("Conversion " + originalGpx + " -> " + expectedOsm + " didn't match!", waysExpected, ways);
     153
     154        assertEquals("Conversion " + originalGpx + " -> " + expectedOsm + " didn't match!", osmExpected.allPrimitives().size(), osm.allPrimitives().size());
    129155    }
    130156
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelperTest.java

    r12849 r15496  
    77import java.io.IOException;
    88import java.util.List;
     9import java.util.Map;
    910import java.util.stream.Collectors;
    1011
     
    1415import org.openstreetmap.josm.data.gpx.GpxData;
    1516import org.openstreetmap.josm.gui.layer.GpxLayer;
     17import org.openstreetmap.josm.gui.layer.gpx.GpxDrawHelper.ColorMode;
    1618import org.openstreetmap.josm.io.GpxReaderTest;
    17 import org.openstreetmap.josm.spi.preferences.Config;
    1819import org.openstreetmap.josm.testutils.JOSMTestRules;
    1920import org.openstreetmap.josm.tools.ColorHelper;
    2021import org.xml.sax.SAXException;
     22
     23import com.google.common.collect.ImmutableMap;
    2124
    2225import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    4245    @Test
    4346    public void testTicket12312() throws FileNotFoundException, IOException, SAXException {
    44         Config.getPref().putBoolean("draw.rawgps.colors.dynamic.layer 12312", true);
    45         Config.getPref().putInt("draw.rawgps.colors.layer 12312", GpxDrawHelper.ColorMode.VELOCITY.toIndex());
    46         final List<String> colors = calculateColors(TestUtils.getRegressionDataFile(12312, "single_trackpoint.gpx"), "12312", 1);
    47         assertEquals("[#FF00FF]", colors.toString());
     47        final List<String> colors = calculateColors(TestUtils.getRegressionDataFile(12312, "single_trackpoint.gpx"),
     48                ImmutableMap.of("colormode.dynamic-range", "true",
     49                        "colormode", Integer.toString(ColorMode.VELOCITY.toIndex())),
     50                1);
     51        assertEquals("[null]", colors.toString());
    4852    }
    4953
     
    5660    @Test
    5761    public void testNone() throws IOException, SAXException {
    58         final List<String> colors = calculateColors("data_nodist/2094047.gpx", "000", 10);
    59         assertEquals("[#FF00FF, #FF00FF, #FF00FF, #FF00FF, #FF00FF, #FF00FF, #FF00FF, #FF00FF, #FF00FF, #FF00FF]", colors.toString());
     62        final List<String> colors = calculateColors("data_nodist/2094047.gpx", ImmutableMap.of(), 10);
     63        assertEquals("[#000000, #000000, #000000, #000000, #000000, #000000, #000000, #000000, #000000, #000000]", colors.toString());
    6064    }
    6165
     
    6872    @Test
    6973    public void testVelocity() throws IOException, SAXException {
    70         Config.getPref().putInt("draw.rawgps.colors.layer 001", GpxDrawHelper.ColorMode.VELOCITY.toIndex());
    71         final List<String> colors = calculateColors("data_nodist/2094047.gpx", "001", 10);
    72         assertEquals("[#FF00FF, #FFAD00, #FFA800, #FFA800, #FF9E00, #FF9400, #FF7000, #FF7000, #FF8000, #FF9400]", colors.toString());
     74        final List<String> colors = calculateColors("data_nodist/2094047.gpx", ImmutableMap.of("colormode", Integer.toString(ColorMode.VELOCITY.toIndex())), 10);
     75        assertEquals("[#000000, #FFAD00, #FFA800, #FFA800, #FF9E00, #FF9400, #FF7000, #FF7000, #FF8000, #FF9400]", colors.toString());
    7376    }
    7477
     
    8184    @Test
    8285    public void testVelocityDynamic() throws IOException, SAXException {
    83         Config.getPref().putInt("draw.rawgps.colors.layer 002", GpxDrawHelper.ColorMode.VELOCITY.toIndex());
    84         Config.getPref().putBoolean("draw.rawgps.colors.dynamic.layer 002", true);
    85         final List<String> colors = calculateColors("data_nodist/2094047.gpx", "002", 10);
    86         assertEquals("[#FF00FF, #00FFE0, #00FFC2, #00FFC2, #00FF75, #00FF3D, #99FF00, #94FF00, #38FF00, #00FF38]", colors.toString());
     86        final List<String> colors = calculateColors("data_nodist/2094047.gpx",
     87                ImmutableMap.of("colormode.dynamic-range", "true",
     88                        "colormode", Integer.toString(ColorMode.VELOCITY.toIndex())),
     89                10);
     90        assertEquals("[#000000, #00FFE0, #00FFC2, #00FFC2, #00FF75, #00FF3D, #99FF00, #94FF00, #38FF00, #00FF38]", colors.toString());
    8791    }
    8892
     
    9599    @Test
    96100    public void testDirection() throws IOException, SAXException {
    97         Config.getPref().putInt("draw.rawgps.colors.layer 003", GpxDrawHelper.ColorMode.DIRECTION.toIndex());
    98         final List<String> colors = calculateColors("data_nodist/2094047.gpx", "003", 10);
    99         assertEquals("[#FF00FF, #EAEC25, #EDEA26, #EDE525, #ECD322, #EBB81D, #E85A0D, #E73708, #E84D0B, #EA8A15]", colors.toString());
     101        final List<String> colors = calculateColors("data_nodist/2094047.gpx", ImmutableMap.of("colormode", Integer.toString(ColorMode.DIRECTION.toIndex())), 10);
     102        assertEquals("[#000000, #EAEC25, #EDEA26, #EDE525, #ECD322, #EBB81D, #E85A0D, #E73708, #E84D0B, #EA8A15]", colors.toString());
    100103    }
    101104
     
    108111    @Test
    109112    public void testTime() throws IOException, SAXException {
    110         Config.getPref().putInt("draw.rawgps.colors.layer 003", GpxDrawHelper.ColorMode.TIME.toIndex());
    111         final List<String> colors = calculateColors("data_nodist/2094047.gpx", "003", 10);
    112         assertEquals("[#FF00FF, #FF0000, #FF0000, #FF0500, #FF0500, #FF0A00, #FF0A00, #FF1F00, #FF2E00, #FF3300]", colors.toString());
     113        final List<String> colors = calculateColors("data_nodist/2094047.gpx", ImmutableMap.of("colormode", Integer.toString(ColorMode.TIME.toIndex())), 10);
     114        assertEquals("[#000000, #FF0000, #FF0000, #FF0500, #FF0500, #FF0A00, #FF0A00, #FF1F00, #FF2E00, #FF3300]", colors.toString());
    113115    }
    114116
     
    116118     *
    117119     * @param fileName the GPX filename to parse
    118      * @param layerName the layer name used to fetch the color settings, see {@link GpxDrawHelper#readPreferences(java.lang.String)}
     120     * @param layerPrefs a HashMap representing the layer specific preferences
    119121     * @param n the number of waypoints of the first track/segment to analyze
    120122     * @return the HTML color codes for the first {@code n} points
     
    123125     * @throws SAXException if any SAX error occurs
    124126     */
    125     static List<String> calculateColors(String fileName, String layerName, int n) throws IOException, SAXException {
     127    static List<String> calculateColors(String fileName, Map<String, String> layerPrefs, int n) throws IOException, SAXException {
    126128        final GpxData data = GpxReaderTest.parseGpxData(fileName);
     129        data.getLayerPrefs().putAll(layerPrefs);
    127130        final GpxLayer layer = new GpxLayer(data);
    128131        final GpxDrawHelper gdh = new GpxDrawHelper(layer);
    129         gdh.readPreferences(layerName);
     132        gdh.readPreferences();
    130133        gdh.calculateColors();
    131134        return data.getTrackPoints().limit(n).map(p -> ColorHelper.color2html(p.customColoring)).collect(Collectors.toList());
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/AudioMarkerTest.java

    r9814 r15496  
    1111import org.openstreetmap.josm.JOSMFixture;
    1212import org.openstreetmap.josm.data.coor.LatLon;
    13 import org.openstreetmap.josm.data.gpx.Extensions;
    14 import org.openstreetmap.josm.data.gpx.GpxConstants;
    1513import org.openstreetmap.josm.data.gpx.GpxData;
    1614import org.openstreetmap.josm.data.gpx.WayPoint;
     
    4644        WayPoint wpt = marker.convertToWayPoint();
    4745        assertEquals(LatLon.ZERO, wpt.getCoor());
    48         Extensions ext = (Extensions) wpt.get(GpxConstants.META_EXTENSIONS);
    49         assertEquals("2.0", ext.get("offset"));
     46        assertEquals("2.0", wpt.getExtensions().get("josm", "offset").getValue());
    5047    }
    5148}
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayerTest.java

    r14138 r15496  
    44import static org.junit.Assert.assertEquals;
    55import static org.junit.Assert.assertNotNull;
     6import static org.junit.Assert.assertNull;
    67import static org.junit.Assert.assertTrue;
    78
    8 import java.awt.Color;
    99import java.util.Arrays;
    1010
     
    1717import org.openstreetmap.josm.data.gpx.GpxLink;
    1818import org.openstreetmap.josm.data.gpx.WayPoint;
     19import org.openstreetmap.josm.data.osm.DataSet;
    1920import org.openstreetmap.josm.gui.MainApplication;
     21import org.openstreetmap.josm.gui.MapFrame;
     22import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2023import org.openstreetmap.josm.spi.preferences.Config;
    2124import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2932
    3033    /**
    31      * Setup tests
     34     * For creating layers
    3235     */
    3336    @Rule
     
    4851    @Test
    4952    public void testMarkerLayer() {
    50         assertEquals(Color.magenta, MarkerLayer.getGenericColor());
    5153        MarkerLayer layer = new MarkerLayer(new GpxData(), "foo", null, null);
    5254        MainApplication.getLayerManager().addLayer(layer);
    5355
    5456        assertEquals("foo", layer.getName());
    55         assertEquals(Color.magenta, layer.getColorProperty().get());
     57        assertNull(layer.getColor());
    5658        assertNotNull(layer.getIcon());
    5759        assertEquals("0 markers", layer.getToolTipText());
     
    6264        WayPoint wpt = new WayPoint(LatLon.ZERO);
    6365        wpt.attr.put(GpxConstants.META_LINKS, Arrays.asList(new GpxLink("https://josm.openstreetmap.de")));
    64         wpt.addExtension("offset", "1.0");
     66        wpt.getExtensions().add("josm", "offset", "1.0");
    6567        gpx.waypoints.add(wpt);
    6668        wpt = new WayPoint(LatLon.ZERO);
    67         wpt.addExtension("offset", "NaN");
     69        wpt.getExtensions().add("josm", "offset", "NaN");
    6870        gpx.waypoints.add(wpt);
    6971        layer = new MarkerLayer(gpx, "bar", null, null);
    7072
    7173        assertEquals("bar", layer.getName());
    72         assertEquals(Color.magenta, layer.getColorProperty().get());
     74        assertNull(layer.getColor());
    7375        assertNotNull(layer.getIcon());
    7476        assertEquals("3 markers", layer.getToolTipText());
     
    7678        assertTrue(layer.getMenuEntries().length > 10);
    7779    }
     80
     81    /**
     82     * Unit test of {@code Main.map.mapView.playHeadMarker}.
     83     */
     84    @Test
     85    public void testPlayHeadMarker() {
     86        try {
     87            MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
     88            MapFrame map = MainApplication.getMap();
     89            MarkerLayer layer = new MarkerLayer(new GpxData(), null, null, null);
     90            assertNull(map.mapView.playHeadMarker);
     91            MainApplication.getLayerManager().addLayer(layer);
     92            assertNotNull(map.mapView.playHeadMarker);
     93            MainApplication.getLayerManager().removeLayer(layer);
     94        } finally {
     95            if (MainApplication.isDisplayingMapView()) {
     96                MainApplication.getMap().mapView.playHeadMarker = null;
     97            }
     98        }
     99    }
    78100}
  • trunk/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java

    r14077 r15496  
    1111import java.nio.charset.StandardCharsets;
    1212import java.util.ArrayList;
     13import java.util.HashMap;
     14import java.util.Map;
    1315
    1416import org.junit.Rule;
     
    7072
    7173    /**
     74     * Tests if layer preferences can be read
     75     * @throws Exception if track can't be parsed
     76     */
     77    @Test
     78    public void testLayerPrefs() throws Exception {
     79        final GpxData data = parseGpxData(TestUtils.getTestDataRoot() + "tracks/tracks-layerprefs.gpx");
     80        Map<String, String> e = new HashMap<>();
     81        e.put("colormode.velocity.tune", "10");
     82        e.put("lines.arrows.min-distance", "20");
     83        e.put("colormode", "1");
     84        e.put("lines", "1");
     85        e.put("lines.arrows", "true");
     86        e.put("colormode.dynamic-range", "true");
     87        e.put("colors", "0");
     88        assertEquals(data.getLayerPrefs(), e);
     89    }
     90
     91    /**
    7292     * Tests invalid data.
    7393     * @throws Exception always SAXException
  • trunk/test/unit/org/openstreetmap/josm/io/GpxWriterTest.java

    r14453 r15496  
    44import static org.junit.Assert.assertEquals;
    55
     6import java.awt.Color;
    67import java.io.ByteArrayOutputStream;
    78import java.io.IOException;
     
    1011import java.time.Month;
    1112import java.time.ZoneOffset;
     13import java.util.Arrays;
    1214import java.util.Date;
     15import java.util.HashMap;
    1316import java.util.function.Consumer;
    1417
     
    1821import org.openstreetmap.josm.data.gpx.GpxConstants;
    1922import org.openstreetmap.josm.data.gpx.GpxData;
     23import org.openstreetmap.josm.data.gpx.GpxData.XMLNamespace;
     24import org.openstreetmap.josm.data.gpx.GpxExtensionCollection;
     25import org.openstreetmap.josm.data.gpx.GpxTrack;
     26import org.openstreetmap.josm.data.gpx.GpxTrackSegment;
    2027import org.openstreetmap.josm.data.gpx.WayPoint;
    2128import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    8895                "    <pdop>1.2</pdop>%n");
    8996    }
     97
     98    /**
     99     * Tests if extensions are written correctly.
     100     * @throws IOException
     101     */
     102    @Test
     103    public void testExtensions() throws IOException {
     104        GpxData data = new GpxData();
     105        data.getNamespaces().add(new XMLNamespace("test", "http://example.com/testURI")); //only namespace, no location printed
     106        data.getNamespaces().add(new XMLNamespace("knownprefix", "http://example.com/URI", "http://example.com/location.xsd")); //printed
     107        data.getNamespaces().add(new XMLNamespace("notpresent", "http://example.com/notpresent", "http://example.com/notpresent.xsd")); //NOT printed
     108
     109        GpxExtensionCollection exts = data.getExtensions();
     110        data.fromServer = true; //printed
     111        data.getLayerPrefs().put("foo", "bar"); //printed depending on writer config
     112        exts.add("knownprefix", "foo", "bar"); //printed
     113        exts.add("unknownprefix", "foo", "bar"); //NOT printed
     114
     115        WayPoint wpt = new WayPoint(LatLon.ZERO);
     116        wpt.getExtensions().add("test", "foo", "extension of a waypoint"); //printed
     117
     118        GpxTrackSegment seg = new GpxTrackSegment(Arrays.asList(wpt));
     119        seg.getExtensions().add("test", "foo", "extension of a segment"); //printed
     120
     121        GpxTrack trk = new GpxTrack(Arrays.asList(seg), new HashMap<>());
     122
     123        trk.setColor(Color.RED); //printed depending on writer configuration
     124
     125        data.addTrack(trk);
     126
     127        ByteArrayOutputStream baos = new ByteArrayOutputStream();
     128        GpxWriter writer = new GpxWriter(baos);
     129
     130        writer.write(data);
     131        assertEquals("<?xml version='1.0' encoding='UTF-8'?>\n" +
     132                "<gpx version=\"1.1\" creator=\"JOSM GPX export\" xmlns=\"http://www.topografix.com/GPX/1/1\"\n" +
     133                "    xmlns:knownprefix=\"http://example.com/URI\"\n" +
     134                "    xmlns:josm=\"http://josm.openstreetmap.de/gpx-extensions-1.1\"\n" +
     135                "    xmlns:gpxd=\"http://josm.openstreetmap.de/gpx-drawing-extensions-1.0\"\n" +
     136                "    xmlns:test=\"http://example.com/testURI\"\n" +
     137                "    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
     138                "    xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://example.com/URI http://example.com/location.xsd http://josm.openstreetmap.de/gpx-extensions-1.1 http://josm.openstreetmap.de/gpx-extensions-1.1.xsd http://josm.openstreetmap.de/gpx-drawing-extensions-1.0 http://josm.openstreetmap.de/gpx-drawing-extensions-1.0.xsd\">\n" +
     139                "  <metadata>\n" +
     140                "    <bounds minlat=\"0.0\" minlon=\"0.0\" maxlat=\"0.0\" maxlon=\"0.0\"/>\n" +
     141                "    <extensions>\n" +
     142                "      <knownprefix:foo>bar</knownprefix:foo>\n" +
     143                "      <josm:from-server>true</josm:from-server>\n" +
     144                "      <josm:layerPreferences>\n" +
     145                "        <josm:entry key=\"foo\" value=\"bar\"/>\n" +
     146                "      </josm:layerPreferences>\n" +
     147                "    </extensions>\n" +
     148                "  </metadata>\n" +
     149                "  <trk>\n" +
     150                "    <extensions>\n" +
     151                "      <gpxd:color>#FF0000</gpxd:color>\n" +
     152                "    </extensions>\n" +
     153                "    <trkseg>\n" +
     154                "      <extensions>\n" +
     155                "        <test:foo>extension of a segment</test:foo>\n" +
     156                "      </extensions>\n" +
     157                "      <trkpt lat=\"0.0\" lon=\"0.0\">\n" +
     158                "        <extensions>\n" +
     159                "          <test:foo>extension of a waypoint</test:foo>\n" +
     160                "        </extensions>\n" +
     161                "      </trkpt>\n" +
     162                "    </trkseg>\n" +
     163                "  </trk>\n" +
     164                "</gpx>", baos.toString());
     165
     166        baos.reset();
     167        writer.write(data, GpxConstants.ColorFormat.GPXX, true);
     168        assertEquals("<?xml version='1.0' encoding='UTF-8'?>\n" +
     169                "<gpx version=\"1.1\" creator=\"JOSM GPX export\" xmlns=\"http://www.topografix.com/GPX/1/1\"\n" +
     170                "    xmlns:knownprefix=\"http://example.com/URI\"\n" +
     171                "    xmlns:josm=\"http://josm.openstreetmap.de/gpx-extensions-1.1\"\n" +
     172                "    xmlns:gpxx=\"http://www.garmin.com/xmlschemas/GpxExtensions/v3\"\n" +
     173                "    xmlns:test=\"http://example.com/testURI\"\n" +
     174                "    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
     175                "    xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://example.com/URI http://example.com/location.xsd http://josm.openstreetmap.de/gpx-extensions-1.1 http://josm.openstreetmap.de/gpx-extensions-1.1.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd\">\n" +
     176                "  <metadata>\n" +
     177                "    <bounds minlat=\"0.0\" minlon=\"0.0\" maxlat=\"0.0\" maxlon=\"0.0\"/>\n" +
     178                "    <extensions>\n" +
     179                "      <knownprefix:foo>bar</knownprefix:foo>\n" +
     180                "      <josm:from-server>true</josm:from-server>\n" +
     181                "      <josm:layerPreferences>\n" +
     182                "        <josm:entry key=\"foo\" value=\"bar\"/>\n" +
     183                "      </josm:layerPreferences>\n" +
     184                "    </extensions>\n" +
     185                "  </metadata>\n" +
     186                "  <trk>\n" +
     187                "    <extensions>\n" +
     188                "      <gpxx:TrackExtensions>\n" +
     189                "        <gpxx:DisplayColor>Red</gpxx:DisplayColor>\n" +
     190                "      </gpxx:TrackExtensions>\n" +
     191                "    </extensions>\n" +
     192                "    <trkseg>\n" +
     193                "      <extensions>\n" +
     194                "        <test:foo>extension of a segment</test:foo>\n" +
     195                "      </extensions>\n" +
     196                "      <trkpt lat=\"0.0\" lon=\"0.0\">\n" +
     197                "        <extensions>\n" +
     198                "          <test:foo>extension of a waypoint</test:foo>\n" +
     199                "        </extensions>\n" +
     200                "      </trkpt>\n" +
     201                "    </trkseg>\n" +
     202                "  </trk>\n" +
     203                "</gpx>", baos.toString());
     204
     205        baos.reset();
     206        writer.write(data, null, false);
     207        assertEquals("<?xml version='1.0' encoding='UTF-8'?>\n" +
     208                "<gpx version=\"1.1\" creator=\"JOSM GPX export\" xmlns=\"http://www.topografix.com/GPX/1/1\"\n" +
     209                "    xmlns:knownprefix=\"http://example.com/URI\"\n" +
     210                "    xmlns:josm=\"http://josm.openstreetmap.de/gpx-extensions-1.1\"\n" +
     211                "    xmlns:test=\"http://example.com/testURI\"\n" +
     212                "    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
     213                "    xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://example.com/URI http://example.com/location.xsd http://josm.openstreetmap.de/gpx-extensions-1.1 http://josm.openstreetmap.de/gpx-extensions-1.1.xsd\">\n" +
     214                "  <metadata>\n" +
     215                "    <bounds minlat=\"0.0\" minlon=\"0.0\" maxlat=\"0.0\" maxlon=\"0.0\"/>\n" +
     216                "    <extensions>\n" +
     217                "      <knownprefix:foo>bar</knownprefix:foo>\n" +
     218                "      <josm:from-server>true</josm:from-server>\n" +
     219                "    </extensions>\n" +
     220                "  </metadata>\n" +
     221                "  <trk>\n" +
     222                "    <trkseg>\n" +
     223                "      <extensions>\n" +
     224                "        <test:foo>extension of a segment</test:foo>\n" +
     225                "      </extensions>\n" +
     226                "      <trkpt lat=\"0.0\" lon=\"0.0\">\n" +
     227                "        <extensions>\n" +
     228                "          <test:foo>extension of a waypoint</test:foo>\n" +
     229                "        </extensions>\n" +
     230                "      </trkpt>\n" +
     231                "    </trkseg>\n" +
     232                "  </trk>\n" +
     233                "</gpx>", baos.toString());
     234
     235        baos.reset();
     236        writer.write(data, GpxConstants.ColorFormat.GPXX, true);
     237        // checked again to make sure that extensions are shown again after
     238        // being hidden, even if they don't actually have to be converted
     239        // (GPXD -> convertColor() -> GPXX -> hide() -> null -> show() -> GPXX)
     240        assertEquals("<?xml version='1.0' encoding='UTF-8'?>\n" +
     241                "<gpx version=\"1.1\" creator=\"JOSM GPX export\" xmlns=\"http://www.topografix.com/GPX/1/1\"\n" +
     242                "    xmlns:knownprefix=\"http://example.com/URI\"\n" +
     243                "    xmlns:josm=\"http://josm.openstreetmap.de/gpx-extensions-1.1\"\n" +
     244                "    xmlns:gpxx=\"http://www.garmin.com/xmlschemas/GpxExtensions/v3\"\n" +
     245                "    xmlns:test=\"http://example.com/testURI\"\n" +
     246                "    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
     247                "    xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://example.com/URI http://example.com/location.xsd http://josm.openstreetmap.de/gpx-extensions-1.1 http://josm.openstreetmap.de/gpx-extensions-1.1.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd\">\n" +
     248                "  <metadata>\n" +
     249                "    <bounds minlat=\"0.0\" minlon=\"0.0\" maxlat=\"0.0\" maxlon=\"0.0\"/>\n" +
     250                "    <extensions>\n" +
     251                "      <knownprefix:foo>bar</knownprefix:foo>\n" +
     252                "      <josm:from-server>true</josm:from-server>\n" +
     253                "      <josm:layerPreferences>\n" +
     254                "        <josm:entry key=\"foo\" value=\"bar\"/>\n" +
     255                "      </josm:layerPreferences>\n" +
     256                "    </extensions>\n" +
     257                "  </metadata>\n" +
     258                "  <trk>\n" +
     259                "    <extensions>\n" +
     260                "      <gpxx:TrackExtensions>\n" +
     261                "        <gpxx:DisplayColor>Red</gpxx:DisplayColor>\n" +
     262                "      </gpxx:TrackExtensions>\n" +
     263                "    </extensions>\n" +
     264                "    <trkseg>\n" +
     265                "      <extensions>\n" +
     266                "        <test:foo>extension of a segment</test:foo>\n" +
     267                "      </extensions>\n" +
     268                "      <trkpt lat=\"0.0\" lon=\"0.0\">\n" +
     269                "        <extensions>\n" +
     270                "          <test:foo>extension of a waypoint</test:foo>\n" +
     271                "        </extensions>\n" +
     272                "      </trkpt>\n" +
     273                "    </trkseg>\n" +
     274                "  </trk>\n" +
     275                "</gpx>", baos.toString());
     276
     277        writer.close();
     278    }
    90279}
  • trunk/test/unit/org/openstreetmap/josm/io/nmea/NmeaReaderTest.java

    r15034 r15496  
    2525import org.openstreetmap.josm.data.gpx.GpxData;
    2626import org.openstreetmap.josm.data.gpx.GpxTrack;
    27 import org.openstreetmap.josm.data.gpx.GpxTrackSegment;
     27import org.openstreetmap.josm.data.gpx.IGpxTrackSegment;
    2828import org.openstreetmap.josm.data.gpx.WayPoint;
    2929import org.openstreetmap.josm.io.GpxReaderTest;
     
    101101        assertEquals(nTracks, nmeaTrack.getSegments().size());
    102102        if (nTracks > 0) {
    103             GpxTrackSegment gpxSeg = gpxTrack.getSegments().iterator().next();
    104             GpxTrackSegment nmeaSeg = nmeaTrack.getSegments().iterator().next();
     103            IGpxTrackSegment gpxSeg = gpxTrack.getSegments().iterator().next();
     104            IGpxTrackSegment nmeaSeg = nmeaTrack.getSegments().iterator().next();
    105105            assertEquals(gpxSeg.getBounds(), nmeaSeg.getBounds());
    106106            assertEquals(numCoor, gpxSeg.getWayPoints().size());
Note: See TracChangeset for help on using the changeset viewer.