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

Changes for uploading baseline images.

parent 95d74481
...@@ -852,26 +852,23 @@ void main() { ...@@ -852,26 +852,23 @@ void main() {
) )
); );
// await expectLater(
// find.byType(CupertinoDatePicker),
// matchesGoldenFile('date_picker_test.datetime.initial.png'),
// skip: !Platform.isLinux
// );
await expectLater( await expectLater(
find.byType(CupertinoDatePicker), 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. // 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.drag(find.text('4'), Offset(0, _kRowOffset.dy / 2));
await tester.pump(); await tester.pump();
// await expectLater( await expectLater(
// find.byType(CupertinoDatePicker), find.byType(CupertinoDatePicker),
matchesSkiaGoldFile('date_picker_test.datetime.drag.png'),
// matchesGoldenFile('date_picker_test.datetime.drag.png'), // matchesGoldenFile('date_picker_test.datetime.drag.png'),
// skip: !Platform.isLinux // skip: !Platform.isLinux
// ); );
}); });
} }
......
...@@ -30,11 +30,9 @@ Future<void> main(FutureOr<void> testMain()) async { ...@@ -30,11 +30,9 @@ Future<void> main(FutureOr<void> testMain()) async {
/// Within the https://github.com/flutter/flutter repository, it's important /// 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 /// 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 /// 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 /// This comparator will instantiate the [SkiaGoldClient] and process the
/// results of the test. /// results of the test.
class FlutterGoldenFileComparator implements GoldenFileComparator { class FlutterGoldenFileComparator implements GoldenFileComparator {
...@@ -71,9 +69,14 @@ class FlutterGoldenFileComparator implements GoldenFileComparator { ...@@ -71,9 +69,14 @@ class FlutterGoldenFileComparator implements GoldenFileComparator {
// Calculate the appropriate basedir for the current test context. // Calculate the appropriate basedir for the current test context.
const FileSystem fs = LocalFileSystem(); const FileSystem fs = LocalFileSystem();
final Directory testDirectory = fs.directory(defaultComparator.basedir); final Directory testDirectory = fs.directory(defaultComparator.basedir);
//print('test: $testDirectory');
final Directory flutterRoot = fs.directory(Platform.environment[_kFlutterRootKey]); final Directory flutterRoot = fs.directory(Platform.environment[_kFlutterRootKey]);
//print('flutter: $flutterRoot');
final Directory goldenRoot = flutterRoot.childDirectory(fs.path.join('bin', 'cache', 'pkg', 'goldens')); 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); 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); return FlutterGoldenFileComparator(goldenRoot.childDirectory(testDirectoryRelativePath).uri);
} }
......
...@@ -142,19 +142,21 @@ class SkiaGoldClient { ...@@ -142,19 +142,21 @@ class SkiaGoldClient {
..writeln('stderr: ${imgtestResult.stderr}'); ..writeln('stderr: ${imgtestResult.stderr}');
throw NonZeroExitCode(imgtestResult.exitCode, buf.toString()); throw NonZeroExitCode(imgtestResult.exitCode, buf.toString());
} }
print('PASS');
return true; return true;
} }
Future<String> _getCommitHash() async { Future<String> _getCommitHash() async {
if (!flutterRoot.existsSync()) { // TODO: Remove after baseline is established and pre-commit works
return null; return 'b27b3d744670bb9312824ec94353b93e7d0424ea';
} else { // if (!flutterRoot.existsSync()) {
final io.ProcessResult revParse = await process.run( // return null;
<String>['git', 'rev-parse', 'HEAD'], // } else {
workingDirectory: flutterRoot.path, // final io.ProcessResult revParse = await process.run(
); // <String>['git', 'rev-parse', 'HEAD'],
return revParse.exitCode == 0 ? revParse.stdout.trim() : null; // workingDirectory: flutterRoot.path,
} // );
// return revParse.exitCode == 0 ? revParse.stdout.trim() : null;
} }
String _getKeysJSON() { String _getKeysJSON() {
......
...@@ -135,6 +135,7 @@ class UpdatePackagesCommand extends FlutterCommand { ...@@ -135,6 +135,7 @@ class UpdatePackagesCommand extends FlutterCommand {
// The dev/integration_tests/android_views integration test depends on an assets // 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 // 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. // 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...'); // printStatus('Cloning goldens repository...');
// try { // try {
// final GoldensClient goldensClient = GoldensClient(); // 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