mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-11-29 09:11:17 +01:00
With the virtual front derailleur on, the compact gear readout switches from rear gear/total (14/25) to head-unit-style front×rear position notation (small ring 1×N, large ring 2×N, e.g. 2×14) — matching how Garmin/Wahoo display Di2/AXS gearing. With it off, it stays 14/25. - Add tested formatGearReadout helper. - Wire into the proxy card, debug menu, desktop second window + Android PiP/overlay (trainer_overlay_view), and the gear hero card (2× · 50T). - Carry frontShiftEnabled + frontRingLarge through TrainerOverlayState (json, ==, hashCode, activity map) so the snapshot reaches the overlay and the iOS surfaces. - iOS PiP + Live Activity: format 2×N centrally in GearSnapshot. - Standardize the off-state readout to 14/25 across all surfaces. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
41 lines
1.3 KiB
Dart
41 lines
1.3 KiB
Dart
import 'package:bike_control/utils/gear_readout.dart';
|
||
import 'package:flutter_test/flutter_test.dart';
|
||
|
||
void main() {
|
||
group('formatGearReadout', () {
|
||
test('shows rear gear / total when front shift is off', () {
|
||
expect(
|
||
formatGearReadout(currentGear: 14, maxGear: 25, frontShiftEnabled: false, largeRing: false),
|
||
'14/25',
|
||
);
|
||
});
|
||
|
||
test('largeRing is ignored when front shift is off', () {
|
||
expect(
|
||
formatGearReadout(currentGear: 14, maxGear: 25, frontShiftEnabled: false, largeRing: true),
|
||
'14/25',
|
||
);
|
||
});
|
||
|
||
test('small ring shows position 1 × rear gear when front shift is on', () {
|
||
expect(
|
||
formatGearReadout(currentGear: 14, maxGear: 25, frontShiftEnabled: true, largeRing: false),
|
||
'1×14',
|
||
);
|
||
});
|
||
|
||
test('large ring shows position 2 × rear gear when front shift is on', () {
|
||
expect(
|
||
formatGearReadout(currentGear: 14, maxGear: 25, frontShiftEnabled: true, largeRing: true),
|
||
'2×14',
|
||
);
|
||
});
|
||
|
||
test('drops the total when front shift is on (position notation only)', () {
|
||
final out = formatGearReadout(currentGear: 7, maxGear: 30, frontShiftEnabled: true, largeRing: true);
|
||
expect(out, '2×7');
|
||
expect(out.contains('/'), isFalse);
|
||
});
|
||
});
|
||
}
|