Added opentracks:gain and opentracks:loss information in GPX files. Fixes #555.

This commit is contained in:
Román Martínez
2020-12-26 16:18:51 +01:00
parent eb02c4c469
commit fd1b7b8af9
5 changed files with 50 additions and 6 deletions
@@ -17,6 +17,7 @@ public class TestDataUtil {
public static final double INITIAL_LONGITUDE = -57.0;
public static final double ALTITUDE_INTERVAL = 2.5;
public static final float ELEVATION_GAIN = 3;
public static final float ELEVATION_LOSS = 3;
/**
* Create a track without any trackPoints.
@@ -72,6 +73,7 @@ public class TestDataUtil {
trackPoint.setCyclingCadence_rpm(300f + i);
trackPoint.setPower(400f + i);
trackPoint.setElevationGain(ELEVATION_GAIN);
trackPoint.setElevationLoss(ELEVATION_LOSS);
return trackPoint;
}
@@ -135,7 +135,7 @@ public class ExportImportTest {
assertMarkers();
// 3. trackpoints
assertTrackpoints(false, false, false, false);
assertTrackpoints(false, false, false, false, false);
}
@LargeTest
@@ -170,7 +170,7 @@ public class ExportImportTest {
assertMarkers();
// 3. trackpoints
assertTrackpoints(true, true, true, true);
assertTrackpoints(true, true, true, true, true);
}
@LargeTest
@@ -263,7 +263,7 @@ public class ExportImportTest {
assertMarkers();
// 3. trackpoints
assertTrackpoints(false, true, true, false);
assertTrackpoints(false, true, true, true, true);
}
@LargeTest
@@ -310,7 +310,7 @@ public class ExportImportTest {
}
}
private void assertTrackpoints(boolean verifyPower, boolean verifyHeartrate, boolean verifyCadence, boolean verifyElevationGain) {
private void assertTrackpoints(boolean verifyPower, boolean verifyHeartrate, boolean verifyCadence, boolean verifyElevationGain, boolean verifyElevationLoss) {
List<TrackPoint> importedTrackPoints = contentProviderUtils.getTrackPoints(importTrackId);
assertEquals(trackPoints.size(), importedTrackPoints.size());
@@ -339,6 +339,9 @@ public class ExportImportTest {
if (verifyElevationGain) {
assertEquals(trackPoint.getElevationGain(), importedTrackPoint.getElevationGain(), 0.01);
}
if (verifyElevationLoss) {
assertEquals(trackPoint.getElevationLoss(), importedTrackPoint.getElevationLoss(), 0.01);
}
}
}
}