Skip to content

Commit

Permalink
Default locales test for flutter tester. Roll engine 162b2e9..7be0217 (
Browse files Browse the repository at this point in the history
…flutter#23596)

162b2e9..7be0217
7be0217 Roll back _countryCode assert - breaking change (flutter#6693)
91a019c Fix popSystemNavigator (flutter#6691)
2b2fbf0 Add Locale.fromSubtags and support for scriptCode. (flutter#6518)
58c8e30 Roll src/third_party/skia ab18c8e6cc20..d48b7a881b24 (5 commits) (flutter#6690)
3b17cfb Flutter tester default locales (flutter#6689)
96bbd2b Roll buildroot to 11a934e99eaa4aa8e278cd2772aff4f51f1f3c41 (flutter#6687)
0e9defb Roll src/third_party/skia 68825776f4b4..ab18c8e6cc20 (11 commits) (flutter#6688)
cc686d7 Don't populate the external view embedder in PaintContext. (flutter#6686)
ab782fa Roll src/third_party/skia 1de48d8040aa..68825776f4b4 (1 commits) (flutter#6685)
c4aa8d3 Roll src/third_party/skia 797197a772b8..1de48d8040aa (2 commits) (flutter#6684)
7352251 Roll src/third_party/skia 79c96811863f..797197a772b8 (1 commits) (flutter#6683)
3dac47e Roll src/third_party/skia 38e4fd0c5654..79c96811863f (1 commits) (flutter#6682)
2f06a53 Roll src/third_party/skia b53f1f46982d..38e4fd0c5654 (1 commits) (flutter#6681)
a1d7cad Fix inconsistent include syntax (flutter#6680)
236661c Roll src/third_party/skia 3b79aa3a5ad0..b53f1f46982d (13 commits) (flutter#6679)
c4f5061 Roll buildroot to pick up Mac toolchain updates. (flutter#6678)
ba8f6aa Handle Windows headers defining ERROR to 0 in log levels. (flutter#6677)
505d2a9 Roll buildroot to pick up updates to custom toolchains. (flutter#6674)
6c2a0b3 Undefine ERROR in platform_view_layer.cc (flutter#6675)
55e1299 Update FlutterPlugin.h docs, suppress warning for older API (flutter#6672)
f797004 Attach and position embedded UIVIews (flutter#6614)
df85722 Plumb the iOS PlatformViewsController into flow. (flutter#6603)
2bfb893 iOS Embedding Refactor (flutter#6447)
  • Loading branch information
GaryQian authored and Xavjer committed Nov 1, 2018
1 parent fa24622 commit 7058513
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bin/internal/engine.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
162b2e98c036a8f8c355fd475dbe0db4f4bc886c
7be0217d6796954694753647b7a757b8e3907f64
38 changes: 29 additions & 9 deletions packages/flutter_localizations/test/widgets_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand All @@ -675,4 +672,27 @@ void main() {
expect(find.text('da_DA TextDirection.rtl'), findsOneWidget);
});

// We provide <Locale>[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<Locale> supportedLocales) => locale,
delegates: <OnlyRTLDefaultWidgetsLocalizationsDelegate>[
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);
});
}

0 comments on commit 7058513

Please sign in to comment.