testGoldensOnWindows function

  1. @isTest
void testGoldensOnWindows(
  1. String description,
  2. WidgetTesterCallback test, {
  3. bool skip = false,
  4. Size? windowSize,
})

A golden test that configures itself as a Windows platform before executing the given test, and nullifies the Windows configuration when the test is done.

Implementation

@isTest
void testGoldensOnWindows(
  String description,
  WidgetTesterCallback test, {
  bool skip = false,
  Size? windowSize,
}) {
  testGoldens(description, (tester) async {
    debugDefaultTargetPlatformOverride = TargetPlatform.windows;

    // Adjust the size of the golden window/image as desired.
    tester.viewSize = windowSize;

    try {
      await test(tester);
    } finally {
      debugDefaultTargetPlatformOverride = null;
    }
  }, skip: skip);
}