refactor(ajustes): split remaining Settings sections into pushed screens

This commit is contained in:
2026-07-28 22:14:03 +02:00
parent 48ece948ff
commit c1903623be
29 changed files with 1538 additions and 735 deletions
+94 -60
View File
@@ -88,15 +88,12 @@ void main() {
// ── WU3a: AUDIO + EMISORAS become grouped nav rows ─────────────────────────
//
// Design ADR-3: the root now carries zero inline controls for the 7
// sections WU3a moved (Ecualizador, Salida de audio, Temporizador de sueño,
// Grupos de favoritos, Emisora preferida, Emisoras personalizadas, Orden de
// listas) — each is reached through a FilaAjuste row instead. The other 5
// sections (Grabaciones, Música local, Idioma, Backup, Info) still render
// inline here: WU3b decomposes GRABACIONES Y MÚSICA / APLICACIÓN the same
// way, so the root is not yet under 400 lines nor fully "zero inline
// controls" — that end state is WU3b's completion, not WU3a's (see the
// apply-progress note on this discrepancy in tasks.md 3a.1/3a.8).
// Design ADR-3: the root carries zero inline controls for the 7 sections
// WU3a moved (Ecualizador, Salida de audio, Temporizador de sueño, Grupos
// de favoritos, Emisora preferida, Emisoras personalizadas, Orden de
// listas) — each is reached through a FilaAjuste row instead. WU3b (below)
// completes the remaining 5 sections, so the root is now exactly 4
// GrupoAjustes cards, under 400 lines.
group('WU3a — AUDIO and EMISORAS groups', () {
testWidgets('AUDIO group renders exactly 3 nav rows, no inline controls', (
tester,
@@ -190,9 +187,66 @@ void main() {
});
});
// ── Sections not yet converted (WU3b's job) stay reachable ─────────────────
group('Sections pending WU3b remain inline and reachable', () {
testWidgets('Grabaciones, Idioma, Backup and Info still render', (
// ── WU3b: GRABACIONES Y MÚSICA + APLICACIÓN become grouped nav rows ───────
//
// Design ADR-3: the root now carries zero inline controls for the final 5
// sections (Grabaciones, Música local, Idioma, Backup, Info) — each is
// reached through a FilaAjuste row, matching WU3a's AUDIO/EMISORAS
// treatment. All 12 sections are decomposed now; the root is exactly 4
// GrupoAjustes cards and crosses under 400 lines (tasks.md 3b.5). The two
// "Phase 7" friendly-folder-name scenarios that used to live in this file
// are relocated verbatim to `ajustes/pantalla_ajustes_musica_local_test.dart`,
// now targeting the isolated pushed screen directly.
group('WU3b — GRABACIONES Y MÚSICA and APLICACIÓN groups', () {
testWidgets(
'RECORDINGS & MUSIC group renders exactly 2 nav rows, no inline '
'controls',
(tester) async {
setLargeSurface(tester);
_suppressListTileInkAssertion();
final estado = await crearEstado();
addTearDown(estado.dispose);
await tester.pumpWidget(buildAjustes(estado));
await pumpStable(tester);
expect(find.text('RECORDINGS & MUSIC'), findsOneWidget);
expect(find.text('Recordings'), findsOneWidget);
expect(find.text('Local music (Android Auto)'), findsOneWidget);
// Zero inline controls: the folder-path row, path action buttons and
// max-size row are gone from the root now.
expect(find.text('Change path'), findsNothing);
expect(find.text('Maximum recording size'), findsNothing);
},
);
testWidgets(
'APPLICATION group renders exactly 3 nav rows, no inline controls',
(tester) async {
setLargeSurface(tester);
_suppressListTileInkAssertion();
final estado = await crearEstado();
addTearDown(estado.dispose);
await tester.pumpWidget(buildAjustes(estado));
await pumpStable(tester);
expect(find.text('APPLICATION'), findsOneWidget);
// "Language" now renders exactly once at the root (the FilaAjuste
// row only) — the old inline dropdown's duplicate label is gone.
expect(find.text('Language'), findsOneWidget);
expect(find.text('Backup'), findsOneWidget);
expect(find.text('Info'), findsOneWidget);
// Zero inline controls: the language dropdown and export/import rows
// are gone from the root now.
expect(find.byType(DropdownButtonFormField<String>), findsNothing);
expect(find.text('Export configuration'), findsNothing);
},
);
testWidgets('tapping the Grabaciones row pushes its detail screen', (
tester,
) async {
setLargeSurface(tester);
@@ -203,50 +257,16 @@ void main() {
await tester.pumpWidget(buildAjustes(estado));
await pumpStable(tester);
expect(find.text('Recordings'), findsOneWidget);
// "Language" legitimately renders twice (pre-existing, unmodified by
// WU3a): the section header AND the dropdown's own label share the
// same l10n string.
expect(find.text('Language'), findsWidgets);
expect(find.text('Backup'), findsOneWidget);
expect(find.text('Help and tutorial'), findsOneWidget);
await tester.tap(find.text('Recordings'));
await pumpStable(tester);
expect(find.byType(PluriPushScaffold), findsOneWidget);
expect(find.text('Change path'), findsOneWidget);
});
});
// ── android-auto-local-music-paging Phase 7: friendly folder name ────────
group('_SeccionMusicaLocal — friendly folder name (Phase 7)', () {
testWidgets(
'7.1-A: carpeta configurada muestra el nombre amigable derivado de '
'la URI, nunca la URI cruda',
(tester) async {
SharedPreferences.setMockInitialValues({
'musica_local_uri':
'content://com.android.externalstorage.documents/tree/'
'primary%3AMusic%2FMyFolder',
});
setLargeSurface(tester);
_suppressListTileInkAssertion();
final estado = await crearEstado();
addTearDown(estado.dispose);
await tester.pumpWidget(buildAjustes(estado));
await pumpStable(tester);
await tester.scrollUntilVisible(
find.text('Local music folder'),
300,
scrollable: find.byType(Scrollable).first,
);
await pumpStable(tester);
expect(find.text('MyFolder'), findsOneWidget);
expect(find.textContaining('content://'), findsNothing);
},
);
testWidgets('7.1-B: sin carpeta configurada mantiene el mensaje '
'localMusicFolderNotConfigured', (tester) async {
SharedPreferences.setMockInitialValues({});
testWidgets('tapping the Info row pushes its detail screen', (
tester,
) async {
setLargeSurface(tester);
_suppressListTileInkAssertion();
final estado = await crearEstado();
@@ -255,14 +275,28 @@ void main() {
await tester.pumpWidget(buildAjustes(estado));
await pumpStable(tester);
await tester.scrollUntilVisible(
find.text('Local music folder'),
300,
scrollable: find.byType(Scrollable).first,
);
await tester.tap(find.text('Info'));
await pumpStable(tester);
expect(find.text('No folder selected'), findsOneWidget);
expect(find.byType(PluriPushScaffold), findsOneWidget);
expect(find.text('Help and tutorial'), findsOneWidget);
});
testWidgets('root now contains exactly 4 GrupoAjustes cards', (
tester,
) async {
setLargeSurface(tester);
_suppressListTileInkAssertion();
final estado = await crearEstado();
addTearDown(estado.dispose);
await tester.pumpWidget(buildAjustes(estado));
await pumpStable(tester);
expect(find.text('AUDIO'), findsOneWidget);
expect(find.text('STATIONS'), findsOneWidget);
expect(find.text('RECORDINGS & MUSIC'), findsOneWidget);
expect(find.text('APPLICATION'), findsOneWidget);
});
});
}