Skip to content
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

Loading font issue that is intermittent #178

Open
michael-woolsey opened this issue Aug 17, 2023 · 0 comments
Open

Loading font issue that is intermittent #178

michael-woolsey opened this issue Aug 17, 2023 · 0 comments

Comments

@michael-woolsey
Copy link

michael-woolsey commented Aug 17, 2023

Hello,

I'm hoping someone can help me with this issue, it seemed to start out of nowhere and I cannot track down how to fix it.

testGoldens('Standard screen', (tester) async {
  await tester.pumpWidgetBuilder(const SomeScreen(), wrapper: localeWrapper());

  await multiScreenGolden(tester, 'some_screen', devices: getDevices());
});

List<Device> getDevices({double longPhoneHeight = 1000.0}) {
  return [
    Device.iphone11,
    Device(name: 'long', size: Size(320, longPhoneHeight)),
    const Device(name: 'smallest', size: Size(320, 480)),
  ];
}

For some reason, the 1st item in the device list has the app font problem as illustrated below (ignore the order of the screenshots, I threw them together manually, the one on the right is the problem):

image

If I change the order of the devices in the getDevices() method then the problem changes to whatever the first item is in the list.

As you can see, it knows how to load the fonts, as I am using loadAppFonts() on the setup of each test.

      setUp(() async {
        await loadAppFonts();
      });

I've tried things like:

  1. Future.delayed in various spots to see if it "finishes loading".
  2. Loading the fonts multiple times calling await loadAppFonts(); multiple times.
  3. Manually loading the fonts, you can't seem to unload fonts.
  4. I even tried putting in Device.iphone11 twice and it does draw the second one correct but causes standard test through flutter test failures because it checks the image on every device entry.

So far I've got nothing that is working, does anyone have any suggestions because I've had to disable my golden tests to be able to have folks on my team submit merge requests, which is obviously not ideal.

Thank you,
Michael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant