Add a devicelab task that generates sample app screenshots, etc (#10303)
This commit is contained in:
@@ -135,6 +135,8 @@ class SampleGenerator {
|
||||
);
|
||||
commentValues[keyword.toLowerCase()] = value.trim();
|
||||
}
|
||||
commentValues['name'] = sourceName;
|
||||
commentValues['path'] = 'examples/catalog/${sourceFile.path}';
|
||||
commentValues['source'] = sourceCode.trim();
|
||||
|
||||
return true;
|
||||
@@ -177,14 +179,12 @@ void generate() {
|
||||
screenshotDriverTemplate,
|
||||
<String, String>{
|
||||
'paths': samples.map((SampleGenerator sample) {
|
||||
return "'${outputFile(sample.sourceName + '.png').path}'";
|
||||
return "'${outputFile('\${prefix}' + sample.sourceName + '.png').path}'";
|
||||
}).toList().join(',\n'),
|
||||
},
|
||||
);
|
||||
|
||||
final List<String> flutterDriveArgs = <String>['drive', 'test_driver/screenshot.dart'];
|
||||
logMessage('Generating screenshots with: flutter ${flutterDriveArgs.join(" ")}');
|
||||
Process.runSync('flutter', flutterDriveArgs);
|
||||
// To generate the screenshots: flutter drive test_driver/screenshot.dart
|
||||
}
|
||||
|
||||
void main(List<String> args) {
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
@(title)
|
||||
=============
|
||||
---
|
||||
catalog: @(name)
|
||||
title: "@(title)"
|
||||
|
||||
permalink: /catalog/@(name)/
|
||||
---
|
||||
|
||||
@(summary)
|
||||
|
||||
@@ -8,6 +12,7 @@
|
||||
See also:
|
||||
@(see also)
|
||||
|
||||
```
|
||||
```dart
|
||||
@(source)
|
||||
```
|
||||
The source code is based on [@(path)](https://github.com/flutter/flutter/blob/master/@(path)).
|
||||
|
||||
@@ -36,5 +36,6 @@ class SampleScreenshotsState extends State<SampleScreenshots> {
|
||||
|
||||
void main() {
|
||||
enableFlutterDriverExtension();
|
||||
WidgetsApp.debugAllowBannerOverride = false; // No "slow mode" banner.
|
||||
runApp(new SampleScreenshots());
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'package:flutter_driver/flutter_driver.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
group('sample screenshots', () async {
|
||||
group('sample screenshots', () {
|
||||
FlutterDriver driver;
|
||||
|
||||
setUpAll(() async {
|
||||
@@ -19,6 +19,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('take sample screenshots', () async {
|
||||
String prefix = Platform.isMacOS ? 'ios_' : "";
|
||||
final List<String> paths = <String>[
|
||||
@(paths)
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user