V3-14: GPX <type> from activity (code only)
gpxActivityType() maps Activity to Strava/Garmin's <trk><type> vocabulary; Activity.other omits the element rather than writing it empty. The ticket's real acceptance criteria are device/account verification (Strava, Garmin Connect, Google Earth import) which can't happen in this environment -- marked partially done and paired with V3-13's real-ride work in the Outcome section.
This commit is contained in:
@@ -141,6 +141,33 @@ void main() {
|
||||
expect(doc.findAllElements('trkpt').length, 1,
|
||||
reason: 'no point may be silently dropped');
|
||||
});
|
||||
|
||||
test('<type> reflects the trip activity (V3-14)', () {
|
||||
final r = ride(segmentCount: 1, perSegment: 1);
|
||||
final bike = trip.copyWith(activity: Activity.bicycle);
|
||||
|
||||
final doc = XmlDocument.parse(gpx(bike, r.segments, r.points, 'Ride'));
|
||||
|
||||
expect(doc.findAllElements('type').single.innerText, 'cycling');
|
||||
});
|
||||
|
||||
test('<type> is absent, not empty, for Activity.other (V3-14)', () {
|
||||
final r = ride(segmentCount: 1, perSegment: 1);
|
||||
final other = trip.copyWith(activity: Activity.other);
|
||||
|
||||
final doc = XmlDocument.parse(gpx(other, r.segments, r.points, 'Ride'));
|
||||
|
||||
expect(doc.findAllElements('type'), isEmpty,
|
||||
reason: 'an empty <type/> would falsely claim the element exists');
|
||||
});
|
||||
|
||||
test('gpxActivityType covers every activity without throwing', () {
|
||||
for (final activity in Activity.values) {
|
||||
// Must not throw; only Activity.other is allowed to map to null.
|
||||
final type = gpxActivityType(activity);
|
||||
expect(type == null, activity == Activity.other);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
group('geojson', () {
|
||||
|
||||
Reference in New Issue
Block a user