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
stream_chat_flutter_core: ^4.0.1
substring_highlight: ^1.0.26
url_launcher: ^6.0.3
url_launcher: ^6.1.0
video_player: ^2.1.0
video_thumbnail: ^0.5.0
@@ -2,7 +2,7 @@
import 'package:flutter/material.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() {
testWidgets('Nested Localizations', (WidgetTester tester) async {
@@ -41,6 +41,8 @@ void main() {
localizationsDelegates: const [
DummyLocalizations.delegate,
GlobalStreamChatLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
home: PageView(),
));
@@ -54,9 +56,7 @@ void main() {
testWidgets('Locale without countryCode', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/pull/16782
await tester.pumpWidget(MaterialApp(
localizationsDelegates: const <LocalizationsDelegate<dynamic>>[
GlobalStreamChatLocalizations.delegate,
],
localizationsDelegates: GlobalStreamChatLocalizations.delegates,
supportedLocales: const <Locale>[
Locale('en', 'US'),
Locale('hi'),
@@ -166,8 +166,8 @@ void main() {
final Key textKey = UniqueKey();
await tester.pumpWidget(buildFrame(
delegates: <LocalizationsDelegate<StreamChatLocalizations>>[
GlobalStreamChatLocalizations.delegate,
delegates: <LocalizationsDelegate>[
...GlobalStreamChatLocalizations.delegates,
const FooStreamChatLocalizationsDelegate(
supportedLanguage: 'fr',
launchUrlError: "Impossible de lancer l'url",
@@ -217,10 +217,11 @@ void main() {
// Accept whatever locale we're given
localeResolutionCallback:
(Locale? locale, Iterable<Locale> supportedLocales) => locale,
delegates: <FooStreamChatLocalizationsDelegate>[
delegates: [
const FooStreamChatLocalizationsDelegate(
supportedLanguage: 'allLanguages',
),
...GlobalStreamChatLocalizations.delegates,
],
buildContent: (BuildContext context) {
// Should always be 'foo', no matter what the locale is