playbook-ui / playbook-flutter

BSD 3-Clause "New" or "Revised" License
77 stars 10 forks source link

Support loading default font #1

Open lcdsmao opened 3 years ago

lcdsmao commented 3 years ago

https://pub.dev/packages/golden_toolkit#loading-fonts

By default, flutter test only uses a single "test" font called Ahem. This font is designed to show black spaces for every character and icon. This obviously makes goldens much less valuable if you are trying to verify that your app looks correct.

Here is how golden_toolkit loading roboto font: https://github.com/eBay/flutter_glove_box/blob/master/packages/golden_toolkit/lib/src/font_loader.dart

tomosaaan commented 3 years ago

Thanks.

Robot font supported English. So we use NotoSans 😢

Do you have any good ideas?

fredgrott commented 2 years ago

I do, just configure tests to use google fonts folder to load custom fonts like we do with eBAy's Golden tool kit ie by using the Golden toolkit:

Future<void> testExecutable(FutureOr<void> Function() testMain) async { return GoldenToolkit.runWithConfiguration( () async { await loadAppFonts(); await testMain(); }, config: GoldenToolkitConfiguration( // Currently, goldens are not generated/validated in CI for this repo. We have settled on the goldens for this package // being captured/validated by developers running on MacOSX. We may revisit this in the future if there is a reason to invest // in more sophistication skipGoldenAssertion: () => !Platform.isMacOS, ), ); }

That way we get more power without having to change anything in playbook