From 9e024fdf3122d03fe332d5f9f4ee3e6ae1682464 Mon Sep 17 00:00:00 2001 From: fzyzcjy <5236035+fzyzcjy@users.noreply.github.com> Date: Sat, 20 Jan 2024 01:45:13 +0800 Subject: [PATCH] Tiny fix inaccurate documentations about bindings (#140282) The old doc says that, AutomatedTestWidgetsFlutterBinding for `flutter test` and LiveTestWidgetsFlutterBinding for `flutter run`. However, suppose we `flutter test integration_test/simple_test.dart` with the following code: ``` void main() { testWidgets('hi', (WidgetTester tester) async { print('hi ${TestWidgetsFlutterBinding.instance} ${Platform.operatingSystem}'); }); } ``` We will see: `hi ios`. Therefore, we see `IntegrationTestWidgetsFlutterBinding` is used in a `flutter test` command, which is contrary to the documentation. --- packages/flutter_test/lib/src/binding.dart | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/flutter_test/lib/src/binding.dart b/packages/flutter_test/lib/src/binding.dart index cc341e3159..9e77db4085 100644 --- a/packages/flutter_test/lib/src/binding.dart +++ b/packages/flutter_test/lib/src/binding.dart @@ -1181,8 +1181,11 @@ abstract class TestWidgetsFlutterBinding extends BindingBase } } -/// A variant of [TestWidgetsFlutterBinding] for executing tests in -/// the `flutter test` environment. +/// A variant of [TestWidgetsFlutterBinding] for executing tests typically +/// the `flutter test` environment, unless it is an integration test. +/// +/// When doing integration test, [LiveTestWidgetsFlutterBinding] is utilized +/// instead. /// /// This binding controls time, allowing tests to verify long /// animation sequences without having to execute them in real time. @@ -1632,9 +1635,9 @@ enum LiveTestWidgetsFlutterBindingFramePolicy { benchmarkLive, } -/// A variant of [TestWidgetsFlutterBinding] for executing tests in -/// the `flutter run` environment, on a device. This is intended to -/// allow interactive test development. +/// A variant of [TestWidgetsFlutterBinding] for executing tests +/// on a device, typically via `flutter run`, or via integration tests. +/// This is intended to allow interactive test development. /// /// This is not the way to run a remote-control test. To run a test on /// a device from a development computer, see the [flutter_driver]