Skip to content

Conversation

jonahwilliams
Copy link
Contributor

@jonahwilliams jonahwilliams commented Apr 9, 2021

flutter screenshot does not require a device for rasterizer/skia. Move device lookup so that it only happens when the device type is selected. update unit tests to run more of the command logic.

Fixes #80149
Fixes #80151

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Apr 9, 2021
@google-cla google-cla bot added the cla: yes label Apr 9, 2021
@jonahwilliams jonahwilliams requested a review from Hixie April 9, 2021 21:38
@@ -87,8 +88,7 @@ class ScreenshotCommand extends FlutterCommand {

@override
Future<FlutterCommandResult> verifyThenRunCommand(String commandPath) async {
device = await findTargetDevice();
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 was the problem line

@jonahwilliams jonahwilliams requested a review from jmagman April 9, 2021 21:41
switch (screenshotType) {
case _kDeviceType:
device = await findTargetDevice();
if (device == null) {
throwToolExit('Must have a connected device for screenshot type $screenshotType');
}
Copy link
Contributor

Choose a reason for hiding this comment

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

while you're at it you could throw if observatoryUri is non-null (see #80151)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


await expectLater(() => createTestCommandRunner(ScreenshotCommand())
.run(<String>['screenshot', '--type=skia', '--observatory-uri=http://localhost:8181']),
throwsException,
Copy link
Contributor

Choose a reason for hiding this comment

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

should we be checking what exception is thrown exactly? it seems like if this regressed, it would still actually throw an exception...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@Hixie Hixie left a comment

Choose a reason for hiding this comment

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

LGTM

@Hixie
Copy link
Contributor

Hixie commented Apr 9, 2021

Thanks for fixing this. Didn't mean to nerd-snipe you. :-)

@jonahwilliams
Copy link
Contributor Author

No worries :)

I'm just happy to know what this command is supposed to be used for

Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

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

LGTM

@fluttergithubbot fluttergithubbot merged commit 7533c47 into flutter:master Apr 9, 2021
@linhzz999
Copy link

Ok

Copy link

@linhzz999 linhzz999 left a comment

Choose a reason for hiding this comment

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

Ok

Copy link

@linhzz999 linhzz999 left a comment

Choose a reason for hiding this comment

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

Ok

Copy link

@linhzz999 linhzz999 left a comment

Choose a reason for hiding this comment

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

Ok

@jonahwilliams jonahwilliams deleted the fix_type_skia branch April 12, 2021 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
5 participants