mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-05 19:13:07 +02:00
Clean up formatting of numbers in gpx export.
Addresses issue #299 and ensures Latitude and Longitude are formatted correctly as well.
This commit is contained in:
@@ -75,12 +75,17 @@ public class GpxTrackWriterTest extends TrackFormatWriterTest {
|
||||
* Asserts that the given tag describes the given location.
|
||||
*/
|
||||
private void assertTagMatchesLocation(Element tag, Location loc) {
|
||||
assertEquals(Double.toString(loc.getLatitude()), tag.getAttribute("lat"));
|
||||
assertEquals(Double.toString(loc.getLongitude()), tag.getAttribute("lon"));
|
||||
assertEquals(
|
||||
Location.convert(loc.getLatitude(), GpxTrackWriter.LATLONG_FORMAT),
|
||||
tag.getAttribute("lat"));
|
||||
assertEquals(
|
||||
Location.convert(loc.getLongitude(), GpxTrackWriter.LATLONG_FORMAT),
|
||||
tag.getAttribute("lon"));
|
||||
assertEquals(
|
||||
GpxTrackWriter.TIMESTAMP_FORMAT.format(new Date(loc.getTime())),
|
||||
getChildTextValue(tag, "time"));
|
||||
assertEquals(Double.toString(loc.getAltitude()),
|
||||
assertEquals(
|
||||
GpxTrackWriter.ELEVATION_FORMAT.format(loc.getAltitude()),
|
||||
getChildTextValue(tag, "ele"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public abstract class TrackFormatWriterTest extends AndroidTestCase {
|
||||
protected void populateLocations(MyTracksLocation... locs) {
|
||||
for (int i = 0; i < locs.length; i++) {
|
||||
MyTracksLocation loc = locs[i];
|
||||
loc.setAltitude(i * 1000);
|
||||
loc.setAltitude(i * 5000000);
|
||||
loc.setLatitude(i);
|
||||
loc.setLongitude(-i);
|
||||
loc.setTime(10000000 + i * 1000);
|
||||
|
||||
Reference in New Issue
Block a user