Skip to content

Conversation

@jacob314
Copy link
Contributor

Add matchesReferenceImage matcher to test that the screenshot extension
generates equivalent images to InspectorService.instance.screenshot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method was previously reviewed just without the outer assert block to avoid the code from being included in release builds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed when I re-applied this that I was missing a test that actually tested end to end instead of just testing the
InspectorService.screenshot method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If desired I can simplify so that this matcher only works for
ui.Image and Future<ui.Image> and not for Finder.

@jacob314 jacob314 force-pushed the add_back_screenshot_extension branch from 4029372 to 47cb257 Compare September 13, 2018 21:18
Add matchesReferenceImage matcher to test that the screenshot extension
generates equivalent images to InspectorService.instance.screenshot.
@jacob314 jacob314 force-pushed the add_back_screenshot_extension branch from 47cb257 to 9227c68 Compare September 13, 2018 21:22
@jacob314 jacob314 requested review from Hixie and tvolkert September 13, 2018 21:32
/// ```dart
/// await expectLater(find.text('Save'), matchesReferenceImage(referenceImage));
/// await expectLater(image, matchesReferenceImage(referenceImage);
/// await expectLater(imageFuture, matchesReferenceImage(referenceImage));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the sample code should explain how to get a referenceImage in the first place

import 'dart:ui' as ui;

import 'package:flutter_test/flutter_test.dart';
import 'package:test/src/frontend/async_matcher.dart'; // ignore: implementation_imports
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we shouldn't import test directly... can you elaborate on why you need this?

@Hixie
Copy link
Contributor

Hixie commented Sep 17, 2018

LGTM with review comments

@jacob314 jacob314 force-pushed the add_back_screenshot_extension branch from 7e023c9 to 343d253 Compare September 17, 2018 21:34
@jacob314 jacob314 merged commit ccd070a into flutter:master Sep 18, 2018
hereisderek added a commit to hereisderek/flutter that referenced this pull request Sep 18, 2018
…dle-fix

* commit '3c22d7b025642abd865160970d39f8c5ba7d3162':
  clarify how to display an image with a specific density (flutter#21152)
  Roll engine 9e315e6..2e8e96f (2 commits) (flutter#22005)
  Make helper and error text separate widgets, make error and counter live region (flutter#21752)
  Use Xcode legacy build system for iOS builds (flutter#21901) (flutter#21994)
  Run logcat through shell (flutter#21977)
  Add back screenshot extension that was temporarily disabled. (flutter#21828)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants