A whole bunch of changes

This commit is contained in:
Courtney Arnold 2026-08-15 17:52:25 -05:00
parent 901ec678a3
commit 956231048e
122 changed files with 5442 additions and 914 deletions

View file

@ -0,0 +1,59 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:provider/provider.dart';
import 'package:fuel_tax_tracker/screens/data_settings_screen.dart';
import 'package:fuel_tax_tracker/screens/settings_screen.dart';
import 'package:fuel_tax_tracker/screens/ui_settings_screen.dart';
import 'package:fuel_tax_tracker/services/app_state.dart';
/// Covers the Settings landing page's menu wiring: it groups settings into
/// two submenus — [UiSettingsScreen] (appearance) and [DataSettingsScreen]
/// (cloud storage, photo syncing/quality, advanced/purge) — plus keeps a
/// read-only summary on the landing page itself. The submenu screens'
/// actual contents are covered by theme_toggle_test.dart and
/// settings_purge_test.dart respectively.
void main() {
Future<void> pumpSettings(WidgetTester tester) async {
final appState = AppState()..isLoading = false;
await tester.pumpWidget(
ChangeNotifierProvider.value(
value: appState,
child: const MaterialApp(home: SettingsScreen()),
),
);
}
testWidgets('shows UI and Data menu entries, plus the summary', (tester) async {
await pumpSettings(tester);
expect(find.text('UI'), findsOneWidget);
expect(find.text('Data'), findsOneWidget);
expect(find.text('Summary'), findsOneWidget);
// None of Data's contents leaked onto the landing page.
expect(find.text('Cloud Storage'), findsNothing);
expect(find.text('Advanced'), findsNothing);
});
testWidgets('tapping UI opens UiSettingsScreen', (tester) async {
await pumpSettings(tester);
await tester.tap(find.text('UI'));
await tester.pumpAndSettle();
expect(find.byType(UiSettingsScreen), findsOneWidget);
expect(find.text('Appearance'), findsOneWidget);
});
testWidgets('tapping Data opens DataSettingsScreen', (tester) async {
await pumpSettings(tester);
await tester.tap(find.text('Data'));
await tester.pumpAndSettle();
expect(find.byType(DataSettingsScreen), findsOneWidget);
expect(find.text('Cloud Storage'), findsOneWidget);
await tester.scrollUntilVisible(find.text('Advanced'), 200, scrollable: find.byType(Scrollable));
expect(find.text('Advanced'), findsOneWidget);
});
}