57 lines
2.1 KiB
Dart
57 lines
2.1 KiB
Dart
// Author: fruit.com.cn
|
|
|
|
import 'package:flutter/widgets.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:fruitshorts/l10n/app_localizations.dart';
|
|
|
|
/// id-ID 文案接入的可读证据:设备语言是 `id` 时真的拿到印尼语、`id` 在支持列表里、
|
|
/// 并且品牌文案里不再有 demo 标记。
|
|
void main() {
|
|
test('should_return_indonesian_copy_when_locale_is_id', () async {
|
|
final l10n = await AppLocalizations.delegate.load(const Locale('id'));
|
|
|
|
expect(l10n.homeTab, 'Beranda');
|
|
expect(l10n.watchNow, 'Tonton gratis');
|
|
expect(l10n.coins, 'Koin');
|
|
expect(l10n.signIn, 'Masuk');
|
|
});
|
|
|
|
test('should_include_id_when_supported_locales_are_read', () {
|
|
final codes = AppLocalizations.supportedLocales
|
|
.map((locale) => locale.languageCode)
|
|
.toList();
|
|
|
|
expect(codes, containsAll(<String>['en', 'zh', 'id']));
|
|
});
|
|
|
|
test('should_drop_demo_marker_when_brand_copy_is_loaded', () async {
|
|
for (final locale in const [Locale('en'), Locale('zh'), Locale('id')]) {
|
|
final l10n = await AppLocalizations.delegate.load(locale);
|
|
|
|
expect(l10n.appName, 'FruitShorts', reason: '$locale appName');
|
|
expect(l10n.brandMark, 'FRUITSHORTS', reason: '$locale brandMark');
|
|
expect(l10n.shareFooter, 'FruitShorts', reason: '$locale shareFooter');
|
|
expect(l10n.brandMark.toLowerCase(), isNot(contains('demo')));
|
|
expect(l10n.shareFooter.toLowerCase(), isNot(contains('demo')));
|
|
}
|
|
});
|
|
|
|
test('should_keep_placeholders_when_indonesian_copy_renders', () async {
|
|
final l10n = await AppLocalizations.delegate.load(const Locale('id'));
|
|
|
|
expect(l10n.episodeLabel(3), contains('3'));
|
|
expect(l10n.episodeProgress(2, 10), contains('2'));
|
|
expect(l10n.episodeProgress(2, 10), contains('10'));
|
|
});
|
|
|
|
test('should_keep_auth_ui_copy_in_all_supported_locales', () async {
|
|
for (final locale in const [Locale('en'), Locale('zh'), Locale('id')]) {
|
|
final l10n = await AppLocalizations.delegate.load(locale);
|
|
expect(l10n.authBrandTagline, isNotEmpty);
|
|
expect(l10n.showPassword, isNotEmpty);
|
|
expect(l10n.hidePassword, isNotEmpty);
|
|
}
|
|
});
|
|
}
|