Skip to content

Commit

Permalink
Rewrap some lines that are about to get much longer. (#146803)
Browse files Browse the repository at this point in the history
This is part 10 of a broken down version of the #140101 refactor.

This will make future PRs easier to review.
  • Loading branch information
Hixie authored Apr 17, 2024
1 parent 9f2bb3b commit 5a81e91
Showing 1 changed file with 38 additions and 10 deletions.
48 changes: 38 additions & 10 deletions packages/flutter_goldens/lib/flutter_goldens.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,19 @@ Future<void> testExecutable(FutureOr<void> Function() testMain, {String? namePre
const Platform platform = LocalPlatform();
const FileSystem fs = LocalFileSystem();
if (FlutterPostSubmitFileComparator.isForEnvironment(platform)) {
goldenFileComparator = await FlutterPostSubmitFileComparator.fromDefaultComparator(platform, namePrefix: namePrefix, log: print, fs: fs);
goldenFileComparator = await FlutterPostSubmitFileComparator.fromDefaultComparator(
platform,
namePrefix: namePrefix,
log: print,
fs: fs,
);
} else if (FlutterPreSubmitFileComparator.isForEnvironment(platform)) {
goldenFileComparator = await FlutterPreSubmitFileComparator.fromDefaultComparator(platform, namePrefix: namePrefix, log: print, fs: fs);
goldenFileComparator = await FlutterPreSubmitFileComparator.fromDefaultComparator(
platform,
namePrefix: namePrefix,
log: print,
fs: fs,
);
} else if (FlutterSkippingFileComparator.isForEnvironment(platform)) {
goldenFileComparator = FlutterSkippingFileComparator.fromDefaultComparator(
'Golden file testing is not executed on Cirrus, or LUCI environments '
Expand All @@ -55,7 +65,11 @@ Future<void> testExecutable(FutureOr<void> Function() testMain, {String? namePre
fs: fs,
);
} else {
goldenFileComparator = await FlutterLocalFileComparator.fromDefaultComparator(platform, log: print, fs: fs);
goldenFileComparator = await FlutterLocalFileComparator.fromDefaultComparator(
platform,
log: print,
fs: fs,
);
}
await testMain();
}
Expand Down Expand Up @@ -251,7 +265,6 @@ class FlutterPostSubmitFileComparator extends FlutterGoldenFileComparator {
required LogCallback log,
required FileSystem fs,
}) async {

defaultComparator ??= goldenFileComparator as LocalFileComparator;
final Directory baseDirectory = FlutterGoldenFileComparator.getBaseDirectory(
defaultComparator,
Expand All @@ -263,7 +276,13 @@ class FlutterPostSubmitFileComparator extends FlutterGoldenFileComparator {

goldens ??= SkiaGoldClient(baseDirectory, log: log);
await goldens.auth();
return FlutterPostSubmitFileComparator(baseDirectory.uri, goldens, namePrefix: namePrefix, log: log, fs: fs);
return FlutterPostSubmitFileComparator(
baseDirectory.uri,
goldens,
namePrefix: namePrefix,
log: log,
fs: fs,
);
}

@override
Expand All @@ -272,7 +291,6 @@ class FlutterPostSubmitFileComparator extends FlutterGoldenFileComparator {
golden = _addPrefix(golden);
await update(golden, imageBytes);
final File goldenFile = getGoldenFile(golden);

return skiaClient.imgtestAdd(golden.path, goldenFile);
}

Expand All @@ -285,7 +303,6 @@ class FlutterPostSubmitFileComparator extends FlutterGoldenFileComparator {
&& !platform.environment.containsKey('GOLD_TRYJOB')
// Only run on main branch.
&& _isMainBranch(platform.environment['GIT_BRANCH']);

return luciPostSubmit;
}
}
Expand Down Expand Up @@ -333,7 +350,6 @@ class FlutterPreSubmitFileComparator extends FlutterGoldenFileComparator {
required LogCallback log,
required FileSystem fs,
}) async {

defaultComparator ??= goldenFileComparator as LocalFileComparator;
final Directory baseDirectory = testBasedir ?? FlutterGoldenFileComparator.getBaseDirectory(
defaultComparator,
Expand Down Expand Up @@ -427,7 +443,14 @@ class FlutterSkippingFileComparator extends FlutterGoldenFileComparator {
defaultComparator ??= goldenFileComparator as LocalFileComparator;
final Uri basedir = defaultComparator.basedir;
final SkiaGoldClient skiaClient = SkiaGoldClient(fs.directory(basedir), log: log);
return FlutterSkippingFileComparator(basedir, skiaClient, reason, namePrefix: namePrefix, log: log, fs: fs);
return FlutterSkippingFileComparator(
basedir,
skiaClient,
reason,
namePrefix: namePrefix,
log: log,
fs: fs,
);
}

@override
Expand Down Expand Up @@ -549,7 +572,12 @@ class FlutterLocalFileComparator extends FlutterGoldenFileComparator with LocalC
);
}

return FlutterLocalFileComparator(baseDirectory.uri, goldens, log: log, fs: fs);
return FlutterLocalFileComparator(
baseDirectory.uri,
goldens,
log: log,
fs: fs,
);
}

@override
Expand Down

0 comments on commit 5a81e91

Please sign in to comment.