halkyon/packages/halkyon_ui/test/l10n/halkyon_ui_localizations_test.dart

47 lines
1.2 KiB
Dart
Raw Normal View History

import 'package:flutter_test/flutter_test.dart';
import 'package:halkyon_ui/halkyon_ui.dart';
import 'package:material_ui/material_ui.dart';
import '../support/test_app.dart';
void main() {
test('speaks British English, American English and German', () {
expect(
lookupHalkyonUiLocalizations(const Locale('en')).colorPickerLabel('X'),
'Colour: X',
);
expect(
lookupHalkyonUiLocalizations(
const Locale('en', 'GB'),
).colorPickerLabel('X'),
'Colour: X',
);
expect(
lookupHalkyonUiLocalizations(
const Locale('en', 'US'),
).colorPickerLabel('X'),
'Color: X',
);
expect(
lookupHalkyonUiLocalizations(const Locale('de')).colorPickerLabel('X'),
'Farbe: X',
);
});
testWidgets("an app adding the package's delegate gets its texts in the "
"app's language", (tester) async {
await tester.pumpWidget(
testApp(
locale: const Locale('de'),
ReorderToggle(
reordering: false,
labelled: true,
tooltip: 'Pfade umsortieren',
onToggle: () {},
),
),
);
expect(find.text('Umsortieren'), findsOneWidget);
});
}