testGoldensOniOS function

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

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

Implementation

@isTest
void testGoldensOniOS(
  String description,
  WidgetTesterCallback test, {
  bool skip = false,
  Size? windowSize,
}) {
  testGoldens('$description (on iOS)', (tester) async {
    debugDefaultTargetPlatformOverride = TargetPlatform.iOS;

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

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