Refactor external_ui → external_textures (#142062)

This PR makes no _behavioral_ changes to executed code, and instead
focuses on organization and naming:

1. Almost[^1] anything named `external_ui` is renamed
`external_textures`
1. Extended the README to explain the intent of the test, as well as how
to run it
1. Renamed `main.dart` and `main_test.dart` to `frame_rate_main.dart`
and `frame_rate_test.dart` (we'll add more)
1. Did some refactoring of the test to make it more obvious what is
being asserted (i.e. `widgetBuilds` and friends)

Given how complex (and in-flux) this directory is, I'm also requesting
either John, Jonah or I review any changes.

[^1]: Except the name of the `.ci.yaml` task, i.e. `name:
Linux_pixel_7pro external_ui_integration_test` because I'm apparently
not able to change that without creating a new task as `bringup: true`
and playing a bit of a dance. Maybe that's worth doing though (in future
PRs)?
This commit is contained in:
Matan Lurey
2024-01-24 12:44:31 -08:00
committed by GitHub
parent fb4eef1c9c
commit 2e2042ff8e
35 changed files with 132 additions and 82 deletions

View File

@@ -0,0 +1,47 @@
# external_textures
Tests external texture rendering between a native[^1] platform and Flutter.
Part of Flutter's API for [plugins](https://flutter.dev/docs/development/packages-and-plugins/developing-packages#plugin) includes passing _external textures_, or textures
created outside of Flutter, to Flutter, typically using the [`Texture`][texture]
widget. This is useful for plugins that render video, or for plugins that
interact with the camera.
For example:
- [`packages/camera`][camera]
- [`packages/video_player`][video_player]
[texture]: https://api.flutter.dev/flutter/widgets/Texture-class.html
[camera]: https://github.com/flutter/packages/tree/8255fbed74465425a1ec06a1804225e705e29f52/packages/camera
[video_player]: https://github.com/flutter/packages/tree/8255fbed74465425a1ec06a1804225e705e29f52/packages/video_player
Because external textures are created outside of Flutter, there is often subtle
translation that needs to happen between the native platform and Flutter, which
is hard to observe. These integration tests are designed to help catch these
subtle translation issues.
## How it works
- Each `lib/*_main.dart` file is a Flutter app instrumenting a test case.
- There is a cooresponding `test_driver/*_test.dart` that runs assertions.
To run the test cases locally, use `flutter drive`[^2]:
```shell
flutter drive lib/frame_rate_main.dart --driver test_driver/frame_rate_test.dart
```
> [!TIP]
> On CI, the test cases are run within our [device lab](../../devicelab/README.md).
>
> See [`devicelab/lib/tasks/integration_tests.dart`](../../devicelab/lib/tasks/integration_tests.dart)
> and search for `createExternalTexturesIntegrationTest`.
>
> The actual tests are run by task runners:
>
> - [Android](../../devicelab/bin/tasks/external_textures_integration_test.dart)
> - [iOS](../../devicelab/bin/tasks/external_textures_integration_test_ios.dart)
[^1]: Only iOS and Android.
[^2]: Unfortunately documentation is quite limited. See [#142021](https://github.com/flutter/flutter/issues/142021).