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

[golden_toolkit] Add teardown surface size, physical size and pixel ratio #147

Open
jamesblasco opened this issue Feb 1, 2022 · 0 comments

Comments

@jamesblasco
Copy link

jamesblasco commented Feb 1, 2022

The current implementation changes some properties for the test window and does not set them back to the default values. This is making some other test to fail as they use the default screen size provided by the test framework.

Future<void> _pumpAppWidget(
WidgetTester tester,
Widget app, {
required Size surfaceSize,
required double textScaleSize,
}) async {
await tester.binding.setSurfaceSize(surfaceSize);
tester.binding.window.physicalSizeTestValue = surfaceSize;
tester.binding.window.devicePixelRatioTestValue = 1.0;
tester.binding.window.textScaleFactorTestValue = textScaleSize;
await tester.pumpWidget(

I would like to propose to add there the following:

    addTearDown(() async {
      await binding.setSurfaceSize(null);
      binding.window.clearPhysicalSizeTestValue();
      binding.window.clearDevicePixelRatioTestValue();
      binding.window.clearTextScaleFactorTestValue();
    });

So after the golden test is finished, the test values are rested to the default ones

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