feat(train): a route's line pulled out into a new waypoint, and any waypoint taken off (ADR 0030, D59)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-30 23:01:04 +01:00
commit 57262ebf73
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -2,6 +2,7 @@ import 'dart:convert';
import 'dart:io';
import 'package:clock/clock.dart';
import 'package:flutter/gestures.dart' show kLongPressTimeout;
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:halkyon_app/halkyon_app.dart';
@ -2138,8 +2139,8 @@ void main() {
await tester.pumpAndSettle();
expect(
find.text(
'Tap the map to add a waypoint; hold one and drag it to '
'move it.',
'Tap the map to add a waypoint, tap one to take it off. Hold '
'one to drag it, or hold the line to pull out another.',
),
findsOneWidget,
);
@ -2183,8 +2184,8 @@ void main() {
expect(find.text('1'), findsOneWidget);
expect(
find.text(
'Tap the map to add a waypoint; hold one and drag it to '
'move it.',
'Tap the map to add a waypoint, tap one to take it off. Hold '
'one to drag it, or hold the line to pull out another.',
),
findsOneWidget,
);
@ -2269,6 +2270,39 @@ void main() {
expect(find.textContaining('No way found there'), findsNothing);
});
testWidgets('the line held and dragged pulls out a waypoint between the '
'two around it, and a waypoint tapped is taken off (D59)', (
tester,
) async {
await openRoutes(tester, at: (lat: 48.137, lon: 11.575));
await tester.tap(find.text('New route'));
await tester.pumpAndSettle();
await tapMap(tester, const Offset(120, 80));
final [start, end] = routing.asked.last.waypoints;
final centre = tester.getCenter(find.byType(FlutterMap));
final gesture = await tester.startGesture(
centre + const Offset(60, 40),
);
await tester.pump(kLongPressTimeout + const Duration(milliseconds: 100));
await gesture.moveTo(centre + const Offset(60, -60));
await tester.pump();
await gesture.up();
await tester.pumpAndSettle();
final [first, pulled, last] = routing.asked.last.waypoints;
expect((first, last), (start, end));
expect(pulled.latitude, greaterThan(start.latitude));
expect(find.text('3'), findsOneWidget);
await tester.tap(find.text('1'));
await tester.pumpAndSettle();
await tester.tap(find.text('Take this waypoint off'));
await tester.pumpAndSettle();
expect(routing.asked.last.waypoints, [pulled, end]);
expect(find.text('3'), findsNothing);
});
testWidgets('the maps stop where their tiles stop being drawn', (
tester,
) async {