flutter/packages/flutter_test
Bruno Leroux 471a82856d
[flutter_test] Use defaultTargetPlatform for key events simulation (#143579)
## Description

This PRs changes the default value for the `platform` parameter used to simulate key events.

With this PR, the default value is "web" on web, otherwise it is the operating system name retrieved from `defaultTargetPlatform`.

Previously, for methods in `WidgetController`, it defaulted to “web” on web, and “android” everywhere else. And for methods in `KeyEventSimulator` it defaulted to “web” on web, and the operating system that the test was running on everywhere else. Because the operating system was based on `Platform.operatingSystem`, it usually differed from the target platform the test was running on.

AFAIK, the `platform` parameter is only meaningful for simulating `RawKeyEvent`. Once `RawKeyboard` will be fully removed, the `platform` parameter won’t be needed. 
@gspencergoog  In the meantime, do you think it is worth merging this fix?

## Related Issue

Fixes to https://github.com/flutter/flutter/issues/133955

## Tests

Adds one test.
2024-03-07 16:08:20 +00:00
..
lib [flutter_test] Use defaultTargetPlatform for key events simulation (#143579) 2024-03-07 16:08:20 +00:00
test [flutter_test] Use defaultTargetPlatform for key events simulation (#143579) 2024-03-07 16:08:20 +00:00
test_fixes Reland simulatedAccessibilityTraversal fix (#143527) 2024-02-15 21:37:40 +00:00
analysis_options.yaml Adds dart_fix support to flutter_test (#124347) 2023-04-11 21:09:07 +00:00
dart_test.yaml Randomize tests, exclude tests that fail with randomization. (#86793) 2021-07-26 23:40:49 -07:00
pubspec.yaml Upgrade leak_tracker. (#143236) 2024-02-09 14:41:22 -08:00