eBay / flutter_glove_box

Various eBay tools for Flutter development
BSD 3-Clause "New" or "Revised" License
323 stars 69 forks source link

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

Open jamesblasco opened 2 years ago

jamesblasco commented 2 years ago

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.

https://github.com/eBay/flutter_glove_box/blob/b8cf5746aa495d14b6b23980eb9500885cea7af9/packages/golden_toolkit/lib/src/testing_tools.dart#L117-L128

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