very_good_cli icon indicating copy to clipboard operation
very_good_cli copied to clipboard

fix: very_good test wrong behavior for Fonts

Open stact opened this issue 1 year ago • 0 comments

Description

There is a difference between flutter test and very_good test when testing the Google Fonts

Steps To Reproduce

  1. Create a test
void main() {
  TestWidgetsFlutterBinding.ensureInitialized();

  test('Example test to verify GoogleFonts', () {
    final textStyle = GoogleFonts.lato();
    expect(textStyle.fontFamily, 'Lato_regular');
  });
}
  1. Run flutter test
  2. No errors
00:01 +1: All tests passed!  
  1. Run very_good test
  2. Error occurs
Error: google_fonts was unable to load font Lato-Regular because the following exception occurred:
Exception: Failed to load font with url: https://fonts.gstatic.com/s/a/5ced1045820caaac87af3f61ded09bacc90881f158d04c59dcce436fd02ad368.ttf

Expected Behavior

No errors with very_good test =)

Additional Context

Using the recommended init tests for fonts https://github.com/material-foundation/flutter-packages/blob/main/packages/google_fonts/example/test/unit_test.dart

stact avatar Jan 03 '25 21:01 stact