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.
93 lines
3.1 KiB
Dart
93 lines
3.1 KiB
Dart
import 'package:material_ui/material_ui.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:mornye/constants/language_choices.dart';
|
|
import 'package:mornye/l10n/l10n.dart';
|
|
import 'package:mornye/l10n/supported_locales.dart';
|
|
|
|
void main() {
|
|
test('selectable languages have generated localizations', () async {
|
|
for (final choice in supportedLanguageChoices) {
|
|
if (choice.$1 == 'system') continue;
|
|
final parts = choice.$1.split('_');
|
|
final locale = Locale(parts.first, parts.length == 2 ? parts.last : null);
|
|
expect(AppLocalizations.delegate.isSupported(locale), isTrue);
|
|
final strings = await AppLocalizations.delegate.load(locale);
|
|
expect(strings.settingsTitle, isNotEmpty);
|
|
}
|
|
expect(
|
|
supportedLanguageChoices.map((choice) => choice.$1),
|
|
containsAll(['vi', 'zh_CN']),
|
|
);
|
|
});
|
|
|
|
test(
|
|
'imported conversion labels keep format and quality arguments',
|
|
() async {
|
|
for (final locale in filteredSupportedLocales) {
|
|
final strings = await AppLocalizations.delegate.load(locale);
|
|
final lossless = strings.trackConvertActionLabelLossless(
|
|
'SOURCE_FORMAT',
|
|
'TARGET_FORMAT',
|
|
'QUALITY',
|
|
);
|
|
final lossy = strings.trackConvertActionLabelLossy(
|
|
'SOURCE_FORMAT',
|
|
'TARGET_FORMAT',
|
|
'BITRATE',
|
|
);
|
|
for (final value in ['SOURCE_FORMAT', 'TARGET_FORMAT', 'QUALITY']) {
|
|
expect(lossless, contains(value), reason: locale.toString());
|
|
}
|
|
for (final value in ['SOURCE_FORMAT', 'TARGET_FORMAT', 'BITRATE']) {
|
|
expect(lossy, contains(value), reason: locale.toString());
|
|
}
|
|
}
|
|
},
|
|
);
|
|
|
|
test('duplicate warnings keep only the two count arguments', () async {
|
|
for (final locale in filteredSupportedLocales) {
|
|
final strings = await AppLocalizations.delegate.load(locale);
|
|
final message = strings.duplicatesKeepBestAllMessage(19, 7);
|
|
expect(message, contains('19'), reason: locale.toString());
|
|
expect(message, contains('7'), reason: locale.toString());
|
|
}
|
|
});
|
|
|
|
test('paused scan notifications retain the scanned file count', () async {
|
|
for (final locale in filteredSupportedLocales) {
|
|
final strings = await AppLocalizations.delegate.load(locale);
|
|
expect(
|
|
strings.notifLibraryScanPausedBody(37),
|
|
contains('37'),
|
|
reason: locale.toString(),
|
|
);
|
|
}
|
|
});
|
|
|
|
for (final (locale, title) in [
|
|
(const Locale('vi'), 'Cài đặt'),
|
|
(const Locale('zh', 'CN'), '设置'),
|
|
]) {
|
|
testWidgets('new locale $locale loads through the app delegates', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
locale: locale,
|
|
supportedLocales: filteredSupportedLocales,
|
|
localizationsDelegates: appLocalizationsDelegates,
|
|
home: Builder(
|
|
builder: (context) => Scaffold(
|
|
body: Text(AppLocalizations.of(context).settingsTitle),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
expect(find.text(title), findsOneWidget);
|
|
expect(tester.takeException(), isNull);
|
|
});
|
|
}
|
|
}
|