Revert "Enable avoid_redundant_argument_values lint (#91409)" (#91461)

This reverts commit 5fd259be24.
This commit is contained in:
Zachary Anderson
2021-10-07 21:11:07 -07:00
committed by GitHub
parent 5fd259be24
commit b9d2177da0
667 changed files with 3385 additions and 1693 deletions

View File

@@ -144,7 +144,7 @@ void main() {
if (noCupertinoArbFile.existsSync() && !nbCupertinoArbFile.existsSync()) {
Locale locale = const Locale.fromSubtags(languageCode: 'no');
Locale locale = const Locale.fromSubtags(languageCode: 'no', scriptCode: null, countryCode: null);
expect(GlobalCupertinoLocalizations.delegate.isSupported(locale), isTrue);
CupertinoLocalizations localizations = await GlobalCupertinoLocalizations.delegate.load(locale);
expect(localizations, isA<CupertinoLocalizationNo>());
@@ -153,7 +153,7 @@ void main() {
final String copyButtonLabelNo = localizations.copyButtonLabel;
final String cutButtonLabelNo = localizations.cutButtonLabel;
locale = const Locale.fromSubtags(languageCode: 'nb');
locale = const Locale.fromSubtags(languageCode: 'nb', scriptCode: null, countryCode: null);
expect(GlobalCupertinoLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalCupertinoLocalizations.delegate.load(locale);
expect(localizations, isA<CupertinoLocalizationNb>());

View File

@@ -13,7 +13,7 @@ void main() {
late DateTime initialDate;
setUp(() {
firstDate = DateTime(2001, DateTime.january);
firstDate = DateTime(2001, DateTime.january, 1);
lastDate = DateTime(2031, DateTime.december, 31);
initialDate = DateTime(2016, DateTime.january, 15);
});
@@ -140,6 +140,9 @@ void main() {
testWidgets('textDirection parameter overrides ambient textDirection', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
locale: const Locale('en', 'US'),
supportedLocales: const <Locale>[
Locale('en', 'US'),
],
home: Material(
child: Builder(
builder: (BuildContext context) {

View File

@@ -144,7 +144,7 @@ void main() {
}
testWidgets('formats dates in English', (WidgetTester tester) async {
final Map<DateType, String> formatted = await formatDate(tester, const Locale('en'), DateTime(2018, 8));
final Map<DateType, String> formatted = await formatDate(tester, const Locale('en'), DateTime(2018, 8, 1));
expect(formatted[DateType.year], '2018');
expect(formatted[DateType.medium], 'Wed, Aug 1');
expect(formatted[DateType.full], 'Wednesday, August 1, 2018');
@@ -152,7 +152,7 @@ void main() {
});
testWidgets('formats dates in German', (WidgetTester tester) async {
final Map<DateType, String> formatted = await formatDate(tester, const Locale('de'), DateTime(2018, 8));
final Map<DateType, String> formatted = await formatDate(tester, const Locale('de'), DateTime(2018, 8, 1));
expect(formatted[DateType.year], '2018');
expect(formatted[DateType.medium], 'Mi., 1. Aug.');
expect(formatted[DateType.full], 'Mittwoch, 1. August 2018');
@@ -160,7 +160,7 @@ void main() {
});
testWidgets('formats dates in Serbian', (WidgetTester tester) async {
final Map<DateType, String> formatted = await formatDate(tester, const Locale('sr'), DateTime(2018, 8));
final Map<DateType, String> formatted = await formatDate(tester, const Locale('sr'), DateTime(2018, 8, 1));
expect(formatted[DateType.year], '2018.');
expect(formatted[DateType.medium], 'сре 1. авг');
expect(formatted[DateType.full], 'среда, 1. август 2018.');
@@ -169,7 +169,7 @@ void main() {
testWidgets('formats dates in Serbian (Latin)', (WidgetTester tester) async {
final Map<DateType, String> formatted = await formatDate(tester,
const Locale.fromSubtags(languageCode:'sr', scriptCode: 'Latn'), DateTime(2018, 8));
const Locale.fromSubtags(languageCode:'sr', scriptCode: 'Latn'), DateTime(2018, 8, 1));
expect(formatted[DateType.year], '2018.');
expect(formatted[DateType.medium], 'sre 1. avg');
expect(formatted[DateType.full], 'sreda, 1. avgust 2018.');
@@ -183,6 +183,9 @@ void main() {
late DateFormat dateFormat;
await tester.pumpWidget(MaterialApp(
supportedLocales: const <Locale>[
Locale('en', 'US'),
],
locale: const Locale('en', 'US'),
localizationsDelegates: const <LocalizationsDelegate<dynamic>>[
GlobalMaterialLocalizations.delegate,

View File

@@ -14,6 +14,7 @@ void main() {
final TabController controller = TabController(
vsync: const TestVSync(),
length: 2,
initialIndex: 0,
);
await tester.pumpWidget(

View File

@@ -88,10 +88,10 @@ void main() {
expect(localizations.formatHour(const TimeOfDay(hour: 10, minute: 0)), isNotNull);
expect(localizations.formatMinute(const TimeOfDay(hour: 10, minute: 0)), isNotNull);
expect(localizations.formatYear(DateTime(2018, 8)), isNotNull);
expect(localizations.formatMediumDate(DateTime(2018, 8)), isNotNull);
expect(localizations.formatFullDate(DateTime(2018, 8)), isNotNull);
expect(localizations.formatMonthYear(DateTime(2018, 8)), isNotNull);
expect(localizations.formatYear(DateTime(2018, 8, 1)), isNotNull);
expect(localizations.formatMediumDate(DateTime(2018, 8, 1)), isNotNull);
expect(localizations.formatFullDate(DateTime(2018, 8, 1)), isNotNull);
expect(localizations.formatMonthYear(DateTime(2018, 8, 1)), isNotNull);
expect(localizations.narrowWeekdays, isNotNull);
expect(localizations.narrowWeekdays.length, 7);
expect(localizations.formatDecimal(123), isNotNull);
@@ -100,14 +100,14 @@ void main() {
}
testWidgets('translations spot check', (WidgetTester tester) async {
Locale locale = const Locale.fromSubtags(languageCode: 'zh');
Locale locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: null, countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
MaterialLocalizations localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationZh>());
expect(localizations.firstPageTooltip, '第一页');
expect(localizations.lastPageTooltip, '最后一页');
locale = const Locale.fromSubtags(languageCode: 'zu');
locale = const Locale.fromSubtags(languageCode: 'zu', scriptCode: null, countryCode: null);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
expect(localizations.firstPageTooltip, 'Ikhasi lokuqala');
@@ -181,7 +181,7 @@ void main() {
});
testWidgets('Chinese resolution', (WidgetTester tester) async {
Locale locale = const Locale.fromSubtags(languageCode: 'zh');
Locale locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: null, countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
MaterialLocalizations localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationZh>());
@@ -191,22 +191,22 @@ void main() {
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationZhHantTw>());
locale = const Locale.fromSubtags(languageCode: 'zh', countryCode: 'HK');
locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: null, countryCode: 'HK');
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationZhHantHk>());
locale = const Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW');
locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: null, countryCode: 'TW');
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationZhHantTw>());
locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans');
locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans', countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationZhHans>());
locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant');
locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant', countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationZhHant>());
@@ -236,7 +236,7 @@ void main() {
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationZhHant>());
locale = const Locale.fromSubtags(languageCode: 'zh', countryCode: 'US');
locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: null, countryCode: 'US');
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationZh>());
@@ -251,7 +251,7 @@ void main() {
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationZh>());
locale = const Locale.fromSubtags(languageCode: 'en', countryCode: 'TW');
locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: null, countryCode: 'TW');
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationEn>());
@@ -261,34 +261,34 @@ void main() {
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationZh>());
locale = const Locale.fromSubtags(languageCode: 'zh', countryCode: 'RU');
locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: null, countryCode: 'RU');
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationZh>());
locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Cyrl');
locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Cyrl', countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationZh>());
});
testWidgets('Serbian resolution', (WidgetTester tester) async {
Locale locale = const Locale.fromSubtags(languageCode: 'sr');
Locale locale = const Locale.fromSubtags(languageCode: 'sr', scriptCode: null, countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
MaterialLocalizations localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationSr>());
locale = const Locale.fromSubtags(languageCode: 'sr', scriptCode: 'Cyrl');
locale = const Locale.fromSubtags(languageCode: 'sr', scriptCode: 'Cyrl', countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationSrCyrl>());
locale = const Locale.fromSubtags(languageCode: 'sr', scriptCode: 'Latn');
locale = const Locale.fromSubtags(languageCode: 'sr', scriptCode: 'Latn', countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationSrLatn>());
locale = const Locale.fromSubtags(languageCode: 'sr', countryCode: 'SR');
locale = const Locale.fromSubtags(languageCode: 'sr', scriptCode: null, countryCode: 'SR');
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationSr>());
@@ -313,49 +313,49 @@ void main() {
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationSrLatn>());
locale = const Locale.fromSubtags(languageCode: 'sr', countryCode: 'US');
locale = const Locale.fromSubtags(languageCode: 'sr', scriptCode: null, countryCode: 'US');
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationSr>());
});
testWidgets('Misc resolution', (WidgetTester tester) async {
Locale locale = const Locale.fromSubtags(languageCode: 'en');
Locale locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: null, countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
MaterialLocalizations localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationEn>());
locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: 'Cyrl');
locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: 'Cyrl', countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationEn>());
locale = const Locale.fromSubtags(languageCode: 'en', countryCode: 'US');
locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: null, countryCode: 'US');
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationEn>());
locale = const Locale.fromSubtags(languageCode: 'en', countryCode: 'AU');
locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: null, countryCode: 'AU');
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationEnAu>());
locale = const Locale.fromSubtags(languageCode: 'en', countryCode: 'GB');
locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: null, countryCode: 'GB');
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationEnGb>());
locale = const Locale.fromSubtags(languageCode: 'en', countryCode: 'SG');
locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: null, countryCode: 'SG');
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationEnSg>());
locale = const Locale.fromSubtags(languageCode: 'en', countryCode: 'MX');
locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: null, countryCode: 'MX');
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationEn>());
locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: 'Hant');
locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: 'Hant', countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationEn>());
@@ -370,37 +370,37 @@ void main() {
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationEn>());
locale = const Locale.fromSubtags(languageCode: 'es');
locale = const Locale.fromSubtags(languageCode: 'es', scriptCode: null, countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationEs>());
locale = const Locale.fromSubtags(languageCode: 'es', countryCode: '419');
locale = const Locale.fromSubtags(languageCode: 'es', scriptCode: null, countryCode: '419');
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationEs419>());
locale = const Locale.fromSubtags(languageCode: 'es', countryCode: 'MX');
locale = const Locale.fromSubtags(languageCode: 'es', scriptCode: null, countryCode: 'MX');
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationEsMx>());
locale = const Locale.fromSubtags(languageCode: 'es', countryCode: 'US');
locale = const Locale.fromSubtags(languageCode: 'es', scriptCode: null, countryCode: 'US');
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationEsUs>());
locale = const Locale.fromSubtags(languageCode: 'es', countryCode: 'AR');
locale = const Locale.fromSubtags(languageCode: 'es', scriptCode: null, countryCode: 'AR');
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationEsAr>());
locale = const Locale.fromSubtags(languageCode: 'es', countryCode: 'ES');
locale = const Locale.fromSubtags(languageCode: 'es', scriptCode: null, countryCode: 'ES');
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationEs>());
locale = const Locale.fromSubtags(languageCode: 'es', scriptCode: 'Latn');
locale = const Locale.fromSubtags(languageCode: 'es', scriptCode: 'Latn', countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationEs>());
@@ -410,39 +410,39 @@ void main() {
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationEsUs>());
locale = const Locale.fromSubtags(languageCode: 'fr');
locale = const Locale.fromSubtags(languageCode: 'fr', scriptCode: null, countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationFr>());
locale = const Locale.fromSubtags(languageCode: 'fr', countryCode: 'CA');
locale = const Locale.fromSubtags(languageCode: 'fr', scriptCode: null, countryCode: 'CA');
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationFrCa>());
locale = const Locale.fromSubtags(languageCode: 'de');
locale = const Locale.fromSubtags(languageCode: 'de', scriptCode: null, countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationDe>());
locale = const Locale.fromSubtags(languageCode: 'de', countryCode: 'CH');
locale = const Locale.fromSubtags(languageCode: 'de', scriptCode: null, countryCode: 'CH');
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationDeCh>());
locale = const Locale.fromSubtags(languageCode: 'th');
locale = const Locale.fromSubtags(languageCode: 'th', scriptCode: null, countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationTh>());
locale = const Locale.fromSubtags(languageCode: 'ru');
locale = const Locale.fromSubtags(languageCode: 'ru', scriptCode: null, countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationRu>());
});
testWidgets('Chinese translations spot check', (WidgetTester tester) async {
Locale locale = const Locale.fromSubtags(languageCode: 'zh');
Locale locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: null, countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
MaterialLocalizations localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationZh>());
@@ -451,7 +451,7 @@ void main() {
expect(localizations.closeButtonLabel, '关闭');
expect(localizations.okButtonLabel, '确定');
locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans');
locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans', countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationZhHans>());
@@ -460,7 +460,7 @@ void main() {
expect(localizations.closeButtonLabel, '关闭');
expect(localizations.okButtonLabel, '确定');
locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant');
locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant', countryCode: null);
expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue);
localizations = await GlobalMaterialLocalizations.delegate.load(locale);
expect(localizations, isA<MaterialLocalizationZhHant>());

View File

@@ -241,7 +241,7 @@ void main() {
await tester.pumpWidget(
buildFrame(
delegates: <FooMaterialLocalizationsDelegate>[
const FooMaterialLocalizationsDelegate(),
const FooMaterialLocalizationsDelegate(supportedLanguage: 'en'),
],
// supportedLocales not specified, so all locales resolve to 'en'
buildContent: (BuildContext context) {