diff --git a/bin/internal/engine.version b/bin/internal/engine.version index 4fa017dd7d9b3..826a168e34807 100644 --- a/bin/internal/engine.version +++ b/bin/internal/engine.version @@ -1 +1 @@ -162b2e98c036a8f8c355fd475dbe0db4f4bc886c +7be0217d6796954694753647b7a757b8e3907f64 diff --git a/packages/flutter_localizations/test/widgets_test.dart b/packages/flutter_localizations/test/widgets_test.dart index 1a2923f07c385..0a263d617f923 100644 --- a/packages/flutter_localizations/test/widgets_test.dart +++ b/packages/flutter_localizations/test/widgets_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:ui' as ui; + import 'package:flutter_test/flutter_test.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; @@ -537,10 +539,8 @@ void main() { ) ); - // Startup time. Default test locale is null, so - // no supported matches. Use the first locale. await tester.pumpAndSettle(); - expect(find.text('zh_CN'), findsOneWidget); + expect(find.text('en_GB'), findsOneWidget); // defaultLocaleChangedHandler prefers exact supported locale match await tester.binding.setLocale('en', 'CA'); @@ -581,8 +581,7 @@ void main() { ) ); - // Initial WidgetTester locale is null due to no platform intitializing it. - // The locale gets resolved to "en_US", which is the first supported locale. + // Initial WidgetTester locale is `en_US`. await tester.pumpAndSettle(); expect(find.text('en_US TextDirection.ltr'), findsOneWidget); @@ -623,8 +622,7 @@ void main() { ) ); - // Initial WidgetTester locale is null due to no platform intitializing it. - // The locale gets resolved to "en_US", which is the first supported locale. + // Initial WidgetTester locale is `en_US`. await tester.pumpAndSettle(); expect(find.text('en_US TextDirection.rtl'), findsOneWidget); @@ -657,8 +655,7 @@ void main() { ) ); - // Initial WidgetTester locale is null due to no platform intitializing it. - // The locale gets resolved to "en_US", which is the first supported locale. + // Initial WidgetTester locale is `en_US`. await tester.pumpAndSettle(); expect(find.text('en_US TextDirection.rtl'), findsOneWidget); @@ -675,4 +672,27 @@ void main() { expect(find.text('da_DA TextDirection.rtl'), findsOneWidget); }); + // We provide [Locale('en', 'US'), Locale('zh', 'CN')] as ui.window.locales + // for flutter tester so that the behavior of tests match that of production + // environments. Here, we test the default locales. + testWidgets('WidgetsApp DefaultWidgetLocalizations', (WidgetTester tester) async { + await tester.pumpAndSettle(); + await tester.pumpWidget( + buildFrame( + // Accept whatever locale we're given + localeResolutionCallback: (Locale locale, Iterable supportedLocales) => locale, + delegates: [ + const OnlyRTLDefaultWidgetsLocalizationsDelegate(), + ], + buildContent: (BuildContext context) { + final Locale locale1 = ui.window.locales.first; + final Locale locale2 = ui.window.locales[1]; + return Text('$locale1 $locale2'); + } + ) + ); + // Initial WidgetTester default locales is `en_US` and `zh_CN`. + await tester.pumpAndSettle(); + expect(find.text('en_US zh_CN'), findsOneWidget); + }); }