You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove WebGoldenComparator, which is no longer used by the tool. (flutter#169898)
I could see the argument in keeping this around longer for API
compatibility, but we no longer use it, it's no longer tested, and only
really existed for the HTML-backend, which was removed, so I'm saying
remove it.
Closesflutter#160261.
/// Compares image pixels against a golden image file.
199
-
///
200
-
/// Instances of this comparator will be used as the backend for
201
-
/// [matchesGoldenFile] when tests are running on Flutter Web, and will usually
202
-
/// implemented by deferring the screenshot taking and image comparison to a
203
-
/// test server.
204
-
///
205
-
/// Instances of this comparator will be invoked by the test framework in the
206
-
/// [TestWidgetsFlutterBinding.runAsync] zone and are thus not subject to the
207
-
/// fake async constraints that are normally imposed on widget tests (i.e. the
208
-
/// need or the ability to call [WidgetTester.pump] to advance the microtask
209
-
/// queue). Prior to the invocation, the test framework will render only the
210
-
/// [Element] to be compared on the screen.
211
-
///
212
-
/// See also:
213
-
///
214
-
/// * [GoldenFileComparator] for the comparator to be used when the test is
215
-
/// not running in a web browser.
216
-
/// * [DefaultWebGoldenComparator] for the default [WebGoldenComparator]
217
-
/// implementation for `flutter test`.
218
-
/// * [matchesGoldenFile], the function that invokes the comparator.
219
-
@Deprecated(
220
-
'Use GoldenFileComparator instead. '
221
-
'This feature was deprecated after v3.28.0-0.1.pre.',
222
-
)
223
-
abstractclassWebGoldenComparator {
224
-
/// Compares the rendered pixels of size [width]x[height] that is being
225
-
/// rendered on the top left of the screen against the golden file identified
226
-
/// by [golden].
227
-
///
228
-
/// The returned future completes with a boolean value that indicates whether
229
-
/// the pixels rendered on screen match the golden file's pixels.
230
-
///
231
-
/// In the case of comparison mismatch, the comparator may choose to throw a
232
-
/// [TestFailure] if it wants to control the failure message, often in the
233
-
/// form of a [ComparisonResult] that provides detailed information about the
234
-
/// mismatch.
235
-
///
236
-
/// The method by which [golden] is located and by which its bytes are loaded
237
-
/// is left up to the implementation class. For instance, some implementations
238
-
/// may load files from the local file system, whereas others may load files
239
-
/// over the network or from a remote repository.
240
-
Future<bool> compare(double width, double height, Uri golden);
241
-
242
-
/// Updates the golden file identified by [golden] with rendered pixels of
243
-
/// [width]x[height].
244
-
///
245
-
/// This will be invoked in lieu of [compare] when [autoUpdateGoldenFiles]
246
-
/// is `true` (which gets set automatically by the test framework when the
247
-
/// user runs `flutter test --update-goldens --platform=chrome`).
248
-
///
249
-
/// The method by which [golden] is located and by which its bytes are written
250
-
/// is left up to the implementation class.
251
-
Future<void> update(double width, double height, Uri golden);
252
-
253
-
/// Compares the pixels of decoded png [bytes] against the golden file
254
-
/// identified by [golden].
255
-
///
256
-
/// The returned future completes with a boolean value that indicates whether
257
-
/// the pixels rendered on screen match the golden file's pixels.
258
-
///
259
-
/// In the case of comparison mismatch, the comparator may choose to throw a
260
-
/// [TestFailure] if it wants to control the failure message, often in the
261
-
/// form of a [ComparisonResult] that provides detailed information about the
262
-
/// mismatch.
263
-
///
264
-
/// The method by which [golden] is located and by which its bytes are loaded
265
-
/// is left up to the implementation class. For instance, some implementations
266
-
/// may load files from the local file system, whereas others may load files
267
-
/// over the network or from a remote repository.
268
-
Future<bool> compareBytes(Uint8List bytes, Uri golden);
269
-
270
-
/// Compares the pixels of decoded png [bytes] against the golden file
271
-
/// identified by [golden].
272
-
///
273
-
/// This will be invoked in lieu of [compareBytes] when [autoUpdateGoldenFiles]
274
-
/// is `true` (which gets set automatically by the test framework when the
275
-
/// user runs `flutter test --update-goldens --platform=chrome`).
276
-
///
277
-
/// The method by which [golden] is located and by which its bytes are written
278
-
/// is left up to the implementation class.
279
-
Future<void> updateBytes(Uint8List bytes, Uri golden);
280
-
281
-
/// Returns a new golden file [Uri] to incorporate any [version] number with
282
-
/// the [key].
283
-
///
284
-
/// The [version] is an optional int that can be used to differentiate
285
-
/// historical golden files.
286
-
///
287
-
/// Version numbers are used in golden file tests for package:flutter. You can
288
-
/// learn more about these tests [here](https://github.com/flutter/flutter/blob/main/docs/contributing/testing/Writing-a-golden-file-test-for-package-flutter.md).
0 commit comments