halkyon/halkyon_learn_flutter/test/support/loaded_strokes.dart
Tizian 「ティツィアーン」 e7f3abdb8d
fix(dictionary): a Hanja reads 물 수, and each radical's form shows once
Korean names a Hanja by its meaning, then its sound; simplified Chinese
shares some radicals' forms with Japanese (麦), which showed twice, and
writes 黑 as itself. A test can read a language's strokes beforehand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-10-14 14:35:35 +02:00

20 lines
731 B
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:halkyon_learn_flutter/src/feature/kanji/data/stroke_repository.dart';
/// The bundled strokes of [characters] in [language], read already:
/// reading an asset is real input, which a widget test's fake clock never
/// lets finish, so it happens outside it and the app gets this repository
/// (`testDependencies(strokes: ...)`).
Future<StrokeRepository> loadedStrokes(
WidgetTester tester,
Iterable<String> characters, {
String? language,
}) async {
final strokes = StrokeRepository();
await tester.runAsync(() async {
for (final character in characters) {
await strokes.strokesOf(character, language: language);
}
});
return strokes;
}