-
Notifications
You must be signed in to change notification settings - Fork 4k
[material_ui] Add tests for Indonesian, Korean and Thai locales tests in TimePicker l10n tests #12948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[material_ui] Add tests for Indonesian, Korean and Thai locales tests in TimePicker l10n tests #12948
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,14 +35,16 @@ void main() { | |
| (Widget w) => '${w.runtimeType}' == '_DayPeriodControl', | ||
| ); | ||
|
|
||
| // TODO(yjbanov): also test `HH.mm` (in_ID), `a h:mm` (ko_KR) and `HH:mm น.` (th_TH) when we have .arb files for them | ||
| final locales = <Locale>[ | ||
| const Locale('en', 'US'), //'h:mm a' | ||
| const Locale('en', 'GB'), //'HH:mm' | ||
| const Locale('es', 'ES'), //'H:mm' | ||
| const Locale('fr', 'CA'), //'HH \'h\' mm' | ||
| const Locale('zh', 'ZH'), //'ah:mm' | ||
| const Locale('fa', 'IR'), //'H:mm' but RTL | ||
| const Locale('in', 'ID'), //'HH.mm' | ||
| const Locale('ko', 'KR'), //'a h:mm' | ||
| const Locale('th', 'TH'), //'HH:mm น.' | ||
| ]; | ||
|
|
||
| for (final locale in locales) { | ||
|
|
@@ -90,6 +92,22 @@ void main() { | |
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsNothing); | ||
| } else if (locale == const Locale('in', 'ID')) { | ||
| // This is an LTR locale, it uses a dot separator instead of a standard colon. | ||
| expect(stringFragmentText.data, '.'); | ||
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsNothing); | ||
| } else if (locale == const Locale('ko', 'KR')) { | ||
| expect(stringFragmentText.data, ':'); | ||
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsOne); | ||
| } else if (locale == const Locale('th', 'TH')) { | ||
| expect(stringFragmentText.data, ':'); | ||
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsOne); | ||
| } | ||
| await tester.tapAt(Offset(center.dx, center.dy - 50.0)); | ||
| await finishPicker(tester); | ||
|
|
@@ -120,14 +138,16 @@ void main() { | |
| (Widget w) => '${w.runtimeType}' == '_DayPeriodControl', | ||
| ); | ||
|
|
||
| // TODO(yjbanov): also test `HH.mm` (in_ID), `a h:mm` (ko_KR) and `HH:mm น.` (th_TH) when we have .arb files for them | ||
| final locales = <Locale>[ | ||
| const Locale('en', 'US'), //'h:mm a' | ||
| const Locale('en', 'GB'), //'HH:mm' | ||
| const Locale('es', 'ES'), //'H:mm' | ||
| const Locale('fr', 'CA'), //'HH \'h\' mm' | ||
| const Locale('zh', 'ZH'), //'ah:mm' | ||
| const Locale('fa', 'IR'), //'H:mm' but RTL | ||
| const Locale('in', 'ID'), //'HH.mm' | ||
| const Locale('ko', 'KR'), //'a h:mm' | ||
| const Locale('th', 'TH'), //'HH:mm น.' | ||
| ]; | ||
|
|
||
| for (final locale in locales) { | ||
|
|
@@ -170,6 +190,22 @@ void main() { | |
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsNothing); | ||
| } else if (locale == const Locale('in', 'ID')) { | ||
| // This is an LTR locale, it uses a dot separator instead of a standard colon. | ||
| expect(stringFragmentText.data, '.'); | ||
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsNothing); | ||
| } else if (locale == const Locale('ko', 'KR')) { | ||
| expect(stringFragmentText.data, ':'); | ||
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsOne); | ||
| } else if (locale == const Locale('th', 'TH')) { | ||
| expect(stringFragmentText.data, ':'); | ||
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsOne); | ||
| } | ||
| await tester.tapAt(Offset(center.dx, center.dy - 50.0)); | ||
| await finishPicker(tester); | ||
|
|
@@ -200,14 +236,16 @@ void main() { | |
| (Widget w) => '${w.runtimeType}' == '_DayPeriodControl', | ||
| ); | ||
|
|
||
| // TODO(yjbanov): also test `HH.mm` (in_ID), `a h:mm` (ko_KR) and `HH:mm น.` (th_TH) when we have .arb files for them | ||
| final locales = <Locale>[ | ||
| const Locale('en', 'US'), //'h:mm a' | ||
| const Locale('en', 'GB'), //'HH:mm' | ||
| const Locale('es', 'ES'), //'H:mm' | ||
| const Locale('fr', 'CA'), //'HH \'h\' mm' | ||
| const Locale('zh', 'ZH'), //'ah:mm' | ||
| const Locale('fa', 'IR'), //'H:mm' but RTL | ||
| const Locale('in', 'ID'), //'HH.mm' | ||
| const Locale('ko', 'KR'), //'a h:mm' | ||
| const Locale('th', 'TH'), //'HH:mm น.' | ||
| ]; | ||
|
|
||
| for (final locale in locales) { | ||
|
|
@@ -260,6 +298,22 @@ void main() { | |
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsNothing); | ||
| } else if (locale == const Locale('in', 'ID')) { | ||
| // This is an LTR locale, it uses a dot separator instead of a standard colon. | ||
| expect(stringFragmentText.data, '.'); | ||
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsNothing); | ||
| } else if (locale == const Locale('ko', 'KR')) { | ||
| expect(stringFragmentText.data, ':'); | ||
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsOne); | ||
| } else if (locale == const Locale('th', 'TH')) { | ||
| expect(stringFragmentText.data, ':'); | ||
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsOne); | ||
| } | ||
| await tester.tapAt(Offset(center.dx, center.dy - 50.0)); | ||
| await finishPicker(tester); | ||
|
|
@@ -290,14 +344,16 @@ void main() { | |
| (Widget w) => '${w.runtimeType}' == '_DayPeriodControl', | ||
| ); | ||
|
|
||
| // TODO(yjbanov): also test `HH.mm` (in_ID), `a h:mm` (ko_KR) and `HH:mm น.` (th_TH) when we have .arb files for them | ||
| final locales = <Locale>[ | ||
| const Locale('en', 'US'), //'h:mm a' | ||
| const Locale('en', 'GB'), //'HH:mm' | ||
| const Locale('es', 'ES'), //'H:mm' | ||
| const Locale('fr', 'CA'), //'HH \'h\' mm' | ||
| const Locale('zh', 'ZH'), //'ah:mm' | ||
| const Locale('fa', 'IR'), //'H:mm' but RTL | ||
| const Locale('in', 'ID'), //'HH.mm' | ||
| const Locale('ko', 'KR'), //'a h:mm' | ||
| const Locale('th', 'TH'), //'HH:mm น.' | ||
| ]; | ||
|
|
||
| for (final locale in locales) { | ||
|
|
@@ -345,6 +401,22 @@ void main() { | |
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsNothing); | ||
| } else if (locale == const Locale('in', 'ID')) { | ||
| // This is an LTR locale, it uses a dot separator instead of a standard colon. | ||
| expect(stringFragmentText.data, '.'); | ||
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsNothing); | ||
| } else if (locale == const Locale('ko', 'KR')) { | ||
| expect(stringFragmentText.data, ':'); | ||
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsOne); | ||
| } else if (locale == const Locale('th', 'TH')) { | ||
| expect(stringFragmentText.data, ':'); | ||
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsOne); | ||
| } | ||
| await tester.tapAt(Offset(center.dx, center.dy - 50.0)); | ||
| await finishPicker(tester); | ||
|
|
@@ -370,17 +442,22 @@ void main() { | |
| ) | ||
| .first; | ||
|
|
||
| // TODO(yjbanov): also test `HH.mm` (in_ID), `a h:mm` (ko_KR) and `HH:mm น.` (th_TH) when we have .arb files for them | ||
| final locales = <Locale>[ | ||
| const Locale('en', 'US'), //'h:mm a' | ||
| const Locale('en', 'GB'), //'HH:mm' | ||
| const Locale('es', 'ES'), //'H:mm' | ||
| const Locale('fr', 'CA'), //'HH \'h\' mm' | ||
| const Locale('zh', 'ZH'), //'ah:mm' | ||
| const Locale('fa', 'IR'), //'H:mm' but RTL | ||
| const Locale('in', 'ID'), //'HH.mm' | ||
| const Locale('ko', 'KR'), //'a h:mm' | ||
| const Locale('th', 'TH'), //'HH:mm น.' | ||
| ]; | ||
|
|
||
| for (final locale in locales) { | ||
| await tester.pumpWidget( | ||
| const SizedBox(), | ||
| ); // this is needed to reset the widget tree and prevent state/Directionality leaks between loop iterations. | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so this is necessary because using it is also possible to repro the bug with moving |
||
| await tester.pumpWidget( | ||
| _TimePickerLauncher( | ||
| onChanged: (TimeOfDay? time) {}, | ||
|
|
@@ -430,6 +507,22 @@ void main() { | |
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsNothing); | ||
| } else if (locale == const Locale('in', 'ID')) { | ||
| // This is an LTR locale, it uses a dot separator instead of a standard colon. | ||
| expect(stringFragmentText.data, '.'); | ||
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsNothing); | ||
| } else if (locale == const Locale('ko', 'KR')) { | ||
| expect(stringFragmentText.data, ':'); | ||
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsOne); | ||
| } else if (locale == const Locale('th', 'TH')) { | ||
| expect(stringFragmentText.data, ':'); | ||
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsOne); | ||
| } | ||
| await finishPicker(tester); | ||
| expect(tester.takeException(), isNot(throwsFlutterError)); | ||
|
|
@@ -455,17 +548,22 @@ void main() { | |
| ) | ||
| .first; | ||
|
|
||
| // TODO(yjbanov): also test `HH.mm` (in_ID), `a h:mm` (ko_KR) and `HH:mm น.` (th_TH) when we have .arb files for them | ||
| final locales = <Locale>[ | ||
| const Locale('en', 'US'), //'h:mm a' | ||
| const Locale('en', 'GB'), //'HH:mm' | ||
| const Locale('es', 'ES'), //'H:mm' | ||
| const Locale('fr', 'CA'), //'HH \'h\' mm' | ||
| const Locale('zh', 'ZH'), //'ah:mm' | ||
| const Locale('fa', 'IR'), //'H:mm' but RTL | ||
| const Locale('in', 'ID'), //'HH.mm' | ||
| const Locale('ko', 'KR'), //'a h:mm' | ||
| const Locale('th', 'TH'), //'HH:mm น.' | ||
| ]; | ||
|
|
||
| for (final locale in locales) { | ||
| await tester.pumpWidget( | ||
| const SizedBox(), | ||
| ); // this is needed to reset the widget tree and prevent state/Directionality leaks between loop iterations. | ||
| await tester.pumpWidget( | ||
| _TimePickerLauncher( | ||
| onChanged: (TimeOfDay? time) {}, | ||
|
|
@@ -514,6 +612,22 @@ void main() { | |
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsNothing); | ||
| } else if (locale == const Locale('in', 'ID')) { | ||
| // This is an LTR locale, it uses a dot separator instead of a standard colon. | ||
| expect(stringFragmentText.data, '.'); | ||
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsNothing); | ||
| } else if (locale == const Locale('ko', 'KR')) { | ||
| expect(stringFragmentText.data, ':'); | ||
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsOne); | ||
| } else if (locale == const Locale('th', 'TH')) { | ||
| expect(stringFragmentText.data, ':'); | ||
| expect(hourLeftOffset, lessThan(stringFragmentLeftOffset)); | ||
| expect(stringFragmentLeftOffset, lessThan(minuteLeftOffset)); | ||
| expect(dayPeriodControlFinder, findsOne); | ||
| } | ||
| await finishPicker(tester); | ||
| expect(tester.takeException(), isNot(throwsFlutterError)); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.