test(theme): load the deferred locale off the widget tester's fake clock

`await LocaleSettings.setLocale` inside a `testWidgets` body waits on a
deferred library load that only completes on the real event loop, so the
regex-dialog test hung indefinitely rather than failing. It passed only
because an earlier plain `test` in the same file loads `de` first —
running the file alone, under a name filter, or sharded apart from that
test stalled the run until the ten-minute timeout.
This commit is contained in:
edde746
2026-08-05 13:17:26 +02:00
parent 26dbce0277
commit 23b8befe11
+6 -1
View File
@@ -184,7 +184,12 @@ void main() {
});
testWidgets('regex dialog localizes its field label and validation error', (tester) async {
await LocaleSettings.setLocale(AppLocale.de);
// `runAsync`: a deferred locale library loads on the real event loop, and
// the widget tester's fake async never pumps it. Awaiting the load
// directly hangs the test whenever the library is not already resident —
// running this file alone, under a name filter, or sharded away from the
// `themeModeLabel` test above that happens to load `de` first.
await tester.runAsync(() => LocaleSettings.setLocale(AppLocale.de));
addTearDown(() => LocaleSettings.setLocaleSync(AppLocale.en));
await tester.pumpWidget(