ExportImportTest: made tests deterministic (simulate GPS/sensors).

Fixes #761.
This commit is contained in:
Dennis Guse
2021-07-16 08:00:42 +02:00
parent 86a0054c24
commit 997ddbb4f1
8 changed files with 100 additions and 34 deletions
@@ -203,6 +203,9 @@ public class TrackPoint {
if (hasAltitude()) {
location.setAltitude(altitude.toM());
}
if (hasSpeed()) {
location.setSpeed((float) speed.toMPS());
}
return location;
}
@@ -169,9 +169,9 @@ public final class SensorDataCycling {
}
public static class Data {
public final Distance distance;
public final Distance distanceOverall;
public final Speed speed;
private final Distance distance;
private final Distance distanceOverall;
private final Speed speed;
private Data(Distance distance, Distance distanceOverall, Speed speed) {
this.distance = distance;
@@ -179,12 +179,24 @@ public final class SensorDataCycling {
this.speed = speed;
}
public Distance getDistance() {
return distance;
}
public Distance getDistanceOverall() {
return distanceOverall;
}
public Speed getSpeed() {
return speed;
}
@Override
public String toString() {
return "Data{" +
"distance_m=" + distance +
", distance_overall_m=" + distanceOverall +
", speed_mps=" + speed +
"distance=" + getDistance() +
", distance_overall=" + getDistanceOverall() +
", speed=" + getSpeed() +
'}';
}
}
@@ -65,8 +65,8 @@ public final class SensorDataSet {
}
if (cyclingDistanceSpeed != null && cyclingDistanceSpeed.hasValue()) {
trackPoint.setSensorDistance(cyclingDistanceSpeed.getValue().distanceOverall);
trackPoint.setSpeed(cyclingDistanceSpeed.getValue().speed);
trackPoint.setSensorDistance(cyclingDistanceSpeed.getValue().getDistanceOverall());
trackPoint.setSpeed(cyclingDistanceSpeed.getValue().getSpeed());
}
if (cyclingPower != null && cyclingPower.hasValue()) {