Changeset 12422 in josm
- Timestamp:
- 2017-06-22T01:07:31+02:00 (7 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/nmea/NmeaReader.java
r12421 r12422 342 342 // other values than (T)rue are ignored 343 343 accu = e[VTG.COURSE.position]; 344 if (!accu.isEmpty() ) {344 if (!accu.isEmpty() && currentwp != null) { 345 345 Double.parseDouble(accu); 346 346 currentwp.put("course", accu); … … 351 351 if (accu.startsWith("K")) { 352 352 accu = e[VTG.SPEED_KMH.position]; 353 if (!accu.isEmpty() ) {353 if (!accu.isEmpty() && currentwp != null) { 354 354 double speed = Double.parseDouble(accu); 355 355 speed /= 3.6; // speed in m/s -
trunk/test/unit/org/openstreetmap/josm/io/nmea/NmeaReaderTest.java
r12421 r12422 76 76 assertEquals(numCoor, in.getNumberOfCoordinates()); 77 77 assertEquals(0, in.getParserMalformed()); 78 assertEquals( in.data.dataSources, gpx.dataSources);78 assertEquals(gpx.dataSources, in.data.dataSources); 79 79 assertEquals(1, gpx.tracks.size()); 80 80 assertEquals(1, in.data.tracks.size()); … … 82 82 GpxTrack nmeaTrack = in.data.tracks.iterator().next(); 83 83 assertEquals(gpxTrack.getBounds(), nmeaTrack.getBounds()); 84 assertEquals(1, gpxTrack.getSegments().size()); 85 assertEquals(1, nmeaTrack.getSegments().size()); 86 GpxTrackSegment gpxSeg = gpxTrack.getSegments().iterator().next(); 87 GpxTrackSegment nmeaSeg = nmeaTrack.getSegments().iterator().next(); 88 assertEquals(gpxSeg.getBounds(), nmeaSeg.getBounds()); 89 assertEquals(numCoor, gpxSeg.getWayPoints().size()); 90 assertEquals(numCoor, nmeaSeg.getWayPoints().size()); 91 WayPoint gpxWpt = gpxSeg.getWayPoints().iterator().next(); 92 WayPoint nmeaWpt = nmeaSeg.getWayPoints().iterator().next(); 93 assertEquals(gpxWpt.getCoor().getRoundedToOsmPrecision(), nmeaWpt.getCoor().getRoundedToOsmPrecision()); 84 int nTracks = gpxTrack.getSegments().size(); 85 assertEquals(nTracks, nmeaTrack.getSegments().size()); 86 if (nTracks > 0) { 87 GpxTrackSegment gpxSeg = gpxTrack.getSegments().iterator().next(); 88 GpxTrackSegment nmeaSeg = nmeaTrack.getSegments().iterator().next(); 89 assertEquals(gpxSeg.getBounds(), nmeaSeg.getBounds()); 90 assertEquals(numCoor, gpxSeg.getWayPoints().size()); 91 assertEquals(numCoor, nmeaSeg.getWayPoints().size()); 92 WayPoint gpxWpt = gpxSeg.getWayPoints().iterator().next(); 93 WayPoint nmeaWpt = nmeaSeg.getWayPoints().iterator().next(); 94 assertEquals(gpxWpt.getCoor().getRoundedToOsmPrecision(), nmeaWpt.getCoor().getRoundedToOsmPrecision()); 95 } 94 96 } 95 97 … … 133 135 compareWithReference(2147, "WG20080203171807.log", 487); 134 136 } 137 138 /** 139 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/14924">Bug #14924</a>. 140 * @throws Exception if an error occurs 141 */ 142 @Test 143 public void testTicket14924() throws Exception { 144 compareWithReference(14924, "input", 0); 145 } 135 146 }
Note:
See TracChangeset
for help on using the changeset viewer.