Add dart fix support to flutter_driver (#141300)

Part of https://github.com/flutter/flutter/issues/139249

This adds dart fix support plus fixes for APIs that are currently deprecated in the flutter_driver package.
This commit is contained in:
Kate Lovett
2024-01-10 18:07:49 -06:00
committed by GitHub
parent 13684ca471
commit 9785718031
10 changed files with 197 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
## Directory contents
The Dart files and golden master `.expect` files in this directory are used to
test the [`dart fix` framework](https://dart.dev/tools/dart-fix) refactorings
used by the Flutter framework.
See the flutter/packages/flutter_driver/lib/fix_data directory for the current
package:flutter data-driven fixes.
To run these tests locally, execute this command in the
flutter/packages/flutter_driver/test_fixes directory.
```sh
dart fix --compare-to-golden
```
For more documentation about Data Driven Fixes, see
https://dart.dev/go/data-driven-fixes#test-folder.
To learn more about how fixes are authored in package:flutter, see
https://github.com/flutter/flutter/wiki/Data-driven-Fixes
## When making structural changes to this directory
The tests in this directory are also invoked from external
repositories. Specifically, the CI system for the dart-lang/sdk repo
runs these tests in order to ensure that changes to the dart fix file
format do not break Flutter.
See [tools/bots/flutter/analyze_flutter_flutter.sh](https://github.com/dart-lang/sdk/blob/main/tools/bots/flutter/analyze_flutter_flutter.sh)
for where the tests are invoked.
When possible, please coordinate changes to this directory that might affect the
`analyze_flutter_flutter.sh` script.

View File

@@ -0,0 +1 @@
# This ensures that parent analysis options do not accidentally break the fix tests.

View File

@@ -0,0 +1,20 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_driver/flutter_driver.dart';
void main() async {
// Changes made in https://github.com/flutter/flutter/pull/82939
final FlutterDriver driver = FlutterDriver();
await driver.enableAccessibility();
// Changes made in https://github.com/flutter/flutter/pull/79310
final Timeline timeline = Timeline.fromJson({});
TimelineSummary.summarize(timeline).writeSummaryToFile('traceName');
TimelineSummary.summarize(timeline).writeSummaryToFile(
'traceName',
destinationDirectory: 'destination',
pretty: false,
);
}

View File

@@ -0,0 +1,20 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_driver/flutter_driver.dart';
void main() async {
// Changes made in https://github.com/flutter/flutter/pull/82939
final FlutterDriver driver = FlutterDriver();
await driver.setSemantics(true);
// Changes made in https://github.com/flutter/flutter/pull/79310
final Timeline timeline = Timeline.fromJson({});
TimelineSummary.summarize(timeline).writeTimelineToFile('traceName');
TimelineSummary.summarize(timeline).writeTimelineToFile(
'traceName',
destinationDirectory: 'destination',
pretty: false,
);
}