mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-11-21 20:00:49 +01:00
Flutter 3.50 deprecates its built-in Material and Cupertino libraries in favour of the material_ui and cupertino_ui packages. The imports move with the official fix (dart fix, migrate_design_widgets); the app's old two-library theme bridge collapses into one Theme type. - MaterialExpressiveScope keeps the complete host theme nearest its child. The reduced copy made for the expressive widgets now shares the app's Theme type and would hide component themes and extensions. - LegacyThemeBrightness hands the brightness to the glass package, which still reads Flutter's built-in theme. - appLocalizationsDelegates lists the material_ui localization delegates; the generated list still names the built-in ones. - Tests: findByTooltip and pageBack replace the flutter_test helpers that only know the built-in widgets, and several tests that had gone stale against earlier app changes are repaired.
69 lines
2.3 KiB
Dart
69 lines
2.3 KiB
Dart
import 'package:material_ui/material_ui.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import 'package:mornye/l10n/l10n.dart';
|
|
import 'package:mornye/models/settings.dart';
|
|
import 'package:mornye/providers/settings_provider.dart';
|
|
import 'package:mornye/widgets/app_slider.dart';
|
|
import 'package:mornye/widgets/playback_normalization_settings.dart';
|
|
|
|
void main() {
|
|
Future<ProviderContainer> pump(
|
|
WidgetTester tester, {
|
|
bool enabled = true,
|
|
}) async {
|
|
SharedPreferences.setMockInitialValues({});
|
|
final container = ProviderContainer(
|
|
overrides: [
|
|
initialSettingsProvider.overrideWithValue(
|
|
const AppSettings(playbackNormalization: true),
|
|
),
|
|
],
|
|
);
|
|
addTearDown(container.dispose);
|
|
await tester.pumpWidget(
|
|
UncontrolledProviderScope(
|
|
container: container,
|
|
child: MaterialApp(
|
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
|
supportedLocales: AppLocalizations.supportedLocales,
|
|
home: Scaffold(
|
|
body: SingleChildScrollView(
|
|
child: PlaybackNormalizationSettings(enabled: enabled),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
return container;
|
|
}
|
|
|
|
testWidgets('pre-amp shows its target and saves at the end of a drag', (
|
|
tester,
|
|
) async {
|
|
final container = await pump(tester);
|
|
expect(find.text('Pre-amp'), findsOneWidget);
|
|
expect(find.text('0 dB (target -18 LUFS)'), findsOneWidget);
|
|
|
|
final slider = tester.widget<AppSlider>(find.byType(AppSlider));
|
|
slider.onChanged!(-7);
|
|
await tester.pump();
|
|
expect(find.text('-7 dB (target -25 LUFS)'), findsOneWidget);
|
|
expect(container.read(settingsProvider).playbackNormalizationPreamp, 0);
|
|
|
|
slider.onChangeEnd!(-7);
|
|
await tester.pump();
|
|
expect(container.read(settingsProvider).playbackNormalizationPreamp, -7);
|
|
|
|
await tester.tap(find.text('Album'));
|
|
await tester.pump();
|
|
expect(container.read(settingsProvider).playbackNormalizationMode, 'album');
|
|
});
|
|
|
|
testWidgets('bit-perfect output disables the controls', (tester) async {
|
|
await pump(tester, enabled: false);
|
|
expect(tester.widget<AppSlider>(find.byType(AppSlider)).onChanged, isNull);
|
|
});
|
|
}
|