Commit 1fcd1b02 authored by Kate Lovett's avatar Kate Lovett

Changes for uploading baseline images.

parent 95d74481
......@@ -852,26 +852,23 @@ void main() {
)
);
// await expectLater(
// find.byType(CupertinoDatePicker),
// matchesGoldenFile('date_picker_test.datetime.initial.png'),
// skip: !Platform.isLinux
// );
await expectLater(
find.byType(CupertinoDatePicker),
matchesSkiaGoldFile('date_picker_test.datetime.initial.png'),
matchesSkiaGoldFile('date_picker_test.datetime.initial.png')
// matchesGoldenFile('date_picker_test.datetime.initial.png'),
// skip: !Platform.isLinux
);
// Slightly drag the hour component to make the current hour off-center.
await tester.drag(find.text('4'), Offset(0, _kRowOffset.dy / 2));
await tester.pump();
// await expectLater(
// find.byType(CupertinoDatePicker),
await expectLater(
find.byType(CupertinoDatePicker),
matchesSkiaGoldFile('date_picker_test.datetime.drag.png'),
// matchesGoldenFile('date_picker_test.datetime.drag.png'),
// skip: !Platform.isLinux
// );
);
});
}
......
......@@ -30,11 +30,9 @@ Future<void> main(FutureOr<void> testMain()) async {
/// Within the https://github.com/flutter/flutter repository, it's important
/// not to check-in binaries in order to keep the size of the repository to a
/// minimum. To satisfy this requirement, this comparator uses the
/// [SkiaGoldClient] to upload widgets for golden tests and process results.
/// [SkiaGoldClient] to upload widgets for framework-related golden tests and
/// process results.
///
/// This comparator will locally clone the `flutter/goldens` repository into
/// the `$FLUTTER_ROOT/bin/cache/pkg/goldens` folder, then perform the comparison against
/// the files therein.
/// This comparator will instantiate the [SkiaGoldClient] and process the
/// results of the test.
class FlutterGoldenFileComparator implements GoldenFileComparator {
......@@ -71,9 +69,14 @@ class FlutterGoldenFileComparator implements GoldenFileComparator {
// Calculate the appropriate basedir for the current test context.
const FileSystem fs = LocalFileSystem();
final Directory testDirectory = fs.directory(defaultComparator.basedir);
//print('test: $testDirectory');
final Directory flutterRoot = fs.directory(Platform.environment[_kFlutterRootKey]);
//print('flutter: $flutterRoot');
final Directory goldenRoot = flutterRoot.childDirectory(fs.path.join('bin', 'cache', 'pkg', 'goldens'));
//print('golden: $goldenRoot');
final String testDirectoryRelativePath = fs.path.relative(testDirectory.path, from: flutterRoot.path);
//print('testDRP: $testDirectoryRelativePath');
//print('FGFC instantiated with:${goldenRoot.childDirectory(testDirectoryRelativePath).uri}');
return FlutterGoldenFileComparator(goldenRoot.childDirectory(testDirectoryRelativePath).uri);
}
......
......@@ -142,20 +142,22 @@ class SkiaGoldClient {
..writeln('stderr: ${imgtestResult.stderr}');
throw NonZeroExitCode(imgtestResult.exitCode, buf.toString());
}
print('PASS');
return true;
}
Future<String> _getCommitHash() async {
if (!flutterRoot.existsSync()) {
return null;
} else {
final io.ProcessResult revParse = await process.run(
<String>['git', 'rev-parse', 'HEAD'],
workingDirectory: flutterRoot.path,
);
return revParse.exitCode == 0 ? revParse.stdout.trim() : null;
// TODO: Remove after baseline is established and pre-commit works
return 'b27b3d744670bb9312824ec94353b93e7d0424ea';
// if (!flutterRoot.existsSync()) {
// return null;
// } else {
// final io.ProcessResult revParse = await process.run(
// <String>['git', 'rev-parse', 'HEAD'],
// workingDirectory: flutterRoot.path,
// );
// return revParse.exitCode == 0 ? revParse.stdout.trim() : null;
}
}
String _getKeysJSON() {
return convert.json.encode(
......
......@@ -135,6 +135,7 @@ class UpdatePackagesCommand extends FlutterCommand {
// The dev/integration_tests/android_views integration test depends on an assets
// package that is in the goldens repository. We need to make sure that the goldens
// repository is cloned locally before we verify or update pubspecs.
// TODO(katelovett): Resolve dependency for android_views living in goldens repository
// printStatus('Cloning goldens repository...');
// try {
// final GoldensClient goldensClient = GoldensClient();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment