live mission details in footer implemented
This commit is contained in:
@@ -34,4 +34,80 @@ void main() {
|
||||
expect(stats.durationSec, closeTo(leg1 / 20 + leg2 / 10, 0.1));
|
||||
});
|
||||
});
|
||||
|
||||
group('computeFlyMissionStatus', () {
|
||||
final waypoints = [_wp(0, 0), _wp(0, 0.01), _wp(0, 0.02)];
|
||||
|
||||
test('kein aktiver Wegpunkt (null) ergibt null', () {
|
||||
expect(
|
||||
computeFlyMissionStatus(waypoints: waypoints, activeWaypointIndex: null),
|
||||
isNull,
|
||||
);
|
||||
});
|
||||
|
||||
test('activeWaypointIndex ausserhalb der Liste ergibt null', () {
|
||||
expect(
|
||||
computeFlyMissionStatus(waypoints: waypoints, activeWaypointIndex: 3),
|
||||
isNull,
|
||||
);
|
||||
expect(
|
||||
computeFlyMissionStatus(waypoints: waypoints, activeWaypointIndex: -1),
|
||||
isNull,
|
||||
);
|
||||
});
|
||||
|
||||
test('activeWaypointNumber ist 1-basiert (Index 1 -> Nummer 2)', () {
|
||||
final status = computeFlyMissionStatus(
|
||||
waypoints: waypoints,
|
||||
activeWaypointIndex: 1,
|
||||
);
|
||||
expect(status!.activeWaypointNumber, 2);
|
||||
expect(status.waypointCount, 3);
|
||||
});
|
||||
|
||||
test('ohne Position (kein Fix) bleiben Distanz/ETA null', () {
|
||||
final status = computeFlyMissionStatus(
|
||||
waypoints: waypoints,
|
||||
activeWaypointIndex: 1,
|
||||
);
|
||||
expect(status!.distanceToActiveWaypointM, isNull);
|
||||
expect(status.etaToActiveWaypointSec, isNull);
|
||||
});
|
||||
|
||||
test('mit Position wird die Distanz zum aktiven Wegpunkt berechnet', () {
|
||||
final status = computeFlyMissionStatus(
|
||||
waypoints: waypoints,
|
||||
activeWaypointIndex: 1,
|
||||
currentLat: 0,
|
||||
currentLon: 0,
|
||||
);
|
||||
// Wegpunkt 1 (Index 1) liegt bei (0, 0.01) - rund 1112.6 m vom
|
||||
// Ursprung entfernt.
|
||||
expect(status!.distanceToActiveWaypointM, closeTo(1112.6, 1));
|
||||
// Ohne Geschwindigkeit keine ETA.
|
||||
expect(status.etaToActiveWaypointSec, isNull);
|
||||
});
|
||||
|
||||
test('mit Position und Geschwindigkeit wird die ETA berechnet', () {
|
||||
final status = computeFlyMissionStatus(
|
||||
waypoints: waypoints,
|
||||
activeWaypointIndex: 1,
|
||||
currentLat: 0,
|
||||
currentLon: 0,
|
||||
currentSpeedMs: 10,
|
||||
);
|
||||
expect(status!.etaToActiveWaypointSec, closeTo(1112.6 / 10, 0.1));
|
||||
});
|
||||
|
||||
test('unter 0.5 m/s wird keine (irrefuehrende) ETA berechnet', () {
|
||||
final status = computeFlyMissionStatus(
|
||||
waypoints: waypoints,
|
||||
activeWaypointIndex: 1,
|
||||
currentLat: 0,
|
||||
currentLon: 0,
|
||||
currentSpeedMs: 0.1,
|
||||
);
|
||||
expect(status!.etaToActiveWaypointSec, isNull);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user