Merge branch 'train-days' into integration

# Conflicts:
#	apps/train/halkyon_train_flutter/lib/src/app/train_paths.dart
#	docs/adr/0030-halkyon-train.md
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-03 23:14:02 +01:00
commit 81adeb91cc
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -0,0 +1,62 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:halkyon_train_flutter/src/feature/workout/widget/workout_chart.dart';
import 'package:material_ui/material_ui.dart';
void main() {
/// A heart rate from 60 at second 0 to 120 at second 100, in steps of 10
/// a second.
Future<void> pumpChart(WidgetTester tester) => tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: SizedBox(
width: 400,
child: WorkoutChart(
title: 'Heart rate',
points: [
for (var second = 0; second <= 100; second += 10)
(x: second.toDouble(), value: 60 + second * 0.6),
],
label: (value) => '${value.round()} bpm',
xLabel: (x) => 'at ${x.round()} s',
),
),
),
),
);
testWidgets('held, the value and its moment under the finger show beside '
'the title, following the finger, and go when it lifts', (
tester,
) async {
await pumpChart(tester);
final plot = find.byKey(WorkoutChart.plotKey);
final box = tester.getRect(plot);
expect(find.text('at 0 s'), findsNothing);
// Held at the plot's start: the first point.
final gesture = await tester.startGesture(
box.centerLeft + const Offset(1, 0),
);
await tester.pump(const Duration(milliseconds: 600));
expect(find.text('60 bpm · at 0 s'), findsOneWidget);
// Dragged to the middle: second 50, 90 bpm.
await gesture.moveTo(box.center);
await tester.pump();
expect(find.text('90 bpm · at 50 s'), findsOneWidget);
expect(find.text('60 bpm · at 0 s'), findsNothing);
await gesture.up();
await tester.pump();
expect(find.textContaining(' · at '), findsNothing);
});
testWidgets('a tap shows nothing: only a long press inspects', (
tester,
) async {
await pumpChart(tester);
await tester.tap(find.byKey(WorkoutChart.plotKey));
await tester.pump();
expect(find.textContaining(' · at '), findsNothing);
});
}