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:
@@ -1,6 +1,8 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:rippr/src/config/config.dart';
|
||||
import 'package:rippr/src/domain/models.dart';
|
||||
import 'package:rippr/src/hud/hud_metric.dart';
|
||||
import 'package:rippr/src/hud/hud_widget_layout.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
/// `Config` had no dedicated tests before V3-03 — every existing widget test leaves
|
||||
@@ -81,6 +83,57 @@ void main() {
|
||||
});
|
||||
});
|
||||
|
||||
group('hudLayout (UI-04)', () {
|
||||
test('a fresh install gets a default layout for every metric', () async {
|
||||
final config = await freshConfig();
|
||||
final layout = config.hudLayout;
|
||||
expect(layout.keys.toSet(), HudMetric.values.toSet());
|
||||
});
|
||||
|
||||
test('round-trips an edited layout through set/get', () async {
|
||||
final config = await freshConfig();
|
||||
final edited = {
|
||||
...config.hudLayout,
|
||||
HudMetric.speed: const HudWidgetLayout(
|
||||
metric: HudMetric.speed,
|
||||
x: 0.33,
|
||||
y: 0.44,
|
||||
width: 0.25,
|
||||
height: 0.1,
|
||||
visible: true,
|
||||
),
|
||||
};
|
||||
|
||||
await config.setHudLayout(edited);
|
||||
final reloaded = config.hudLayout;
|
||||
|
||||
expect(reloaded[HudMetric.speed]!.x, 0.33);
|
||||
expect(reloaded[HudMetric.speed]!.y, 0.44);
|
||||
});
|
||||
|
||||
test('a metric missing from a saved layout (e.g. one added in a later app '
|
||||
'version) falls back to its default rather than being omitted', () async {
|
||||
SharedPreferences.setMockInitialValues({
|
||||
'hud_layout': '{"speed": {"x": 0.1, "y": 0.1, "width": 0.2, "height": 0.1, '
|
||||
'"visible": true}}',
|
||||
});
|
||||
final config = await Config.load();
|
||||
final layout = config.hudLayout;
|
||||
|
||||
expect(layout.keys.toSet(), HudMetric.values.toSet());
|
||||
final expectedDefault = HudWidgetLayout.defaultFor(HudMetric.distance);
|
||||
expect(layout[HudMetric.distance]!.x, expectedDefault.x);
|
||||
expect(layout[HudMetric.distance]!.visible, expectedDefault.visible);
|
||||
});
|
||||
|
||||
test('corrupted stored JSON falls back to defaults rather than crashing',
|
||||
() async {
|
||||
SharedPreferences.setMockInitialValues({'hud_layout': 'not json at all'});
|
||||
final config = await Config.load();
|
||||
expect(config.hudLayout.keys.toSet(), HudMetric.values.toSet());
|
||||
});
|
||||
});
|
||||
|
||||
group('deviceId', () {
|
||||
test('is generated once and then stable across reads', () async {
|
||||
final config = await freshConfig();
|
||||
|
||||
Reference in New Issue
Block a user