fix(i18n): normalize translations and fallbacks
This commit is contained in:
@@ -22,6 +22,7 @@ void main() {
|
||||
testWidgets(
|
||||
'PantallaInicio muestra custom, reproducir usa EstadoRadio y favorito usa flujo existente',
|
||||
(tester) async {
|
||||
_setLargeSurfaceSize(tester);
|
||||
final audio = FakeServicioAudio();
|
||||
final favoritos = FakeServicioFavoritos();
|
||||
final radio = FakeServicioRadio();
|
||||
@@ -47,6 +48,7 @@ void main() {
|
||||
);
|
||||
await _pumpStableFrame(tester);
|
||||
|
||||
await _scrollUntilText(tester, 'Custom Uno');
|
||||
expect(find.text('Custom Uno'), findsOneWidget);
|
||||
|
||||
await tester.ensureVisible(find.text('Custom Uno'));
|
||||
@@ -82,6 +84,7 @@ void main() {
|
||||
testWidgets(
|
||||
'PantallaInicio permite reintentar manualmente tras fallo inicial agotado',
|
||||
(tester) async {
|
||||
_setLargeSurfaceSize(tester);
|
||||
final radio = FakeServicioRadio(
|
||||
erroresPopularesPorLlamada: [Exception('sin red')],
|
||||
popularesPorLlamada: [
|
||||
@@ -113,6 +116,7 @@ void main() {
|
||||
);
|
||||
await _pumpStableFrame(tester);
|
||||
|
||||
await _scrollUntilText(tester, 'Sin conexión a la API de radio');
|
||||
expect(find.text('Sin conexión a la API de radio'), findsOneWidget);
|
||||
expect(find.text('Reintentar'), findsOneWidget);
|
||||
|
||||
@@ -130,6 +134,7 @@ void main() {
|
||||
testWidgets('PantallaFavoritos muestra custom favorito tras recarga', (
|
||||
tester,
|
||||
) async {
|
||||
_setLargeSurfaceSize(tester);
|
||||
final favoritos = FakeServicioFavoritos();
|
||||
final custom = emisoraDemo(uuid: 'custom-1', nombre: 'Custom Uno');
|
||||
final archivo = await _crearArchivoCustom([custom]);
|
||||
@@ -155,7 +160,7 @@ void main() {
|
||||
);
|
||||
await _pumpStableFrame(tester);
|
||||
|
||||
await tester.ensureVisible(find.text('Custom Uno'));
|
||||
await _scrollUntilText(tester, 'Custom Uno');
|
||||
await _pumpStableFrame(tester);
|
||||
final tarjetaCustom = find.ancestor(
|
||||
of: find.text('Custom Uno'),
|
||||
@@ -185,6 +190,7 @@ void main() {
|
||||
|
||||
Widget _testApp(Widget body) {
|
||||
return MaterialApp(
|
||||
locale: const Locale('es'),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: Scaffold(body: body),
|
||||
@@ -209,7 +215,23 @@ class FakeServicioGrabacionRadio extends ServicioGrabacionRadio {
|
||||
|
||||
Future<void> _pumpStableFrame(WidgetTester tester) async {
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 100));
|
||||
await tester.pumpAndSettle(const Duration(milliseconds: 100));
|
||||
}
|
||||
|
||||
void _setLargeSurfaceSize(WidgetTester tester) {
|
||||
tester.view.physicalSize = const Size(1440, 3200);
|
||||
tester.view.devicePixelRatio = 1.0;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
}
|
||||
|
||||
Future<void> _scrollUntilText(WidgetTester tester, String text) async {
|
||||
await tester.scrollUntilVisible(
|
||||
find.text(text),
|
||||
300,
|
||||
scrollable: find.byType(Scrollable).first,
|
||||
);
|
||||
await _pumpStableFrame(tester);
|
||||
}
|
||||
|
||||
Future<File> _crearArchivoCustom(List<dynamic> emisoras) async {
|
||||
|
||||
Reference in New Issue
Block a user