Refresh the Flutter snapshot: UI-01 through UI-09, plus a fresh installable APK
Full UI redesign pass complete: persistent tab shell with an always-visible background map, Modern Professional Dark theme, monochrome dark map tiles, offline skeleton map, a shared GlassPanel/FloatingPill component kit, customizable HUD telemetry widgets, and the Map HUD / Plan & Route Planning / Rides History screen rebuilds. 374 tests passing, up from 316. The APK is a fresh release build (debug-signed, no release signing config exists yet). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Xki7YAcc2TiN2PRZJ2tXr
This commit is contained in:
43
rippr-flutter-src/test/ride_history_summary_test.dart
Normal file
43
rippr-flutter-src/test/ride_history_summary_test.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:rippr/src/domain/models.dart';
|
||||
import 'package:rippr/src/ui/trips/trips_screen.dart';
|
||||
|
||||
/// UI-07: `RideHistorySummary.compute` is a pure function specifically so it can be
|
||||
/// tested directly against a hand-computed total, rather than through a screen.
|
||||
void main() {
|
||||
test('compute matches a hand-computed total over a fixed set of trips', () {
|
||||
final trips = [
|
||||
const Trip(
|
||||
id: 1,
|
||||
startedAt: 0,
|
||||
endedAt: 3600000,
|
||||
distanceM: 20000,
|
||||
movingMillis: 3600000,
|
||||
),
|
||||
const Trip(
|
||||
id: 2,
|
||||
startedAt: 0,
|
||||
endedAt: 1800000,
|
||||
distanceM: 5000,
|
||||
movingMillis: 1800000,
|
||||
),
|
||||
];
|
||||
|
||||
final summary = RideHistorySummary.compute(trips);
|
||||
|
||||
expect(summary.rideCount, 2);
|
||||
expect(summary.totalDistanceM, 25000);
|
||||
expect(summary.totalMovingMillis, 5400000);
|
||||
// Distance-weighted, not an average of each ride's own average: 25 km over 1.5 h.
|
||||
expect(summary.avgSpeedKmh, closeTo(25 / 1.5, 0.0001));
|
||||
});
|
||||
|
||||
test('an empty history has zero average speed, not a division error', () {
|
||||
final summary = RideHistorySummary.compute(const []);
|
||||
|
||||
expect(summary.rideCount, 0);
|
||||
expect(summary.totalDistanceM, 0);
|
||||
expect(summary.totalMovingMillis, 0);
|
||||
expect(summary.avgSpeedKmh, 0);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user