Files
BlockSeasons/test/ui/booster_hint_test.dart
T
airkjw 410182cf7d feat(ui): floating pulse hint for booster targeting
Replaces the plain bottom SnackBar with a BoosterHint pill that floats in
the empty space above the board: season-accent coloured, a breathing glow
that pulses only while armed (idle otherwise — no wasted ticker), slides/
fades in, shows the booster icon + prompt, and cancels on tap. 3 widget
tests; full suite 234 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 20:53:52 +09:00

55 lines
1.8 KiB
Dart

import 'package:block_seasons/game/models/booster.dart';
import 'package:block_seasons/l10n/gen/app_localizations.dart';
import 'package:block_seasons/ui/widgets/booster_hint.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
Widget wrap(Widget child) => MaterialApp(
locale: const Locale('en'),
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: Scaffold(body: Center(child: child)),
);
testWidgets('shows the cell hint for hammer and cancels on tap',
(tester) async {
var cancelled = false;
await tester.pumpWidget(wrap(BoosterHint(
arming: BoosterType.hammer,
accent: const Color(0xFF5B7FFF),
onCancel: () => cancelled = true,
)));
await tester.pump(const Duration(milliseconds: 250)); // settle entrance
expect(find.text('Tap a cell'), findsOneWidget);
await tester.tap(find.byType(BoosterHint));
expect(cancelled, isTrue);
});
testWidgets('shows the line hint for the line bomb', (tester) async {
await tester.pumpWidget(wrap(BoosterHint(
arming: BoosterType.lineBomb,
accent: const Color(0xFF5B7FFF),
onCancel: () {},
)));
await tester.pump(const Duration(milliseconds: 250));
expect(find.text('Tap a row or column'), findsOneWidget);
});
testWidgets('ignores taps when nothing is armed', (tester) async {
var cancelled = false;
await tester.pumpWidget(wrap(BoosterHint(
arming: null,
accent: const Color(0xFF5B7FFF),
onCancel: () => cancelled = true,
)));
await tester.pump(const Duration(milliseconds: 250));
await tester.tap(find.byType(BoosterHint), warnIfMissed: false);
expect(cancelled, isFalse);
});
}