fix localization tests

This commit is contained in:
Salvatore Giordano
2022-05-03 15:44:03 +02:00
parent 7f562d3ee8
commit 075f9414de
3 changed files with 9 additions and 8 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ dependencies:
shimmer: ^2.0.0 shimmer: ^2.0.0
stream_chat_flutter_core: ^4.0.1 stream_chat_flutter_core: ^4.0.1
substring_highlight: ^1.0.26 substring_highlight: ^1.0.26
url_launcher: ^6.0.3 url_launcher: ^6.1.0
video_player: ^2.1.0 video_player: ^2.1.0
video_thumbnail: ^0.5.0 video_thumbnail: ^0.5.0
@@ -2,7 +2,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:stream_chat_localizations/src/stream_chat_localizations.dart'; import 'package:stream_chat_localizations/stream_chat_localizations.dart';
void main() { void main() {
testWidgets('Nested Localizations', (WidgetTester tester) async { testWidgets('Nested Localizations', (WidgetTester tester) async {
@@ -41,6 +41,8 @@ void main() {
localizationsDelegates: const [ localizationsDelegates: const [
DummyLocalizations.delegate, DummyLocalizations.delegate,
GlobalStreamChatLocalizations.delegate, GlobalStreamChatLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
], ],
home: PageView(), home: PageView(),
)); ));
@@ -54,9 +56,7 @@ void main() {
testWidgets('Locale without countryCode', (WidgetTester tester) async { testWidgets('Locale without countryCode', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/pull/16782 // Regression test for https://github.com/flutter/flutter/pull/16782
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
localizationsDelegates: const <LocalizationsDelegate<dynamic>>[ localizationsDelegates: GlobalStreamChatLocalizations.delegates,
GlobalStreamChatLocalizations.delegate,
],
supportedLocales: const <Locale>[ supportedLocales: const <Locale>[
Locale('en', 'US'), Locale('en', 'US'),
Locale('hi'), Locale('hi'),
@@ -166,8 +166,8 @@ void main() {
final Key textKey = UniqueKey(); final Key textKey = UniqueKey();
await tester.pumpWidget(buildFrame( await tester.pumpWidget(buildFrame(
delegates: <LocalizationsDelegate<StreamChatLocalizations>>[ delegates: <LocalizationsDelegate>[
GlobalStreamChatLocalizations.delegate, ...GlobalStreamChatLocalizations.delegates,
const FooStreamChatLocalizationsDelegate( const FooStreamChatLocalizationsDelegate(
supportedLanguage: 'fr', supportedLanguage: 'fr',
launchUrlError: "Impossible de lancer l'url", launchUrlError: "Impossible de lancer l'url",
@@ -217,10 +217,11 @@ void main() {
// Accept whatever locale we're given // Accept whatever locale we're given
localeResolutionCallback: localeResolutionCallback:
(Locale? locale, Iterable<Locale> supportedLocales) => locale, (Locale? locale, Iterable<Locale> supportedLocales) => locale,
delegates: <FooStreamChatLocalizationsDelegate>[ delegates: [
const FooStreamChatLocalizationsDelegate( const FooStreamChatLocalizationsDelegate(
supportedLanguage: 'allLanguages', supportedLanguage: 'allLanguages',
), ),
...GlobalStreamChatLocalizations.delegates,
], ],
buildContent: (BuildContext context) { buildContent: (BuildContext context) {
// Should always be 'foo', no matter what the locale is // Should always be 'foo', no matter what the locale is