2019-11-27 23:04:02 +00:00
|
|
|
// Copyright 2014 The Flutter Authors. All rights reserved.
|
2019-11-06 18:59:29 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2021-01-27 23:17:53 +00:00
|
|
|
// @dart = 2.8
|
|
|
|
|
2019-11-06 18:59:29 +00:00
|
|
|
import 'package:flutter_tools/src/commands/screenshot.dart';
|
|
|
|
|
|
|
|
import '../src/common.dart';
|
|
|
|
import '../src/context.dart';
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
group('Validate screenshot options', () {
|
|
|
|
testUsingContext('rasterizer and skia screenshots do not require a device', () async {
|
|
|
|
ScreenshotCommand.validateOptions('rasterizer', null, 'dummy_observatory_uri');
|
|
|
|
ScreenshotCommand.validateOptions('skia', null, 'dummy_observatory_uri');
|
|
|
|
});
|
|
|
|
|
|
|
|
testUsingContext('rasterizer and skia screenshots require observatory uri', () async {
|
2020-12-01 18:00:30 +00:00
|
|
|
expect(
|
|
|
|
() => ScreenshotCommand.validateOptions('rasterizer', null, null),
|
|
|
|
throwsToolExit(
|
|
|
|
message:
|
|
|
|
'Observatory URI must be specified for screenshot type rasterizer'));
|
|
|
|
expect(
|
|
|
|
() => ScreenshotCommand.validateOptions('skia', null, null),
|
|
|
|
throwsToolExit(
|
|
|
|
message:
|
|
|
|
'Observatory URI must be specified for screenshot type skia'));
|
|
|
|
expect(() => ScreenshotCommand.validateOptions('skia', null, ''),
|
|
|
|
throwsToolExit(message: 'Observatory URI "" is invalid'));
|
2019-11-06 18:59:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
testUsingContext('device screenshots require device', () async {
|
|
|
|
expect(() => ScreenshotCommand.validateOptions('device', null, null), throwsToolExit());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|