Skip to content

Commit cbf2e7a

Browse files
committed
Updates
1 parent d1b4e5f commit cbf2e7a

2 files changed

Lines changed: 18 additions & 25 deletions

File tree

script/flutter_goldens/lib/flutter_goldens.dart

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ import 'package:yaml/yaml.dart';
2525
/// tests using `flutter test`. This should not be called when running a test
2626
/// using `flutter run`, as in that environment, the [goldenFileComparator] is a
2727
/// [TrivialComparator].
28-
///
29-
/// An [HttpClient] is created when this method is called. That client is used
30-
/// to communicate with the Skia Gold servers. Any [HttpOverrides] set in this
31-
/// will affect whether this is effective or not. For example, if the current
32-
/// override provides a mock client that always fails, then all calls to gold
33-
/// comparison functions will fail.
3428
Future<void> testExecutable(
3529
FutureOr<void> Function() testMain, {
3630
String? namePrefix,
@@ -97,11 +91,6 @@ abstract class FlutterGoldenFileComparator extends GoldenFileComparator {
9791
Uri getTestUri(Uri key, int? version) => key;
9892

9993
/// Calculate the appropriate basedir for the current test context.
100-
///
101-
/// The optional [suffix] argument is used by the
102-
/// [FlutterPostSubmitFileComparator] and the [FlutterPreSubmitFileComparator].
103-
/// These [FlutterGoldenFileComparator]s randomize their base directories to
104-
/// maintain thread safety while using the `goldctl` tool.
10594
@protected
10695
@visibleForTesting
10796
static Directory getBaseDirectory(
@@ -147,20 +136,6 @@ abstract class FlutterGoldenFileComparator extends GoldenFileComparator {
147136

148137
/// A [FlutterGoldenFileComparator] for testing conditions that do not execute
149138
/// golden file tests.
150-
///
151-
/// Currently, this comparator is used on Luci environments when executing tests
152-
/// outside of the flutter/flutter repository.
153-
///
154-
/// See also:
155-
///
156-
/// * [FlutterPostSubmitFileComparator], another [FlutterGoldenFileComparator]
157-
/// that tests golden images through Skia Gold.
158-
/// * [FlutterPreSubmitFileComparator], another
159-
/// [FlutterGoldenFileComparator] that tests golden images before changes are
160-
/// merged into the master branch.
161-
/// * [FlutterLocalFileComparator], another
162-
/// [FlutterGoldenFileComparator] that tests golden images locally on your
163-
/// current machine.
164139
class FlutterSkippingFileComparator extends FlutterGoldenFileComparator {
165140
/// Creates a [FlutterSkippingFileComparator] that will skip tests that
166141
/// are not in the right environment for golden file testing.

script/flutter_goldens/test/flutter_goldens_test.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
// See also dev/automated_tests/flutter_test/flutter_gold_test.dart
66

7+
import 'dart:typed_data';
8+
79
import 'package:file/file.dart';
810
import 'package:file/memory.dart';
911
import 'package:flutter_goldens/flutter_goldens.dart';
@@ -84,6 +86,22 @@ void main() {
8486
});
8587
});
8688
});
89+
90+
group('FlutterSkippingFileComparator', () {
91+
test('compare returns true', () async {
92+
final fs = MemoryFileSystem();
93+
final comparator = FlutterSkippingFileComparator(
94+
Uri.parse('/basedir'),
95+
'reason',
96+
fs: fs,
97+
);
98+
final bool result = await comparator.compare(
99+
Uint8List.fromList(<int>[1, 2, 3]),
100+
Uri.parse('golden.png'),
101+
);
102+
expect(result, isTrue);
103+
});
104+
});
87105
}
88106

89107
class FakeLocalFileComparator extends Fake implements LocalFileComparator {

0 commit comments

Comments
 (0)